[gold] "entry in mergeable string section not null terminated"
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 <email@example.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
> 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
> > 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
More information about the Binutils