public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [pushed] [gdb/testsuite] Silence compilation fail in gdb.base/rtld-step.exp
@ 2022-10-21  6:36 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2022-10-21  6:36 UTC (permalink / raw)
  To: gdb-patches

With gcc 7.5.0 and test-case gdb.base/rtld-step.exp, I run into:
...
gdb compile failed, gcc: error: unrecognized command line option \
  '-static-pie'; did you mean '-static'?
...

Silence this by checking in the test-case that -static-pie is supported, and
emitting instead:
...
UNTESTED: gdb.base/rtld-step.exp: \
  failed to compile (-static-pie not supported or static libc missing)
...

Tested on x86_64-linux, with:
- gcc 7.5.0: UNTESTED
- gcc 12.2.1 with static glibc not installed: UNTESTED
- gcc 12.2.1 with static glibc installed: PASS
---
 gdb/testsuite/gdb.base/rtld-step.exp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/gdb/testsuite/gdb.base/rtld-step.exp b/gdb/testsuite/gdb.base/rtld-step.exp
index 4773fa8de3d..0aa2ab0fe1f 100644
--- a/gdb/testsuite/gdb.base/rtld-step.exp
+++ b/gdb/testsuite/gdb.base/rtld-step.exp
@@ -87,6 +87,14 @@ set binfile_rtld [standard_output_file ${rtld_basename}]
 set rtld_flags [list debug additional_flags=[list -static-pie -fPIE \
 						  -nostdlib -static -lc]]
 
+if { ![gdb_can_simple_compile static-pie-static-libc \
+	   "void _start (void) { _exit (0); }" \
+	   executable $rtld_flags] } {
+    set reason "-static-pie not supported or static libc missing"
+    untested "failed to compile ($reason)"
+    return -1
+}
+
 # Main program file names and flags:
 set main_basename ${::gdb_test_file_name}-main
 set srcfile_main ${srcdir}/${subdir}/${main_basename}.c

base-commit: 68830fbae98867f63720d250a18ce64f9f2f51fc
-- 
2.35.3


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-10-21  6:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-21  6:36 [pushed] [gdb/testsuite] Silence compilation fail in gdb.base/rtld-step.exp Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).