Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Gary Benson <gbenson@redhat.com>
To: Simon Marchi <simon.marchi@polymtl.ca>
Cc: gdb@sourceware.org
Subject: Re: Minimum kernel and glibc versions to build on GNU/Linux?
Date: Thu, 27 Sep 2018 08:43:00 -0000	[thread overview]
Message-ID: <20180927084345.GA25872@blade.nx> (raw)
In-Reply-To: <320801121f7fa389eaa3e149de74d230@polymtl.ca>

Simon Marchi wrote:
> On 2018-09-26 10:53, Gary Benson wrote:
> > Are there specific minimum kernel and glibc versions required to
> > build GDB or gdbserver on GNU/Linux? I'm working on a refactor
> > that's complicated by workarounds for ancient versions of both
> > (circa 2002) and I'm wondering if I can just drop the workarounds.
> 
> I'd say that if something was introduced in 2002, we can safely
> assume it will be available.  But it would be easier to tell if you
> specified which particular feature you would like to rely on.

Hi Simon,

I noticed there's two gdb_proc_service.h files, so I'm trying to
merge them.  I have them pretty close, but I'm still working on
this difference:

  #ifndef HAVE_PRGREGSET_T
 -typedef gdb_gregset_t prgregset_t;
 +typedef elf_gregset_t prgregset_t;
  #endif

  #ifndef HAVE_PRFPREGSET_T
 -typedef gdb_fpregset_t prfpregset_t;
 +typedef elf_fpregset_t prfpregset_t;
  #endif

Now, my machine has:

  /usr/include/linux/elfcore.h: typedef elf_gregset_t gregset_t;
  /usr/include/linux/elfcore.h: typedef elf_fpregset_t fpregset_t;

and:

  gdb/gregset.h: #define GDB_GREGSET_T gregset_t
  gdb/gregset.h:#define GDB_FPREGSET_T fpregset_t

  gdb/gregset.h: typedef GDB_GREGSET_T gdb_gregset_t;
  gdb/gregset.h:typedef GDB_FPREGSET_T gdb_fpregset_t;

so they are actually the same types on my machine.  I'm not sure how
long this equivalence has been true, or if it's true on all platforms,
but if it is I'll make them both use the same type.  Except, the
workarounds complicate things.  GDB has this:

  /* Unfortunately glibc 2.1.3 was released with a broken prfpregset_t
     type.  We let configure check for this lossage, and make
     appropriate typedefs here.  */

  #ifdef PRFPREGSET_T_BROKEN
  typedef gdb_fpregset_t gdb_prfpregset_t;
  #else
  typedef prfpregset_t gdb_prfpregset_t;
  #endif

and gdbserver has this:

  /* Not all platforms bring in <linux/elf.h> via <sys/procfs.h>.  If
     <sys/procfs.h> wasn't enough to find elf_fpregset_t, try the kernel
     headers also (but don't if we don't need to).  */
  #ifndef HAVE_ELF_FPREGSET_T
  # ifdef HAVE_LINUX_ELF_H
  #  include <linux/elf.h>
  # endif
  #endif

I think nobody needs the GDB workaround.  glibc 2.1.3 was released
2000-02-24 and superseded 2000-11-09 so this is real old, and the
workaround isn't in gdbserver, so presumably gdbserver would be
failing to build if anyone still required that workaround, unless
they're building GDB without gdbserver (is this possible?)

I'm not sure if the gdbserver-only workaround is required, maybe it is
on some non x86 platforms, but if it's valid to make gdbserver use
gregset_t and fpregset_t everywhere then the gdbserver workaround
shouldn't be needed.

Anyway, I'm still researching this.  Note that the gdb_proc_service.h
files are only used on GNU/Linux, the Solaris implementation is
entirely separate, so I don't need to consider that.

Cheers,
Gary


      reply	other threads:[~2018-09-27  8:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-26 14:54 Gary Benson
2018-09-26 15:00 ` Simon Marchi
2018-09-27  8:43   ` Gary Benson [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=20180927084345.GA25872@blade.nx \
    --to=gbenson@redhat.com \
    --cc=gdb@sourceware.org \
    --cc=simon.marchi@polymtl.ca \
    /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