[gold] "entry in mergeable string section not null terminated"
Peter Baumann
waste.manager@gmx.de
Fri Mar 20 18:13:00 GMT 2009
On Thu, Mar 19, 2009 at 11:24:40PM +0100, Peter Baumann wrote:
> On Thu, Mar 19, 2009 at 12:18:42PM -0700, Ian Lance Taylor wrote:
> > Cary Coutant <ccoutant@google.com> 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
> >
> > http://gcc.gnu.org/ml/gcc-patches/2006-06/msg01004.html
> >
> > 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
>
> http://download.opensuse.org/distribution/11.1/repo/oss/suse/i586/
>
> to guess which g++ I am using.
>
> There are 3 versions:
>
> gcc43-c++-4.3.3_20081022-9.5.i586.rpm
> gcc41-c++-4.1.3_20080612-26.5.i586.rpm
> 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
>
> http://download.opensuse.org/factory/repo/oss/suse/i586/binutils-gold-2.19.51-5.22.i586.rpm
>
>
> > 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
> > gold/merge.cc
> >
> > object->error(_("entry in mergeable string section "
> > "not null terminated"));
> >
> > to something like
> >
> > gold_warning(_("%s: entry in mergeable string section "
> > "not null terminated"),
> > object->name().c_str());
> >
>
> 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.
FYI: Degrading the error to a warning solved the problem.
I also checked the compiler version and its the above mentioned 4.3.
Do you need any further information to fix this problem in gold? I have the
laptop with me so I could supply you with more info during the weekend if
needed.
-Peter
More information about the Binutils
mailing list