Reference to discarded section

Paul Koning Paul_Koning@dell.com
Tue Jun 24 20:56:00 GMT 2008
I'm trying to get Binutils 2.18 to work (with GCC 3.3.3) and I'm
running into a cryptic and undocumented message:

  (_("%X`%s' referenced in section `%A' of %B: "
     "defined in discarded section `%A' of %B\n"),

which comes from bfd/elflink.c.  The code around it seems to suggest
that this is meant as a warning, because the next action is

      /* Try to do the best we can to support buggy old
	 versions of gcc.  Pretend that the symbol is
	 really defined in the kept linkonce section.
	 FIXME: This is quite broken.  Modifying the
	 symbol here means we will be changing all later
	 uses of the symbol, not just in this section.  */

but in fact it's an error so my Makefile aborts the build.

The program being linked is a large C++ program with many files and
assorted libraries.  The complaints all mention some module out of an
object library.

So what I'm wondering is:

1. What does this mean?  
2. How do I fix this?
3. What causes a link-once section to be discarded?  There's nothing
   in ld.info that discusses that topic.

I'm looking for a fix that I can use with GCC 3.3.3 -- I can't yet
move to a newer GCC because of source code compatibility issues (the
parser changes that happened in 3.4 and 4.x).  Can I turn off the
error message and just let the "try to do the best we can" code do its
thing?

	paul



More information about the Binutils mailing list