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]$
A patch is posted at http://sourceware.org/ml/binutils/2009-08/msg00293.html
The current patch is at http://sourceware.org/ml/binutils/2009-08/msg00334.html
The current patch is at http://sourceware.org/ml/binutils/2009-08/msg00405.html
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
See also http://llvm.org/bugs/show_bug.cgi?id=6218 .
Please provide a small assembly testcase.
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
(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.
(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>
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
Fixed.