+2017-06-21 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/21090
+ * testsuite/ld-size/size.exp: Pass $NOPIE_LDFLAGS to size-4a,
+ size-4b, size-5a, size-5b, size-6 and size-8 tests.
+
2017-06-21 Alan Modra <amodra@gmail.com>
* testsuite/ld-powerpc/powerpc.exp: Run TOCSAVE tests.
] \
[list \
"Run size-4a" \
- "" \
+ "$NOPIE_LDFLAGS" \
"" \
{size-4a.c size-4b.c} \
"size-4a" \
] \
[list \
"Run size-4b" \
- "" \
+ "$NOPIE_LDFLAGS" \
"" \
{size-4b.c size-4a.c} \
"size-4b" \
] \
[list \
"Run size-5a" \
- "" \
+ "$NOPIE_LDFLAGS" \
"" \
{size-5a.c size-5b.c} \
"size-5a" \
] \
[list \
"Run size-5b" \
- "" \
+ "$NOPIE_LDFLAGS" \
"" \
{size-5b.c size-5a.c} \
"size-5b" \
] \
[list \
"Run size-6" \
- "-Wl,--no-as-needed tmpdir/libsize-6b.so" \
+ "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/libsize-6b.so" \
"" \
{size-6a.c} \
"size-6" \
] \
[list \
"Run size-8" \
- "-Wl,--no-as-needed,--hash-styl=gnu tmpdir/libsize-8.so" \
+ "$NOPIE_LDFLAGS -Wl,--no-as-needed,--hash-styl=gnu \
+ tmpdir/libsize-8.so" \
"" \
{size-8a.c} \
"size-8" \
}
# Pass -fplt to CC and CXX since -fno-plt doesn't work with S-records
-# tests.
-global PLT_CFLAGS
+# tests. Also add $NOPIE_CFLAGS and $NOPIE_LDFLAGS if PIE doesn't work
+# with S-records.
+global PLT_CFLAGS NOPIE_CFLAGS NOPIE_LDFLAGS
set old_CC "$CC"
-set CC "$CC $PLT_CFLAGS"
+set CC "$CC $PLT_CFLAGS $NOPIE_CFLAGS $NOPIE_LDFLAGS"
set old_CXX "$CXX"
-set CXX "$CXX $PLT_CFLAGS"
+set CXX "$CXX $PLT_CFLAGS $NOPIE_CFLAGS $NOPIE_LDFLAGS"
if { ![ld_compile $CC $srcdir/$subdir/sr1.c tmpdir/sr1.o] \
|| ![ld_compile $CC $srcdir/$subdir/sr2.c tmpdir/sr2.o] } {
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-check1.o tmpdir/no-plt-main1.o \
+ "$NOPIE_LDFLAGS tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
tmpdir/no-plt-func1.o tmpdir/no-plt-extern1.o" \
"" \
{dummy.s} \
] \
[list \
"No PLT (dynamic 1c)" \
- "tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
+ "$NOPIE_LDFLAGS tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
tmpdir/no-plt-func1.o tmpdir/libno-plt-1b.so" \
"" \
{dummy.s} \
] \
[list \
"Run pr20253-2f" \
- "tmpdir/pr20253-2a.o" \
+ "$NOPIE_LDFLAGS tmpdir/pr20253-2a.o" \
"" \
{ pr20253-2b.S pr20253-2c.S pr20253-2d.S } \
"pr20253-2f" \
] \
[list \
"Build gotpcrel1" \
- "-Wl,--as-needed tmpdir/gotpcrel1a.o tmpdir/gotpcrel1b.o tmpdir/gotpcrel1c.o tmpdir/gotpcrel1d.so" \
+ "$NOPIE_LDFLAGS -Wl,--as-needed tmpdir/gotpcrel1a.o \
+ tmpdir/gotpcrel1b.o tmpdir/gotpcrel1c.o \
+ tmpdir/gotpcrel1d.so" \
{ dummy.s } \
"" \
{{objdump {-dw} gotpcrel1.dd}} \
] \
[list \
"Run pr19031" \
- "-Wl,--no-as-needed tmpdir/pr19031.so" \
+ "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/pr19031.so" \
"" \
{ pr19031b.S pr19031c.c } \
"pr19031" \
"pr19031.out" \
+ "$NOPIE_CFLAGS" \
] \
[list \
"Run gotpcrel1" \