diff --git a/ldso/ldso/arm/dl-startup.h b/ldso/ldso/arm/dl-startup.h index b5f7d73..06c95cb 100644 --- a/ldso/ldso/arm/dl-startup.h +++ b/ldso/ldso/arm/dl-startup.h @@ -245,6 +245,7 @@ void PERFORM_BOOTSTRAP_RELOC(ELF_RELOC *rpnt, unsigned long *reloc_addr, break; case R_ARM_COPY: break; +#ifdef __FDPIC__ case R_ARM_FUNCDESC_VALUE: { struct funcdesc_value *dst = (struct funcdesc_value *) reloc_addr; @@ -253,6 +254,7 @@ void PERFORM_BOOTSTRAP_RELOC(ELF_RELOC *rpnt, unsigned long *reloc_addr, dst->got_value = load_addr.got_value; } break; +#endif default: SEND_STDERR("Unsupported relocation type\n"); _dl_exit(1); diff --git a/ldso/ldso/arm/dl-sysdep.h b/ldso/ldso/arm/dl-sysdep.h index 2bb0023..0288b0e 100644 --- a/ldso/ldso/arm/dl-sysdep.h +++ b/ldso/ldso/arm/dl-sysdep.h @@ -75,9 +75,10 @@ unsigned long _dl_linux_resolver(struct elf_resolve * tpnt, int reloc_entry); define the value. ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one - of the main executable's symbols, as for a COPY reloc. + of the main executable's symbols, as for a COPY reloc. */ - Avoid R_ARM_ABS32 to go through the PLT so that R_ARM_TARGET1 +#ifdef __FDPIC__ +/* Avoid R_ARM_ABS32 to go through the PLT so that R_ARM_TARGET1 translated to R_ARM_ABS32 doesn't use the PLT: otherwise, this breaks init_array because functions are referenced through the PLT. */ @@ -87,6 +88,13 @@ unsigned long _dl_linux_resolver(struct elf_resolve * tpnt, int reloc_entry); || (type) == R_ARM_TLS_DTPOFF32 || (type) == R_ARM_TLS_TPOFF32) \ * ELF_RTYPE_CLASS_PLT) \ | (((type) == R_ARM_COPY) * ELF_RTYPE_CLASS_COPY)) +#else +#define elf_machine_type_class(type) \ + ((((type) == R_ARM_JUMP_SLOT || (type) == R_ARM_TLS_DTPMOD32 \ + || (type) == R_ARM_TLS_DTPOFF32 || (type) == R_ARM_TLS_TPOFF32) \ + - ELF_RTYPE_CLASS_PLT) \ + | (((type) == R_ARM_COPY) * ELF_RTYPE_CLASS_COPY)) +#endif /* __FDPIC__ */ /* Return the link-time address of _DYNAMIC. Conveniently, this is the first element of the GOT. We used to use the PIC register to do this @@ -125,6 +133,7 @@ elf_machine_dynamic (void) extern char __dl_start[] __asm__("_dl_start"); +#ifdef __FDPIC__ /* We must force strings used early in the bootstrap into the data segment. */ #undef SEND_EARLY_STDERR @@ -133,6 +142,7 @@ extern char __dl_start[] __asm__("_dl_start"); #undef INIT_GOT #include "../fdpic/dl-sysdep.h" +#endif /* __FDPIC__ */ /* Return the run-time load address of the shared object. */ static __always_inline Elf32_Addr __attribute__ ((unused)) @@ -163,7 +173,11 @@ elf_machine_load_address (void) } static __always_inline void +#ifdef __FDPIC__ elf_machine_relative (DL_LOADADDR_TYPE load_off, const Elf32_Addr rel_addr, +#else +elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr, +#endif Elf32_Word relative_count) { #if defined(__FDPIC__) diff --git a/ldso/ldso/arm/elfinterp.c b/ldso/ldso/arm/elfinterp.c index 2444ed7..4c26835 100644 --- a/ldso/ldso/arm/elfinterp.c +++ b/ldso/ldso/arm/elfinterp.c @@ -343,6 +343,7 @@ _dl_do_reloc (struct elf_resolve *tpnt,struct r_scope_elem *scope, _dl_memcpy((void *) reloc_addr, (void *) symbol_addr, symtab[symtab_index].st_size); break; +#ifdef __FDPIC__ case R_ARM_FUNCDESC_VALUE: { struct funcdesc_value funcval; @@ -371,6 +372,7 @@ _dl_do_reloc (struct elf_resolve *tpnt,struct r_scope_elem *scope, *reloc_addr = reloc_value; } break; +#endif #if defined USE_TLS && USE_TLS case R_ARM_TLS_DTPMOD32: *reloc_addr = def_mod->l_tls_modid; @@ -422,6 +424,7 @@ _dl_do_lazy_reloc (struct elf_resolve *tpnt, struct r_scope_elem *scope, case R_ARM_JUMP_SLOT: *reloc_addr = DL_RELOC_ADDR(tpnt->loadaddr, *reloc_addr); break; +#ifdef __FDPIC__ case R_ARM_FUNCDESC_VALUE: { struct funcdesc_value *dst = (struct funcdesc_value *) reloc_addr; @@ -430,6 +433,7 @@ _dl_do_lazy_reloc (struct elf_resolve *tpnt, struct r_scope_elem *scope, dst->got_value = tpnt->loadaddr.got_value; } break; +#endif default: return -1; /*call _dl_exit(1) */ }