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]

Re: PR12921


On Thu, Jun 23, 2011 at 8:58 PM, Alan Modra <amodra@gmail.com> wrote:
> I've committed this patch to both mainline and 2.21.
>
> ? ? ? ?PR ld/12921
> ? ? ? ?* elf.c (assign_file_positions_for_load_sections): Don't align
> ? ? ? ?sh_offset for all SHT_NOBITS sections here, just .tbss sections
> ? ? ? ?that don't get a PT_LOAD.

I checked in this patch to add a testcase:

diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 75c0c09..4817ef2 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,14 @@
+2011-06-24  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR ld/12921
+	* ld-i386/i386.exp: Run pr12921.
+	* ld-x86-64/x86-64.exp: Likewise.
+
+	* ld-i386/pr12921.d: New.
+	* ld-i386/pr12921.s: Likewise.
+	* ld-x86-64/pr12921.d: Likewise.
+	* ld-x86-64/pr12921.s: Likewise.
+
 2011-06-22  Thomas Schwinge  <thomas@schwinge.name>

 	* ld-elf/elf.exp: Execute array_tests_pie tests on *-*-gnu*, too.
diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp
index ae798c0..68b71fb 100644
--- a/ld/testsuite/ld-i386/i386.exp
+++ b/ld/testsuite/ld-i386/i386.exp
@@ -200,6 +200,7 @@ run_dump_test "nogot1"
 run_dump_test "nogot2"
 run_dump_test "discarded1"
 run_dump_test "pr12718"
+run_dump_test "pr12921"

 if { !([istarget "i?86-*-linux*"]
        || [istarget "i?86-*-gnu*"]
diff --git a/ld/testsuite/ld-i386/pr12921.d b/ld/testsuite/ld-i386/pr12921.d
new file mode 100644
index 0000000..4b75888
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr12921.d
@@ -0,0 +1,21 @@
+#name: PR ld/12921
+#as: --32
+#ld: -melf_i386
+#readelf: -S --wide
+
+There are 7 section headers, starting at offset 0x204c:
+
+Section Headers:
+  \[Nr\] Name              Type            Addr     Off    Size   ES
Flg Lk Inf Al
+  \[ 0\]                   NULL            00000000 000000 000000 00
    0   0  0
+  \[ 1\] .text             PROGBITS        08049000 001000 000001 00
AX  0   0 4096
+  \[ 2\] .data             PROGBITS        0804b000 002000 000020 00
WA  0   0 4096
+  \[ 3\] .bss              NOBITS          0804c000 002020 010000 00
WA  0   0 4096
+  \[ 4\] .shstrtab         STRTAB          00000000 002020 00002c 00
    0   0  1
+  \[ 5\] .symtab           SYMTAB          00000000 002164 0000c0 10
    6   6  4
+  \[ 6\] .strtab           STRTAB          00000000 002224 000037 00
    0   0  1
+Key to Flags:
+  W \(write\), A \(alloc\), X \(execute\), M \(merge\), S \(strings\)
+  I \(info\), L \(link order\), G \(group\), T \(TLS\), E
\(exclude\), x \(unknown\)
+  O \(extra OS processing required\) o \(OS specific\), p \(processor
specific\)
+#pass
diff --git a/ld/testsuite/ld-i386/pr12921.s b/ld/testsuite/ld-i386/pr12921.s
new file mode 100644
index 0000000..9c4966f
--- /dev/null
+++ b/ld/testsuite/ld-i386/pr12921.s
@@ -0,0 +1,25 @@
+	.text
+	.balign 4096
+vtext:
+	.p2align 4,,15
+	.globl	_start
+	.type	_start, @function
+_start:
+	ret
+	.size	_start, .-_start
+	.globl	vdata
+	.data
+	.align 4096
+	.type	vdata, @object
+	.size	vdata, 4
+vdata:
+	.long	5
+	.comm	vbss,65536,4096
+	.align 16
+	.type	local, @object
+	.size	local, 24
+local:
+	.byte	77
+	.zero	7
+	.dc.a	local
+	.dc.a	0
diff --git a/ld/testsuite/ld-x86-64/pr12921.d b/ld/testsuite/ld-x86-64/pr12921.d
new file mode 100644
index 0000000..c0fe8ab
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr12921.d
@@ -0,0 +1,21 @@
+#name: PR ld/12921
+#as: --64
+#ld: -melf_x86_64
+#readelf: -S --wide
+
+There are 7 section headers, starting at offset 0x2058:
+
+Section Headers:
+  \[Nr\] Name              Type            Address          Off
Size   ES Flg Lk Inf Al
+  \[ 0\]                   NULL            0000000000000000 000000
000000 00      0   0  0
+  \[ 1\] .text             PROGBITS        0000000000401000 001000
000001 00  AX  0   0 4096
+  \[ 2\] .data             PROGBITS        0000000000602000 002000
000028 00  WA  0   0 4096
+  \[ 3\] .bss              NOBITS          0000000000603000 002028
010000 00  WA  0   0 4096
+  \[ 4\] .shstrtab         STRTAB          0000000000000000 002028
00002c 00      0   0  1
+  \[ 5\] .symtab           SYMTAB          0000000000000000 002218
000120 18      6   6  8
+  \[ 6\] .strtab           STRTAB          0000000000000000 002338
000037 00      0   0  1
+Key to Flags:
+  W \(write\), A \(alloc\), X \(execute\), M \(merge\), S
\(strings\), l \(large\)
+  I \(info\), L \(link order\), G \(group\), T \(TLS\), E
\(exclude\), x \(unknown\)
+  O \(extra OS processing required\) o \(OS specific\), p \(processor
specific\)
+#pass
diff --git a/ld/testsuite/ld-x86-64/pr12921.s b/ld/testsuite/ld-x86-64/pr12921.s
new file mode 100644
index 0000000..9c4966f
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/pr12921.s
@@ -0,0 +1,25 @@
+	.text
+	.balign 4096
+vtext:
+	.p2align 4,,15
+	.globl	_start
+	.type	_start, @function
+_start:
+	ret
+	.size	_start, .-_start
+	.globl	vdata
+	.data
+	.align 4096
+	.type	vdata, @object
+	.size	vdata, 4
+vdata:
+	.long	5
+	.comm	vbss,65536,4096
+	.align 16
+	.type	local, @object
+	.size	local, 24
+local:
+	.byte	77
+	.zero	7
+	.dc.a	local
+	.dc.a	0
diff --git a/ld/testsuite/ld-x86-64/x86-64.exp
b/ld/testsuite/ld-x86-64/x86-64.exp
index 58e4bc0..bf75d00 100644
--- a/ld/testsuite/ld-x86-64/x86-64.exp
+++ b/ld/testsuite/ld-x86-64/x86-64.exp
@@ -161,6 +161,7 @@ run_dump_test "nogot1"
 run_dump_test "nogot2"
 run_dump_test "discarded1"
 run_dump_test "pr12718"
+run_dump_test "pr12921"

 if { ![istarget "x86_64-*-linux*"] } {
     return

-- 
H.J.


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