[Bug gdb/26949] New: ELF target support seems broken on macOS 11

eblot.ml at gmail dot com sourceware-bugzilla@sourceware.org
Thu Nov 26 10:00:32 GMT 2020


https://sourceware.org/bugzilla/show_bug.cgi?id=26949

            Bug ID: 26949
           Summary: ELF target support seems broken on macOS 11
           Product: gdb
           Version: 10.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: eblot.ml at gmail dot com
  Target Milestone: ---

On macOS 11 (Big Sur), when GDB is built with an ELF target, for example
--target=riscv64-unknown-elf, GDB builds successfully.

At runtime, when an ELF file is loaded in GDB, the following message is raised:

I'm sorry, Dave, I can't do that.  Symbol format `elf32-littleriscv' unknown.

It appears that despite the successful build, GDB does not include ELF support,
as
gdb/config.h contains `#undef HAVE_ELF`

The root cause seems to be the gdb/configure script that fails to valide BFD
ELF support, around line 16832 on GDB 10.1, although the same issue arise with
the previous GDB 9.2 release.

The generated conftest.c test fails as strncmp function is used, but <string.h>
has not been included. I have not checked why the test file works on Linux
hosts and not on macOS hosts.

Anyway, adding <string.h> to acinclude.m4 fixes the trouble on macOS, such as
with:

--- a/gdb/acinclude.m4  2020-11-26 10:10:52.000000000 +0100
+++ b/gdb/acinclude.m4  2020-11-26 10:12:25.000000000 +0100
@@ -362,6 +362,7 @@
   AC_CACHE_CHECK([$1], [$2],
   [AC_TRY_LINK(
   [#include <stdlib.h>
+  #include <string.h>
   #include "bfd.h"
   #include "$4"
   ],

although I have no idea if this is the proper way to fix it. At least GDB keeps
building in macOS 11, and the resulting gdb application is able to load ELF
files.

As a side note, is it an expected behaviour that building for an explicit ELF
target completes successfully although ELF support cannot be included?

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Gdb-prs mailing list