[PATCH, GDB] Re: Should rename ELFOSABI_LINUX into ELFOSABI_GNU, and drop ELFOSABI_HURD
Thomas Schwinge
thomas@schwinge.name
Mon Jul 4 18:02:00 GMT 2011
Hallo!
On Mon, 04 Jul 2011 12:55:55 +0200, I wrote:
> On Mon, 4 Jul 2011 09:15:26 +0200, Samuel Thibault <samuel.thibault@ens-lyon.org> wrote:
> > Matt Rice, le Sun 03 Jul 2011 23:42:10 -0700, a écrit :
> > > On Sun, Jul 3, 2011 at 6:40 AM, Thomas Schwinge <thomas@schwinge.name> wrote:
> > > > On Thu, 30 Jun 2011 10:48:02 +0100, Nick Clifton <nickc@redhat.com> wrote:
> > > >> > [ELFOSABI_GNU]
> > > >>
> > > >> Approved - please apply.
> > > >
> > > > Applied, with the following additional changed:
> > >
> > > Hi, It isn't immediately obvious to me how to fix it but this patch
> > > broke gdb compilation,
> > >
> > > ELFOSABI_HURD and ELFOSABI_LINUX caused the respective i386gnu-tdep.c
> > > and i386-linux-tdep.c implementations to be used. Not sure what to
> > > replace that with, with these being the same and/or missing.
> >
> > I believe it should be turned into just one case (ELFOSABI_GNU), and
> > then use generic_elf_osabi_sniff_abi_tag_sections, as is done for
> > ELFOSABI_NONE, to distinguish between LINUX and HURD.
>
> That's what I'm thinking too, and here is the simple patch -- completely
> untested. Matt, are you interested in testing this? The must be no
> regressions for GNU/Linux [...]
No regressions in the testsuite for i686-pc-linux-gnu.
Additional manual testing:
GNU/Hurd box:
$ cp /bin/true true-h-0
$ cp /bin/true true-h-3
$ elfedit --output-osabi none true-h-0
$ elfedit --output-osabi linux true-h-3
(Need to use ``--output-osabi linux'' until ``--output-osabi GNU'' is
supported by the installed binutils version.)
GNU/Linux box:
$ cp /bin/true true-l-0
$ cp /bin/true true-l-3
$ elfedit --output-osabi none true-l-0
$ elfedit --output-osabi linux true-l-3
Without the patch, on i686-pc-linux-gnu:
$ for f in ~/tmp/true-*; do echo "* $(basename "$f"):" && gdb/gdb --batch -q -ex 'show osabi' "$f"; done
* true-h-0:
warning: A handler for the OS ABI "GNU/Hurd" is not built into this configuration
of GDB. Attempting to continue with the default i386 settings.
The current OS ABI is "auto" (currently "GNU/Hurd").
The default OS ABI is "GNU/Linux".
* true-h-3:
The current OS ABI is "auto" (currently "GNU/Linux").
The default OS ABI is "GNU/Linux".
* true-l-0:
The current OS ABI is "auto" (currently "GNU/Linux").
The default OS ABI is "GNU/Linux".
* true-l-3:
The current OS ABI is "auto" (currently "GNU/Linux").
The default OS ABI is "GNU/Linux".
(true-h-3 should fail in the same way as true-h-0.)
With the patch, on i686-pc-linux-gnu:
$ for f in ~/tmp/true-*; do echo "* $(basename "$f"):" && gdb/gdb --batch -q -ex 'show osabi' "$f"; done
* true-h-0:
warning: A handler for the OS ABI "GNU/Hurd" is not built into this configuration
of GDB. Attempting to continue with the default i386 settings.
The current OS ABI is "auto" (currently "GNU/Hurd").
The default OS ABI is "GNU/Linux".
* true-h-3:
warning: A handler for the OS ABI "GNU/Hurd" is not built into this configuration
of GDB. Attempting to continue with the default i386 settings.
The current OS ABI is "auto" (currently "GNU/Hurd").
The default OS ABI is "GNU/Linux".
* true-l-0:
The current OS ABI is "auto" (currently "GNU/Linux").
The default OS ABI is "GNU/Linux".
* true-l-3:
The current OS ABI is "auto" (currently "GNU/Linux").
The default OS ABI is "GNU/Linux".
All OK.
With the patch, on i686-unknown-gnu0.3:
$ for f in ~/tmp/true-*; do echo "* $(basename "$f"):" && gdb/gdb --batch -q -ex 'show osabi' "$f"; done
* true-h-0:
The current OS ABI is "auto" (currently "GNU/Hurd").
The default OS ABI is "GNU/Hurd".
* true-h-3:
The current OS ABI is "auto" (currently "GNU/Hurd").
The default OS ABI is "GNU/Hurd".
* true-l-0:
warning: A handler for the OS ABI "GNU/Linux" is not built into this configuration
of GDB. Attempting to continue with the default i386 settings.
The current OS ABI is "auto" (currently "GNU/Linux").
The default OS ABI is "GNU/Hurd".
* true-l-3:
warning: A handler for the OS ABI "GNU/Linux" is not built into this configuration
of GDB. Attempting to continue with the default i386 settings.
The current OS ABI is "auto" (currently "GNU/Linux").
The default OS ABI is "GNU/Hurd".
All OK.
> 2011-07-04 Thomas Schwinge <thomas@schwinge.name>
>
> gdb/
> * osabi.c (generic_elf_osabi_sniffer) <ELFOSABI_GNU>: Handle in the
> same way as ELFOSABI_NONE.
> <ELFOSABI_LINUX, ELFOSABI_HURD>: Remove cases.
>
> diff --git a/gdb/osabi.c b/gdb/osabi.c
> index a264924..7820ecb 100644
> --- a/gdb/osabi.c
> +++ b/gdb/osabi.c
> @@ -519,6 +519,11 @@ generic_elf_osabi_sniffer (bfd *abfd)
> the base specification for that machine (there are no
> OS-specific extensions). In order to determine the real OS
> in use we must look for OS-specific notes. */
> + /* Fall through. */
> +
> + case ELFOSABI_GNU:
> + /* The same applies for ELFOSABI_GNU: this can mean GNU/Hurd, GNU/Linux,
> + and possibly more. */
> bfd_map_over_sections (abfd,
> generic_elf_osabi_sniff_abi_tag_sections,
> &osabi);
> @@ -532,14 +537,6 @@ generic_elf_osabi_sniffer (bfd *abfd)
> osabi = GDB_OSABI_NETBSD_ELF;
> break;
>
> - case ELFOSABI_LINUX:
> - osabi = GDB_OSABI_LINUX;
> - break;
> -
> - case ELFOSABI_HURD:
> - osabi = GDB_OSABI_HURD;
> - break;
> -
> case ELFOSABI_SOLARIS:
> osabi = GDB_OSABI_SOLARIS;
> break;
OK for HEAD?
I now had a look at the complete ``Cygnus src tree'', and there is no
further use of ELFOSABI_HURD. There is an additional definition of it in
winsup/cygwin/include/sys/elf_common.h (and ELFOSABI_GNU missing). Is
that file still in active use?
Grüße,
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 489 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20110704/8304a711/attachment.sig>
More information about the Gdb-patches
mailing list