public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: binutils@sourceware.org, Alan Modra <amodra@gmail.com>
Subject: Re: [GOLD] testsuite tweaks for powerpc
Date: Thu, 06 Sep 2012 04:26:00 -0000	[thread overview]
Message-ID: <CAMe9rOr6aP0cABE1+jbHLmYYqZ-O_s64nBMYhqVrpmQr6Lz7rQ@mail.gmail.com> (raw)
In-Reply-To: <20120905034538.GS3159@bubble.grove.modra.org>

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

  parent reply	other threads:[~2012-09-06  4:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-05  3:46 Alan Modra
2012-09-05  4:33 ` Ian Lance Taylor
2012-09-06  4:26 ` H.J. Lu [this message]
2012-09-06  4:40   ` Ian Lance Taylor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMe9rOr6aP0cABE1+jbHLmYYqZ-O_s64nBMYhqVrpmQr6Lz7rQ@mail.gmail.com \
    --to=hjl.tools@gmail.com \
    --cc=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).