This is the mail archive of the binutils@sourceware.org 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: ld definitely not discarding unreferenced routines


On Sun, Jul 18, 2010 at 02:49:24PM +0100, Alex Buell wrote:
> In the common library archive (libcommon.a), there are two main
> routines. One is 16 bit and the other is 32 bit. Linking part1.bin
> should only pull in the 16 bit routine from the library, whilst linking
> part2.bin should do the same for the 32 bit routine. 

You put both functions in one object file.  ld extracts from archives
on a file by file basis to satisfy undefined symbols.  ld is working
exactly as designed.

If you must put both functions in one object file for some reason,
then you'll need to link with -gc-sections, *and* put the functions in
separate sections.  Garbage collection works on a section by section
basis.

-- 
Alan Modra
Australia Development Lab, IBM


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