public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Tom de Vries <vries@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] [gdb/testsuite] Fix gdb.base/infoline-reloc-main-from-zero.exp with PIE
Date: Fri, 14 Oct 2022 11:10:23 +0000 (GMT)	[thread overview]
Message-ID: <20221014111024.03C71385842F@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f98a7af815ce6f656eebe95e8dc21b63bb8ec9d2

commit f98a7af815ce6f656eebe95e8dc21b63bb8ec9d2
Author: Tom de Vries <tdevries@suse.de>
Date:   Fri Oct 14 13:09:51 2022 +0200

    [gdb/testsuite] Fix gdb.base/infoline-reloc-main-from-zero.exp with PIE
    
    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.

Diff:
---
 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 \

                 reply	other threads:[~2022-10-14 11:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221014111024.03C71385842F@sourceware.org \
    --to=vries@sourceware.org \
    --cc=gdb-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).