This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


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

Incremental linking, ELF, & templates => REDUNDANT CODE



I've been under the impression for some time now that when a platform
uses the ELF object format, that all redundant template code (weak
symbols) will cancel out.

This is not (necessarily) true!

It appears that when you do an incremental link (ld -r), this
cancellation will occur during that link, but subsequent links will
fail to cancel redundant code.

When a *.o file is created from a C++ source file, it has a number of
sections called .gnu.linkonce.*.  When the incremental link is attempted,
it appears that redundant copies of these sections are removed, but then
these sections are simply rolled into the .text section of the resulting
*.o file.  Once in the .text section, weak symbols cannot be removed.

This seems like a bug in the linker.  Has anyone heard of a fix?
Am I wrong in my analysis?  I'm using binutils 2.8.1.

Brad Garcia
   ___/  __ /  __ /  ___/ "Being the Linux of digital media
  __/   /  /  / _/  __/    would be a very good life."
_/    ____/ _/ _| ____/      - Jean-Louis Gassee, CEO of Be, Inc.



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