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: [GOLD] testsuite tweaks for powerpc


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) }


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