[gold] "entry in mergeable string section not null terminated"
Thu Mar 19 22:22:00 GMT 2009
On Thu, Mar 19, 2009 at 12:18:42PM -0700, Ian Lance Taylor wrote:
> Cary Coutant <firstname.lastname@example.org> writes:
> > Certain sections in your relocatable object files contain read-only
> > string data; the linker tries to optimize the size of your executable
> > by merging these sections together and eliminating any duplicate
> > strings. For that to work, each section marked as a mergeable string
> > section (one with the flags SHF_MERGE and SHF_STRINGS set) must
> > consist entirely of null-terminated strings, one after the other, so
> > that the linker can find each individual string.
> > This error message is telling you that it found a section marked with
> > SHF_MERGE and SHF_STRINGS, but that the section didn't end with a
> > null. If you can gzip your archive
> > libApplicationComponents_AnatomicProgram-debug.a and send it to me,
> > I'll take a look and see if I can spot the problem. I'm not sure if
> > the gnu linker is more tolerant, or if it just wasn't trying to do the
> > constant merging optimization.
> The GNU linker does implement this optimization, and it is more
> tolerant. When merging a string section, it reads the section into
> memory, and explicitly pads it with a null character. The code refers
> to a gcc patch
> which fixes a case where gcc marked a section as containing mergeable
> strings even though the strings were not null terminated. This was
> fixed in gcc 4.1.2, so if Peter is using an earlier version of gcc that
> could conceivably be the problem here.
Hm. I'm using the g++ from opensuse 11.1. As I am not on that specific computer
I could only look on
to guess which g++ I am using.
There are 3 versions:
gcc33-c++-3.3.3-7.5.i586.rpm (<- not relevant, because I have
at least 4.x)
So it seems my g++ is recent enough.
FYI, gold was installed from
> gold could use a similar workaround. In fact, if we just demote the
> error to a warning, I think everything would work fine. Peter, would
> you be interested in trying such a patch? Change this line in
> object->error(_("entry in mergeable string section "
> "not null terminated"));
> to something like
> gold_warning(_("%s: entry in mergeable string section "
> "not null terminated"),
I will give it a try next time I'll be at the PC with that environment (and the
sources), which will propably be tomorrow.
More information about the Binutils