aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2017-06-22 09:53:33 -0700
committerH.J. Lu <hjl.tools@gmail.com>2017-06-22 09:53:33 -0700
commit9d1c54ed7f3a4a70f35f85658c311697c17a95f5 (patch)
tree857f43f1ee6abdb2e92a990afe8077b809ca36e5 /ld
parent16892a0323ce6cf41ca80e384dfba12524247902 (diff)
Pass $NOPIE_CFLAGS and $NOPIE_LDFLAGS to more ELF tests
PR ld/21090 * testsuite/ld-gc/gc.ex: Compile tmpdir/pr14265.o with $NOPIE_CFLAGS. * testsuite/ld-i386/i386.exp: Pass $NOPIE_CFLAGS and $NOPIE_LDFLAGS if non-PIE is required. * testsuite/ld-i386/no-plt.exp (NOPIE_CFLAGS): New. (NOPIE_LDFLAGS): Likewise. Pass $NOPIE_LDFLAGS if non-PIE is required. * testsuite/ld-shared/shared.exp: Compile tmpdir/sh1np.o with $NOPIE_CFLAGS.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog13
-rw-r--r--ld/testsuite/ld-gc/gc.exp5
-rw-r--r--ld/testsuite/ld-i386/i386.exp12
-rw-r--r--ld/testsuite/ld-i386/no-plt.exp23
-rw-r--r--ld/testsuite/ld-shared/shared.exp4
5 files changed, 38 insertions, 19 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index bdc5853a7a..b2603aeae1 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,5 +1,18 @@
2017-06-22 H.J. Lu <hongjiu.lu@intel.com>
+ PR ld/21090
+ * testsuite/ld-gc/gc.ex: Compile tmpdir/pr14265.o with
+ $NOPIE_CFLAGS.
+ * testsuite/ld-i386/i386.exp: Pass $NOPIE_CFLAGS and
+ $NOPIE_LDFLAGS if non-PIE is required.
+ * testsuite/ld-i386/no-plt.exp (NOPIE_CFLAGS): New.
+ (NOPIE_LDFLAGS): Likewise.
+ Pass $NOPIE_LDFLAGS if non-PIE is required.
+ * testsuite/ld-shared/shared.exp: Compile tmpdir/sh1np.o with
+ $NOPIE_CFLAGS.
+
+2017-06-22 H.J. Lu <hongjiu.lu@intel.com>
+
* NEWS: Mention -z shstk and GNU_PROPERTY_X86_FEATURE_1_SHSTK.
* emulparams/cet.sh (PARSE_AND_LIST_OPTIONS_CET): Add "-z shstk".
(PARSE_AND_LIST_ARGS_CASE_Z_CET): Support "-z shstk".
diff --git a/ld/testsuite/ld-gc/gc.exp b/ld/testsuite/ld-gc/gc.exp
index 364c73bf5d..083b77c231 100644
--- a/ld/testsuite/ld-gc/gc.exp
+++ b/ld/testsuite/ld-gc/gc.exp
@@ -26,6 +26,9 @@ if ![check_gc_sections_available] {
set cflags "-ffunction-sections -fdata-sections"
set objfile "tmpdir/gc.o"
+# Add $NOPIE_CFLAGS and $NOPIE_LDFLAGS if non-PIE is required.
+global NOPIE_CFLAGS NOPIE_LDFLAGS
+
if [istarget powerpc64*-*-*] {
# otherwise with -mcmodel=medium gcc we get XPASSes.
set cflags "$cflags -mminimal-toc"
@@ -144,7 +147,7 @@ if { [is_remote host] || [which $CC] != 0 } {
}
if { [is_remote host] || [which $CC] != 0 } {
- ld_compile "$CC $CFLAGS $cflags" $srcdir/$subdir/pr14265.c tmpdir/pr14265.o
+ ld_compile "$CC $CFLAGS $cflags $NOPIE_CFLAGS" $srcdir/$subdir/pr14265.c tmpdir/pr14265.o
run_dump_test "pr14265"
}
diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp
index 1cecea4e38..4bf6706c48 100644
--- a/ld/testsuite/ld-i386/i386.exp
+++ b/ld/testsuite/ld-i386/i386.exp
@@ -732,7 +732,7 @@ if { [isnative]
] \
[list \
"Build gotpc1" \
- "-Wl,--as-needed tmpdir/gotpc1.o tmpdir/got1d.so" \
+ "$NOPIE_LDFLAGS -Wl,--as-needed tmpdir/gotpc1.o tmpdir/got1d.so" \
"" \
{ dummy.s } \
{{objdump {-dw} got1.dd}} \
@@ -994,7 +994,7 @@ if { [isnative]
] \
[list \
"Run got1" \
- "tmpdir/got1d.so" \
+ "$NOPIE_LDFLAGS tmpdir/got1d.so" \
"" \
{ got1a.S got1b.c got1c.c } \
"got1" \
@@ -1107,14 +1107,14 @@ if { [isnative]
] \
]
- undefined_weak "" ""
- undefined_weak "-fPIE" ""
+ undefined_weak "$NOPIE_CFLAGS" "$NOPIE_LDFLAGS"
+ undefined_weak "-fPIE" "$NOPIE_LDFLAGS"
undefined_weak "-fPIE" "-pie"
- undefined_weak "-fPIE" "-z nodynamic-undefined-weak"
+ undefined_weak "-fPIE" "-z nodynamic-undefined-weak $NOPIE_LDFLAGS"
undefined_weak "-fPIE" "-pie -z nodynamic-undefined-weak"
}
-global NOPIE_LDFLAGS
+global NOPIE_CFLAGS NOPIE_LDFLAGS
# Must be native with the C compiler and working IFUNC support,
if { [isnative]
diff --git a/ld/testsuite/ld-i386/no-plt.exp b/ld/testsuite/ld-i386/no-plt.exp
index a37b9c400c..7839390c9c 100644
--- a/ld/testsuite/ld-i386/no-plt.exp
+++ b/ld/testsuite/ld-i386/no-plt.exp
@@ -39,6 +39,9 @@ if { [which $CC] == 0 } {
return
}
+# Add $NOPIE_CFLAGS and $NOPIE_LDFLAGS if non-PIE is required.
+global NOPIE_CFLAGS NOPIE_LDFLAGS
+
run_cc_link_tests [list \
[list \
"Build no-plt-func1.o no-plt-main1.o" \
@@ -73,7 +76,7 @@ run_cc_link_tests [list \
] \
[list \
"No PLT (dynamic 1a)" \
- "tmpdir/no-plt-check1a.o tmpdir/no-plt-main1.o \
+ "$NOPIE_LDFLAGS tmpdir/no-plt-check1a.o tmpdir/no-plt-main1.o \
tmpdir/no-plt-func1.o tmpdir/no-plt-extern1a.o" \
"" \
{dummy.s} \
@@ -91,7 +94,7 @@ run_cc_link_tests [list \
] \
[list \
"No PLT (dynamic 1c)" \
- "tmpdir/no-plt-check1a.o tmpdir/no-plt-main1.o \
+ "$NOPIE_LDFLAGS tmpdir/no-plt-check1a.o tmpdir/no-plt-main1.o \
tmpdir/no-plt-func1.o tmpdir/libno-plt-1b.so" \
"" \
{dummy.s} \
@@ -136,7 +139,7 @@ run_cc_link_tests [list \
] \
[list \
"No PLT (dynamic 1h)" \
- "tmpdir/no-plt-check1b.o tmpdir/no-plt-main1.o \
+ "$NOPIE_LDFLAGS tmpdir/no-plt-check1b.o tmpdir/no-plt-main1.o \
tmpdir/no-plt-func1.o tmpdir/no-plt-extern1b.o" \
"" \
{dummy.s} \
@@ -145,7 +148,7 @@ run_cc_link_tests [list \
] \
[list \
"No PLT (dynamic 1i)" \
- "tmpdir/no-plt-check1b.o tmpdir/no-plt-main1.o \
+ "$NOPIE_LDFLAGS tmpdir/no-plt-check1b.o tmpdir/no-plt-main1.o \
tmpdir/no-plt-extern1b.o tmpdir/libno-plt-1a.so" \
"" \
{dummy.s} \
@@ -229,7 +232,7 @@ run_ld_link_exec_tests [list \
] \
[list \
"No PLT (dynamic 1h)" \
- "tmpdir/no-plt-check1b.o tmpdir/no-plt-main1.o \
+ "$NOPIE_LDFLAGS tmpdir/no-plt-check1b.o tmpdir/no-plt-main1.o \
tmpdir/no-plt-func1.o tmpdir/no-plt-extern1b.o" \
"" \
{dummy.s} \
@@ -238,7 +241,7 @@ run_ld_link_exec_tests [list \
] \
[list \
"No PLT (dynamic 1i)" \
- "tmpdir/no-plt-check1b.o tmpdir/no-plt-main1.o \
+ "$NOPIE_LDFLAGS tmpdir/no-plt-check1b.o tmpdir/no-plt-main1.o \
tmpdir/no-plt-extern1b.o tmpdir/libno-plt-1a.so" \
"" \
{dummy.s} \
@@ -291,7 +294,7 @@ if { [check_ifunc_available] } {
run_ld_link_exec_tests [list \
[list \
"Run pr20244-3a" \
- "tmpdir/pr20244-3a.o tmpdir/pr20244-3b.o \
+ "$NOPIE_LDFLAGS tmpdir/pr20244-3a.o tmpdir/pr20244-3b.o \
tmpdir/pr20244-3c.o tmpdir/pr20244-3d.o" \
"" \
{ dummy.c } \
@@ -352,7 +355,7 @@ if { [check_ifunc_available] } {
] \
[list \
"Run pr20253-1f" \
- "tmpdir/pr20253-1a.o" \
+ "$NOPIE_LDFLAGS tmpdir/pr20253-1a.o" \
"" \
{ pr20253-1b.S pr20253-1c.S pr20253-1d.S } \
"pr20253-1f" \
@@ -370,7 +373,7 @@ if { [check_ifunc_available] } {
] \
[list \
"Run pr20253-2a" \
- "tmpdir/pr20253-2a.o tmpdir/pr20253-2b.o \
+ "$NOPIE_LDFLAGS tmpdir/pr20253-2a.o tmpdir/pr20253-2b.o \
tmpdir/pr20253-2c.o tmpdir/pr20253-2d.o" \
"" \
{ dummy.s } \
@@ -388,7 +391,7 @@ if { [check_ifunc_available] } {
] \
[list \
"Run pr20253-2c" \
- "tmpdir/pr20253-2a.o" \
+ "$NOPIE_LDFLAGS tmpdir/pr20253-2a.o" \
"" \
{ pr20253-2b.S pr20253-2c.S pr20253-2d.S } \
"pr20253-2c" \
diff --git a/ld/testsuite/ld-shared/shared.exp b/ld/testsuite/ld-shared/shared.exp
index 93181dc067..723b51cddf 100644
--- a/ld/testsuite/ld-shared/shared.exp
+++ b/ld/testsuite/ld-shared/shared.exp
@@ -225,8 +225,8 @@ if ![ld_compile "$CC $CFLAGS $SHCFLAG" $srcdir/$subdir/main.c $tmpdir/mainnp.o]
# will need to do more relocation work. However, note that not
# using -fpic will cause some of the tests to return different
# results. Make sure that PLT is used since PLT is expected.
- global PLT_CFLAGS
- if { ![ld_compile "$CC $PLT_CFLAGS $CFLAGS $SHCFLAG" $srcdir/$subdir/sh1.c $tmpdir/sh1np.o]
+ global PLT_CFLAGS NOPIE_CFLAGS
+ if { ![ld_compile "$CC $PLT_CFLAGS $NOPIE_CFLAGS $CFLAGS $SHCFLAG" $srcdir/$subdir/sh1.c $tmpdir/sh1np.o]
|| ![ld_compile "$CC $PLT_CFLAGS $CFLAGS $SHCFLAG" $srcdir/$subdir/sh2.c $tmpdir/sh2np.o] } {
unresolved "shared (non PIC)"
} else { if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {