From 66484acafd396ecb9bffd9f00ff3c37aec549c83 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Fri, 24 Sep 2021 16:56:50 +0200 Subject: [PATCH] [gdb/testsuite] Use pie instead of -fpie/-pie 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. --- gdb/testsuite/gdb.base/gcore-relro-pie.exp | 3 ++- gdb/testsuite/gdb.base/gcore-tls-pie.exp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/gdb.base/gcore-relro-pie.exp b/gdb/testsuite/gdb.base/gcore-relro-pie.exp index 5b25721ad61..39142fe4254 100644 --- a/gdb/testsuite/gdb.base/gcore-relro-pie.exp +++ b/gdb/testsuite/gdb.base/gcore-relro-pie.exp @@ -19,7 +19,8 @@ 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 } diff --git a/gdb/testsuite/gdb.base/gcore-tls-pie.exp b/gdb/testsuite/gdb.base/gcore-tls-pie.exp index 3f42cb4fe67..e514c42d498 100644 --- a/gdb/testsuite/gdb.base/gcore-tls-pie.exp +++ b/gdb/testsuite/gdb.base/gcore-tls-pie.exp @@ -23,7 +23,8 @@ if { [have_fuse_ld_gold] == 0} { 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 } -- 2.30.2