This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Handle PowerPC64 ELFv1 function descriptors in libbacktrace (PR other/82368)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Szabolcs Nagy <szabolcs dot nagy at arm dot com>
- Cc: Ian Lance Taylor <iant at golang dot org>, Segher Boessenkool <segher at kernel dot crashing dot org>, David Edelsohn <dje dot gcc at gmail dot com>, Alan Modra <amodra at gmail dot com>, nd at arm dot com, gcc-patches at gcc dot gnu dot org
- Date: Thu, 15 Feb 2018 12:33:01 +0100
- Subject: Re: [PATCH] Handle PowerPC64 ELFv1 function descriptors in libbacktrace (PR other/82368)
- Authentication-results: sourceware.org; auth=none
- References: <20180214114138.GX5867@tucnak> <a7e63471-e9c1-c7a1-7968-5f6182c5c583@arm.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Thu, Feb 15, 2018 at 11:08:20AM +0000, Szabolcs Nagy wrote:
> > --- libbacktrace/elf.c.jj 2018-02-08 20:46:10.671242369 +0000
> > +++ libbacktrace/elf.c 2018-02-14 08:39:06.674088951 +0000
> ...
> > @@ -2857,6 +2889,23 @@ elf_add (struct backtrace_state *state,
> > debuglink_crc = *(const uint32_t*)(debuglink_data + crc_offset);
> > }
> > }
> > +
> > + /* Read the .opd section on PowerPC64 ELFv1. */
> > + if (ehdr.e_machine == EM_PPC64
> > + && (ehdr.e_flags & EF_PPC64_ABI) < 2
> > + && shdr->sh_type == SHT_PROGBITS
>
> this broke baremetal arm targets (e.g. aarch64-none-elf with newlib)
>
> ...src/gcc/libbacktrace/elf.c: In function 'elf_add':
> ...src/gcc/libbacktrace/elf.c:2896:24: error: 'SHT_PROGBITS' undeclared (first use in this function)
>
> && shdr->sh_type == SHT_PROGBITS
> ^~~~~~~~~~~~
Oops, sorry, fixed thusly, committed as obvious to trunk.
2018-02-15 Jakub Jelinek <jakub@redhat.com>
PR other/82368
* elf.c (SHT_PROGBITS): Undefine and define.
--- libbacktrace/elf.c.jj 2018-02-14 15:19:13.849333101 +0100
+++ libbacktrace/elf.c 2018-02-15 12:30:53.948579969 +0100
@@ -170,6 +170,7 @@ dl_iterate_phdr (int (*callback) (struct
#undef SHN_LORESERVE
#undef SHN_XINDEX
#undef SHN_UNDEF
+#undef SHT_PROGBITS
#undef SHT_SYMTAB
#undef SHT_STRTAB
#undef SHT_DYNSYM
@@ -267,6 +268,7 @@ typedef struct {
#define SHN_LORESERVE 0xFF00 /* Begin range of reserved indices */
#define SHN_XINDEX 0xFFFF /* Section index is held elsewhere */
+#define SHT_PROGBITS 1
#define SHT_SYMTAB 2
#define SHT_STRTAB 3
#define SHT_DYNSYM 11
Jakub