Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries via Gdb-patches <gdb-patches@sourceware.org>
To: Jan Palus <atler@pld-linux.org>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: [pushed][gdb/build] Fix x86_64 x32 build
Date: Mon, 22 Nov 2021 12:23:46 +0100	[thread overview]
Message-ID: <67c5fad3-52af-b96b-136c-41070352403b@suse.de> (raw)
In-Reply-To: <20211122083842.zhqyr2r73lkvahdh@pine>

[-- Attachment #1: Type: text/plain, Size: 1534 bytes --]

On 11/22/21 9:38 AM, Jan Palus wrote:
> On 22.11.2021 07:46, Tom de Vries wrote:
>> On 11/21/21 8:45 PM, Jan Palus wrote:
>>> gdb 11.1 fails during compilation on x32 ABI:
>>>
>>> ../.././gdbserver/../gdb/nat/amd64-linux-siginfo.c:280:42: error: 'struct compat_x32_siginfo_t::<unnamed union>::<unnamed>' has no member named 'si_addr_bnd'
>>> 280 | #define cpt_si_lower _sifields._sigfault.si_addr_bnd._lower
>>> | ^~~~~~~~~~~
>>> ../.././gdbserver/../gdb/nat/amd64-linux-siginfo.c:337:38: note: in expansion of macro 'cpt_si_lower'
>>> 337 | to->cpt_si_lower = from_ptrace.cpt_si_lower;
>>> | ^~~~~~~~~~~~
>>> ../.././gdbserver/../gdb/nat/amd64-linux-siginfo.c:281:42: error: 'struct compat_x32_siginfo_t::<unnamed union>::<unnamed>' has no member named 'si_addr_bnd'
>>> 281 | #define cpt_si_upper _sifields._sigfault.si_addr_bnd._upper
>>> | ^~~~~~~~~~~
>>> ../.././gdbserver/../gdb/nat/amd64-linux-siginfo.c:338:38: note: in expansion of macro 'cpt_si_upper'
>>> 338 | to->cpt_si_upper = from_ptrace.cpt_si_upper;
>>> | ^~~~~~~~~~~~
>>>
>>> I believe it is caused by https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=d3d7d1b
>>
>> Hi,
>>
>> I've attached a conservative fix, can you check whether that fixes the
>> build breaker?
> 
> Thanks. That's essentially the same fix as the temporary workaround I
> came up with:
> 
> http://git.pld-linux.org/?p=packages/gdb.git;a=commitdiff;h=9f79cb7
> 
> and can confirm that it fixes the failure and build is successful on x32.

Committed as attached below.

Thanks,
- Tom


[-- Attachment #2: 0001-gdb-build-Fix-x86_64-x32-build.patch --]
[-- Type: text/x-patch, Size: 1788 bytes --]

[gdb/build] Fix x86_64 x32 build

A build error on x86_64 with x32 abi was reported here (
https://sourceware.org/pipermail/gdb/2021-November/049787.html ):
...
gdb/nat/amd64-linux-siginfo.c:280:42: error: \
  'struct compat_x32_siginfo_t::<unnamed union>::<unnamed>' has no member \
  named 'si_addr_bnd'
280 | #define cpt_si_lower _sifields._sigfault.si_addr_bnd._lower
| ^~~~~~~~~~~
gdb/nat/amd64-linux-siginfo.c:337:38: note: in expansion of macro 'cpt_si_lower'
337 | to->cpt_si_lower = from_ptrace.cpt_si_lower;
| ^~~~~~~~~~~~
...

The problem is that code added in commit d3d7d1ba3bb "[gdb/tdep] Handle
si_addr_bnd in compat_siginfo_from_siginfo" doesn't compile on an x86_64 x32
setup, because compat_x32_siginfo_t doesn't have the si_addr_bnd fields.

Fix this conservatively by disabling the code for x32.

Tested on x86_64-linux.

---
 gdb/nat/amd64-linux-siginfo.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gdb/nat/amd64-linux-siginfo.c b/gdb/nat/amd64-linux-siginfo.c
index 342840e5085..fc52b5b6056 100644
--- a/gdb/nat/amd64-linux-siginfo.c
+++ b/gdb/nat/amd64-linux-siginfo.c
@@ -330,6 +330,9 @@ compat_siginfo_from_siginfo (compat_siginfo_t *to, const siginfo_t *from)
       to->cpt_si_pid = from_ptrace.cpt_si_pid;
       to->cpt_si_uid = from_ptrace.cpt_si_uid;
     }
+#ifndef __ILP32__
+  /* The struct compat_x32_siginfo_t doesn't contain
+     cpt_si_lower/cpt_si_upper.  */
   else if (to->si_code == SEGV_BNDERR
 	   && to->si_signo == SIGSEGV)
     {
@@ -337,6 +340,7 @@ compat_siginfo_from_siginfo (compat_siginfo_t *to, const siginfo_t *from)
       to->cpt_si_lower = from_ptrace.cpt_si_lower;
       to->cpt_si_upper = from_ptrace.cpt_si_upper;
     }
+#endif
   else if (to->si_code < 0)
     {
       to->cpt_si_pid = from_ptrace.cpt_si_pid;

      reply	other threads:[~2021-11-22 11:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20211121194556.nreowfixabal5ebj@pine>
2021-11-22  6:46 ` Build failure on x32 (gdb 11.1) Tom de Vries via Gdb-patches
2021-11-22  8:38   ` Jan Palus
2021-11-22 11:23     ` Tom de Vries via Gdb-patches [this message]

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=67c5fad3-52af-b96b-136c-41070352403b@suse.de \
    --to=gdb-patches@sourceware.org \
    --cc=atler@pld-linux.org \
    --cc=tdevries@suse.de \
    /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