* [GOLD] testsuite tweaks for powerpc
@ 2012-09-05 3:46 Alan Modra
2012-09-05 4:33 ` Ian Lance Taylor
2012-09-06 4:26 ` H.J. Lu
0 siblings, 2 replies; 4+ messages in thread
From: Alan Modra @ 2012-09-05 3:46 UTC (permalink / raw)
To: binutils
Various test tweaks for powerpc.
- Non-pic shared libs don't work.
- Adding synthetic syms lets the test see the ordering of code sections
which is what the tests are checking, rather than the ordering of
.opd entries.
- memory_test assumes 4k pages
- justsyms_exec looks at the address of a function, which on powerpc64
is the descriptor in .opd, a data section.
- .toc input sections on powerpc64 need to be part of the .got output
section.
Tested on x86_64 too. OK?
* configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
* configure: Regenerate.
* testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
(plugin_final_layout.stdout): Likewise.
(memory_test): Set page sizes to 0x1000.
* testsuite/Makefile.in: Regenerate.
* testsuite/discard_locals_test.sh: Add FIXME comment.
* testsuite/justsyms_exec.c: Disable function test for powerpc64.
* testsuite/pr14265.t: Add .got output section statement.
* testsuite/script_test_2.t: Likewise.
* testsuite/script_test_3.t: Likewise.
* testsuite/script_test_4.t: Likewise.
* testsuite/script_test_5.t: Likewise.
* testsuite/script_test_6.t: Likewise.
* testsuite/script_test_7.t: Likewise.
* testsuite/script_test_9.t: Likewise.
Index: gold/configure.ac
===================================================================
RCS file: /cvs/src/src/gold/configure.ac,v
retrieving revision 1.76
diff -u -p -r1.76 configure.ac
--- gold/configure.ac 19 Jul 2012 00:19:34 -0000 1.76
+++ gold/configure.ac 5 Sep 2012 03:20:04 -0000
@@ -304,7 +304,7 @@ dnl tell the unittest framework if we're
dnl targets, so it doesn't try to run the tests that do that.
AM_CONDITIONAL(FN_PTRS_IN_SO_WITHOUT_PIC, [
case $target_cpu in
- i?86) true;;
+ powerpc*) false;;
x86_64) false;;
sparc64) false;;
*) true;;
Index: gold/testsuite/Makefile.am
===================================================================
RCS file: /cvs/src/src/gold/testsuite/Makefile.am,v
retrieving revision 1.196
diff -u -p -r1.196 Makefile.am
--- gold/testsuite/Makefile.am 24 Aug 2012 18:35:34 -0000 1.196
+++ gold/testsuite/Makefile.am 5 Sep 2012 03:20:05 -0000
@@ -228,7 +228,7 @@ final_layout_sequence.txt:
final_layout: final_layout.o final_layout_sequence.txt gcctestdir/ld
$(CXXLINK) -Bgcctestdir/ -Wl,--section-ordering-file,final_layout_sequence.txt final_layout.o
final_layout.stdout: final_layout
- $(TEST_NM) -n final_layout > final_layout.stdout
+ $(TEST_NM) -n --synthetic final_layout > final_layout.stdout
check_PROGRAMS += icf_virtual_function_folding_test
MOSTLYCLEANFILES += icf_virtual_function_folding_test
@@ -1535,7 +1535,7 @@ plugin_final_layout.o: plugin_final_layo
plugin_final_layout: plugin_final_layout.o plugin_section_order.so gcctestdir/ld
$(CXXLINK) -Bgcctestdir/ -Wl,--plugin,"./plugin_section_order.so" plugin_final_layout.o
plugin_final_layout.stdout: plugin_final_layout
- $(TEST_NM) -n plugin_final_layout > plugin_final_layout.stdout
+ $(TEST_NM) -n --synthetic plugin_final_layout > plugin_final_layout.stdout
plugin_final_layout_readelf.stdout: plugin_final_layout
$(TEST_READELF) -Wl plugin_final_layout > plugin_final_layout_readelf.stdout
@@ -1975,7 +1975,7 @@ MOSTLYCLEANFILES += memory_test.stdout m
memory_test.o: memory_test.s
$(COMPILE) -o $@ -c $<
memory_test: memory_test.o gcctestdir/ld $(srcdir)/memory_test.t
- $(LINK) -Bgcctestdir/ -nostartfiles -nostdlib -T $(srcdir)/memory_test.t -o $@ memory_test.o
+ $(LINK) -Bgcctestdir/ -nostartfiles -nostdlib -z max-page-size=0x1000 -z common-page-size=0x1000 -T $(srcdir)/memory_test.t -o $@ memory_test.o
memory_test.stdout: memory_test
$(TEST_READELF) -lWS $< > $@
Index: gold/testsuite/discard_locals_test.sh
===================================================================
RCS file: /cvs/src/src/gold/testsuite/discard_locals_test.sh,v
retrieving revision 1.2
diff -u -p -r1.2 discard_locals_test.sh
--- gold/testsuite/discard_locals_test.sh 3 Mar 2010 19:31:54 -0000 1.2
+++ gold/testsuite/discard_locals_test.sh 5 Sep 2012 03:20:05 -0000
@@ -55,8 +55,10 @@ check_non_discarded()
check_discarded "discard_locals_test.syms" "should_be_discarded"
+# FIXME: gcc doesn't generate a .LC0 sym for powerpc64
check_non_discarded "discard_locals_relocatable_test1.syms" ".LC0"
check_discarded "discard_locals_relocatable_test1.syms" "should_be_discarded"
+# FIXME: gcc doesn't generate a .LC0 sym for powerpc64
check_non_discarded "discard_locals_relocatable_test2.syms" ".LC0"
check_discarded "discard_locals_relocatable_test2.syms" "should_be_discarded"
Index: gold/testsuite/justsyms_exec.c
===================================================================
RCS file: /cvs/src/src/gold/testsuite/justsyms_exec.c,v
retrieving revision 1.1
diff -u -p -r1.1 justsyms_exec.c
--- gold/testsuite/justsyms_exec.c 2 Aug 2011 00:37:41 -0000 1.1
+++ gold/testsuite/justsyms_exec.c 5 Sep 2012 03:20:05 -0000
@@ -47,7 +47,10 @@ check(void *sym, long v, const char *nam
int
main(void)
{
+#ifndef __powerpc64__
+ /* PowerPC64 uses function descriptors. */
check(exported_func, 0x1000200, "exported_func");
+#endif
check(&exported_data, 0x2000000, "exported_data");
return errs;
}
Index: gold/testsuite/pr14265.t
===================================================================
RCS file: /cvs/src/src/gold/testsuite/pr14265.t,v
retrieving revision 1.1
diff -u -p -r1.1 pr14265.t
--- gold/testsuite/pr14265.t 14 Aug 2012 08:31:57 -0000 1.1
+++ gold/testsuite/pr14265.t 5 Sep 2012 03:20:05 -0000
@@ -15,6 +15,8 @@ SECTIONS
KEEP(*(.foo2.*))
__foo2_end = .;
}
+
+ .got : { *(.got .toc) }
}
Index: gold/testsuite/script_test_2.t
===================================================================
RCS file: /cvs/src/src/gold/testsuite/script_test_2.t,v
retrieving revision 1.4
diff -u -p -r1.4 script_test_2.t
--- gold/testsuite/script_test_2.t 31 Oct 2011 22:51:03 -0000 1.4
+++ gold/testsuite/script_test_2.t 5 Sep 2012 03:20:05 -0000
@@ -32,6 +32,7 @@ SECTIONS
. += 0x100000;
. = ALIGN(0x100);
.data : { *(.data) }
+ .got : { *(.got .toc) }
.bss : { *(.bss) }
/* Now the real test. */
Index: gold/testsuite/script_test_3.t
===================================================================
RCS file: /cvs/src/src/gold/testsuite/script_test_3.t,v
retrieving revision 1.5
diff -u -p -r1.5 script_test_3.t
--- gold/testsuite/script_test_3.t 15 Sep 2010 17:39:57 -0000 1.5
+++ gold/testsuite/script_test_3.t 5 Sep 2012 03:20:05 -0000
@@ -35,6 +35,7 @@ SECTIONS
. = ALIGN(0x100);
.dynamic : { *(.dynamic) } :data :dynamic
.data : { *(.data) } :data
+ .got : { *(.got .toc) }
.tdata : { *(.tdata*) } :data :tls
.tbss : { *(.tbss*) } :data :tls
. += 0x100000;
Index: gold/testsuite/script_test_4.t
===================================================================
RCS file: /cvs/src/src/gold/testsuite/script_test_4.t,v
retrieving revision 1.2
diff -u -p -r1.2 script_test_4.t
--- gold/testsuite/script_test_4.t 15 Sep 2010 17:39:57 -0000 1.2
+++ gold/testsuite/script_test_4.t 5 Sep 2012 03:20:05 -0000
@@ -37,6 +37,7 @@ SECTIONS
. = ALIGN(0x100);
.dynamic : { *(.dynamic) }
.data : { *(.data) }
+ .got : { *(.got .toc) }
. += 0x100000;
. = ALIGN(0x100);
.bss : { *(.bss) }
Index: gold/testsuite/script_test_5.t
===================================================================
RCS file: /cvs/src/src/gold/testsuite/script_test_5.t,v
retrieving revision 1.2
diff -u -p -r1.2 script_test_5.t
--- gold/testsuite/script_test_5.t 15 Sep 2010 17:39:57 -0000 1.2
+++ gold/testsuite/script_test_5.t 5 Sep 2012 03:20:05 -0000
@@ -37,6 +37,7 @@ SECTIONS
. = ALIGN(0x100);
.dynamic : { *(.dynamic) }
.data : { *(.data) }
+ .got : { *(.got .toc) }
. += 0x100000;
. = ALIGN(0x100);
.bss : { *(.bss) }
Index: gold/testsuite/script_test_6.t
===================================================================
RCS file: /cvs/src/src/gold/testsuite/script_test_6.t,v
retrieving revision 1.2
diff -u -p -r1.2 script_test_6.t
--- gold/testsuite/script_test_6.t 15 Sep 2010 17:39:57 -0000 1.2
+++ gold/testsuite/script_test_6.t 5 Sep 2012 03:20:05 -0000
@@ -38,6 +38,7 @@ SECTIONS
. = ALIGN(0x100);
.dynamic : { *(.dynamic) }
.data : { *(.data) }
+ .got : { *(.got .toc) }
. += 0x100000;
. = ALIGN(0x100);
.bss : { *(.bss) }
Index: gold/testsuite/script_test_7.t
===================================================================
RCS file: /cvs/src/src/gold/testsuite/script_test_7.t,v
retrieving revision 1.2
diff -u -p -r1.2 script_test_7.t
--- gold/testsuite/script_test_7.t 15 Sep 2010 17:39:57 -0000 1.2
+++ gold/testsuite/script_test_7.t 5 Sep 2012 03:20:05 -0000
@@ -38,6 +38,7 @@ SECTIONS
. = SEGMENT_START(".data", 0x10200000);
.data : { *(.data) }
+ .got : { *(.got .toc) }
. = SEGMENT_START(".bss", 0x10400000);
.bss : { *(.bss) }
Index: gold/testsuite/script_test_9.t
===================================================================
RCS file: /cvs/src/src/gold/testsuite/script_test_9.t,v
retrieving revision 1.2
diff -u -p -r1.2 script_test_9.t
--- gold/testsuite/script_test_9.t 2 Mar 2011 21:59:36 -0000 1.2
+++ gold/testsuite/script_test_9.t 5 Sep 2012 03:20:05 -0000
@@ -16,6 +16,7 @@ SECTIONS
.data :
{
} :data
+ .got : { *(.got .toc) }
.tdata :
{
*(.tdata*)
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [GOLD] testsuite tweaks for powerpc
2012-09-05 3:46 [GOLD] testsuite tweaks for powerpc Alan Modra
@ 2012-09-05 4:33 ` Ian Lance Taylor
2012-09-06 4:26 ` H.J. Lu
1 sibling, 0 replies; 4+ messages in thread
From: Ian Lance Taylor @ 2012-09-05 4:33 UTC (permalink / raw)
To: binutils
On Tue, Sep 4, 2012 at 8:45 PM, Alan Modra <amodra@gmail.com> wrote:
>
> * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
> * configure: Regenerate.
> * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
> (plugin_final_layout.stdout): Likewise.
> (memory_test): Set page sizes to 0x1000.
> * testsuite/Makefile.in: Regenerate.
> * testsuite/discard_locals_test.sh: Add FIXME comment.
> * testsuite/justsyms_exec.c: Disable function test for powerpc64.
> * testsuite/pr14265.t: Add .got output section statement.
> * testsuite/script_test_2.t: Likewise.
> * testsuite/script_test_3.t: Likewise.
> * testsuite/script_test_4.t: Likewise.
> * testsuite/script_test_5.t: Likewise.
> * testsuite/script_test_6.t: Likewise.
> * testsuite/script_test_7.t: Likewise.
> * testsuite/script_test_9.t: Likewise.
This is OK.
Thanks.
Ian
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [GOLD] testsuite tweaks for powerpc
2012-09-05 3:46 [GOLD] testsuite tweaks for powerpc Alan Modra
2012-09-05 4:33 ` Ian Lance Taylor
@ 2012-09-06 4:26 ` H.J. Lu
2012-09-06 4:40 ` Ian Lance Taylor
1 sibling, 1 reply; 4+ messages in thread
From: H.J. Lu @ 2012-09-06 4:26 UTC (permalink / raw)
To: binutils, Alan Modra
On Tue, Sep 4, 2012 at 8:45 PM, Alan Modra <amodra@gmail.com> wrote:
> Various test tweaks for powerpc.
> - Non-pic shared libs don't work.
> - Adding synthetic syms lets the test see the ordering of code sections
> which is what the tests are checking, rather than the ordering of
> .opd entries.
> - memory_test assumes 4k pages
> - justsyms_exec looks at the address of a function, which on powerpc64
> is the descriptor in .opd, a data section.
> - .toc input sections on powerpc64 need to be part of the .got output
> section.
>
> Tested on x86_64 too. OK?
>
> * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
> * configure: Regenerate.
> * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
> (plugin_final_layout.stdout): Likewise.
> (memory_test): Set page sizes to 0x1000.
> * testsuite/Makefile.in: Regenerate.
> * testsuite/discard_locals_test.sh: Add FIXME comment.
> * testsuite/justsyms_exec.c: Disable function test for powerpc64.
> * testsuite/pr14265.t: Add .got output section statement.
> * testsuite/script_test_2.t: Likewise.
> * testsuite/script_test_3.t: Likewise.
> * testsuite/script_test_4.t: Likewise.
> * testsuite/script_test_5.t: Likewise.
> * testsuite/script_test_6.t: Likewise.
> * testsuite/script_test_7.t: Likewise.
> * testsuite/script_test_9.t: Likewise.
>
> Index: gold/testsuite/script_test_3.t
> ===================================================================
> RCS file: /cvs/src/src/gold/testsuite/script_test_3.t,v
> retrieving revision 1.5
> diff -u -p -r1.5 script_test_3.t
> --- gold/testsuite/script_test_3.t 15 Sep 2010 17:39:57 -0000 1.5
> +++ gold/testsuite/script_test_3.t 5 Sep 2012 03:20:05 -0000
> @@ -35,6 +35,7 @@ SECTIONS
> . = ALIGN(0x100);
> .dynamic : { *(.dynamic) } :data :dynamic
> .data : { *(.data) } :data
> + .got : { *(.got .toc) }
> .tdata : { *(.tdata*) } :data :tls
> .tbss : { *(.tbss*) } :data :tls
> . += 0x100000;
> Index: gold/testsuite/script_test_4.t
> ===================================================================
> RCS file: /cvs/src/src/gold/testsuite/script_test_4.t,v
> retrieving revision 1.2
> diff -u -p -r1.2 script_test_4.t
> --- gold/testsuite/script_test_4.t 15 Sep 2010 17:39:57 -0000 1.2
> +++ gold/testsuite/script_test_4.t 5 Sep 2012 03:20:05 -0000
> @@ -37,6 +37,7 @@ SECTIONS
> . = ALIGN(0x100);
> .dynamic : { *(.dynamic) }
> .data : { *(.data) }
> + .got : { *(.got .toc) }
> . += 0x100000;
> . = ALIGN(0x100);
> .bss : { *(.bss) }
This change generates strange section layout on x86-64:
[28] .got.plt PROGBITS 0000000010101d40 001d40
000060 00 WA 0 0 8
[29] .tdata PROGBITS 0000000010101da0 001da0
00002c 00 WAT 0 0 8
[30] .tbss NOBITS 0000000010101dd0 001dd0
00002c 00 WAT 0 0 8
[31] .got PROGBITS 0000000010101dd0 001dd0
000008 00 WA 0 0 8
The executable runs. But on x32, I got
[28] .got.plt PROGBITS 10101b20 001b20 000060 00 WA 0 0 8
[29] .tdata PROGBITS 10101b80 001b80 000024 00 WAT 0 0 8
[30] .tbss NOBITS 10101ba4 001ba4 000020 00 WAT 0 0 4
[31] .got PROGBITS 10101ba8 001ba8 000008 00 WA 0 0 8
and
[hjl@gnu-6 testsuite]$ ./tls_script_test
Segmentation fault
[hjl@gnu-6 testsuite]$
Total failures on x32 are:
/bin/sh: line 1: 30456 Segmentation fault "$tst" >
script_test_3.log-t 2>&1FAIL: script_test_3
PASS: binary_test
PASS: thin_archive_test_1
/bin/sh: line 1: 30493 Segmentation fault "$tst" >
tls_phdrs_script_test.log-t 2>&1
FAIL: tls_phdrs_script_test
/bin/sh: line 1: 30486 Segmentation fault "$tst" >
tls_script_test.log-t 2>&1
PASS: relro_now_test
FAIL: tls_script_test
I think they work by pure luck on other targets.
This patch fixes those 3 failures on x32. I didn't
change other linker scripts since they don't cause
any failures.
--
H.J.
---
diff --git a/gold/testsuite/script_test_3.t b/gold/testsuite/script_test_3.t
index 9c75194..accd055 100644
--- a/gold/testsuite/script_test_3.t
+++ b/gold/testsuite/script_test_3.t
@@ -36,6 +36,7 @@ SECTIONS
.dynamic : { *(.dynamic) } :data :dynamic
.data : { *(.data) } :data
.got : { *(.got .toc) }
+ .got.plt : { *(.got.plt) }
.tdata : { *(.tdata*) } :data :tls
.tbss : { *(.tbss*) } :data :tls
. += 0x100000;
diff --git a/gold/testsuite/script_test_4.t b/gold/testsuite/script_test_4.t
index f5569c5..3ba5e93 100644
--- a/gold/testsuite/script_test_4.t
+++ b/gold/testsuite/script_test_4.t
@@ -38,6 +38,7 @@ SECTIONS
.dynamic : { *(.dynamic) }
.data : { *(.data) }
.got : { *(.got .toc) }
+ .got.plt : { *(.got.plt) }
. += 0x100000;
. = ALIGN(0x100);
.bss : { *(.bss) }
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [GOLD] testsuite tweaks for powerpc
2012-09-06 4:26 ` H.J. Lu
@ 2012-09-06 4:40 ` Ian Lance Taylor
0 siblings, 0 replies; 4+ messages in thread
From: Ian Lance Taylor @ 2012-09-06 4:40 UTC (permalink / raw)
To: H.J. Lu; +Cc: binutils, Alan Modra
On Wed, Sep 5, 2012 at 9:26 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> I think they work by pure luck on other targets.
> This patch fixes those 3 failures on x32. I didn't
> change other linker scripts since they don't cause
> any failures.
This is OK.
Thanks.
Ian
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-09-06 4:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-05 3:46 [GOLD] testsuite tweaks for powerpc Alan Modra
2012-09-05 4:33 ` Ian Lance Taylor
2012-09-06 4:26 ` H.J. Lu
2012-09-06 4:40 ` Ian Lance Taylor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).