This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Referenced symbol not present in final image?


----Original Message----
>From: Øyvind Harboe
>Sent: 08 April 2005 12:15

> One more thing:
> 
> If I add -Wl,--undefined=pthread_mutex_lock, I get the expected result,
> i.e. that the pthread_mutex_lock fn is included in the final image.
> 
> $ arm-elf-gcc   -Wl,-static -g -nostdlib  -nostartfiles
>   -L../romapp/install/lib -Ttarget.ld [truncated] 
> -Wl,-Map,output/rimi.map   -Wl,--trace-symbol=pthread_mutex_lock 
> -Wl,--undefined=pthread_mutex_lock
>
/ecos-c/cdtworkspace/arm/install/bin/../lib/gcc/arm-elf/3.4.3/../../../../ar
m-elf/lib/libsupc++.a(eh_alloc.o):
> reference to pthread_mutex_lock
>
/ecos-c/cdtworkspace/arm/install/bin/../lib/gcc/arm-elf/3.4.3/../../../../ar
m-elf/lib/libstdc++.a(locale_init.o):
> reference to pthread_mutex_lock
>
/ecos-c/cdtworkspace/arm/install/bin/../lib/gcc/arm-elf/3.4.3/../../../../ar
m-elf/lib/libstdc++.a(allocator-inst.o):
> reference to pthread_mutex_lock
> ../romapp/install/lib/libtarget.a(compat_posix_mutex.o): definition of
> pthread_mutex_lock      


  Umm, look, if you really want to know what kind of symbol it is, don't you
just want to be using "nm" or "objdump --syms" on eh_alloc.o (or libsupc++),
and it'll probably tell you something interesting like it's weak, or common,
or somesuch ?

  If it's referenced, but doesn't get pulled into the link unless you -U it
on the linker command line, that suggests that the object that contains it
is too early in the link order and the objects that reference it are too
late in the link order, so by the time the linker knows it's needed, it's
already gone by and be discarded.

    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]