mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-24 12:23:31 +08:00
[gdb/testsuite] Factor out with_PIE_multilib_flags_filtered
Factor out new procs with_PIE_multilib_flags_filtered and with_multilib_flags_filtered from proc gdb_compile_shlib. Tested on x86_64-linux.
This commit is contained in:
@ -4983,20 +4983,17 @@ proc gdb_compile_shlib_1 {sources dest options} {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
# Build a shared library from SOURCES. Ignore target boards PIE-related
|
# Ignore FLAGS in target board multilib_flags while executing BODY.
|
||||||
# multilib_flags.
|
|
||||||
|
|
||||||
proc gdb_compile_shlib {sources dest options} {
|
proc with_multilib_flags_filtered { flags body } {
|
||||||
global board
|
global board
|
||||||
|
|
||||||
# Ignore PIE-related setting in multilib_flags.
|
# Ignore flags in multilib_flags.
|
||||||
set board [target_info name]
|
set board [target_info name]
|
||||||
set multilib_flags_orig [board_info $board multilib_flags]
|
set multilib_flags_orig [board_info $board multilib_flags]
|
||||||
set multilib_flags ""
|
set multilib_flags ""
|
||||||
foreach op $multilib_flags_orig {
|
foreach op $multilib_flags_orig {
|
||||||
if { $op == "-pie" || $op == "-no-pie" \
|
if { [lsearch -exact $flags $op] == -1 } {
|
||||||
|| $op == "-fPIE" || $op == "-fno-PIE"} {
|
|
||||||
} else {
|
|
||||||
append multilib_flags " $op"
|
append multilib_flags " $op"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5004,6 +5001,24 @@ proc gdb_compile_shlib {sources dest options} {
|
|||||||
save_target_board_info { multilib_flags } {
|
save_target_board_info { multilib_flags } {
|
||||||
unset_board_info multilib_flags
|
unset_board_info multilib_flags
|
||||||
set_board_info multilib_flags "$multilib_flags"
|
set_board_info multilib_flags "$multilib_flags"
|
||||||
|
set result [uplevel 1 $body]
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result
|
||||||
|
}
|
||||||
|
|
||||||
|
# Ignore PIE-related flags in target board multilib_flags while executing BODY.
|
||||||
|
|
||||||
|
proc with_PIE_multilib_flags_filtered { body } {
|
||||||
|
set pie_flags [list "-pie" "-no-pie" "-fPIE" "-fno-PIE"]
|
||||||
|
return [uplevel 1 [list with_multilib_flags_filtered $pie_flags $body]]
|
||||||
|
}
|
||||||
|
|
||||||
|
# Build a shared library from SOURCES. Ignore target boards PIE-related
|
||||||
|
# multilib_flags.
|
||||||
|
|
||||||
|
proc gdb_compile_shlib {sources dest options} {
|
||||||
|
with_PIE_multilib_flags_filtered {
|
||||||
set result [gdb_compile_shlib_1 $sources $dest $options]
|
set result [gdb_compile_shlib_1 $sources $dest $options]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user