diff options
Diffstat (limited to 'libc/ports/sysdeps/aarch64/dl-irel.h')
-rw-r--r-- | libc/ports/sysdeps/aarch64/dl-irel.h | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/libc/ports/sysdeps/aarch64/dl-irel.h b/libc/ports/sysdeps/aarch64/dl-irel.h index 1a3811e7b..78395caf2 100644 --- a/libc/ports/sysdeps/aarch64/dl-irel.h +++ b/libc/ports/sysdeps/aarch64/dl-irel.h @@ -1,6 +1,6 @@ /* Machine-dependent ELF indirect relocation inline functions. AArch64 version. - Copyright (C) 2012-2013 Free Software Foundation, Inc. + Copyright (C) 2012-2014 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -22,15 +22,31 @@ #include <stdio.h> #include <unistd.h> +#include <ldsodefs.h> -/* AArch64 does not yet implement IFUNC support. However since - 2011-06-20 provision of a elf_ifunc_invoke has been mandatory. */ +#define ELF_MACHINE_IRELA 1 static inline ElfW(Addr) __attribute ((always_inline)) elf_ifunc_invoke (ElfW(Addr) addr) { - return ((ElfW(Addr) (*) (void)) (addr)) (); + return ((ElfW(Addr) (*) (unsigned long int)) (addr)) (GLRO(dl_hwcap)); +} + +static inline void +__attribute ((always_inline)) +elf_irela (const ElfW(Rela) *reloc) +{ + ElfW(Addr) *const reloc_addr = (void *) reloc->r_offset; + const unsigned long int r_type = ELFW(R_TYPE) (reloc->r_info); + + if (__glibc_likely (r_type == R_AARCH64_IRELATIVE)) + { + ElfW(Addr) value = elf_ifunc_invoke (reloc->r_addend); + *reloc_addr = value; + } + else + __libc_fatal ("unexpected reloc type in static binary"); } #endif |