public inbox for binutils-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] ld/x86: skip p_align-1 tests with unsuitable compiler
@ 2022-06-28  6:56 Jan Beulich
  0 siblings, 0 replies; only message in thread
From: Jan Beulich @ 2022-06-28  6:56 UTC (permalink / raw)
  To: bfd-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d0e0f9c87a3eb141f2036c3ca1569ce7ba2d9ff3

commit d0e0f9c87a3eb141f2036c3ca1569ce7ba2d9ff3
Author: Jan Beulich <jbeulich@suse.com>
Date:   Tue Jun 28 08:56:06 2022 +0200

    ld/x86: skip p_align-1 tests with unsuitable compiler
    
    When the compiler doesn't properly arrange for foo's alignment, there's
    no point even trying these tests. Report the situation as a single
    "unsupported" test.

Diff:
---
 ld/testsuite/ld-elf/linux-x86.exp | 82 ++++++++++++++++++++++-----------------
 1 file changed, 46 insertions(+), 36 deletions(-)

diff --git a/ld/testsuite/ld-elf/linux-x86.exp b/ld/testsuite/ld-elf/linux-x86.exp
index e3f20189e4c..ae0ed6ac0d2 100644
--- a/ld/testsuite/ld-elf/linux-x86.exp
+++ b/ld/testsuite/ld-elf/linux-x86.exp
@@ -185,44 +185,54 @@ run_ld_link_exec_tests [list \
 	"" \
 	"tmpdir/indirect-extern-access-2.so" \
     ] \
-    [list \
-	"Run p_align-1a without PIE" \
-	"$NOPIE_LDFLAGS" \
-	"" \
-	{ p_align-1.c } \
-	"p_align-1a" \
-	"pass.out" \
-	"$NOPIE_CFLAGS" \
-    ] \
-    [list \
-	"Run p_align-1b with PIE" \
-	"-pie" \
-	"" \
-	{ p_align-1.c } \
-	"p_align-1b" \
-	"pass.out" \
-	"-fpie" \
-    ] \
-    [list \
-	"Run p_align-1c with -Wl,-z,max-page-size=0x1000 without PIE" \
-	"$NOPIE_LDFLAGS -Wl,-z,max-page-size=0x1000" \
-	"" \
-	{ p_align-1.c } \
-	"p_align-1c" \
-	"pass.out" \
-	"$NOPIE_CFLAGS" \
-    ] \
-    [list \
-	"Run p_align-1d with -Wl,-z,max-page-size=0x1000 with PIE" \
-	"-pie -Wl,-z,max-page-size=0x1000" \
-	"" \
-	{ p_align-1.c } \
-	"p_align-1d" \
-	"pass.out" \
-	"-fpie" \
-    ] \
 ]
 
+# Old gcc silently ignores __attribute__ ((aligned())) with too big alignment.
+ld_compile $CC_FOR_TARGET $srcdir/$subdir/p_align-1.c tmpdir/p_align-1.o
+set output [run_host_cmd "$READELF" "-SW tmpdir/p_align-1.o"]
+if { [regexp { [.]data *PROGBITS .* 8388608[\n]} $output] } then {
+    run_ld_link_exec_tests [list \
+	[list \
+	    "Run p_align-1a without PIE" \
+	    "$NOPIE_LDFLAGS" \
+	    "" \
+	    { p_align-1.c } \
+	    "p_align-1a" \
+	    "pass.out" \
+	    "$NOPIE_CFLAGS" \
+	] \
+	[list \
+	    "Run p_align-1b with PIE" \
+	    "-pie" \
+	    "" \
+	    { p_align-1.c } \
+	    "p_align-1b" \
+	    "pass.out" \
+	    "-fpie" \
+	] \
+	[list \
+	    "Run p_align-1c with -Wl,-z,max-page-size=0x1000 without PIE" \
+	    "$NOPIE_LDFLAGS -Wl,-z,max-page-size=0x1000" \
+	    "" \
+	    { p_align-1.c } \
+	    "p_align-1c" \
+	    "pass.out" \
+	    "$NOPIE_CFLAGS" \
+	] \
+	[list \
+	    "Run p_align-1d with -Wl,-z,max-page-size=0x1000 with PIE" \
+	    "-pie -Wl,-z,max-page-size=0x1000" \
+	    "" \
+	    { p_align-1.c } \
+	    "p_align-1d" \
+	    "pass.out" \
+	    "-fpie" \
+	] \
+    ]
+} else {
+    unsupported "p_align-1"
+}
+
 proc elfedit_test { options test output } {
     global ELFEDIT
     global READELF


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-28  6:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-28  6:56 [binutils-gdb] ld/x86: skip p_align-1 tests with unsuitable compiler Jan Beulich

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