X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=ld%2Ftestsuite%2Fld-elf%2Flinux-x86.exp;h=2e0cbd37f1764ebc0e7d2ae308150b1d051972f3;hb=74e315dbfe5200c473b226e937935fb8ce391489;hp=a16da10505bdc884471debdea8c6208b73d25d05;hpb=250d07de5cf6efc81ed934c25292beb63c7e3129;p=binutils-gdb.git diff --git a/ld/testsuite/ld-elf/linux-x86.exp b/ld/testsuite/ld-elf/linux-x86.exp index a16da10505b..2e0cbd37f17 100644 --- a/ld/testsuite/ld-elf/linux-x86.exp +++ b/ld/testsuite/ld-elf/linux-x86.exp @@ -1,5 +1,5 @@ # Expect script for simple native Linux/x86 tests. -# Copyright (C) 2018-2021 Free Software Foundation, Inc. +# Copyright (C) 2018-2022 Free Software Foundation, Inc. # # This file is part of the GNU Binutils. # @@ -73,6 +73,156 @@ run_ld_link_tests [list \ ] \ ] +run_cc_link_tests [list \ + [list \ + "Build indirect-extern-access-1.so" \ + "-shared" \ + "-fPIC" \ + { indirect-extern-access-1a.c } \ + {} \ + "indirect-extern-access-1.so" \ + ] \ + [list \ + "Build indirect-extern-access-1a without PIE" \ + "$NOPIE_LDFLAGS -Wl,--no-as-needed \ + tmpdir/indirect-extern-access-1.so" \ + "$NOPIE_CFLAGS" \ + { indirect-extern-access.S indirect-extern-access-1b.c } \ + {{readelf -rn indirect-extern-access-1.rd}} \ + "indirect-extern-access-1a" \ + ] \ + [list \ + "Build indirect-extern-access-2.so" \ + "-shared" \ + "-fPIC" \ + { indirect-extern-access-2a.c } \ + {} \ + "indirect-extern-access-2.so" \ + ] \ + [list \ + "Build indirect-extern-access-2a without PIE" \ + "$NOPIE_LDFLAGS -Wl,--no-as-needed \ + tmpdir/indirect-extern-access-2.so" \ + "$NOPIE_CFLAGS" \ + { indirect-extern-access.S indirect-extern-access-1b.c } \ + {{readelf -rn indirect-extern-access-2.rd}} \ + "indirect-extern-access-2a" \ + ] \ + [list \ + "Build indirect-extern-access-2b with PIE" \ + "-pie -Wl,--no-as-needed \ + tmpdir/indirect-extern-access-2.so" \ + "-fpie" \ + { indirect-extern-access.S indirect-extern-access-2b.c } \ + {{readelf -rn indirect-extern-access-3.rd}} \ + "indirect-extern-access-2b" \ + ] \ + [list \ + "Build pr28158.so" \ + "-shared -Wl,-version-script,pr27128.t" \ + "-fPIC" \ + { pr28158-1.c } \ + {} \ + "pr28158.so" \ + ] \ + [list \ + "Build pr28158" \ + "$NOPIE_LDFLAGS -Wl,--no-as-needed \ + tmpdir/pr28158.so" \ + "" \ + { pr28158-2.S } \ + {{readelf {--dyn-syms -W} pr28158.rd} {nm -D pr28158.nd}} \ + "pr28158" \ + ] \ +] + +run_ld_link_exec_tests [list \ + [list \ + "Run indirect-extern-access-1a without PIE" \ + "$NOPIE_LDFLAGS" \ + "" \ + { indirect-extern-access.S indirect-extern-access-1b.c } \ + "indirect-extern-access-1a" \ + "pass.out" \ + "$NOPIE_CFLAGS" \ + "" \ + "" \ + "tmpdir/indirect-extern-access-1.so" \ + ] \ + [list \ + "Run indirect-extern-access-1b with PIE" \ + "-pie" \ + "" \ + { indirect-extern-access.S indirect-extern-access-1b.c } \ + "indirect-extern-access-1b" \ + "pass.out" \ + "-fpie" \ + "" \ + "" \ + "tmpdir/indirect-extern-access-1.so" \ + ] \ + [list \ + "Run indirect-extern-access-2a without PIE" \ + "$NOPIE_LDFLAGS" \ + "" \ + { indirect-extern-access.S indirect-extern-access-2b.c } \ + "indirect-extern-access-2a" \ + "pass.out" \ + "$NOPIE_CFLAGS" \ + "" \ + "" \ + "tmpdir/indirect-extern-access-2.so" \ + ] \ + [list \ + "Run indirect-extern-access-2b with PIE" \ + "-pie" \ + "" \ + { indirect-extern-access.S indirect-extern-access-2b.c } \ + "indirect-extern-access-2b" \ + "pass.out" \ + "-fpie" \ + "" \ + "" \ + "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" \ + ] \ +] + proc elfedit_test { options test output } { global ELFEDIT global READELF @@ -84,13 +234,13 @@ proc elfedit_test { options test output } { set got [remote_exec host "$ELFEDIT $options tmpdir/$test" "" "/dev/null"] if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then { send_log "$got\n" - unresolved "$test_name" + fail "$test_name" } send_log "$READELF -n $options tmpdir/$test > tmpdir/$output.out\n" set got [remote_exec host "$READELF -n tmpdir/$test" "" "/dev/null" "tmpdir/$output.out"] if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then { send_log "$got\n" - unresolved "$test_name" + fail "$test_name" } if { [regexp_diff tmpdir/$output.out $srcdir/$subdir/$output.rd] } then { fail "$test_name"