mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-22 19:09:31 +08:00
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.
This commit is contained in:
13
ld/ChangeLog
13
ld/ChangeLog
@ -1,3 +1,16 @@
|
|||||||
|
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>
|
2017-06-22 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
* NEWS: Mention -z shstk and GNU_PROPERTY_X86_FEATURE_1_SHSTK.
|
* NEWS: Mention -z shstk and GNU_PROPERTY_X86_FEATURE_1_SHSTK.
|
||||||
|
@ -26,6 +26,9 @@ if ![check_gc_sections_available] {
|
|||||||
set cflags "-ffunction-sections -fdata-sections"
|
set cflags "-ffunction-sections -fdata-sections"
|
||||||
set objfile "tmpdir/gc.o"
|
set objfile "tmpdir/gc.o"
|
||||||
|
|
||||||
|
# Add $NOPIE_CFLAGS and $NOPIE_LDFLAGS if non-PIE is required.
|
||||||
|
global NOPIE_CFLAGS NOPIE_LDFLAGS
|
||||||
|
|
||||||
if [istarget powerpc64*-*-*] {
|
if [istarget powerpc64*-*-*] {
|
||||||
# otherwise with -mcmodel=medium gcc we get XPASSes.
|
# otherwise with -mcmodel=medium gcc we get XPASSes.
|
||||||
set cflags "$cflags -mminimal-toc"
|
set cflags "$cflags -mminimal-toc"
|
||||||
@ -144,7 +147,7 @@ if { [is_remote host] || [which $CC] != 0 } {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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"
|
run_dump_test "pr14265"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -732,7 +732,7 @@ if { [isnative]
|
|||||||
] \
|
] \
|
||||||
[list \
|
[list \
|
||||||
"Build gotpc1" \
|
"Build gotpc1" \
|
||||||
"-Wl,--as-needed tmpdir/gotpc1.o tmpdir/got1d.so" \
|
"$NOPIE_LDFLAGS -Wl,--as-needed tmpdir/gotpc1.o tmpdir/got1d.so" \
|
||||||
"" \
|
"" \
|
||||||
{ dummy.s } \
|
{ dummy.s } \
|
||||||
{{objdump {-dw} got1.dd}} \
|
{{objdump {-dw} got1.dd}} \
|
||||||
@ -994,7 +994,7 @@ if { [isnative]
|
|||||||
] \
|
] \
|
||||||
[list \
|
[list \
|
||||||
"Run got1" \
|
"Run got1" \
|
||||||
"tmpdir/got1d.so" \
|
"$NOPIE_LDFLAGS tmpdir/got1d.so" \
|
||||||
"" \
|
"" \
|
||||||
{ got1a.S got1b.c got1c.c } \
|
{ got1a.S got1b.c got1c.c } \
|
||||||
"got1" \
|
"got1" \
|
||||||
@ -1107,14 +1107,14 @@ if { [isnative]
|
|||||||
] \
|
] \
|
||||||
]
|
]
|
||||||
|
|
||||||
undefined_weak "" ""
|
undefined_weak "$NOPIE_CFLAGS" "$NOPIE_LDFLAGS"
|
||||||
undefined_weak "-fPIE" ""
|
undefined_weak "-fPIE" "$NOPIE_LDFLAGS"
|
||||||
undefined_weak "-fPIE" "-pie"
|
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"
|
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,
|
# Must be native with the C compiler and working IFUNC support,
|
||||||
if { [isnative]
|
if { [isnative]
|
||||||
|
@ -39,6 +39,9 @@ if { [which $CC] == 0 } {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Add $NOPIE_CFLAGS and $NOPIE_LDFLAGS if non-PIE is required.
|
||||||
|
global NOPIE_CFLAGS NOPIE_LDFLAGS
|
||||||
|
|
||||||
run_cc_link_tests [list \
|
run_cc_link_tests [list \
|
||||||
[list \
|
[list \
|
||||||
"Build no-plt-func1.o no-plt-main1.o" \
|
"Build no-plt-func1.o no-plt-main1.o" \
|
||||||
@ -73,7 +76,7 @@ run_cc_link_tests [list \
|
|||||||
] \
|
] \
|
||||||
[list \
|
[list \
|
||||||
"No PLT (dynamic 1a)" \
|
"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" \
|
tmpdir/no-plt-func1.o tmpdir/no-plt-extern1a.o" \
|
||||||
"" \
|
"" \
|
||||||
{dummy.s} \
|
{dummy.s} \
|
||||||
@ -91,7 +94,7 @@ run_cc_link_tests [list \
|
|||||||
] \
|
] \
|
||||||
[list \
|
[list \
|
||||||
"No PLT (dynamic 1c)" \
|
"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" \
|
tmpdir/no-plt-func1.o tmpdir/libno-plt-1b.so" \
|
||||||
"" \
|
"" \
|
||||||
{dummy.s} \
|
{dummy.s} \
|
||||||
@ -136,7 +139,7 @@ run_cc_link_tests [list \
|
|||||||
] \
|
] \
|
||||||
[list \
|
[list \
|
||||||
"No PLT (dynamic 1h)" \
|
"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" \
|
tmpdir/no-plt-func1.o tmpdir/no-plt-extern1b.o" \
|
||||||
"" \
|
"" \
|
||||||
{dummy.s} \
|
{dummy.s} \
|
||||||
@ -145,7 +148,7 @@ run_cc_link_tests [list \
|
|||||||
] \
|
] \
|
||||||
[list \
|
[list \
|
||||||
"No PLT (dynamic 1i)" \
|
"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" \
|
tmpdir/no-plt-extern1b.o tmpdir/libno-plt-1a.so" \
|
||||||
"" \
|
"" \
|
||||||
{dummy.s} \
|
{dummy.s} \
|
||||||
@ -229,7 +232,7 @@ run_ld_link_exec_tests [list \
|
|||||||
] \
|
] \
|
||||||
[list \
|
[list \
|
||||||
"No PLT (dynamic 1h)" \
|
"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" \
|
tmpdir/no-plt-func1.o tmpdir/no-plt-extern1b.o" \
|
||||||
"" \
|
"" \
|
||||||
{dummy.s} \
|
{dummy.s} \
|
||||||
@ -238,7 +241,7 @@ run_ld_link_exec_tests [list \
|
|||||||
] \
|
] \
|
||||||
[list \
|
[list \
|
||||||
"No PLT (dynamic 1i)" \
|
"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" \
|
tmpdir/no-plt-extern1b.o tmpdir/libno-plt-1a.so" \
|
||||||
"" \
|
"" \
|
||||||
{dummy.s} \
|
{dummy.s} \
|
||||||
@ -291,7 +294,7 @@ if { [check_ifunc_available] } {
|
|||||||
run_ld_link_exec_tests [list \
|
run_ld_link_exec_tests [list \
|
||||||
[list \
|
[list \
|
||||||
"Run pr20244-3a" \
|
"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" \
|
tmpdir/pr20244-3c.o tmpdir/pr20244-3d.o" \
|
||||||
"" \
|
"" \
|
||||||
{ dummy.c } \
|
{ dummy.c } \
|
||||||
@ -352,7 +355,7 @@ if { [check_ifunc_available] } {
|
|||||||
] \
|
] \
|
||||||
[list \
|
[list \
|
||||||
"Run pr20253-1f" \
|
"Run pr20253-1f" \
|
||||||
"tmpdir/pr20253-1a.o" \
|
"$NOPIE_LDFLAGS tmpdir/pr20253-1a.o" \
|
||||||
"" \
|
"" \
|
||||||
{ pr20253-1b.S pr20253-1c.S pr20253-1d.S } \
|
{ pr20253-1b.S pr20253-1c.S pr20253-1d.S } \
|
||||||
"pr20253-1f" \
|
"pr20253-1f" \
|
||||||
@ -370,7 +373,7 @@ if { [check_ifunc_available] } {
|
|||||||
] \
|
] \
|
||||||
[list \
|
[list \
|
||||||
"Run pr20253-2a" \
|
"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" \
|
tmpdir/pr20253-2c.o tmpdir/pr20253-2d.o" \
|
||||||
"" \
|
"" \
|
||||||
{ dummy.s } \
|
{ dummy.s } \
|
||||||
@ -388,7 +391,7 @@ if { [check_ifunc_available] } {
|
|||||||
] \
|
] \
|
||||||
[list \
|
[list \
|
||||||
"Run pr20253-2c" \
|
"Run pr20253-2c" \
|
||||||
"tmpdir/pr20253-2a.o" \
|
"$NOPIE_LDFLAGS tmpdir/pr20253-2a.o" \
|
||||||
"" \
|
"" \
|
||||||
{ pr20253-2b.S pr20253-2c.S pr20253-2d.S } \
|
{ pr20253-2b.S pr20253-2c.S pr20253-2d.S } \
|
||||||
"pr20253-2c" \
|
"pr20253-2c" \
|
||||||
|
@ -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
|
# will need to do more relocation work. However, note that not
|
||||||
# using -fpic will cause some of the tests to return different
|
# using -fpic will cause some of the tests to return different
|
||||||
# results. Make sure that PLT is used since PLT is expected.
|
# results. Make sure that PLT is used since PLT is expected.
|
||||||
global PLT_CFLAGS
|
global PLT_CFLAGS NOPIE_CFLAGS
|
||||||
if { ![ld_compile "$CC $PLT_CFLAGS $CFLAGS $SHCFLAG" $srcdir/$subdir/sh1.c $tmpdir/sh1np.o]
|
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] } {
|
|| ![ld_compile "$CC $PLT_CFLAGS $CFLAGS $SHCFLAG" $srcdir/$subdir/sh2.c $tmpdir/sh2np.o] } {
|
||||||
unresolved "shared (non PIC)"
|
unresolved "shared (non PIC)"
|
||||||
} else { if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
|
} else { if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
|
||||||
|
Reference in New Issue
Block a user