gdb/configure: fail configure if all targets requested with 32bit bfd

Message ID 20250123201338.158819-2-guinevere@redhat.com
State New
Headers
Series gdb/configure: fail configure if all targets requested with 32bit bfd |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Test passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Test passed

Commit Message

Guinevere Larsen Jan. 23, 2025, 8:13 p.m. UTC
  As PR sim/28684 explains, it isn't possible to compile GDB with all
targets enabled and not enabling 64 bit bfd. In 64 bit hosts, 64 bit bfd
is forced, so the build works, but in 32 bit hosts, that has to be
explicitly enabled.

I ran into this when I tried compiling GDB on a mips64 machine running a
32 bit OS. Along with the errors in the PR, several other architectures
are also required, notably aarch64 and other explicitly 64bit targets.
Additionally, some 32 bit files required for the gdb mips target aren't
added to the makefile.

Considering the last comment in the bug says this isn't going to be
fixed on the binutils side, I didn't think it was worth trying to fix
the GDB side. Instead, this commit causes the configure script to fail
if all targets were requested and 64 bit bfd isn't enabled. If that is
ever fixed, we can revert this commit.

I considered adding this to the top level configure script, but couldn't
figure out how to detect the situation in there, so this was my next
best idea.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28684
---
 gdb/configure    | 4 +++-
 gdb/configure.ac | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)
  

Comments

Kevin Buettner Jan. 28, 2025, 1:11 a.m. UTC | #1
On Thu, 23 Jan 2025 17:13:39 -0300
Guinevere Larsen <guinevere@redhat.com> wrote:

> As PR sim/28684 explains, it isn't possible to compile GDB with all
> targets enabled and not enabling 64 bit bfd. In 64 bit hosts, 64 bit bfd
> is forced, so the build works, but in 32 bit hosts, that has to be
> explicitly enabled.
> 
> I ran into this when I tried compiling GDB on a mips64 machine running a
> 32 bit OS. Along with the errors in the PR, several other architectures
> are also required, notably aarch64 and other explicitly 64bit targets.
> Additionally, some 32 bit files required for the gdb mips target aren't
> added to the makefile.
> 
> Considering the last comment in the bug says this isn't going to be
> fixed on the binutils side, I didn't think it was worth trying to fix
> the GDB side. Instead, this commit causes the configure script to fail
> if all targets were requested and 64 bit bfd isn't enabled. If that is
> ever fixed, we can revert this commit.
> 
> I considered adding this to the top level configure script, but couldn't
> figure out how to detect the situation in there, so this was my next
> best idea.
> 
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28684

Sounds like the right approach to me...

Approved-by: Kevin Buettner <kevinb@redhat.com>
  
Guinevere Larsen Jan. 28, 2025, 12:07 p.m. UTC | #2
On 1/27/25 10:11 PM, Kevin Buettner wrote:
> On Thu, 23 Jan 2025 17:13:39 -0300
> Guinevere Larsen <guinevere@redhat.com> wrote:
>
>> As PR sim/28684 explains, it isn't possible to compile GDB with all
>> targets enabled and not enabling 64 bit bfd. In 64 bit hosts, 64 bit bfd
>> is forced, so the build works, but in 32 bit hosts, that has to be
>> explicitly enabled.
>>
>> I ran into this when I tried compiling GDB on a mips64 machine running a
>> 32 bit OS. Along with the errors in the PR, several other architectures
>> are also required, notably aarch64 and other explicitly 64bit targets.
>> Additionally, some 32 bit files required for the gdb mips target aren't
>> added to the makefile.
>>
>> Considering the last comment in the bug says this isn't going to be
>> fixed on the binutils side, I didn't think it was worth trying to fix
>> the GDB side. Instead, this commit causes the configure script to fail
>> if all targets were requested and 64 bit bfd isn't enabled. If that is
>> ever fixed, we can revert this commit.
>>
>> I considered adding this to the top level configure script, but couldn't
>> figure out how to detect the situation in there, so this was my next
>> best idea.
>>
>> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28684
> Sounds like the right approach to me...
>
> Approved-by: Kevin Buettner <kevinb@redhat.com>
>
Thanks, pushed!
  

Patch

diff --git a/gdb/configure b/gdb/configure
index 1531f62f76a..cfb4f446ef8 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -25005,7 +25005,9 @@  if test x${all_targets} = xtrue; then
   if test x${enable_64_bit_bfd} = xyes; then
     TARGET_OBS='$(ALL_TARGET_OBS) $(ALL_64_TARGET_OBS)'
   else
-    TARGET_OBS='$(ALL_TARGET_OBS)'
+    # If all targets were requested, but 64 bit bfd is not enabled,
+    # the build will fail. See PR 28684.
+    as_fn_error $? "--enable-targets=all requires --enable-64-bit-bfd" "$LINENO" 5
   fi
 fi
 
diff --git a/gdb/configure.ac b/gdb/configure.ac
index e9312b1bc64..77f774e23ee 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -257,7 +257,9 @@  if test x${all_targets} = xtrue; then
   if test x${enable_64_bit_bfd} = xyes; then
     TARGET_OBS='$(ALL_TARGET_OBS) $(ALL_64_TARGET_OBS)'
   else
-    TARGET_OBS='$(ALL_TARGET_OBS)'
+    # If all targets were requested, but 64 bit bfd is not enabled,
+    # the build will fail. See PR 28684.
+    AC_MSG_ERROR([--enable-targets=all requires --enable-64-bit-bfd])
   fi
 fi