Message ID | 20230515144815.3939017-4-bugaevc@gmail.com |
---|---|
State | New |
Headers | show
Return-Path: <libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=<UNKNOWN>) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=y0nwhi4q; dkim-atps=neutral Received: from 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 (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QKj1w5qcvz20db for <incoming@patchwork.ozlabs.org>; Tue, 16 May 2023 00:49:24 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B290E3853563 for <incoming@patchwork.ozlabs.org>; Mon, 15 May 2023 14:49:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B290E3853563 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1684162162; bh=H8SKUlF5AeHkhSntvYV/CARs03lANPRLi+lKu03gqcg=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=y0nwhi4qiYeg9ssBbzGEhx3MZPzlu2Koe9zFl/gc51GJsRCP4Zn8SHb6rAnx8eKCJ VPh6vs1gQCOVCu/B8eKq62kmrV85TIAixafX4ZQg1uwCOTPANH+o4dJtqzCLOBVaEw Yvy36jUJwyuVcWhf8AWWWktE6SH/vIyEK28o0z04= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by sourceware.org (Postfix) with ESMTPS id A7D4D3858404 for <libc-alpha@sourceware.org>; Mon, 15 May 2023 14:48:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A7D4D3858404 Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2ac89e6a5a1so127142641fa.0 for <libc-alpha@sourceware.org>; Mon, 15 May 2023 07:48:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684162100; x=1686754100; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=H8SKUlF5AeHkhSntvYV/CARs03lANPRLi+lKu03gqcg=; b=ThEp79GKWpoSaFtxhbbEYVqUxgYj2O586QHWU2ergWCcB90I1ZXsCTU4ATOboEm/jM SYnl8EXEERv7hMRyTZgkeYLSSeRZIgoxXDOSsQqYvWmWojohE5w6dfs2hWCo9M8gsTKW y1i3Min35d19/jCxQ3+a4sKuarMKIoa9nPTYg7blp89BzJKqKClIMfEcYhfYvkOrx/m+ iKKafPF9jgHd9hOmNNkMGSL2KEeJ89mmjFPf35q8GisZHIh1U7wkvH4z2MIVTGi2+gIG FUZAr9wVWzr5e7vnRIxOyYWVcGMGQto4ST2YKOEjpspV/u/MmIZtvlm4iWc09LNSEDOj nQGA== X-Gm-Message-State: AC+VfDwvXFBLlzh6jiwiACeBCJ3fCcf+ogYY6I4ytRcTLBfHSKGhWKxk 01jrujVHQtTQBblkmbg5E0sWjqxxaT0= X-Google-Smtp-Source: ACHHUZ7NFZ/yypXPW5KczHeZrQYnWjCnmAv1mfkSCLDwbpaf/pZsKM9NJYbRB4gxV1CE/0T7Euzt9g== X-Received: by 2002:ac2:46ee:0:b0:4f1:5001:1d9c with SMTP id q14-20020ac246ee000000b004f150011d9cmr7087321lfo.55.1684162099799; Mon, 15 May 2023 07:48:19 -0700 (PDT) Received: from surface-pro-6.. ([194.190.106.50]) by smtp.gmail.com with ESMTPSA id w9-20020a056512098900b004f11e965308sm2643336lft.20.2023.05.15.07.48.19 for <libc-alpha@sourceware.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 May 2023 07:48:19 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [RFC PATCH 3/6] sys/cdefs.h: Define __TEXT_STARTUP & __TEXT_EXIT Date: Mon, 15 May 2023 17:48:12 +0300 Message-Id: <20230515144815.3939017-4-bugaevc@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230515144815.3939017-1-bugaevc@gmail.com> References: <20230515144815.3939017-1-bugaevc@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.1 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.29 Precedence: list List-Id: Libc-alpha mailing list <libc-alpha.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=subscribe> From: Sergey Bugaev via Libc-alpha <libc-alpha@sourceware.org> Reply-To: Sergey Bugaev <bugaevc@gmail.com> Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" <libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org> |
Series |
.text.subsections for some questionable benefit
|
expand
|
diff --git a/include/sys/cdefs.h b/include/sys/cdefs.h index ef78edda..da866784 100644 --- a/include/sys/cdefs.h +++ b/include/sys/cdefs.h @@ -43,6 +43,9 @@ rtld_hidden_proto (__chk_fail) #endif +#define __TEXT_STARTUP __attribute__ ((section (".text.startup"))) +#define __TEXT_EXIT __attribute__ ((section (".text.exit"))) + #endif /* !defined _ISOMAC */ #endif
GCC already tries to place functions that it knows will only be called at startup (constructors and main ()) into .text.startup, and those that will only be called at exit (destructors) into .text.exit, to improve cache locality. These contents of these sections then get grouped together during linking. What GCC does not know is that glibc contains a lot of code that is not ELF constructors or destructors (nor main ()), but that is also only executed on startup or exit. To help GCC and the linker group such code together, we can mark it up explicitly. To that end, this patch introduces __TEXT_STARTUP and __TEXT_EXIT macros that can be applied to functions to mark them as startup-only or exit-only, respectively. Signed-off-by: Sergey Bugaev <bugaevc@gmail.com> --- include/sys/cdefs.h | 3 +++ 1 file changed, 3 insertions(+)