Re: ld/x86: skip p_align-1 tests with unsuitable compiler
authorAlan Modra <amodra@gmail.com>
Wed, 29 Jun 2022 00:40:15 +0000 (10:10 +0930)
committerAlan Modra <amodra@gmail.com>
Wed, 29 Jun 2022 00:45:55 +0000 (10:15 +0930)
commit d0e0f9c87a3e results "ERROR: i586-linux-cc does not exist" if
cross-building an i586-linux target without a target compiler
installed.

* testsuite/ld-elf/linux-x86.exp (compiler_honours_aligned): New.
Use it after first testing check_compiler_available.

ld/testsuite/ld-elf/linux-x86.exp

index ae0ed6ac0d2ec27528767f75c5346ad89c089cce..6035ecd68293bf58573cb2c1eff7476d9601337c 100644 (file)
@@ -188,9 +188,17 @@ run_ld_link_exec_tests [list \
 ]
 
 # 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 {
+proc compiler_honours_aligned { } {
+    global CC_FOR_TARGET READELF srcdir subdir
+    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] } {
+       return 1
+    }
+    return 0
+}
+
+if { [check_compiler_available] && [compiler_honours_aligned] } {
     run_ld_link_exec_tests [list \
        [list \
            "Run p_align-1a without PIE" \