bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Wrong symbol length in ELF object


From: Paul Edwards
Subject: Wrong symbol length in ELF object
Date: Tue, 06 Dec 2005 16:00:37 +0000

Hello,

I've been using the mpich MPI library and am using a wrapper to gather
information about the calls used.  It uses:

        #pragma weak MPI_xxx = PMPI_xxx

I then only need to implement the MPI_xxx functions and link against my
library first to intercept the calls (I then do stuff and go on to call
PMPI_xxx).  The problem I am experiencing is that the symbol lengths
being shown from readelf (or objdump) are reporting the length of
PMPI_xxx rather than my MPI_xxx which is being called.

I don't expect you will have used the MPI library so I have made a
simple example.  The source code and Makefile are attached to this
message.  I create 2 libraries and an executable - weaklib, mylib and
test.  The executable test calls the function in mylib correctly (which
in turn calls the function in weaklib) but the executable shows the
wrong length for the function Foo:

address@hidden ~/samples/weaksyms $ readelf -s libweaklib.a |grep Foo
     7: 00000000    10 FUNC    WEAK   DEFAULT    1 Foo
     8: 00000000    10 FUNC    GLOBAL DEFAULT    1 PFoo
address@hidden ~/samples/weaksyms $ readelf -s libmylib.a |grep Foo
     7: 00000000    79 FUNC    GLOBAL DEFAULT    1 Foo
     8: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND PFoo
address@hidden ~/samples/weaksyms $ readelf -s test |grep Foo
   100: 080483b4    10 FUNC    GLOBAL DEFAULT   12 Foo
   101: 08048404    10 FUNC    GLOBAL DEFAULT   12 PFoo

The executable should show the length as 79, shouldn't it?

Regards,
Paul

Btw this happens on all systems I have tried it on: FC4, Gentoo, Suse
Opteron - let me know if you want any specific versions

Attachment: weaksyms.tgz
Description: application/compressed-tar


reply via email to

[Prev in Thread] Current Thread [Next in Thread]