This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [gold] Merging string literals with bigger alignment
- From: Cary Coutant <ccoutant at google dot com>
- To: Cary Coutant <ccoutant at google dot com>, "H.J. Lu" <hjl dot tools at gmail dot com>, Alexander Ivchenko <aivchenk at gmail dot com>, binutils <binutils at sourceware dot org>
- Date: Thu, 2 May 2013 22:58:51 -0700
- Subject: Re: [gold] Merging string literals with bigger alignment
- References: <CACysShiw_kcnug9u8ShzS-k0qQVdrz3wk5kB2Aqh=cZmaQrPhA at mail dot gmail dot com> <CAHACq4q7CReFbYaeK+APLLhi+oKxBcv4d-2o4wjvkxRpx=Uj_A at mail dot gmail dot com> <20130501022527 dot GC5221 at bubble dot grove dot modra dot org> <CAHACq4otE1CiMUanv0paiMu=cDNE8UsyrpLCpBbBYaZDH4kQrQ at mail dot gmail dot com> <CAMe9rOpsr1xDvU5tWA5GFp0q+Z+=u_9=eh3LnsS4P_zojLth8A at mail dot gmail dot com> <CAMe9rOqSd4GA8UGrvtPWsNM6CMWFjL=dowpSux=0ruWPq=JpcA at mail dot gmail dot com> <CAMe9rOo9NW=3CfDCCm+uh06kFRfHM=Q-LgmTMrD0pVDm5pft9A at mail dot gmail dot com> <20130502032920 dot GI5221 at bubble dot grove dot modra dot org> <CAMe9rOq5FbfkHmhFCWG4J8aNTPvWeJohigtw1m6sBB=d0zOK=Q at mail dot gmail dot com> <CAHACq4pmuTYL83f8yxnJ1NBj5XBFK3UhLEiLGjNbsYr8O6d7Sg at mail dot gmail dot com> <20130503011406 dot GM5221 at bubble dot grove dot modra dot org>
> Ah! Take a look at merge.cc:545. len is set for the first string
> and then the same value used for all subsequent strings. The
> shadowing of vars is horrible too. A final nit: If the last string in
> the section is missing a terminator, I think input_size_ ought to
> include the missing terminator.
>
> Oh, and the loop doesn't terminate due to pt < pend0 until we wrap..
> (gdb) p len
> $3 = -97 '\237'
> (gdb) p sizeof(len)
> $4 = 1
Ouch -- all issues that I should have caught before committing, and
probably introduced as a result of my review comments. Sorry for that.
> * merge.cc (Output_merge_string::do_add_input_section): Correct
> scan for number of strings. Rename vars to avoid shadowing.
> Include missing terminator in input_size_.
This is OK. Thanks to you and HJ for tracking these down.
-cary