From owner-svn-src-all@freebsd.org Thu Apr 20 12:48:03 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1C220D4848E; Thu, 20 Apr 2017 12:48:03 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C7ACAE4B; Thu, 20 Apr 2017 12:48:02 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3KCm145087365; Thu, 20 Apr 2017 12:48:01 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3KCm1cn087364; Thu, 20 Apr 2017 12:48:01 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201704201248.v3KCm1cn087364@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 20 Apr 2017 12:48:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317189 - stable/11/libexec/rtld-elf/aarch64 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Apr 2017 12:48:03 -0000 Author: andrew Date: Thu Apr 20 12:48:01 2017 New Revision: 317189 URL: https://svnweb.freebsd.org/changeset/base/317189 Log: 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" 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 Thu Apr 20 11:52:10 2017 (r317188) +++ stable/11/libexec/rtld-elf/aarch64/reloc.c Thu Apr 20 12:48:01 2017 (r317189) @@ -184,6 +184,18 @@ rtld_tlsdesc_handle(struct tls_data *tls 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 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);