+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.
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"
}
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"
}
] \
[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}} \
] \
[list \
"Run got1" \
- "tmpdir/got1d.so" \
+ "$NOPIE_LDFLAGS tmpdir/got1d.so" \
"" \
{ got1a.S got1b.c got1c.c } \
"got1" \
] \
]
- 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]
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" \
] \
[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} \
] \
[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} \
] \
[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} \
] \
[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} \
] \
[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} \
] \
[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} \
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 } \
] \
[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" \
] \
[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 } \
] \
[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" \
# 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*] } {