summaryrefslogtreecommitdiffstats
path: root/libexec/rtld-elf
diff options
context:
space:
mode:
authorandrew <andrew@FreeBSD.org>2017-04-20 12:48:01 +0000
committerandrew <andrew@FreeBSD.org>2017-04-20 12:48:01 +0000
commit3cf5b32278c1f90c768904c77318567294150318 (patch)
tree3dc3aad095a5986cefa77e334a1e51bd83979d6a /libexec/rtld-elf
parent28e785bd9db197f512ffc1a04b12abc7282958b0 (diff)
downloadFreeBSD-src-3cf5b32278c1f90c768904c77318567294150318.zip
FreeBSD-src-3cf5b32278c1f90c768904c77318567294150318.tar.gz
MFC r312764:
Pull the R_AARCH64_TLSDESC code out into a common function and use them in both the plt and non-plt case. This fixes an issue where libraries built with LLD can fail with "Unhandled relocation 1031"
Diffstat (limited to 'libexec/rtld-elf')
-rw-r--r--libexec/rtld-elf/aarch64/reloc.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/libexec/rtld-elf/aarch64/reloc.c b/libexec/rtld-elf/aarch64/reloc.c
index 41f9396..c298195 100644
--- a/libexec/rtld-elf/aarch64/reloc.c
+++ b/libexec/rtld-elf/aarch64/reloc.c
@@ -184,6 +184,18 @@ rtld_tlsdesc_handle(struct tls_data *tlsdesc, int flags)
return (tlsdesc->index);
}
+static void
+reloc_tlsdesc(Obj_Entry *obj, const Elf_Rela *rela, Elf_Addr *where)
+{
+ if (ELF_R_SYM(rela->r_info) == 0) {
+ where[0] = (Elf_Addr)_rtld_tlsdesc;
+ where[1] = obj->tlsoffset + rela->r_addend;
+ } else {
+ where[0] = (Elf_Addr)_rtld_tlsdesc_dynamic;
+ where[1] = (Elf_Addr)reloc_tlsdesc_alloc(obj, rela);
+ }
+}
+
/*
* Process the PLT relocations.
*/
@@ -204,14 +216,7 @@ reloc_plt(Obj_Entry *obj)
*where += (Elf_Addr)obj->relocbase;
break;
case R_AARCH64_TLSDESC:
- if (ELF_R_SYM(rela->r_info) == 0) {
- where[0] = (Elf_Addr)_rtld_tlsdesc;
- where[1] = obj->tlsoffset + rela->r_addend;
- } else {
- where[0] = (Elf_Addr)_rtld_tlsdesc_dynamic;
- where[1] = (Elf_Addr)reloc_tlsdesc_alloc(obj,
- rela);
- }
+ reloc_tlsdesc(obj, rela, where);
break;
default:
_rtld_error("Unknown relocation type %u in PLT",
@@ -361,6 +366,9 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int flags,
return (-1);
}
break;
+ case R_AARCH64_TLSDESC:
+ reloc_tlsdesc(obj, rela, where);
+ break;
case R_AARCH64_TLS_TPREL64:
def = find_symdef(symnum, obj, &defobj, flags, cache,
lockstate);
OpenPOWER on IntegriCloud