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

Jim Wilson wilson@codesourcery.com
Wed Aug 19 03:08:00 GMT 2009


On 08/17/2009 04:07 PM, H.J. Lu wrote:
> We can't use bfd_get_section_by_name, subseg_new and subseg_get directly
> in dwarf2dbg.c since they don't know ELF section groups.  This patch adds
> obj_get_section_by_name, obj_subseg_new and obj_subseg_get.  Tested on
> Linux/ia32, Linux/ia64 and Linux/Intel64.  OK to install?

The underlying problem here is that gas is emitting a spurious warning 
when fed assembly code generated by icc -g.  This causes gas to fail if 
using -Wa,--warn-fatal.

Gas handles the case where gas generates debug info itself, in which 
case gas must create both the debug_info and debug_line sections.  Gas 
handles the case where gcc generated the debug info, in which case gas 
must only create the debug_line section.  Gas does not correctly handle 
the case where the compiler (icc) generated both the debug_info and 
debug_line sections, in which case gas should do nothing.  Gas insists 
on creating and writing to the debug_line section even though it already 
exists.

This would be relatively harmless, except for the section name 
confusion.  icc creates comdat debug sections for comdat functions. 
When gas tries to create the debug_line section, it accidentally gets a 
comdat section instead.  And then because gas assumes it is creating a 
section, gas sets the section flags and now we have a comdat section 
with incorrect flags.

H.J.'s patch tries to fix this by resolving the section name/comdat 
group section confusion.  There is still a minor problem that we get 
unnecessary and useless bytes written to the end of the debug_line 
section, but this should be relatively harmless.

I've toyed with trying to fix it by changing the logic in dwarf2_finish 
so that we don't create the debug_line section if there already is one. 
  However, I have a lot of more important tasks on my list at the 
moment, and don't have a finished patch yet.  I'm not sure if my 
solution is safe, since it doesn't fix the section name/comdat group 
section confusion.  I'm not sure if my patch works everywhere, since I 
haven't done any serious testing of it.

Maybe what we need here is a combination of both H.J.'s patch and my 
patch to fix both issues.

Jim
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: icc-comdat-warning.patch
URL: <https://sourceware.org/pipermail/binutils/attachments/20090819/330cf0e5/attachment.ksh>


More information about the Binutils mailing list