diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2017-04-28 12:29:29 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2017-04-28 12:35:18 -0700 |
commit | d6f48aed23d1004a4ed8ab3b2742b0bf7c838c1c (patch) | |
tree | 32c17eb64d15eb5dd02d96ae5610ebb49f1dc90e /ld | |
parent | 428544e8ae6252a615a3100889f3df7d2c5483c4 (diff) | |
download | gdb-d6f48aed23d1004a4ed8ab3b2742b0bf7c838c1c.zip gdb-d6f48aed23d1004a4ed8ab3b2742b0bf7c838c1c.tar.gz gdb-d6f48aed23d1004a4ed8ab3b2742b0bf7c838c1c.tar.bz2 |
ELF: Add run-time tests for -z now
* testsuite/ld-elf/shared.exp: Add run-time tests for -z now.
* testsuite/ld-i386/tls.exp: Likewise.
* testsuite/ld-ifunc/ifunc.exp: Likewise.
* testsuite/ld-x86-64/tls.exp: Likewise.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/ChangeLog | 7 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/shared.exp | 86 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/tls.exp | 53 | ||||
-rw-r--r-- | ld/testsuite/ld-ifunc/ifunc.exp | 99 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/tls.exp | 53 |
5 files changed, 298 insertions, 0 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index 008e8c9..be412ed 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,10 @@ +2017-04-28 H.J. Lu <hongjiu.lu@intel.com> + + * testsuite/ld-elf/shared.exp: Add run-time tests for -z now. + * testsuite/ld-i386/tls.exp: Likewise. + * testsuite/ld-ifunc/ifunc.exp: Likewise. + * testsuite/ld-x86-64/tls.exp: Likewise. + 2017-04-27 H.J. Lu <hongjiu.lu@intel.com> * testsuite/ld-x86-64/pr21038a.d: Update DW_CFA_nop paddings diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp index 0fd41ff..070b51a 100644 --- a/ld/testsuite/ld-elf/shared.exp +++ b/ld/testsuite/ld-elf/shared.exp @@ -375,6 +375,9 @@ set build_tests { {"Build libpr2404a.so" "-shared" "-fPIC" {pr2404a.c} {} "libpr2404a.so"} + {"Build libpr2404n.so" + "-shared -Wl,-z,now" "-fPIC" + {pr2404a.c} {} "libpr2404n.so"} {"Build libpr2404b.a" "" "" {pr2404b.c} {} "libpr2404b.a"} @@ -528,6 +531,9 @@ set run_tests [list \ [list "Run pr2404" \ "-Wl,--no-as-needed tmpdir/pr2404b.o tmpdir/libpr2404a.so" "" \ {dummy.c} "pr2404" "pr2404.out" ] \ + [list "Run pr2404n" \ + "-Wl,-z,now -Wl,--no-as-needed tmpdir/pr2404b.o tmpdir/libpr2404n.so" "" \ + {dummy.c} "pr2404n" "pr2404.out" ] \ [list "Run pr18458" \ "-Wl,--no-as-needed,-z,now tmpdir/libpr18458a.so tmpdir/libpr18458b.so" "" \ {pr18458c.c} "pr18458" "pass.out" ] \ @@ -688,9 +694,26 @@ if { [istarget *-*-linux*] {} \ "libpr19579.so" \ ] \ + [list \ + "Build libpr19579now.so" \ + "-shared -Wl,-z,now" \ + "-fPIC" \ + {pr19579b.c} \ + {} \ + "libpr19579.so" \ + ] \ ] run_ld_link_exec_tests [list \ [list \ + "Run pr18458 with PIE" \ + "-pie -Wl,--no-as-needed,-z,now tmpdir/libpr18458a.so tmpdir/libpr18458b.so" \ + "" \ + {pr18458c.c} \ + "pr18458p" \ + "pass.out" \ + "-fPIE" \ + ] \ + [list \ "Run pr2404 with PIE" \ "-pie -Wl,--no-as-needed tmpdir/pr2404b.o tmpdir/libpr2404a.so" \ "" \ @@ -700,6 +723,15 @@ if { [istarget *-*-linux*] "-fPIE" \ ] \ [list \ + "Run pr2404 with PIE (-z now)" \ + "-pie -Wl,-z,now -Wl,--no-as-needed tmpdir/pr2404b.o tmpdir/libpr2404n.so" \ + "" \ + { dummy.c } \ + "pr2404pien" \ + "pr2404.out" \ + "-fPIE" \ + ] \ + [list \ "Run pr18718" \ "" \ "" \ @@ -709,6 +741,15 @@ if { [istarget *-*-linux*] "-O2 -I../bfd" \ ] \ [list \ + "Run pr18718 (-z now)" \ + "-Wl,-z,now" \ + "" \ + { pr18718.c check-ptr-eq.c } \ + "pr18718" \ + "pass.out" \ + "-O2 -I../bfd" \ + ] \ + [list \ "Run pr18718 with PIE (1)" \ "-pie" \ "" \ @@ -727,6 +768,24 @@ if { [istarget *-*-linux*] "-O2 -fPIE -I../bfd" \ ] \ [list \ + "Run pr18718 with PIE (3)" \ + "-pie -Wl,-z,now" \ + "" \ + { pr18718.c check-ptr-eq.c } \ + "pr18718pie3" \ + "pass.out" \ + "-O2 -fPIE -I../bfd" \ + ] \ + [list \ + "Run pr18718 with PIE (4)" \ + "-Wl,-z,now" \ + "" \ + { pr18718.c check-ptr-eq.c } \ + "pr18718pie4" \ + "pass.out" \ + "-O2 -fPIE -I../bfd" \ + ] \ + [list \ "Run pr18718 with PIC (1)" \ "" \ "" \ @@ -745,6 +804,24 @@ if { [istarget *-*-linux*] "-O2 -fPIC -I../bfd" \ ] \ [list \ + "Run pr18718 with PIC (3)" \ + "-Wl,-z,now" \ + "" \ + { pr18718.c check-ptr-eq.c } \ + "pr18718pic3" \ + "pass.out" \ + "-O2 -fPIC -I../bfd" \ + ] \ + [list \ + "Run pr18718 with PIC (4)" \ + "-pie -Wl,-z,now" \ + "" \ + { pr18718.c check-ptr-eq.c } \ + "pr18718pic4" \ + "pass.out" \ + "-O2 -fPIC -I../bfd" \ + ] \ + [list \ "Run pr19579" \ "-pie -Wl,--no-as-needed,-z,text tmpdir/pr19579a.o tmpdir/libpr19579.so" \ "" \ @@ -753,6 +830,15 @@ if { [istarget *-*-linux*] "pass.out" \ "-fPIE" \ ] \ + [list \ + "Run pr19579 (-z now)" \ + "-pie -Wl,-z,now -Wl,--no-as-needed,-z,text tmpdir/pr19579a.o tmpdir/libpr19579.so" \ + "" \ + {dummy.c} \ + "pr19579n" \ + "pass.out" \ + "-fPIE" \ + ] \ ] } diff --git a/ld/testsuite/ld-i386/tls.exp b/ld/testsuite/ld-i386/tls.exp index 1653104..4430821 100644 --- a/ld/testsuite/ld-i386/tls.exp +++ b/ld/testsuite/ld-i386/tls.exp @@ -65,6 +65,14 @@ run_cc_link_tests [list \ {} \ "libtls-1b.so" \ ] \ + [list \ + "Build libtls-1bn.so" \ + "-Wl,-z,now -shared tmpdir/tls-gd1.o tmpdir/tls-ld1.o" \ + "" \ + {dummy.s} \ + {} \ + "libtls-1bn.so" \ + ] \ ] run_ld_link_exec_tests [list \ @@ -78,6 +86,15 @@ run_ld_link_exec_tests [list \ "pass.out" \ ] \ [list \ + "TLS GD/LD -> LE transition without PLT (dynamic, -z now)" \ + "-Wl,-z,now tmpdir/tls-def1.o tmpdir/tls-main1.o tmpdir/tls-gd1.o \ + tmpdir/tls-ld1.o" \ + "" \ + { dummy.s } \ + "tls-1an" \ + "pass.out" \ + ] \ + [list \ "TLS GD/LD -> LE transition without PLT (PIE)" \ "-pie tmpdir/tls-def1.o tmpdir/tls-main1.o tmpdir/tls-gd1.o \ tmpdir/tls-ld1.o" \ @@ -87,6 +104,15 @@ run_ld_link_exec_tests [list \ "pass.out" \ ] \ [list \ + "TLS GD/LD -> LE transition without PLT (PIE, -z now)" \ + "-pie -Wl,-z,now tmpdir/tls-def1.o tmpdir/tls-main1.o tmpdir/tls-gd1.o \ + tmpdir/tls-ld1.o" \ + "" \ + { dummy.s } \ + "tls-1bn" \ + "pass.out" \ + ] \ + [list \ "TLS GD/LD -> LE transition without PLT (static)" \ "-static tmpdir/tls-def1.o tmpdir/tls-main1.o tmpdir/tls-gd1.o \ tmpdir/tls-ld1.o" \ @@ -105,6 +131,15 @@ run_ld_link_exec_tests [list \ "pass.out" \ ] \ [list \ + "TLS GD/LD -> IE transition without PLT (-z now)" \ + "-Wl,-z,now tmpdir/tls-main1.o tmpdir/tls-gd1.o tmpdir/tls-ld1.o \ + tmpdir/libtls-1a.so -Wl,-R,tmpdir" \ + "" \ + { dummy.s } \ + "tls-1dn" \ + "pass.out" \ + ] \ + [list \ "TLS without PLT (1)" \ "tmpdir/tls-main1.o \ tmpdir/libtls-1a.so tmpdir/libtls-1b.so -Wl,-R,tmpdir" \ @@ -122,4 +157,22 @@ run_ld_link_exec_tests [list \ "tls-1f" \ "pass.out" \ ] \ + [list \ + "TLS without PLT (3)" \ + "-Wl,-z,now tmpdir/tls-main1.o \ + tmpdir/libtls-1a.so tmpdir/libtls-1bn.so -Wl,-R,tmpdir" \ + "" \ + { dummy.s } \ + "tls-1en" \ + "pass.out" \ + ] \ + [list \ + "TLS without PLT (4)" \ + "-Wl,-z,now tmpdir/tls-main1.o tmpdir/tls-def1.o \ + tmpdir/libtls-1bn.so -Wl,-R,tmpdir" \ + "" \ + { dummy.s } \ + "tls-1fn" \ + "pass.out" \ + ] \ ] diff --git a/ld/testsuite/ld-ifunc/ifunc.exp b/ld/testsuite/ld-ifunc/ifunc.exp index 13d50a5..9445f9f 100644 --- a/ld/testsuite/ld-ifunc/ifunc.exp +++ b/ld/testsuite/ld-ifunc/ifunc.exp @@ -379,6 +379,23 @@ run_cc_link_tests [list \ {} \ "libpr16467c.a" \ ] \ + [list \ + "Build libpr16467an.so" \ + "-shared -Wl,-z,now -Wl,--version-script=pr16467a.map" \ + "-fPIC" \ + { pr16467a.c } \ + {} \ + "libpr16467an.so" \ + ] \ + [list \ + "Build libpr16467bn.so" \ + "-shared tmpdir/pr16467b.o tmpdir/libpr16467an.so \ + -Wl,--version-script=pr16467b.map" \ + "-fPIC" \ + { dummy.c } \ + {} \ + "libpr16467bn.so" \ + ] \ ] run_ld_link_exec_tests [list \ @@ -423,6 +440,14 @@ run_cc_link_tests [list \ {} \ "libifunc-lib.so" \ ] \ + [list \ + "Build ifunc-libn.so" \ + "-shared -Wl,-z,now" \ + "-fPIC" \ + { ifunc-lib.c } \ + {} \ + "libifunc-libn.so" \ + ] \ ] run_ld_link_exec_tests [list \ @@ -436,6 +461,15 @@ run_ld_link_exec_tests [list \ "" \ ] \ [list \ + "Run pr16467 (-z now)" \ + "-Wl,-z,now -Wl,--no-as-needed tmpdir/pr16467c.o tmpdir/libpr16467bn.so tmpdir/libpr16467an.so" \ + "" \ + { dummy.c } \ + "pr16467n" \ + "pr16467.out" \ + "" \ + ] \ + [list \ "Run ifunc-main" \ "-Wl,--no-as-needed tmpdir/libifunc-lib.so" \ "" \ @@ -452,6 +486,23 @@ run_ld_link_exec_tests [list \ "ifunc-main.out" \ "-fpic" \ ] \ + [list \ + "Run ifunc-main (-z now)" \ + "-Wl,-z,now -Wl,--no-as-needed tmpdir/libifunc-libn.so" \ + "" \ + { ifunc-main.c } \ + "ifunc-mainn" \ + "ifunc-main.out" \ + ] \ + [list \ + "Run ifunc-main with PIE (-z now)" \ + "-pie -Wl,-z,now -Wl,--no-as-needed tmpdir/libifunc-libn.so" \ + "" \ + { ifunc-main.c } \ + "ifunc-mainpn" \ + "ifunc-main.out" \ + "-fpie" \ + ] \ ] # Run-time tests which require working ifunc attribute support. @@ -477,6 +528,14 @@ run_cc_link_tests [list \ "libpr18808.so" \ ] \ [list \ + "Build libpr18808n.so" \ + "-shared -Wl,-z,now" \ + "-fPIC -O2 -g" \ + { pr18808b.c } \ + {} \ + "libpr18808n.so" \ + ] \ + [list \ "Build pr18841a.o" \ "" \ "" \ @@ -500,6 +559,22 @@ run_cc_link_tests [list \ {} \ "libpr18841c.so" \ ] \ + [list \ + "Build libpr18841bn.so" \ + "-Wl,-z,now -shared" \ + "-fPIC -O0 -g" \ + { pr18841b.c } \ + {} \ + "libpr18841bn.so" \ + ] \ + [list \ + "Build libpr18841cn.so" \ + "-shared" \ + "-Wl,-z,now -fPIC -O0 -g" \ + { pr18841c.c } \ + {} \ + "libpr18841cn.so" \ + ] \ ] run_ld_link_exec_tests [list \ @@ -512,6 +587,14 @@ run_ld_link_exec_tests [list \ "pr18808.out" \ ] \ [list \ + "Run pr18808 (-z now)" \ + "-Wl,-z,now -Wl,--no-as-needed tmpdir/pr18808a.o tmpdir/libpr18808n.so" \ + "" \ + { dummy.c } \ + "pr18808n" \ + "pr18808.out" \ + ] \ + [list \ "Run pr18841 with libpr18841b.so" \ "-Wl,--no-as-needed tmpdir/pr18841a.o tmpdir/libpr18841b.so" \ "" \ @@ -527,4 +610,20 @@ run_ld_link_exec_tests [list \ "pr18841c" \ "pr18841.out" \ ] \ + [list \ + "Run pr18841 with libpr18841bn.so (-z now)" \ + "-Wl,-z,now -Wl,--no-as-needed tmpdir/pr18841a.o tmpdir/libpr18841bn.so" \ + "" \ + { dummy.c } \ + "pr18841bn" \ + "pr18841.out" \ + ] \ + [list \ + "Run pr18841 with libpr18841cn.so (-z now)" \ + "-Wl,-z,now -Wl,--as-needed tmpdir/pr18841a.o tmpdir/libpr18841cn.so" \ + "" \ + { dummy.c } \ + "pr18841cn" \ + "pr18841.out" \ + ] \ ] diff --git a/ld/testsuite/ld-x86-64/tls.exp b/ld/testsuite/ld-x86-64/tls.exp index 7061320..e578645 100644 --- a/ld/testsuite/ld-x86-64/tls.exp +++ b/ld/testsuite/ld-x86-64/tls.exp @@ -65,6 +65,14 @@ run_cc_link_tests [list \ {} \ "libtls-1b.so" \ ] \ + [list \ + "Build libtls-1bn.so" \ + "-Wl,-z,now -shared tmpdir/tls-gd1.o tmpdir/tls-ld1.o" \ + "" \ + {dummy.s} \ + {} \ + "libtls-1bn.so" \ + ] \ ] run_ld_link_exec_tests [list \ @@ -78,6 +86,15 @@ run_ld_link_exec_tests [list \ "pass.out" \ ] \ [list \ + "TLS GD/LD -> LE transition without PLT (dynamic, -z now)" \ + "-Wl,-z,now tmpdir/tls-def1.o tmpdir/tls-main1.o tmpdir/tls-gd1.o \ + tmpdir/tls-ld1.o" \ + "" \ + { dummy.s } \ + "tls-1an" \ + "pass.out" \ + ] \ + [list \ "TLS GD/LD -> LE transition without PLT (PIE)" \ "-pie tmpdir/tls-def1.o tmpdir/tls-main1.o tmpdir/tls-gd1.o \ tmpdir/tls-ld1.o" \ @@ -87,6 +104,15 @@ run_ld_link_exec_tests [list \ "pass.out" \ ] \ [list \ + "TLS GD/LD -> LE transition without PLT (PIE, -z now)" \ + "-pie -Wl,-z,now tmpdir/tls-def1.o tmpdir/tls-main1.o tmpdir/tls-gd1.o \ + tmpdir/tls-ld1.o" \ + "" \ + { dummy.s } \ + "tls-1bn" \ + "pass.out" \ + ] \ + [list \ "TLS GD/LD -> LE transition without PLT (static)" \ "-static tmpdir/tls-def1.o tmpdir/tls-main1.o tmpdir/tls-gd1.o \ tmpdir/tls-ld1.o" \ @@ -105,6 +131,15 @@ run_ld_link_exec_tests [list \ "pass.out" \ ] \ [list \ + "TLS GD/LD -> IE transition without PLT (-z now)" \ + "-Wl,-z,now tmpdir/tls-main1.o tmpdir/tls-gd1.o tmpdir/tls-ld1.o \ + tmpdir/libtls-1a.so -Wl,-R,tmpdir" \ + "" \ + { dummy.s } \ + "tls-1dn" \ + "pass.out" \ + ] \ + [list \ "TLS without PLT (1)" \ "-Wl,--no-as-needed,-R,tmpdir tmpdir/tls-main1.o \ tmpdir/libtls-1a.so tmpdir/libtls-1b.so" \ @@ -122,4 +157,22 @@ run_ld_link_exec_tests [list \ "tls-1f" \ "pass.out" \ ] \ + [list \ + "TLS without PLT (3)" \ + "-Wl,-z,now tmpdir/tls-main1.o \ + tmpdir/libtls-1a.so tmpdir/libtls-1bn.so -Wl,-R,tmpdir" \ + "" \ + { dummy.s } \ + "tls-1en" \ + "pass.out" \ + ] \ + [list \ + "TLS without PLT (4)" \ + "-Wl,-z,now tmpdir/tls-main1.o tmpdir/tls-def1.o \ + tmpdir/libtls-1bn.so -Wl,-R,tmpdir" \ + "" \ + { dummy.s } \ + "tls-1fn" \ + "pass.out" \ + ] \ ] |