From nobody Fri May 17 10:21:53 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VgjgQ26Zpz5KwJf; Fri, 17 May 2024 10:21:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VgjgP74Lqz53Hg; Fri, 17 May 2024 10:21:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715941314; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jUlaljsqZBHkwks/YcC8I3x9oqP04mJJtOLI7JNGvyo=; b=xzbvBd2aHrpAHF5B+Ikpp53Zt/drXmFCae/B/LjAg4eYaR8BgZepHHGVr+GBRiopG1DgN+ rA0Bgk8C5n7AkHBZv22SDTxxaKPI2nzwjN9Ox7tSztgAPD/Xg1DxV/AnNpsBkEdxKu0F63 mWtzjhJ1ogDQX3odvX2cwoO5zuCr5c9Oyd3qM+CCgB0FzJJSPiWJ3PIfSTFZCSMJ/K7nsb QvK0DP6qVRIPv0JD7pW3FTxLe9KBMP2qloi4NSjuCMA1b+OwNc86oG7VBZ8hRLZ2SAEv2u P/3qTw8xFCnVniEBcIj2ckMbRCcKa1reD2nIb0tZPVJCNG3xkBiyqtM+Pssg9g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715941314; a=rsa-sha256; cv=none; b=as9GivtLDaQeZAUAY0hDqtngB7BrOTQmEjgGIacVVrbP1r75fCv4/X5awkBr0OZVuCmk3s Y0guJc1k93m94owPO153P/eysAEUxUwn5cLqdC4ivoWu+yRbhPwccJ1jJuOuorn6opqeIA 40ppH4XzRX0JzRq+stKhtlwr0m3NMNo7o7P39/mmP1OhTBdv4ZibH+0QwzHDFMF2trOxXI gFpk4Jpgv247d3a3Vl6dqUWrFm1LnVSU9ow/yZV1PR2K8UctojxkDdSsTvYKicvIfkIbFR JbVUX/moPdKlyyAiB3Yy/jIpixkmECCzbMwH37ujOrfMrKTCX9iTwUODuriufg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715941314; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jUlaljsqZBHkwks/YcC8I3x9oqP04mJJtOLI7JNGvyo=; b=X6ThcwAufpGZfFGILFXv26KHL4yBHJRtifZC+30j8xiTiqlOEa646IfqsTsX3nwoCn2kf9 CweelWf4se29ixWkxl5v+WodAA/K7YSzQmLqZt+Wdf+fE6ezKSVUPlNXKCk7jMcOHSUrC6 y7jqYql5bpASwXmksZLpXxmRFuuCrjBDoALKLZrwVIrubnLAU4hHatJqFPmU3J0UyrswlY 4Bbnamp9QVANSMS4mlNmMSI8hCPp/4sQX91BGXK2dUSxIRM6jKVerxReA3o0AAFfu/gD6x RRF+ALP2rKzGi9W5mX0JUQD8C1wJJa8sP/fT9KC8TDTN9SSxEhR3PgeRnp/1hQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VgjgP6gN7zfDR; Fri, 17 May 2024 10:21:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 44HALrDH071607; Fri, 17 May 2024 10:21:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44HALrxd071584; Fri, 17 May 2024 10:21:53 GMT (envelope-from git) Date: Fri, 17 May 2024 10:21:53 GMT Message-Id: <202405171021.44HALrxd071584@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 1cd90a2c16dd - main - rtld: Move powerpc specific code to powerpc files List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1cd90a2c16dd2e22dd6f6c8e1ebd3eff0fe4993a Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=1cd90a2c16dd2e22dd6f6c8e1ebd3eff0fe4993a commit 1cd90a2c16dd2e22dd6f6c8e1ebd3eff0fe4993a Author: Andrew Turner AuthorDate: 2024-05-13 18:13:07 +0000 Commit: Andrew Turner CommitDate: 2024-05-17 09:37:23 +0000 rtld: Move powerpc specific code to powerpc files There are two variables set by dynamic tags in the powerpc runtime linker. Now we have a way to split out architecture-specific dynamic tags use it to handle these. Reviewed by: kib, jhibbits Obtained from: jhibbits (earlier version) Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D45182 --- libexec/rtld-elf/powerpc/reloc.c | 11 +++++++++++ libexec/rtld-elf/powerpc/rtld_machdep.h | 6 +++--- libexec/rtld-elf/powerpc64/reloc.c | 11 +++++++++++ libexec/rtld-elf/powerpc64/rtld_machdep.h | 6 +++--- libexec/rtld-elf/rtld.c | 12 ------------ libexec/rtld-elf/rtld.h | 7 ------- 6 files changed, 28 insertions(+), 25 deletions(-) diff --git a/libexec/rtld-elf/powerpc/reloc.c b/libexec/rtld-elf/powerpc/reloc.c index 73a1c89991e2..5618efb7f716 100644 --- a/libexec/rtld-elf/powerpc/reloc.c +++ b/libexec/rtld-elf/powerpc/reloc.c @@ -57,6 +57,17 @@ void _rtld_bind_secureplt_start(void); +bool +arch_digest_dynamic(struct Struct_Obj_Entry *obj, const Elf_Dyn *dynp) +{ + if (dynp->d_tag == DT_PPC_GOT) { + obj->gotptr = (Elf_Addr *)(obj->relocbase + dynp->d_un.d_ptr); + return (true); + } + + return (false); +} + /* * Process the R_PPC_COPY relocations */ diff --git a/libexec/rtld-elf/powerpc/rtld_machdep.h b/libexec/rtld-elf/powerpc/rtld_machdep.h index 69fc52369201..ec470f238991 100644 --- a/libexec/rtld-elf/powerpc/rtld_machdep.h +++ b/libexec/rtld-elf/powerpc/rtld_machdep.h @@ -35,13 +35,13 @@ struct Struct_Obj_Entry; -#define MD_OBJ_ENTRY +#define MD_OBJ_ENTRY \ + Elf_Addr *gotptr; /* GOT pointer (secure-plt only) */ /* Return the address of the .dynamic section in the dynamic linker. */ #define rtld_dynamic(obj) (&_DYNAMIC) -/* No arch-specific dynamic tags */ -#define arch_digest_dynamic(obj, dynp) false +bool arch_digest_dynamic(struct Struct_Obj_Entry *, const Elf_Dyn *); /* No architecture specific notes */ #define arch_digest_note(obj, note) false diff --git a/libexec/rtld-elf/powerpc64/reloc.c b/libexec/rtld-elf/powerpc64/reloc.c index 70928829aeda..2d06d5821d1b 100644 --- a/libexec/rtld-elf/powerpc64/reloc.c +++ b/libexec/rtld-elf/powerpc64/reloc.c @@ -52,6 +52,17 @@ struct funcdesc { }; #endif +bool +arch_digest_dynamic(struct Struct_Obj_Entry *obj, const Elf_Dyn *dynp) +{ + if (dynp->d_tag == DT_PPC64_GLINK) { + obj->glink = (Elf_Addr)(obj->relocbase + dynp->d_un.d_ptr); + return (true); + } + + return (false); +} + /* * Process the R_PPC_COPY relocations */ diff --git a/libexec/rtld-elf/powerpc64/rtld_machdep.h b/libexec/rtld-elf/powerpc64/rtld_machdep.h index d1dab63d3779..d628e776bae9 100644 --- a/libexec/rtld-elf/powerpc64/rtld_machdep.h +++ b/libexec/rtld-elf/powerpc64/rtld_machdep.h @@ -35,13 +35,13 @@ struct Struct_Obj_Entry; -#define MD_OBJ_ENTRY +#define MD_OBJ_ENTRY \ + Elf_Addr glink; /* GLINK PLT call stub section */ /* Return the address of the .dynamic section in the dynamic linker. */ #define rtld_dynamic(obj) (&_DYNAMIC) -/* No arch-specific dynamic tags */ -#define arch_digest_dynamic(obj, dynp) false +bool arch_digest_dynamic(struct Struct_Obj_Entry *, const Elf_Dyn *); /* No architecture specific notes */ #define arch_digest_note(obj, note) false diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 20c340ed15a3..ef34a9d36bc3 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -1520,18 +1520,6 @@ digest_dynamic1(Obj_Entry *obj, int early, const Elf_Dyn **dyn_rpath, obj->static_tls = true; break; -#ifdef __powerpc__ -#ifdef __powerpc64__ - case DT_PPC64_GLINK: - obj->glink = (Elf_Addr)(obj->relocbase + dynp->d_un.d_ptr); - break; -#else - case DT_PPC_GOT: - obj->gotptr = (Elf_Addr *)(obj->relocbase + dynp->d_un.d_ptr); - break; -#endif -#endif - case DT_FLAGS_1: if (dynp->d_un.d_val & DF_1_NOOPEN) obj->z_noopen = true; diff --git a/libexec/rtld-elf/rtld.h b/libexec/rtld-elf/rtld.h index a4f2c35cc03f..9df5b4ec8f59 100644 --- a/libexec/rtld-elf/rtld.h +++ b/libexec/rtld-elf/rtld.h @@ -183,13 +183,6 @@ typedef struct Struct_Obj_Entry { const Elf_Sym *symtab; /* Symbol table */ const char *strtab; /* String table */ unsigned long strsize; /* Size in bytes of string table */ -#ifdef __powerpc__ -#ifdef __powerpc64__ - Elf_Addr glink; /* GLINK PLT call stub section */ -#else - Elf_Addr *gotptr; /* GOT pointer (secure-plt only) */ -#endif -#endif const Elf_Verneed *verneed; /* Required versions. */ Elf_Word verneednum; /* Number of entries in verneed table */