PATCH: PR gas/10531: Strange assembler warning message on section group

H.J. Lu hjl.tools@gmail.com
Thu Aug 20 05:09:00 GMT 2009


On Wed, Aug 19, 2009 at 6:20 PM, H.J. Lu<hjl.tools@gmail.com> wrote:
> On Wed, Aug 19, 2009 at 10:59 AM, Jim Wilson<wilson@codesourcery.com> wrote:
>> On Tue, 2009-08-18 at 20:08 -0700, H.J. Lu wrote:
>>> The main problem is we shouldn't identify a section just by section name only.
>>
>> I don't think that you understand the complete problem here.  This patch
>> will make the spurious warning message go away.  This does not solve the
>> problem that gas is emitting bogus debug info into a file that already
>> contains debug info.
>>
>> This is trivial to prove with a small example.  Put this into a C file
>> int main (void) { asm (""); return 0; }
>> Compile with "icc -c -g".  Run "readelf -wl" on the .o file, and you
>> will see that we have two directory tables, two file name tables, two
>> line number tables, etc.  The first set is OK, and was emitted by icc.
>> The second set is bogus, and was emitted by gas.
>>
>> The reason that an unpatched gas can emit a bogus warning is that when
>> we have comdat sections, gas accidentally emits the bogus debug info
>> into a comdat section, corrupting the comdat section.  Your patch fixes
>> this by emitting the bogus debug info into a regular section.  This is
>> good, and necessary, but we are still emitting bogus debug info with
>> your patch.  I think this needs to be fixed also.  We can probably fix
>> this with a separate patch.
>>
>> If you want an example that generates the bogus warning, then try this
>> inline int sub (void) { return 0; }
>> int main (void) { asm (""); return sub (); }
>> When I compile with "icc -O -g -c" I get a bogus warning.  And running
>> "readelf -wl" on the output shows again that we have bogus debug info
>> emitted by gas, except now it is in a comdat section.
>>
>
>
> I didn't see the problem with my icc, using the patched
> assembler. Can you provide main.s compiled by your icc?
>
> Thanks.
>

BTW, readelf won't dump more than one set of debug sections:

http://www.sourceware.org/bugzilla/show_bug.cgi?id=3237


-- 
H.J.



More information about the Binutils mailing list