mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-30 21:44:19 +08:00
[gdb/testsuite] Use pie instead of -fPIE -pie
Replace {additional_flags=-fPIE ldflags=-pie} with {pie}. This makes sure that the test-cases properly error out when using target board unix/-fno-PIE/-no-pie. Tested on x86_64-linux.
This commit is contained in:
parent
508109612f
commit
6ef69a3ff3
@ -25,7 +25,8 @@ standard_testfile .c
|
|||||||
set genfile [standard_output_file ${testfile}-gen.h]
|
set genfile [standard_output_file ${testfile}-gen.h]
|
||||||
set executable $testfile
|
set executable $testfile
|
||||||
|
|
||||||
if {[build_executable_own_libs ${testfile}.exp $executable $srcfile [list additional_flags=-fPIE ldflags=-pie]] == ""} {
|
if {[build_executable_own_libs ${testfile}.exp $executable $srcfile \
|
||||||
|
{pie}] == ""} {
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,7 +96,8 @@ if {$result == 0} {
|
|||||||
fail $test
|
fail $test
|
||||||
}
|
}
|
||||||
|
|
||||||
set prelink_args [build_executable_own_libs ${test}.exp $executable $srcfile [list "additional_flags=-fPIE -DGEN=\"$genfile\"" "ldflags=-pie"]]
|
set prelink_args [build_executable_own_libs ${test}.exp $executable $srcfile \
|
||||||
|
[list pie "additional_flags=-DGEN=\"$genfile\""]]
|
||||||
if {$prelink_args == ""} {
|
if {$prelink_args == ""} {
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
@ -118,7 +120,7 @@ verbose -log "first_offset is $first_offset"
|
|||||||
|
|
||||||
set test "first offset is non-zero"
|
set test "first offset is non-zero"
|
||||||
if {$first_offset == 0} {
|
if {$first_offset == 0} {
|
||||||
fail "$test (-fPIE -pie in effect?)"
|
fail "$test (failing because PIE is not effect?)"
|
||||||
} else {
|
} else {
|
||||||
pass $test
|
pass $test
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ if {![can_spawn_for_attach]} {
|
|||||||
standard_testfile .c
|
standard_testfile .c
|
||||||
set executable ${testfile}
|
set executable ${testfile}
|
||||||
|
|
||||||
if { [prepare_for_testing "failed to prepare" $executable "" [list debug "additional_flags=-fPIE" "ldflags=-pie"]] } {
|
if { [prepare_for_testing "failed to prepare" $executable "" [list debug pie]] } {
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ standard_testfile .c
|
|||||||
set executable ${testfile}
|
set executable ${testfile}
|
||||||
|
|
||||||
if { [build_executable ${testfile}.exp $executable $srcfile \
|
if { [build_executable ${testfile}.exp $executable $srcfile \
|
||||||
[list debug pthreads "additional_flags=-fPIE" "ldflags=-pie"]] } {
|
[list debug pthreads pie]] } {
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,8 +158,7 @@ if {[can_spawn_for_attach]} {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if { [compile_jit_main ${main_srcfile} "${main_binfile}-pie" \
|
if { [compile_jit_main ${main_srcfile} "${main_binfile}-pie" pie] == 0 } {
|
||||||
{additional_flags=-fPIE ldflags=-pie}] == 0 } {
|
|
||||||
with_test_prefix PIE {
|
with_test_prefix PIE {
|
||||||
one_jit_test [lindex $jit_solibs_target 0] "${hex} jit_function_0001" 0
|
one_jit_test [lindex $jit_solibs_target 0] "${hex} jit_function_0001" 0
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ set binfile2_test_msg OBJDIR/${subdir}/${executable2}
|
|||||||
# Use conditional compilation according to `BIN' as GDB remembers the source
|
# Use conditional compilation according to `BIN' as GDB remembers the source
|
||||||
# file name of the breakpoint.
|
# file name of the breakpoint.
|
||||||
|
|
||||||
set opts [list debug additional_flags=-fPIE ldflags=-pie]
|
set opts [list debug pie]
|
||||||
if {[build_executable ${testfile}.exp $executable1 $srcfile [concat $opts {additional_flags=-DBIN=1}]] == -1
|
if {[build_executable ${testfile}.exp $executable1 $srcfile [concat $opts {additional_flags=-DBIN=1}]] == -1
|
||||||
|| [build_executable ${testfile}.exp $executable2 $srcfile [concat $opts {additional_flags=-DBIN=2}]] == -1} {
|
|| [build_executable ${testfile}.exp $executable2 $srcfile [concat $opts {additional_flags=-DBIN=2}]] == -1} {
|
||||||
return -1
|
return -1
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
standard_testfile
|
standard_testfile
|
||||||
|
|
||||||
set opts [list debug additional_flags=-fPIE ldflags=-pie]
|
set opts [list debug pie]
|
||||||
|
|
||||||
if [prepare_for_testing "failed to prepare" $testfile $srcfile $opts] {
|
if [prepare_for_testing "failed to prepare" $testfile $srcfile $opts] {
|
||||||
return
|
return
|
||||||
|
@ -14,9 +14,7 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# Build programs in PIE mode, to reproduce PR 21555.
|
# Build programs in PIE mode, to reproduce PR 21555.
|
||||||
foreach_with_prefix opts {
|
foreach_with_prefix opts { "" "pie" } {
|
||||||
{ "" "" }
|
|
||||||
{ "-fPIE" "ldflags=-pie" } } {
|
|
||||||
|
|
||||||
# build the first test case
|
# build the first test case
|
||||||
|
|
||||||
@ -25,9 +23,7 @@ foreach_with_prefix opts {
|
|||||||
# Cygwin needs $EXEEXT.
|
# Cygwin needs $EXEEXT.
|
||||||
set binfile1 [standard_output_file ${testfile1}$EXEEXT]
|
set binfile1 [standard_output_file ${testfile1}$EXEEXT]
|
||||||
|
|
||||||
set testfile1_opt [list debug nowarnings \
|
set testfile1_opt [list debug nowarnings $opts]
|
||||||
additional_flags=[lindex $opts 0] \
|
|
||||||
[lindex $opts 1] ]
|
|
||||||
if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile1}" \
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile1}" \
|
||||||
executable ${testfile1_opt}] != "" } {
|
executable ${testfile1_opt}] != "" } {
|
||||||
untested "failed to compile first testcase"
|
untested "failed to compile first testcase"
|
||||||
@ -40,12 +36,9 @@ foreach_with_prefix opts {
|
|||||||
set srcfile2 ${testfile2}.c
|
set srcfile2 ${testfile2}.c
|
||||||
set binfile2 [standard_output_file ${testfile2}$EXEEXT]
|
set binfile2 [standard_output_file ${testfile2}$EXEEXT]
|
||||||
|
|
||||||
set testfile2_opt1 [list debug nowarnings \
|
set testfile2_opt1 [list debug nowarnings $opts]
|
||||||
additional_flags=[lindex $opts 0] \
|
set testfile2_op2 [list debug nowarnings $opts \
|
||||||
[lindex $opts 1]]
|
"additional_flags=-DNO_SECTIONS"]
|
||||||
set testfile2_op2 [list debug nowarnings \
|
|
||||||
"additional_flags=-DNO_SECTIONS [lindex $opts 0]" \
|
|
||||||
[lindex $opts 1]]
|
|
||||||
if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" \
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" \
|
||||||
executable ${testfile2_opt1}] != ""
|
executable ${testfile2_opt1}] != ""
|
||||||
&& [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" \
|
&& [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" \
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
standard_testfile
|
standard_testfile
|
||||||
|
|
||||||
if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \
|
if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \
|
||||||
[list "additional_flags=-fPIE -pie"]] != "" } {
|
{pie}] != "" } {
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user