bfd/
authorH.J. Lu <hjl.tools@gmail.com>
Sat, 1 Sep 2007 06:09:20 +0000 (06:09 +0000)
committerH.J. Lu <hjl.tools@gmail.com>
Sat, 1 Sep 2007 06:09:20 +0000 (06:09 +0000)
2007-08-31  H.J. Lu  <hongjiu.lu@intel.com>

PR ld/4986
* dwarf2.c (new_line_sorts_after): Also compare line number.

ld/testsuite/

2007-08-31  H.J. Lu  <hongjiu.lu@intel.com>

PR ld/4986
* ld-x86-64/line.exp: New
* ld-x86-64/undefined.s: Likewise.

bfd/ChangeLog
bfd/dwarf2.c
ld/testsuite/ChangeLog
ld/testsuite/ld-x86-64/line.exp [new file with mode: 0644]
ld/testsuite/ld-x86-64/undefined.s [new file with mode: 0644]

index 2aec877277675acabc572a99ae0d5bae8a6030d2..26508d8a8987da664ff382e502a03d273b3662b9 100644 (file)
@@ -1,3 +1,8 @@
+2007-08-31  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR ld/4986
+       * dwarf2.c (new_line_sorts_after): Also compare line number.
+
 2007-08-31  Jesse Michael  <jmichael@suse.de>
 
        * mach-o.c (bfd_mach_o_make_bfd_section): Fix test for non
@@ -9,7 +14,7 @@
        narrowing instructions.
 
 2007-08-28  Mark Shinwell  <shinwell@codesourcery.com>
-            Joseph Myers  <joseph@codesourcery.com>
+           Joseph Myers  <joseph@codesourcery.com>
 
        * elf32-arm.c (elf32_arm_compare_mapping): Compare first on vma,
        then on type.
index 37d68f9b9e67dca9cf9801339f28615a47911b7a..7f5f3974a337f34ce89ecf20481a56b5e3841d8c 100644 (file)
@@ -917,7 +917,8 @@ new_line_sorts_after (struct line_info *new_line, struct line_info *line)
 {
   return (new_line->address > line->address
          || (new_line->address == line->address
-             && new_line->end_sequence < line->end_sequence));
+             && (new_line->line > line->line
+                 || new_line->end_sequence < line->end_sequence)));
 }
 
 
index 5b0ce3225ef2f6a4ce59336e824d8cdb31633111..c145f09c59938d52f8cd7559f040812ef966fee8 100644 (file)
@@ -1,3 +1,9 @@
+2007-08-31  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR ld/4986
+       * ld-x86-64/line.exp: New
+       * ld-x86-64/undefined.s: Likewise.
+
 2007-08-31  Tristan Gingold  <gingold@adacore.com>
 
        * ld-script/map-address.t: Add a test for testing DEFINED in map
@@ -5,7 +11,7 @@
        * ld-script/map-address.d: Update expected output.
 
 2007-08-28  Mark Shinwell  <shinwell@codesourcery.com>
-            Joseph Myers  <joseph@codesourcery.com>
+           Joseph Myers  <joseph@codesourcery.com>
 
        * ld-elfcomm/elfcomm.exp: Use run_host_cmd.  Only check "which
        $CC" if host is local.
diff --git a/ld/testsuite/ld-x86-64/line.exp b/ld/testsuite/ld-x86-64/line.exp
new file mode 100644 (file)
index 0000000..0d92489
--- /dev/null
@@ -0,0 +1,63 @@
+# Test that the linker reports undefined symbol line number correctly.
+#
+#   Copyright 2007  Free Software Foundation, Inc.
+#
+# This file is part of the GNU Binutils.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+if { !([istarget "x86_64-*-elf*"]
+       || [istarget "x86_64-*-linux*"]) } {
+    return
+}
+
+set testline "undefined line"
+
+if { ![is_remote host] && [which $CC] == 0 } {
+    verbose "Could not find C compiler!" 1
+    untested $testline
+    return
+}
+
+if ![ld_assemble $as "--64 $srcdir/$subdir/undefined.s" tmpdir/undefined.o] {
+    verbose "Unable to assemble test file!" 1
+    unresolved $testline
+    return
+}
+
+remote_file host delete "tmpdir/undefined"
+
+# Using -e start prevents the SunOS linker from trying to build a
+# shared library.
+send_log "$ld -e start -melf_x86_64 -o tmpdir/undefined tmpdir/undefined.o\n"
+set exec_output [run_host_cmd "$ld" "-e start -melf_x86_64 -o tmpdir/undefined tmpdir/undefined.o"]
+
+send_log "$exec_output\n"
+verbose "$exec_output"
+
+proc checkund { string testname } {
+    global exec_output
+
+    if [string match "*$string*" $exec_output] {
+       pass $testname
+    } else {
+       fail $testname
+    }
+}
+
+set ml "undefined.c:9: undefined reference to `*this_function_is_not_defined'"
+
+checkund $ml $testline
diff --git a/ld/testsuite/ld-x86-64/undefined.s b/ld/testsuite/ld-x86-64/undefined.s
new file mode 100644 (file)
index 0000000..60c1c94
--- /dev/null
@@ -0,0 +1,154 @@
+       .file   "undefined.c"
+       .section        .debug_abbrev,"",@progbits
+.Ldebug_abbrev0:
+       .section        .debug_info,"",@progbits
+.Ldebug_info0:
+       .section        .debug_line,"",@progbits
+.Ldebug_line0:
+       .text
+.Ltext0:
+       .p2align 4,,15
+.globl function
+       .type   function, @function
+function:
+.LFB2:
+       .file 1 "undefined.c"
+       .loc 1 8 0
+       .loc 1 9 0
+       xorl    %eax, %eax
+       jmp     this_function_is_not_defined
+.LFE2:
+       .size   function, .-function
+       .section        .debug_frame,"",@progbits
+.Lframe0:
+       .long   .LECIE0-.LSCIE0
+.LSCIE0:
+       .long   0xffffffff
+       .byte   0x1
+       .string ""
+       .uleb128 0x1
+       .sleb128 -8
+       .byte   0x10
+       .byte   0xc
+       .uleb128 0x7
+       .uleb128 0x8
+       .byte   0x90
+       .uleb128 0x1
+       .align 8
+.LECIE0:
+.LSFDE0:
+       .long   .LEFDE0-.LASFDE0
+.LASFDE0:
+       .long   .Lframe0
+       .quad   .LFB2
+       .quad   .LFE2-.LFB2
+       .align 8
+.LEFDE0:
+       .text
+.Letext0:
+       .section        .debug_info
+       .long   0x4c
+       .value  0x2
+       .long   .Ldebug_abbrev0
+       .byte   0x8
+       .uleb128 0x1
+       .long   .Ldebug_line0
+       .quad   .Letext0
+       .quad   .Ltext0
+       .long   .LASF0
+       .byte   0x1
+       .long   .LASF1
+       .uleb128 0x2
+       .byte   0x1
+       .long   .LASF2
+       .byte   0x1
+       .byte   0x8
+       .long   0x48
+       .quad   .LFB2
+       .quad   .LFE2
+       .byte   0x2
+       .byte   0x77
+       .sleb128 8
+       .uleb128 0x3
+       .string "int"
+       .byte   0x4
+       .byte   0x5
+       .byte   0x0
+       .section        .debug_abbrev
+       .uleb128 0x1
+       .uleb128 0x11
+       .byte   0x1
+       .uleb128 0x10
+       .uleb128 0x6
+       .uleb128 0x12
+       .uleb128 0x1
+       .uleb128 0x11
+       .uleb128 0x1
+       .uleb128 0x25
+       .uleb128 0xe
+       .uleb128 0x13
+       .uleb128 0xb
+       .uleb128 0x3
+       .uleb128 0xe
+       .byte   0x0
+       .byte   0x0
+       .uleb128 0x2
+       .uleb128 0x2e
+       .byte   0x0
+       .uleb128 0x3f
+       .uleb128 0xc
+       .uleb128 0x3
+       .uleb128 0xe
+       .uleb128 0x3a
+       .uleb128 0xb
+       .uleb128 0x3b
+       .uleb128 0xb
+       .uleb128 0x49
+       .uleb128 0x13
+       .uleb128 0x11
+       .uleb128 0x1
+       .uleb128 0x12
+       .uleb128 0x1
+       .uleb128 0x40
+       .uleb128 0xa
+       .byte   0x0
+       .byte   0x0
+       .uleb128 0x3
+       .uleb128 0x24
+       .byte   0x0
+       .uleb128 0x3
+       .uleb128 0x8
+       .uleb128 0xb
+       .uleb128 0xb
+       .uleb128 0x3e
+       .uleb128 0xb
+       .byte   0x0
+       .byte   0x0
+       .byte   0x0
+       .section        .debug_pubnames,"",@progbits
+       .long   0x1b
+       .value  0x2
+       .long   .Ldebug_info0
+       .long   0x50
+       .long   0x29
+       .string "function"
+       .long   0x0
+       .section        .debug_aranges,"",@progbits
+       .long   0x2c
+       .value  0x2
+       .long   .Ldebug_info0
+       .byte   0x8
+       .byte   0x0
+       .value  0x0
+       .value  0x0
+       .quad   .Ltext0
+       .quad   .Letext0-.Ltext0
+       .quad   0x0
+       .quad   0x0
+       .section        .debug_str,"MS",@progbits,1
+.LASF0:
+       .string "GNU C 3.4.6"
+.LASF1:
+       .string "undefined.c"
+.LASF2:
+       .string "function"