This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Handle PowerPC64 ELFv1 function descriptors in libbacktrace (PR other/82368)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]