From b3d7a86748247a68c69939cdf9925d4a78448f2d Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Thu, 11 Apr 2019 06:52:03 -0700 Subject: ld: Add -static-pie tests Add -static-pie tests for DT_INIT_ARRAY, DT_FINI_ARRAY, DT_PREINIT_ARRAY and IFUNC. * testsuite/config/default.exp (STATIC_PIE_LDFLAGS): New. Set to "-static-pie" if target compiler supports it. * testsuite/ld-elf/elf.exp: Run -static-pie tests if $STATIC_PIE_LDFLAGS isn't empty. * testsuite/ld-ifunc/ifunc.exp: Likewise. --- ld/testsuite/ld-elf/elf.exp | 50 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'ld/testsuite/ld-elf') diff --git a/ld/testsuite/ld-elf/elf.exp b/ld/testsuite/ld-elf/elf.exp index 4a5ef8a..4686870 100644 --- a/ld/testsuite/ld-elf/elf.exp +++ b/ld/testsuite/ld-elf/elf.exp @@ -235,6 +235,56 @@ if { [istarget *-*-linux*] || [istarget *-*-gnu*] } { run_ld_link_exec_tests $array_tests_pie $xfails + if { $STATIC_PIE_LDFLAGS != "" } then { + run_ld_link_exec_tests [list \ + [list \ + "Static PIE preinit array" \ + "$STATIC_PIE_LDFLAGS" \ + "" \ + {preinit.c} \ + "preinit-static-pie" \ + "preinit.out" \ + "-fPIE" \ + ] \ + [list \ + "Static PIE init array" \ + "$STATIC_PIE_LDFLAGS" \ + "" \ + {init.c} \ + "init-static-pie" \ + "init.out" \ + "-fPIE" \ + ] \ + [list \ + "Static PIE fini array" \ + "$STATIC_PIE_LDFLAGS" \ + "" \ + {fini.c} \ + "fini-static-pie" \ + "fini.out" \ + "-fPIE" \ + ] \ + [list \ + "Static PIE init array mixed" \ + "$STATIC_PIE_LDFLAGS" \ + "" \ + {init-mixed.c} \ + "init-mixed-static-pie" \ + "init-mixed.out" \ + "-I. -fPIE" \ + ] \ + [list \ + "Static PIE PR ld/14525" \ + "$STATIC_PIE_LDFLAGS" \ + "" \ + {pr14525.c} \ + "pr14525-static-pie" \ + "pr14525.out" \ + "-fPIE" \ + ] \ + ] + } + run_ld_link_exec_tests [list \ [list \ "Run mbind2a" \ -- cgit v1.1