Bug 10531 - Strange assembler warning message on section group
Summary: Strange assembler warning message on section group
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: gas (show other bugs)
Version: 2.20
: P2 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-17 19:53 UTC by H.J. Lu
Modified: 2010-07-06 15:48 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
assembler test case (1.13 KB, text/plain)
2010-06-28 19:00 UTC, Anders Kaseorg
Details

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2009-08-17 19:53:53 UTC
hjl@gnu-6 group-7]$ cat foo.s
	.section .debug_info,"G",@progbits,foo,comdat
	.byte 0x0
	.section .debug_line,"G",@progbits,foo,comdat
	.byte 0x0
[hjl@gnu-6 group-7]$ make foo.o
./as --32 -o foo.o foo.s
foo.s: Assembler messages:
foo.s:4: Warning: assuming all members of group `foo' are COMDAT
[hjl@gnu-6 group-7]$
Comment 1 H.J. Lu 2009-08-17 23:08:12 UTC
A patch is posted at

http://sourceware.org/ml/binutils/2009-08/msg00293.html
Comment 2 H.J. Lu 2009-08-19 03:14:18 UTC
The current patch is at

http://sourceware.org/ml/binutils/2009-08/msg00334.html
Comment 3 H.J. Lu 2009-08-24 13:59:21 UTC
The current patch is at

http://sourceware.org/ml/binutils/2009-08/msg00405.html
Comment 4 Anders Kaseorg 2010-06-28 18:34:07 UTC
Ubuntu has taken the current version of this patch 
<http://sourceware.org/ml/binutils/2009-10/msg00512.html>, and it broke clang -
g:

$ echo 'int main(){}' > test.c
$ clang -g -c test.c
/tmp/cc-xPGs3W.s: Assembler messages:
/tmp/cc-xPGs3W.s:413: Fatal error: duplicate .debug_line sections
clang: error: assembler command failed with exit code 1 (use -v to see 
invocation)

https://bugs.launchpad.net/ubuntu/+source/binutils/+bug/599485
Comment 5 Anders Kaseorg 2010-06-28 18:35:01 UTC
See also http://llvm.org/bugs/show_bug.cgi?id=6218 .
Comment 6 H.J. Lu 2010-06-28 18:42:34 UTC
Please provide a small assembly testcase.
Comment 7 Anders Kaseorg 2010-06-28 19:00:39 UTC
Created attachment 4859 [details]
assembler test case

Sure.  This was generated by
$ echo 'int main() { return 0; }' > test.c
$ clang -v -save-temps -g -c test.c
…
 as --gdwarf2 -V -Qy --64 -o test.o test.s
GNU assembler version 2.20.51 (x86_64-linux-gnu) using BFD version (GNU
Binutils for Ubuntu) 2.20.51-system.20100617
test.s: Assembler messages:
test.s:414: Fatal error: duplicate .debug_line sections
Comment 8 H.J. Lu 2010-06-28 20:37:10 UTC
(In reply to comment #7)
> Created an attachment (id=4859)
> assembler test case
> 
> Sure.  This was generated by
> $ echo 'int main() { return 0; }' > test.c
> $ clang -v -save-temps -g -c test.c
> �
>  as --gdwarf2 -V -Qy --64 -o test.o test.s
> GNU assembler version 2.20.51 (x86_64-linux-gnu) using BFD version (GNU
> Binutils for Ubuntu) 2.20.51-system.20100617
> test.s: Assembler messages:
> test.s:414: Fatal error: duplicate .debug_line sections
> 

That is clang bug. You should pass --gdwarf2 to as only
if you want assembler to generate debug info instead of
the compiler. --gdwarf2 is used to debug pure assembly codes.
Comment 9 Anders Kaseorg 2010-06-28 20:50:36 UTC
(In reply to comment #8)
> That is clang bug. You should pass --gdwarf2 to as only
> if you want assembler to generate debug info instead of
> the compiler. --gdwarf2 is used to debug pure assembly codes.

Thanks for looking at this.  I’ve noted your response on the upstream clang bug: 
<http://llvm.org/bugs/show_bug.cgi?id=6218#c20>
Comment 10 Sourceware Commits 2010-07-05 15:07:41 UTC
Subject: Bug 10531

CVSROOT:	/cvs/src
Module name:	src
Changes by:	hjl@sourceware.org	2010-07-05 15:07:20

Modified files:
	binutils/testsuite: ChangeLog 
	binutils/testsuite/binutils-all: objdump.W 
	gas            : ChangeLog dwarf2dbg.c 
	gas/testsuite  : ChangeLog 
	gas/testsuite/gas/elf: elf.exp 
	gas/testsuite/gas/i386: dw2-compress-1.d i386.exp 
Added files:
	gas/testsuite/gas/elf: dwarf2-1.d dwarf2-1.s dwarf2-2.d 
	                       dwarf2-2.s dwarf2-3.d dwarf2-3.s 
	gas/testsuite/gas/i386: debug1.d debug1.s 

Log message:
	Don't generate .debug_line section if it isn't empty.
	
	binutils/testsuite/
	
	2010-07-05  H.J. Lu  <hongjiu.lu@intel.com>
	
	PR gas/10531
	PR gas/11789
	* binutils-all/objdump.W: Remove bogus line debug info.
	
	gas/
	
	2010-07-05  Jim Wilson  <wilson@codesourcery.com>
	
	PR gas/10531
	PR gas/11789
	* dwarf2dbg.c (dwarf2_finish): Don't generate .debug_line section
	if it isn't empty.
	
	gas/testsuite/
	
	2010-07-05  H.J. Lu  <hongjiu.lu@intel.com>
	
	PR gas/10531
	PR gas/11789
	* gas/i386/dw2-compress-1.d: Remove bogus line debug info.
	
	* gas/elf/dwarf2-1.d: New.
	* gas/elf/dwarf2-1.s: Likewise.
	* gas/elf/dwarf2-2.d: Likewise.
	* gas/elf/dwarf2-2.s: Likewise.
	* gas/elf/dwarf2-3.d: Likewise.
	* gas/elf/dwarf2-3.s: Likewise.
	* gas/i386/debug1.d: Likewise.
	* gas/i386/debug1.s: Likewise.
	
	* gas/elf/elf.exp: Run dwarf2-1, dwarf2-2 and dwarf2-3.
	
	* gas/i386/i386.exp: Run debug1 for both 32bit and 64bit.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/binutils/testsuite/ChangeLog.diff?cvsroot=src&r1=1.202&r2=1.203
http://sourceware.org/cgi-bin/cvsweb.cgi/src/binutils/testsuite/binutils-all/objdump.W.diff?cvsroot=src&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/ChangeLog.diff?cvsroot=src&r1=1.4191&r2=1.4192
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/dwarf2dbg.c.diff?cvsroot=src&r1=1.106&r2=1.107
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/testsuite/ChangeLog.diff?cvsroot=src&r1=1.1688&r2=1.1689
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/testsuite/gas/elf/dwarf2-1.d.diff?cvsroot=src&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/testsuite/gas/elf/dwarf2-1.s.diff?cvsroot=src&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/testsuite/gas/elf/dwarf2-2.d.diff?cvsroot=src&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/testsuite/gas/elf/dwarf2-2.s.diff?cvsroot=src&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/testsuite/gas/elf/dwarf2-3.d.diff?cvsroot=src&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/testsuite/gas/elf/dwarf2-3.s.diff?cvsroot=src&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/testsuite/gas/elf/elf.exp.diff?cvsroot=src&r1=1.58&r2=1.59
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/testsuite/gas/i386/debug1.d.diff?cvsroot=src&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/testsuite/gas/i386/debug1.s.diff?cvsroot=src&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/testsuite/gas/i386/dw2-compress-1.d.diff?cvsroot=src&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gas/testsuite/gas/i386/i386.exp.diff?cvsroot=src&r1=1.139&r2=1.140

Comment 11 H.J. Lu 2010-07-06 15:48:03 UTC
Fixed.