Date: Sat, 15 Dec 2018 06:34:13 +0000 (UTC) From: Michal Meloun <mmel@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r342111 - stable/11/libexec/rtld-elf/aarch64 Message-ID: <201812150634.wBF6YDdr001655@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mmel Date: Sat Dec 15 06:34:13 2018 New Revision: 342111 URL: https://svnweb.freebsd.org/changeset/base/342111 Log: MFC r341738: Implement R_AARCH64_TLS_DTPMOD64 and A_AARCH64_TLS_DTPREL64 relocations. Although these are slightly obsolete in favor of R_AARCH64_TLSDESC, gcc -mtls-dialect=trad still use them. Modified: stable/11/libexec/rtld-elf/aarch64/reloc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/libexec/rtld-elf/aarch64/reloc.c ============================================================================== --- stable/11/libexec/rtld-elf/aarch64/reloc.c Sat Dec 15 06:22:48 2018 (r342110) +++ stable/11/libexec/rtld-elf/aarch64/reloc.c Sat Dec 15 06:34:13 2018 (r342111) @@ -217,6 +217,8 @@ reloc_plt(Obj_Entry *obj) case R_AARCH64_TLSDESC: reloc_tlsdesc(obj, rela, where); break; + case R_AARCH64_NONE: + break; default: _rtld_error("Unknown relocation type %u in PLT", (unsigned int)ELF_R_TYPE(rela->r_info)); @@ -342,6 +344,9 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int switch (ELF_R_TYPE(rela->r_info)) { case R_AARCH64_ABS64: case R_AARCH64_GLOB_DAT: + case R_AARCH64_TLS_TPREL64: + case R_AARCH64_TLS_DTPREL64: + case R_AARCH64_TLS_DTPMOD64: def = find_symdef(symnum, obj, &defobj, flags, cache, lockstate); if (def == NULL) @@ -392,8 +397,23 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int *where = def->st_value + rela->r_addend + defobj->tlsoffset; break; + + /* + * !!! BEWARE !!! + * ARM ELF ABI defines TLS_DTPMOD64 as 1029, and TLS_DTPREL64 + * as 1028. But actual bfd linker and the glibc RTLD linker + * treats TLS_DTPMOD64 as 1028 and TLS_DTPREL64 1029. + */ + case R_AARCH64_TLS_DTPREL64: /* efectively is TLS_DTPMOD64 */ + *where += (Elf_Addr)defobj->tlsindex; + break; + case R_AARCH64_TLS_DTPMOD64: /* efectively is TLS_DTPREL64 */ + *where += (Elf_Addr)(def->st_value + rela->r_addend); + break; case R_AARCH64_RELATIVE: *where = (Elf_Addr)(obj->relocbase + rela->r_addend); + break; + case R_AARCH64_NONE: break; default: rtld_printf("%s: Unhandled relocation %lu\n",
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201812150634.wBF6YDdr001655>