Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Re: Build failure on x32 (gdb 11.1)
       [not found] <20211121194556.nreowfixabal5ebj@pine>
@ 2021-11-22  6:46 ` Tom de Vries via Gdb-patches
  2021-11-22  8:38   ` Jan Palus
  0 siblings, 1 reply; 3+ messages in thread
From: Tom de Vries via Gdb-patches @ 2021-11-22  6:46 UTC (permalink / raw)
  To: Jan Palus, gdb-patches

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

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,
- Tom

[-- Attachment #2: tmp.patch --]
[-- Type: text/x-patch, Size: 868 bytes --]

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;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Build failure on x32 (gdb 11.1)
  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     ` [pushed][gdb/build] Fix x86_64 x32 build Tom de Vries via Gdb-patches
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Palus @ 2021-11-22  8:38 UTC (permalink / raw)
  To: Tom de Vries; +Cc: gdb-patches

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.


> 
> Thanks,
> - Tom


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pushed][gdb/build] Fix x86_64 x32 build
  2021-11-22  8:38   ` Jan Palus
@ 2021-11-22 11:23     ` Tom de Vries via Gdb-patches
  0 siblings, 0 replies; 3+ messages in thread
From: Tom de Vries via Gdb-patches @ 2021-11-22 11:23 UTC (permalink / raw)
  To: Jan Palus; +Cc: gdb-patches

[-- 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;

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-11-22 11:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [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     ` [pushed][gdb/build] Fix x86_64 x32 build Tom de Vries via Gdb-patches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox