From patchwork Fri Dec 29 16:43:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 1881104 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=WnBq6bpR; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4T1rnZ4wkzz20R0 for ; Sat, 30 Dec 2023 03:44:34 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7514E3858432 for ; Fri, 29 Dec 2023 16:44:32 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by sourceware.org (Postfix) with ESMTPS id CA3003858D33 for ; Fri, 29 Dec 2023 16:43:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CA3003858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org CA3003858D33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::630 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703868239; cv=none; b=pQHBEuKHtWJDrd9k1ojgsab4te4m9zuc7W4/LvN1hykNSG0zCUiPtBOiusXbiIewGbZQ9hVI/FWKklLTWzxPOmN7c1wJ6rPgm323rU0ip22Cyi6jVJMhSTnzpSJ5QswfmT9MIQt9zZInepmIVoaPxarbt4YC0jKOe36wy82zT9U= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703868239; c=relaxed/simple; bh=ZlbQEjGNblHw4S9vp+Qm4stLOuzu3mEDd9m/i/l5ans=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=dGILy9BPYYw4FVYf8a5/ULmJbz0ZPnQ16idzicvSgFGOoLJ3WRqBW4fJxV/YQx8fnyRpv+bV5/XSSLVbBP4gvnk0Kq98uC4LnSsl6N2XSBUoOiSHNQWgiKSjGEe7JgmIndFTckY4Twi4bOFl/XgWlffSZCmO3p7H0L7JBW8PKfw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1d409bcb0e7so25877795ad.1 for ; Fri, 29 Dec 2023 08:43:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703868237; x=1704473037; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wGRUHYTl4jMbXR/OkUKOWFEcrpXVFTegM+CTVCIofDs=; b=WnBq6bpRgBSh1wsBUBWLaYYLId/5qxBv7gRefmPgKVEOhxUMVx2O1wrby6qVD7M7hQ DBHnuA0P7uQPKNSlm/jST01+xAtfSbu5d/IvGV1S9SgdgwZrv877z4srYvW2QKTn+tpn wOqu4QeaxN5Yz43NMiuwSOUXaQEyxZ3QU5q3f6wn+GifPcZwY6CiXZc0UkWFUD9ejIvW neg+UY9qY0VDHbUHBmYO74QMWGzRsxszJjPkkzuh+y/6+WaE+oWtdUnyp0OmjURL2QNM HkxIfCi9j3gE9JKcAkf98LTd3h6xpy43v0+L2sRcIOdz//yis98jqCCkhRYZ79AkoFEv FgJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703868237; x=1704473037; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wGRUHYTl4jMbXR/OkUKOWFEcrpXVFTegM+CTVCIofDs=; b=DsJROiVow7SSBY75XxEQKMtaKSwnw5fPhixpA+QLTnczPC+ngDrwZj3isQl5rmH6Rk uOrkjfyHux91FhlhGk0ZjKkNOUDPt9AL0hMvORWxtPcdRjg3lHoVBmDHV1YSKUminkpv NMiTL+I1pfPREA68jO35o/xmyeygH/HGxr2oX/LbCVmIGO3nk3bfS+oJFMTM7vuA1LkQ UYLnsY39dPWb+ytcJe5nrwEmba4H72Ge/UzFkQgF1Fs5Sk1wt9EhOt1wq6XpgTydOAT1 SwDaD+3DrzJ9UaAJC1Zcpeboq61oWNt5OJgwuYjKvZ70VRuCBvIK0XBcjY8KbqXzXUqR l/jA== X-Gm-Message-State: AOJu0YxOzLp6yiJxdLbhrinnvOs1iUuBj9z/Ny8IQquMBO1Z/Ikncj66 z1oft48hyzo2InDVXU6/5/ncAb8LN/A= X-Google-Smtp-Source: AGHT+IG8L23Je+HZkyewiPF8/AL5tPPvxwl/AHOJVCS4dTyd8HPmC5zuIZab1KD2qsZ75mPdr9wAUg== X-Received: by 2002:a17:902:ceca:b0:1d3:dc01:6983 with SMTP id d10-20020a170902ceca00b001d3dc016983mr5754088plg.108.1703868236704; Fri, 29 Dec 2023 08:43:56 -0800 (PST) Received: from gnu-cfl-3.localdomain ([172.56.169.119]) by smtp.gmail.com with ESMTPSA id g24-20020a170902fe1800b001d0c41b1d03sm15891211plj.32.2023.12.29.08.43.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Dec 2023 08:43:56 -0800 (PST) Received: from gnu-cfl-3.. (localhost [IPv6:::1]) by gnu-cfl-3.localdomain (Postfix) with ESMTP id 2B07F7403B1; Fri, 29 Dec 2023 08:43:55 -0800 (PST) From: "H.J. Lu" To: libc-alpha@sourceware.org Cc: rick.p.edgecombe@intel.com, goldstein.w.n@gmail.com Subject: [PATCH v6 2/6] elf: Always provide _dl_get_dl_main_map in libc.a Date: Fri, 29 Dec 2023 08:43:50 -0800 Message-ID: <20231229164354.182594-3-hjl.tools@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231229164354.182594-1-hjl.tools@gmail.com> References: <20231229164354.182594-1-hjl.tools@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-3024.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Always provide _dl_get_dl_main_map in libc.a. It will be used by x86 to process PT_GNU_PROPERTY segment. --- elf/dl-support.c | 2 -- sysdeps/generic/ldsodefs.h | 7 +++---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/elf/dl-support.c b/elf/dl-support.c index 837fa1c836..70c5b3599a 100644 --- a/elf/dl-support.c +++ b/elf/dl-support.c @@ -344,7 +344,6 @@ _dl_non_dynamic_init (void) DL_SYSINFO_IMPLEMENTATION #endif -#if ENABLE_STATIC_PIE /* Since relocation to hidden _dl_main_map causes relocation overflow on aarch64, a function is used to get the address of _dl_main_map. */ @@ -353,7 +352,6 @@ _dl_get_dl_main_map (void) { return &_dl_main_map; } -#endif /* This is used by _dl_runtime_profile, not used on static code. */ void diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h index 9b50ddd09f..bbf51bc1f5 100644 --- a/sysdeps/generic/ldsodefs.h +++ b/sysdeps/generic/ldsodefs.h @@ -1172,10 +1172,6 @@ void __libc_setup_tls (void); # if ENABLE_STATIC_PIE /* Relocate static executable with PIE. */ extern void _dl_relocate_static_pie (void) attribute_hidden; - -/* Get a pointer to _dl_main_map. */ -extern struct link_map * _dl_get_dl_main_map (void) - __attribute__ ((visibility ("hidden"))); # else # define _dl_relocate_static_pie() # endif @@ -1217,6 +1213,9 @@ rtld_hidden_proto (_dl_deallocate_tls) extern void _dl_nothread_init_static_tls (struct link_map *) attribute_hidden; +/* Get a pointer to _dl_main_map. */ +extern struct link_map * _dl_get_dl_main_map (void) attribute_hidden; + /* Find origin of the executable. */ extern const char *_dl_get_origin (void) attribute_hidden;