From patchwork Wed Dec 6 17:20:05 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: 1872903 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=K/OSHa2L; 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 4Slkhm3Qm7z23nD for ; Thu, 7 Dec 2023 04:21:28 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 07343386185C for ; Wed, 6 Dec 2023 17:21:21 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by sourceware.org (Postfix) with ESMTPS id 4F5583858023 for ; Wed, 6 Dec 2023 17:20:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4F5583858023 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 4F5583858023 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::632 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701883221; cv=none; b=EGagewBZyy3s60uxxB8QdqHeCUes5Osnuhmy5WsdUmBxoyrYcykHF5l84QAITOJYyMt0BZrYgdonlGSkn7/xN+h7iRsPKcSpiCbvfxX9KH2FDFKV/pxZ1YYivOdYWv3be9FP0EaAsEit93ocsN87JC7xMFU0rWbqw7+6WFEWTUk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701883221; c=relaxed/simple; bh=A1+fHusyoFA5MDej/XYdek+uGkHZyKKGCEBcDtlbUlM=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=lcLrBFJUwbWl9YT17jxQRM2M57ijW5JBqS8WQB22ZxMOlYaDtL0Asv+m5ndWZshDadDLOrh+g7wZGk/2oA1pATrxHW3Q6YwbZDfsw2gcCYXFWEoxYYBXI/IZD01gNuHrd9ZvrpHQITE5vG5lX0nXkw+I73pBgyoCs8Aw5hiJP2s= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1cfc9c4acb6so27745ad.0 for ; Wed, 06 Dec 2023 09:20:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701883219; x=1702488019; 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=VuRsd3PBVfXGnOWm4frtoz3pLiPQWXDOpUpz4C5moqM=; b=K/OSHa2LsJNn4XW89lrMweIm7DmcZDpEUVU74iR1T+v+WuQW98JXly2o8SHpMMux2s IMVxmczMmsuPgFHsg7o1CEW95AtU9qal3irW7Z23QxHwXwcHQdmGZ6gnEJ+7lquJvDat qqRjOyrMdHyb9jt7A6tzqu7JUDedXB5BS4wQeYhKRIh79QcidR174MgJ2x+c73N+ERJd BgTosaBDW0VikJy9n4AcmqZDrJF6aEmK6wfYHws+GZ6PJOBatS1B0cECuGWYvaBpzx6E PxNAU1JB0wo1ekG4qJeloLazJvFxnVCWkvYvFv64sNdqXYk75s+cUs+Ln+oyu7qAxDmL l6OA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701883219; x=1702488019; 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=VuRsd3PBVfXGnOWm4frtoz3pLiPQWXDOpUpz4C5moqM=; b=byPC21Mu9LiJ/ZDjv15YmHT0pf6D4NIKJvARaYAShKdVYMcS622bOnIRPje8+hzhrO tEa1m+fmr9cGvXVz1+1EaDW3WMkXmxqzHaD1JidQq992BPOQZy3qXDxi7KtOX8QDjucd Iy6XmGWFBja4uZ/CE7ONCUmaTuwoobIMGIyAcugIHYdyCWgWqdzKqRVwgFyG27kilqGn TOTVQ3ZVrMF6cq/6HEc1BIXljOk8CKT7TkhsrCpf8P38U4+NwlmcpbMpP9I/QYRG7tSh +dZeB6XOhDDE4fClh3uIu3z4AAg7XIeGV1g6hIGtTr/1ege3giTrojio2dKybG7cTwn9 nt5w== X-Gm-Message-State: AOJu0Yx3murTUlEzRw3p2fYmZX3wMIxtnrLUAwISeby1lX5W/0wzaEA0 18NAR36ykNKbrtdd7UMoPt4OsNghduM= X-Google-Smtp-Source: AGHT+IHv/vsCzmo5avri3+QVh7rS6bMCQ7xqYOqIHYo+ZW4S5k9hs3bLqRIYBis7cpxHbDHfOaOs4A== X-Received: by 2002:a17:902:ec82:b0:1d0:9c9d:dcdc with SMTP id x2-20020a170902ec8200b001d09c9ddcdcmr905515plg.85.1701883218992; Wed, 06 Dec 2023 09:20:18 -0800 (PST) Received: from gnu-cfl-3.localdomain ([172.59.161.253]) by smtp.gmail.com with ESMTPSA id k16-20020a170902ba9000b001bc6e6069a6sm70795pls.122.2023.12.06.09.20.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 09:20:16 -0800 (PST) Received: from gnu-cfl-3.. (localhost [IPv6:::1]) by gnu-cfl-3.localdomain (Postfix) with ESMTP id D864A740635; Wed, 6 Dec 2023 09:20:10 -0800 (PST) From: "H.J. Lu" To: libc-alpha@sourceware.org Cc: rick.p.edgecombe@intel.com Subject: [PATCH 12/17] elf: Always provide _dl_get_dl_main_map in libc.a Date: Wed, 6 Dec 2023 09:20:05 -0800 Message-ID: <20231206172010.1023415-13-hjl.tools@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231206172010.1023415-1-hjl.tools@gmail.com> References: <20231206172010.1023415-1-hjl.tools@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-3025.0 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 | 8 ++++---- 2 files changed, 4 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..0e8a008a49 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,10 @@ 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__ ((visibility ("hidden"))); + /* Find origin of the executable. */ extern const char *_dl_get_origin (void) attribute_hidden;