I noticed two test-cases where -fpie is used. Using the canonical pie option
will usually get one -fPIE instead.
That choice is justified here in gdb_compile:
...
# For safety, use fPIE rather than fpie. On AArch64, m68k, PowerPC
# and SPARC, fpie can cause compile errors due to the GOT exceeding
# a maximum size. On other architectures the two flags are
# identical (see the GCC manual). Note Debian9 and Ubuntu16.10
# onwards default GCC to using fPIE. If you do require fpie, then
# it can be set using the pie_flag.
set flag "additional_flags=-fPIE"
...
There is no indication that using -fpie rather than -fPIE is on purpose, so
use pie instead.
Tested on x86_64-linux.
standard_testfile
-if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug additional_flags=-fpie "ldflags=-pie -Wl,-z,relro"}]} {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
+ {debug pie "ldflags=-Wl,-z,relro"}]} {
return -1
}
return -1
}
-if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug additional_flags=-fpie "ldflags=-pie -fuse-ld=gold"}]} {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
+ {debug pie "ldflags=-fuse-ld=gold"}]} {
return -1
}