From nobody Sun Jul 09 17:52:04 2023 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 4QzZTJ5kBqz4mVgb; Sun, 9 Jul 2023 17:52:04 +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 4QzZTJ21FTz3tgP; Sun, 9 Jul 2023 17:52:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1688925124; 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=/lAkll+FvetlLeVoB56CQOjKe0PvzR0enGfLDjEv6x0=; b=dROTd2YnEZ+GLoig0h1UgbzeqMTqsHKyXfaj8Y8ibvwLJCGeO3q1YTwWudlw4AMzquGzda triFK/XxfURnsC3y03BFQkANSSMgYwEHHaRhpc0ryCQwOKcTlhIqry9zqgqg9rgRmRFc12 yWyTvg47KVJdiI/R3P8uqzhOwQLKAIyWW8kGME38pdvCXfJPV/XJP1rJ02LEyNKssz2i47 gNNxQVLF39M94YAD6cLM+kwHYK6gTWmWqo8AyFgDp4tTaoEV7bLCVkc5PFz8lLdRpJynJf aqp/tdoAUx/QkeaIjRu8jZzpUFzVIJbXVr4v/p0tKDfRrzArdJNh0Qs7Q4cKdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1688925124; 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=/lAkll+FvetlLeVoB56CQOjKe0PvzR0enGfLDjEv6x0=; b=wMk0SXBD04K24wLopRu6SP1vdoW8suCVCqTQ5DIwZw4zMW3xLnbOZWdLTtI0xfjTQ6FzKd 7I/EEoFDgUeiKHtwfYJD+zg5ub/GgD7UpuOJcx0feviJH3JzshMgbhdXXJyhgP0OgJ+RvQ pDKps1BaiONEqCVNW3tH7fGfUeJqRPj23c0hwPpOwiEt2qZkumly+JfFZ4il8r1lyl2+O/ M9Z/meGHdhMyAEANF3RX1qyp+FrcfApebmLgSl38fFG2p79XvBHz6RMuJE5N2FJa9JuOyk lbLLCnfhFyCTBRl5a0BWxuA9/sARDJty30ew4ldXgPtJjOvCGMKR5sHVA7Q5oA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1688925124; a=rsa-sha256; cv=none; b=fYQF/gF00hN8UJ5v383mMlqmb6AIk6VaJxcW6hbSx2NePV9ndQFh4F6feM32MdCtuIDyGs ADAC96YRbeLmHU0vdMjK6wszTT3wTOOIyRVagAmm6kKFsQYqC8sLOkT51Avah9Z29vPX5b tDkDQn/SHSo97Lutnih1y+qotWugwRxVSwD9tTkWeFEFuDZQ1/Kf2G/vcwHaFIk2nuwV8P lWYqJ5WsfEiAl3DZvfOcKm7qCWXqLxwyyEbgeTnU9Qj1yXLqua5BH8EpW6gm0zw+YZlOGY rief4pvPKFQTwp4TR73JO9MTWT4i0mO9PWvp8sH8OzoEFBRHS9EQowOvy71PAg== 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 4QzZTJ16FRz1BNj; Sun, 9 Jul 2023 17:52:04 +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 369Hq4jL098706; Sun, 9 Jul 2023 17:52:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 369Hq4At098705; Sun, 9 Jul 2023 17:52:04 GMT (envelope-from git) Date: Sun, 9 Jul 2023 17:52:04 GMT Message-Id: <202307091752.369Hq4At098705@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: f940929d4111 - main - rtld-elf: Migrate from COMPAT_32BIT to generic COMPAT_libcompat/LIBCOMPAT 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: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f940929d411102d6925e158de90d8d23b3774df6 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=f940929d411102d6925e158de90d8d23b3774df6 commit f940929d411102d6925e158de90d8d23b3774df6 Author: Jessica Clarke AuthorDate: 2023-07-09 17:49:07 +0000 Commit: Jessica Clarke CommitDate: 2023-07-09 17:49:07 +0000 rtld-elf: Migrate from COMPAT_32BIT to generic COMPAT_libcompat/LIBCOMPAT We still have a tiny amount of libcompat-specific code in rtld_paths.h, but it's been deduplicated as much as possible, and in future we may wish to just push these variables down to the few consumers of them and make them use the double-underscore variants with a libcompat argument rather than give them names here. See commit 8fad2cda93c7 ("bsd.compat.mk: Provide new CPP and sub-make variables") for the context behind this change. Reviewed by: kib, brooks, jhb Differential Revision: https://reviews.freebsd.org/D40925 --- libexec/rtld-elf/rtld.c | 2 +- libexec/rtld-elf/rtld_paths.h | 57 +++++++++++++++++++++++++++---------------- 2 files changed, 37 insertions(+), 22 deletions(-) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 9a522bf721c5..5c96405be62c 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -804,7 +804,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp) aux_info[AT_STACKPROT]->a_un.a_val != 0) stack_prot = aux_info[AT_STACKPROT]->a_un.a_val; -#ifndef COMPAT_32BIT +#ifndef COMPAT_libcompat /* * Get the actual dynamic linker pathname from the executable if * possible. (It should always be possible.) That ensures that diff --git a/libexec/rtld-elf/rtld_paths.h b/libexec/rtld-elf/rtld_paths.h index 759a610e6469..fd61da4507ee 100644 --- a/libexec/rtld-elf/rtld_paths.h +++ b/libexec/rtld-elf/rtld_paths.h @@ -31,53 +31,68 @@ #undef _PATH_ELF_HINTS -#ifndef _COMPAT32_BASENAME_RTLD -#define _COMPAT32_BASENAME_RTLD "ld-elf32.so.1" +#ifndef _RTLD_COMPAT_LIB_SUFFIX +#ifdef COMPAT_libcompat +#define _RTLD_COMPAT_LIB_SUFFIX COMPAT_libcompat +#else +#define _RTLD_COMPAT_LIB_SUFFIX "" +#endif #endif -#ifndef _PATH_ELF32_HINTS -#define _PATH_ELF32_HINTS "/var/run/ld-elf32.so.hints" +#ifndef _RTLD_COMPAT_ENV_SUFFIX +#ifdef COMPAT_LIBCOMPAT +#define _RTLD_COMPAT_ENV_SUFFIX COMPAT_LIBCOMPAT "_" +#else +#define _RTLD_COMPAT_ENV_SUFFIX "" +#endif #endif -#ifdef COMPAT_32BIT -#define _PATH_ELF_HINTS _PATH_ELF32_HINTS -#define _PATH_LIBMAP_CONF "/etc/libmap32.conf" -#define _BASENAME_RTLD _COMPAT32_BASENAME_RTLD -#define STANDARD_LIBRARY_PATH "/lib32:/usr/lib32" -#define LD_ "LD_32_" -#define TOKEN_LIB "lib32" +#ifndef __PATH_ELF_HINTS +#define __PATH_ELF_HINTS(_lc) "/var/run/ld-elf" _lc ".so.hints" #endif #ifndef _PATH_ELF_HINTS -#define _PATH_ELF_HINTS "/var/run/ld-elf.so.hints" +#define _PATH_ELF_HINTS __PATH_ELF_HINTS(_RTLD_COMPAT_LIB_SUFFIX) #endif #ifndef _PATH_LIBMAP_CONF -#define _PATH_LIBMAP_CONF "/etc/libmap.conf" +#define _PATH_LIBMAP_CONF "/etc/libmap" _RTLD_COMPAT_LIB_SUFFIX ".conf" +#endif + +#ifndef __BASENAME_RTLD +#define __BASENAME_RTLD(_lc) "ld-elf" _lc ".so.1" #endif #ifndef _BASENAME_RTLD -#define _BASENAME_RTLD "ld-elf.so.1" +#define _BASENAME_RTLD __BASENAME_RTLD(_RTLD_COMPAT_LIB_SUFFIX) #endif -#ifndef _PATH_RTLD -#define _PATH_RTLD "/libexec/" _BASENAME_RTLD +#ifndef __PATH_RTLD +#define __PATH_RTLD(_lc) "/libexec/" __BASENAME_RTLD(_lc) #endif -#ifndef _COMPAT32_PATH_RTLD -#define _COMPAT32_PATH_RTLD "/libexec/" _COMPAT32_BASENAME_RTLD +#ifndef _PATH_RTLD +#define _PATH_RTLD __PATH_RTLD(_RTLD_COMPAT_LIB_SUFFIX) #endif #ifndef STANDARD_LIBRARY_PATH -#define STANDARD_LIBRARY_PATH "/lib:/usr/lib" +#define STANDARD_LIBRARY_PATH "/lib" _RTLD_COMPAT_LIB_SUFFIX ":/usr/lib" _RTLD_COMPAT_LIB_SUFFIX #endif #ifndef LD_ -#define LD_ "LD_" +#define LD_ "LD_" _RTLD_COMPAT_ENV_SUFFIX #endif #ifndef TOKEN_LIB -#define TOKEN_LIB "lib" +#define TOKEN_LIB "lib" _RTLD_COMPAT_LIB_SUFFIX +#endif + +#ifndef _PATH_ELF32_HINTS +#define _PATH_ELF32_HINTS __PATH_ELF_HINTS("32") +#endif + +#ifndef _COMPAT32_PATH_RTLD +#define _COMPAT32_PATH_RTLD __PATH_RTLD("32") #endif #ifdef IN_RTLD