From 96a73f2cb2a1b4c47e49ff194a94f7394308956b Mon Sep 17 00:00:00 2001 From: YunQiang Su Date: Fri, 30 Jun 2023 13:14:51 +0800 Subject: [PATCH] ld: Use [list ] syntax to define run_tests in indirect.exp Currently, the var run_tests is defined by syntax {{}}, while in this case, variables cannot be used. Thus $NOPIE_CFLAGS and $NOPIE_LDFLAGS are passed to cmd as names instead of values: gcc ... $NOPIE_CFLAGS -c .../indirect5a.c -o tmpdir/indirect5a.o Let's use [list [list ]] syntax instead. ld/ChangeLog: * testsuite/ld-elf/indirect.exp(run_tests): use [list [list]] syntax instead of {{}}. --- ld/testsuite/ld-elf/indirect.exp | 124 +++++++++++++++---------------- 1 file changed, 62 insertions(+), 62 deletions(-) diff --git a/ld/testsuite/ld-elf/indirect.exp b/ld/testsuite/ld-elf/indirect.exp index ce4771371dd..eda48d30949 100644 --- a/ld/testsuite/ld-elf/indirect.exp +++ b/ld/testsuite/ld-elf/indirect.exp @@ -135,68 +135,68 @@ set testname "Indirect symbol 2" set cmd "$ld -shared -o tmpdir/indirect2.so tmpdir/indirect2.o" check_link_message "$cmd" [list $string2] "$testname" -set run_tests { - {"Run with libindirect3c.so 1" - "-Wl,--no-as-needed tmpdir/indirect3a.o tmpdir/indirect3b.o tmpdir/libindirect3c.so" "" - {dummy.c} "indirect3a" "indirect3.out"} - {"Run with libindirect3c.so 2" - "-Wl,--no-as-needed tmpdir/indirect3a.o tmpdir/libindirect3c.so tmpdir/indirect3b.o" "" - {dummy.c} "indirect3b" "indirect3.out"} - {"Run with libindirect3c.so 3" - "-Wl,--no-as-needed tmpdir/indirect3b.o tmpdir/libindirect3c.so tmpdir/indirect3a.o" "" - {dummy.c} "indirect3c" "indirect3.out"} - {"Run with libindirect3c.so 4" - "-Wl,--no-as-needed tmpdir/libindirect3c.so tmpdir/indirect3b.o tmpdir/indirect3a.o" "" - {dummy.c} "indirect3d" "indirect3.out"} - {"Run with libindirect4c.so 1" - "-Wl,--no-as-needed tmpdir/indirect4a.o tmpdir/indirect4b.o tmpdir/libindirect4c.so" "" - {dummy.c} "indirect4a" "indirect4.out"} - {"Run with libindirect4c.so 2" - "-Wl,--no-as-needed tmpdir/indirect4a.o tmpdir/libindirect4c.so tmpdir/indirect4b.o" "" - {dummy.c} "indirect4b" "indirect4.out"} - {"Run with libindirect4c.so 3" - "-Wl,--no-as-needed tmpdir/indirect4b.o tmpdir/libindirect4c.so tmpdir/indirect4a.o" "" - {dummy.c} "indirect4c" "indirect4.out"} - {"Run with libindirect4c.so 4" - "-Wl,--no-as-needed tmpdir/libindirect4c.so tmpdir/indirect4b.o tmpdir/indirect4a.o" "" - {dummy.c} "indirect4d" "indirect4.out"} - {"Run indirect5 1" - "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/libindirect5.so" "" - {indirect5a.c} "indirect5a" "indirect5.out" "$NOPIE_CFLAGS"} - {"Run indirect5 2" - "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/indirect5a.o tmpdir/libindirect5.so" "" - {dummy.c} "indirect5b" "indirect5.out" "$NOPIE_CFLAGS"} - {"Run indirect6 1" - "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/libindirect5.so" "" - {indirect6a.c} "indirect6a" "indirect5.out" "$NOPIE_CFLAGS"} - {"Run indirect6 2" - "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/indirect6a.o tmpdir/libindirect5.so" "" - {dummy.c} "indirect6b" "indirect5.out" "$NOPIE_CFLAGS"} - {"Run with libpr18720c.so 1" - "-Wl,--no-as-needed tmpdir/pr18720a.o tmpdir/pr18720b.o tmpdir/libpr18720c.so" "" - {check-ptr-eq.c} "pr18720a" "pr18720.out"} - {"Run with libpr18720c.so 2" - "-Wl,--no-as-needed tmpdir/pr18720a.o tmpdir/libpr18720c.so tmpdir/pr18720b.o" "" - {check-ptr-eq.c} "pr18720b" "pr18720.out"} - {"Run with libpr18720c.so 3" - "-Wl,--no-as-needed tmpdir/pr18720b.o tmpdir/libpr18720c.so tmpdir/pr18720a.o" "" - {check-ptr-eq.c} "pr18720c" "pr18720.out"} - {"Run with libpr18720c.so 4" - "-Wl,--no-as-needed tmpdir/libpr18720c.so tmpdir/pr18720b.o tmpdir/pr18720a.o" "" - {check-ptr-eq.c} "pr18720d" "pr18720.out"} - {"Run with libpr18720c.so 5" - "-Wl,--no-as-needed tmpdir/libpr18720c.so tmpdir/pr18720b1.o tmpdir/pr18720a.o" "" - {check-ptr-eq.c} "pr18720d" "pr18720.out"} - {"Run with libpr19553b.so" - "-Wl,--no-as-needed tmpdir/libpr19553b.so tmpdir/libpr19553d.so -Wl,-rpath-link,." "" - {pr19553a.c} "pr19553b" "pr19553b.out"} - {"Run with libpr19553c.so" - "-Wl,--no-as-needed tmpdir/libpr19553c.so tmpdir/libpr19553b.so tmpdir/libpr19553d.so" "" - {pr19553a.c} "pr19553c" "pr19553c.out"} - {"Run with libpr19553d.so" - "-Wl,--no-as-needed tmpdir/libpr19553d.so tmpdir/libpr19553b.so -Wl,-rpath-link,." "" - {pr19553a.c} "pr19553d" "pr19553d.out"} -} +set run_tests [list \ + [list "Run with libindirect3c.so 1" \ + "-Wl,--no-as-needed tmpdir/indirect3a.o tmpdir/indirect3b.o tmpdir/libindirect3c.so" "" \ + {dummy.c} "indirect3a" "indirect3.out"] \ + [list "Run with libindirect3c.so 2" \ + "-Wl,--no-as-needed tmpdir/indirect3a.o tmpdir/libindirect3c.so tmpdir/indirect3b.o" "" \ + {dummy.c} "indirect3b" "indirect3.out"] \ + [list "Run with libindirect3c.so 3" \ + "-Wl,--no-as-needed tmpdir/indirect3b.o tmpdir/libindirect3c.so tmpdir/indirect3a.o" "" \ + {dummy.c} "indirect3c" "indirect3.out"] \ + [list "Run with libindirect3c.so 4" \ + "-Wl,--no-as-needed tmpdir/libindirect3c.so tmpdir/indirect3b.o tmpdir/indirect3a.o" "" \ + {dummy.c} "indirect3d" "indirect3.out"] \ + [list "Run with libindirect4c.so 1" \ + "-Wl,--no-as-needed tmpdir/indirect4a.o tmpdir/indirect4b.o tmpdir/libindirect4c.so" "" \ + {dummy.c} "indirect4a" "indirect4.out"] \ + [list "Run with libindirect4c.so 2" \ + "-Wl,--no-as-needed tmpdir/indirect4a.o tmpdir/libindirect4c.so tmpdir/indirect4b.o" "" \ + {dummy.c} "indirect4b" "indirect4.out"] \ + [list "Run with libindirect4c.so 3" \ + "-Wl,--no-as-needed tmpdir/indirect4b.o tmpdir/libindirect4c.so tmpdir/indirect4a.o" "" \ + {dummy.c} "indirect4c" "indirect4.out"] \ + [list "Run with libindirect4c.so 4" \ + "-Wl,--no-as-needed tmpdir/libindirect4c.so tmpdir/indirect4b.o tmpdir/indirect4a.o" "" \ + {dummy.c} "indirect4d" "indirect4.out"] \ + [list "Run indirect5 1" \ + "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/libindirect5.so" "" \ + {indirect5a.c} "indirect5a" "indirect5.out" "$NOPIE_CFLAGS"] \ + [list "Run indirect5 2" \ + "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/indirect5a.o tmpdir/libindirect5.so" "" \ + {dummy.c} "indirect5b" "indirect5.out" "$NOPIE_CFLAGS"] \ + [list "Run indirect6 1" \ + "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/libindirect5.so" "" \ + {indirect6a.c} "indirect6a" "indirect5.out" "$NOPIE_CFLAGS"] \ + [list "Run indirect6 2" \ + "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/indirect6a.o tmpdir/libindirect5.so" "" \ + {dummy.c} "indirect6b" "indirect5.out" "$NOPIE_CFLAGS"] \ + [list "Run with libpr18720c.so 1" \ + "-Wl,--no-as-needed tmpdir/pr18720a.o tmpdir/pr18720b.o tmpdir/libpr18720c.so" "" \ + {check-ptr-eq.c} "pr18720a" "pr18720.out"] \ + [list "Run with libpr18720c.so 2" \ + "-Wl,--no-as-needed tmpdir/pr18720a.o tmpdir/libpr18720c.so tmpdir/pr18720b.o" "" \ + {check-ptr-eq.c} "pr18720b" "pr18720.out"] \ + [list "Run with libpr18720c.so 3" \ + "-Wl,--no-as-needed tmpdir/pr18720b.o tmpdir/libpr18720c.so tmpdir/pr18720a.o" "" \ + {check-ptr-eq.c} "pr18720c" "pr18720.out"] \ + [list "Run with libpr18720c.so 4" \ + "-Wl,--no-as-needed tmpdir/libpr18720c.so tmpdir/pr18720b.o tmpdir/pr18720a.o" "" \ + {check-ptr-eq.c} "pr18720d" "pr18720.out"] \ + [list "Run with libpr18720c.so 5" \ + "-Wl,--no-as-needed tmpdir/libpr18720c.so tmpdir/pr18720b1.o tmpdir/pr18720a.o" "" \ + {check-ptr-eq.c} "pr18720d" "pr18720.out"] \ + [list "Run with libpr19553b.so" \ + "-Wl,--no-as-needed tmpdir/libpr19553b.so tmpdir/libpr19553d.so -Wl,-rpath-link,." "" \ + {pr19553a.c} "pr19553b" "pr19553b.out"] \ + [list "Run with libpr19553c.so" \ + "-Wl,--no-as-needed tmpdir/libpr19553c.so tmpdir/libpr19553b.so tmpdir/libpr19553d.so" "" \ + {pr19553a.c} "pr19553c" "pr19553c.out"] \ + [list "Run with libpr19553d.so" \ + "-Wl,--no-as-needed tmpdir/libpr19553d.so tmpdir/libpr19553b.so -Wl,-rpath-link,." "" \ + {pr19553a.c} "pr19553d" "pr19553d.out"] \ +] run_ld_link_exec_tests $run_tests -- 2.30.2