This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: PR ld/11817: Linker crash due to compressed debug section change


Hi,

I checked in this patch to add testcases for PR ld/11817.


H.J.
---
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 71ce0e6..fc42eeb 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,14 @@
+2010-07-14  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR ld/11817
+	* ld-i386/compressed1.s: New.
+	* ld-i386/compressed1.d: Likewise.
+	* ld-x86-64/compressed1.s: Likewise.
+	* ld-x86-64/compressed1.d: Likewise.
+
+	* ld-i386/i386.exp: Run compressed1.
+	* ld-x86-64/x86-64.exp: Likewise.
+
 2010-07-13  H.J. Lu  <hongjiu.lu@intel.com>
 
 	PR ld/11812
diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp
index 3f20533..850713a 100644
--- a/ld/testsuite/ld-i386/i386.exp
+++ b/ld/testsuite/ld-i386/i386.exp
@@ -190,3 +190,10 @@ run_dump_test "protected2"
 run_dump_test "protected3"
 run_dump_test "tlspie1"
 run_dump_test "nogot1"
+
+if { !([istarget "i?86-*-linux*"]
+       || [istarget "x86_64-*-linux*"]) } {
+    return
+}
+
+run_dump_test "compressed1"
diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
index 76ac474..d7ca525 100644
--- a/ld/testsuite/ld-x86-64/x86-64.exp
+++ b/ld/testsuite/ld-x86-64/x86-64.exp
@@ -99,3 +99,9 @@ run_dump_test "tlsle1"
 run_dump_test "tlspie1"
 run_dump_test "unique1"
 run_dump_test "nogot1"
+
+if { ![istarget "x86_64-*-linux*"] } {
+    return
+}
+
+run_dump_test "compressed1"
--- /dev/null	2010-07-09 11:29:32.805426765 -0700
+++ binutils/ld/testsuite/ld-i386/compressed1.d	2010-07-14 17:31:57.537420845 -0700
@@ -0,0 +1,9 @@
+#name: undefined symbol with compressed debug sections
+#as: --32
+#ld: -e foo -melf_i386 --noinhibit-exec
+#warning: .*/compressed1.c:13: undefined reference to .bar.
+#nm: -n
+
+#...
+[ \t]+U bar
+#pass
--- /dev/null	2010-07-09 11:29:32.805426765 -0700
+++ binutils/ld/testsuite/ld-i386/compressed1.s	2010-07-14 16:59:08.757413834 -0700
@@ -0,0 +1,186 @@
+	.file	"compressed1.c"
+	.section	.debug_abbrev,"",@progbits
+.Ldebug_abbrev0:
+	.section	.debug_info,"",@progbits
+.Ldebug_info0:
+	.section	.debug_line,"",@progbits
+.Ldebug_line0:
+	.text
+.Ltext0:
+	.cfi_sections	.debug_frame
+	.p2align 4,,15
+.globl foo
+	.type	foo, @function
+foo:
+.LFB0:
+	.file 1 "compressed1.c"
+	.loc 1 12 0
+	.cfi_startproc
+	pushl	%ebp
+	.cfi_def_cfa_offset 8
+	movl	%esp, %ebp
+	.cfi_offset 5, -8
+	.cfi_def_cfa_register 5
+	subl	$8, %esp
+	.loc 1 14 0
+	leave
+	.cfi_restore 5
+	.cfi_def_cfa 4, 4
+	.loc 1 13 0
+	jmp	bar
+	.cfi_endproc
+.LFE0:
+	.size	foo, .-foo
+.Letext0:
+	.section	.debug_info
+	.long	0x5e
+	.value	0x3
+	.long	.Ldebug_abbrev0
+	.byte	0x4
+	.uleb128 0x1
+	.long	.LASF5
+	.byte	0x1
+	.long	.LASF6
+	.long	.LASF7
+	.long	.Ltext0
+	.long	.Letext0
+	.long	.Ldebug_line0
+	.uleb128 0x2
+	.byte	0x1
+	.byte	0x6
+	.long	.LASF0
+	.uleb128 0x2
+	.byte	0x2
+	.byte	0x5
+	.long	.LASF1
+	.uleb128 0x3
+	.byte	0x4
+	.byte	0x5
+	.string	"int"
+	.uleb128 0x2
+	.byte	0x4
+	.byte	0x5
+	.long	.LASF2
+	.uleb128 0x2
+	.byte	0x1
+	.byte	0x8
+	.long	.LASF3
+	.uleb128 0x2
+	.byte	0x2
+	.byte	0x7
+	.long	.LASF4
+	.uleb128 0x4
+	.byte	0x1
+	.string	"foo"
+	.byte	0x1
+	.byte	0xb
+	.long	.LFB0
+	.long	.LFE0
+	.byte	0x1
+	.byte	0x9c
+	.byte	0x0
+	.section	.debug_abbrev
+	.uleb128 0x1
+	.uleb128 0x11
+	.byte	0x1
+	.uleb128 0x25
+	.uleb128 0xe
+	.uleb128 0x13
+	.uleb128 0xb
+	.uleb128 0x3
+	.uleb128 0xe
+	.uleb128 0x1b
+	.uleb128 0xe
+	.uleb128 0x11
+	.uleb128 0x1
+	.uleb128 0x12
+	.uleb128 0x1
+	.uleb128 0x10
+	.uleb128 0x6
+	.byte	0x0
+	.byte	0x0
+	.uleb128 0x2
+	.uleb128 0x24
+	.byte	0x0
+	.uleb128 0xb
+	.uleb128 0xb
+	.uleb128 0x3e
+	.uleb128 0xb
+	.uleb128 0x3
+	.uleb128 0xe
+	.byte	0x0
+	.byte	0x0
+	.uleb128 0x3
+	.uleb128 0x24
+	.byte	0x0
+	.uleb128 0xb
+	.uleb128 0xb
+	.uleb128 0x3e
+	.uleb128 0xb
+	.uleb128 0x3
+	.uleb128 0x8
+	.byte	0x0
+	.byte	0x0
+	.uleb128 0x4
+	.uleb128 0x2e
+	.byte	0x0
+	.uleb128 0x3f
+	.uleb128 0xc
+	.uleb128 0x3
+	.uleb128 0x8
+	.uleb128 0x3a
+	.uleb128 0xb
+	.uleb128 0x3b
+	.uleb128 0xb
+	.uleb128 0x11
+	.uleb128 0x1
+	.uleb128 0x12
+	.uleb128 0x1
+	.uleb128 0x40
+	.uleb128 0xa
+	.byte	0x0
+	.byte	0x0
+	.byte	0x0
+	.section	.debug_pubnames,"",@progbits
+	.long	0x16
+	.value	0x2
+	.long	.Ldebug_info0
+	.long	0x62
+	.long	0x4f
+	.string	"foo"
+	.long	0x0
+	.section	.debug_pubtypes,"",@progbits
+	.long	0xe
+	.value	0x2
+	.long	.Ldebug_info0
+	.long	0x62
+	.long	0x0
+	.section	.debug_aranges,"",@progbits
+	.long	0x1c
+	.value	0x2
+	.long	.Ldebug_info0
+	.byte	0x4
+	.byte	0x0
+	.value	0x0
+	.value	0x0
+	.long	.Ltext0
+	.long	.Letext0-.Ltext0
+	.long	0x0
+	.long	0x0
+	.section	.debug_str,"MS",@progbits,1
+.LASF0:
+	.string	"signed char"
+.LASF1:
+	.string	"short int"
+.LASF6:
+	.string	"compressed1.c"
+.LASF5:
+	.string	"GNU C 4.4.4 20100630 (Red Hat 4.4.4-10)"
+.LASF7:
+	.string	"."
+.LASF3:
+	.string	"unsigned char"
+.LASF2:
+	.string	"long int"
+.LASF4:
+	.string	"short unsigned int"
--- /dev/null	2010-07-09 11:29:32.805426765 -0700
+++ binutils/ld/testsuite/ld-x86-64/compressed1.d	2010-07-14 17:32:28.473416586 -0700
@@ -0,0 +1,9 @@
+#name: undefined symbol with compressed debug sections
+#as: --64
+#ld: -e foo -melf_x86_64 --noinhibit-exec
+#warning: .*/compressed1.c:13: undefined reference to .bar.
+#nm: -n
+
+#...
+[ \t]+U bar
+#pass
--- /dev/null	2010-07-09 11:29:32.805426765 -0700
+++ binutils/ld/testsuite/ld-x86-64/compressed1.s	2010-07-14 16:58:28.350413106 -0700
@@ -0,0 +1,176 @@
+	.file	"compressed1.c"
+	.section	.debug_abbrev,"",@progbits
+.Ldebug_abbrev0:
+	.section	.debug_info,"",@progbits
+.Ldebug_info0:
+	.section	.debug_line,"",@progbits
+.Ldebug_line0:
+	.text
+.Ltext0:
+	.cfi_sections	.debug_frame
+	.p2align 4,,15
+.globl foo
+	.type	foo, @function
+foo:
+.LFB0:
+	.file 1 "compressed1.c"
+	.loc 1 12 0
+	.cfi_startproc
+	.loc 1 13 0
+	jmp	bar
+	.cfi_endproc
+.LFE0:
+	.size	foo, .-foo
+.Letext0:
+	.section	.debug_info
+	.long	0x6e
+	.value	0x3
+	.long	.Ldebug_abbrev0
+	.byte	0x8
+	.uleb128 0x1
+	.long	.LASF5
+	.byte	0x1
+	.long	.LASF6
+	.long	.LASF7
+	.quad	.Ltext0
+	.quad	.Letext0
+	.long	.Ldebug_line0
+	.uleb128 0x2
+	.byte	0x1
+	.byte	0x6
+	.long	.LASF0
+	.uleb128 0x2
+	.byte	0x2
+	.byte	0x5
+	.long	.LASF1
+	.uleb128 0x3
+	.byte	0x4
+	.byte	0x5
+	.string	"int"
+	.uleb128 0x2
+	.byte	0x8
+	.byte	0x5
+	.long	.LASF2
+	.uleb128 0x2
+	.byte	0x1
+	.byte	0x8
+	.long	.LASF3
+	.uleb128 0x2
+	.byte	0x2
+	.byte	0x7
+	.long	.LASF4
+	.uleb128 0x4
+	.byte	0x1
+	.string	"foo"
+	.byte	0x1
+	.byte	0xb
+	.quad	.LFB0
+	.quad	.LFE0
+	.byte	0x1
+	.byte	0x9c
+	.byte	0x0
+	.section	.debug_abbrev
+	.uleb128 0x1
+	.uleb128 0x11
+	.byte	0x1
+	.uleb128 0x25
+	.uleb128 0xe
+	.uleb128 0x13
+	.uleb128 0xb
+	.uleb128 0x3
+	.uleb128 0xe
+	.uleb128 0x1b
+	.uleb128 0xe
+	.uleb128 0x11
+	.uleb128 0x1
+	.uleb128 0x12
+	.uleb128 0x1
+	.uleb128 0x10
+	.uleb128 0x6
+	.byte	0x0
+	.byte	0x0
+	.uleb128 0x2
+	.uleb128 0x24
+	.byte	0x0
+	.uleb128 0xb
+	.uleb128 0xb
+	.uleb128 0x3e
+	.uleb128 0xb
+	.uleb128 0x3
+	.uleb128 0xe
+	.byte	0x0
+	.byte	0x0
+	.uleb128 0x3
+	.uleb128 0x24
+	.byte	0x0
+	.uleb128 0xb
+	.uleb128 0xb
+	.uleb128 0x3e
+	.uleb128 0xb
+	.uleb128 0x3
+	.uleb128 0x8
+	.byte	0x0
+	.byte	0x0
+	.uleb128 0x4
+	.uleb128 0x2e
+	.byte	0x0
+	.uleb128 0x3f
+	.uleb128 0xc
+	.uleb128 0x3
+	.uleb128 0x8
+	.uleb128 0x3a
+	.uleb128 0xb
+	.uleb128 0x3b
+	.uleb128 0xb
+	.uleb128 0x11
+	.uleb128 0x1
+	.uleb128 0x12
+	.uleb128 0x1
+	.uleb128 0x40
+	.uleb128 0xa
+	.byte	0x0
+	.byte	0x0
+	.byte	0x0
+	.section	.debug_pubnames,"",@progbits
+	.long	0x16
+	.value	0x2
+	.long	.Ldebug_info0
+	.long	0x72
+	.long	0x57
+	.string	"foo"
+	.long	0x0
+	.section	.debug_pubtypes,"",@progbits
+	.long	0xe
+	.value	0x2
+	.long	.Ldebug_info0
+	.long	0x72
+	.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	"signed char"
+.LASF1:
+	.string	"short int"
+.LASF6:
+	.string	"compressed1.c"
+.LASF5:
+	.string	"GNU C 4.4.4"
+.LASF7:
+	.string	"."
+.LASF3:
+	.string	"unsigned char"
+.LASF2:
+	.string	"long int"
+.LASF4:
+	.string	"short unsigned int"


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]