public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [committed][gdb/testsuite] Fix gdb.base/infoline-reloc-main-from-zero.exp with PIE
@ 2022-10-14 11:11 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2022-10-14 11:11 UTC (permalink / raw)
  To: gdb-patches

Hi,

With test-case gdb.base/infoline-reloc-main-from-zero.exp and target board
unix/-fPIE/-pie I run into:
...
gdb compile failed, ld: infoline-reloc-main-from-zero: error: \
  PHDR segment not covered by LOAD segment
collect2: error: ld returned 1 exit status
...

When running with native, I find that the executable is static:
...
$ file infoline-reloc-main-from-zero
infoline-reloc-main-from-zero: ELF 64-bit LSB executable, x86-64, \
  version 1 (SYSV), statically linked, BuildID[sha1]=$hex, with debug_info, \
  not stripped
...
despite not having been compiled with -static.

Fix the compilation by adding -static to the compilation flags.

Tested on x86_64-linux.

Committed to trunk.

Thanks,
- Tom

[gdb/testsuite] Fix gdb.base/infoline-reloc-main-from-zero.exp with PIE

---
 gdb/testsuite/gdb.base/infoline-reloc-main-from-zero.exp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gdb/testsuite/gdb.base/infoline-reloc-main-from-zero.exp b/gdb/testsuite/gdb.base/infoline-reloc-main-from-zero.exp
index c1391ee22c9..93c729535bb 100644
--- a/gdb/testsuite/gdb.base/infoline-reloc-main-from-zero.exp
+++ b/gdb/testsuite/gdb.base/infoline-reloc-main-from-zero.exp
@@ -28,6 +28,7 @@ standard_testfile .c
 set opts {}
 lappend opts debug
 lappend opts "ldflags=-nostdlib -emain -Wl,-Ttext=0x00 -Wl,-N"
+lappend opts additional_flags=-static
 
 set ld_flags ldflags=-Wl,--no-warn-rwx-segments
 if { [gdb_can_simple_compile ld-flags {int main () { return 0; }} executable \

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

only message in thread, other threads:[~2022-10-14 11:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-14 11:11 [committed][gdb/testsuite] Fix gdb.base/infoline-reloc-main-from-zero.exp with PIE 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).