This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Reference to discarded section
- From: Paul Koning <Paul_Koning at dell dot com>
- To: binutils at sourceware dot org
- Date: Tue, 24 Jun 2008 15:16:08 -0400
- Subject: Reference to discarded section
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