Re: [PATCH 2/4 v3] IPA: Add alloc_jump_pad_buffer target hook.

Ulrich Weigand
2016-04-01T14:43:57Z

> * linux-aarch64-ipa.c: Add <sys/mman.h> and <sys/auxv.h> includes.
> (alloc_jump_pad_buffer): New function.
> * linux-amd64-ipa.c: Add <sys/mman.h> include.
> (alloc_jump_pad_buffer): New function.
> * linux-i386-ipa.c (alloc_jump_pad_buffer): New function.
> * linux-s390-ipa.c: Add <sys/mman.h> and <sys/auxv.h> includes.
> (alloc_jump_pad_buffer): New function.
> * tracepoint.c (getauxval) [!HAVE_GETAUXVAL]: New function.
> (initialize_tracepoint): Delegate to alloc_jump_pad_buffer.
> * tracepoint.h (alloc_jump_pad_buffer): New prototype.
> (getauxval) [!HAVE_GETAUXVAL]: New prototype.

This caused a build failure on my RHEL5 Cell daily build, due to
gdb/gdbserver/linux-ppc-ipa.c: In function 'alloc_jump_pad_buffer':
gdb/gdbserver/linux-ppc-ipa.c:120: error: 'AT_PHDR' undeclared (first use in this function)

The problem seems to be that this system is so old it doesn't have
a <sys/auvx.h> header. You do provide a fallback getauxval implementation
for those systems, but the AT_PHDR value isn't available. It is actually
defined in my system headers, in <elf.h>, but this isn't pulled in ---
usually it would be implicitly included from <sys/auxv.h>.

It might be best to add an explicit #include <elf.h> to all files that
make use of AT_... constants, in case HAVE_GETAUXVAL is false.

Bye,
Ulrich

--
Dr. Ulrich Weigand
GNU/Linux compilers and toolchain
Ulrich.Weigand@de.ibm.com