Bug 4986 - gas emits duplicate .loc directive from gcc 3.4.6
Summary: gas emits duplicate .loc directive from gcc 3.4.6
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.19
: P2 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-01 00:16 UTC by H.J. Lu
Modified: 2007-09-05 19:44 UTC (History)
2 users (show)

See Also:
Host:
Target: x86_64-unknown-linux-gnu
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2007-09-01 00:16:08 UTC
This patch:

http://sourceware.org/ml/binutils/2007-08/msg00433.html

caused

FAIL: undefined line

on Linux/x86-64 with gcc 3.4.6. Before the change, ld generated

/net/gnu-6/export/gnu/src/binutils-next/binutils/ld/testsuite/ld-undefined/undefined.c:9:
undefined reference to `this_function_is_not_defined'

After the patch, ld generates

/net/gnu-6/export/gnu/src/binutils-last/binutils/ld/testsuite/ld-undefined/undefined.c:8:
undefined reference to `this_function_is_not_defined'

Gcc 3.4.6 generates

.globl function
        .type   function, @function
function:
.LFB2:
        .file 1 "/net/gnu-6/export/gnu/src/binutils-last/binutils/ld/testsuite/l
d-undefined/undefined.c"
        .loc 1 8 0
        .loc 1 9 0
        xorl    %eax, %eax
        jmp     this_function_is_not_defined
..

Should we adjust _bfd_dwarf2_find_nearest_line/_bfd_dwarf2_find_line for
this?
Comment 1 H.J. Lu 2007-09-01 02:19:43 UTC
A patch is posted at

http://sourceware.org/ml/binutils/2007-09/msg00003.html
Comment 2 H.J. Lu 2007-09-01 06:51:09 UTC
I checked in my patch. But it doesn't work on ia64 with gcc 3.4 and 4.1.
I got

 Line Number Statements:
  Extended opcode 2: set Address to 0x0
  Special opcode 12: advance Address by 0 to 0x0 and Line by 7 to 8
  Copy
  Special opcode 230: advance Address by 16 to 0x10 and Line by 1 to 9
  Special opcode 6: advance Address by 0 to 0x10 and Line by 1 to 10
  Special opcode 4: advance Address by 0 to 0x10 and Line by -1 to 9
  Special opcode 229: advance Address by 16 to 0x20 and Line by 0 to 9
  Copy
  Special opcode 34: advance Address by 2 to 0x22 and Line by 1 to 10
  Advance PC by 30 to 0x40
  Extended opcode 1: End of Sequence

We wind up with line 10 instead of line 9.
Comment 3 H.J. Lu 2007-09-01 13:05:47 UTC
An updated patch is posted at

http://sourceware.org/ml/binutils/2007-09/msg00005.html
Comment 4 H.J. Lu 2007-09-05 19:44:16 UTC
Fixed.