From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-6.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by gnuweeb.org (Postfix) with ESMTPS id A08FD7E3ED for ; Tue, 19 Apr 2022 00:42:31 +0000 (UTC) Authentication-Results: gnuweeb.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=BHRomnEW; dkim-atps=neutral Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B7E9961478; Tue, 19 Apr 2022 00:42:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3BC5DC385DB; Tue, 19 Apr 2022 00:42:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1650328948; bh=byMzJe2H2GUtc2cOXlkFwHCrNq/HY4AjpqDjvfRblZg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BHRomnEW9/Ytc7BPx3QAijQMqWJlL96oxk7MZOZ3uih6/1zLY4MFnuv1xPSd16W3k nZcWOFQdnfEO3sCaJZ/StRTOt1O4edjJChiMSQq9hoJJrKqCioPQI9cLjE6MjqcXt8 TlBFYFRlzWQpgDVuI2meBdiT5b54wnNdJDlw/J/yDR0TaVJR974MKxyWPTrvxO4tmU omd0Aw91unuDLZCaxtsPfo/4MibtjotVKUIwJSbBI7K0kqIttJ4j8Gh80izTUPHsIA WN+Sx+C9Uxbu2g4cLa6L2I6jAFwtn1+/gqeXkMJ8qv6gOI+WTTandhBcMaiqCi304v nEpXRoslachqw== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 415EE5C3108; Mon, 18 Apr 2022 17:42:27 -0700 (PDT) From: "Paul E. McKenney" To: linux-kernel@vger.kernel.org Cc: gwml@vger.gnuweeb.org, kernel-team@fb.com, w@lwt.eu, Willy Tarreau , "Paul E . McKenney" Subject: [PATCH nolibc 32/61] tools/nolibc: move exported functions to their own section Date: Mon, 18 Apr 2022 17:41:56 -0700 Message-Id: <20220419004225.3952530-32-paulmck@kernel.org> X-Mailer: git-send-email 2.31.1.189.g2e36527f23 In-Reply-To: <20220419004219.GA3952301@paulmck-ThinkPad-P17-Gen-1> References: <20220419004219.GA3952301@paulmck-ThinkPad-P17-Gen-1> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: From: Willy Tarreau Some functions like raise() and memcpy() are permanently exported because they're needed by libgcc on certain platforms. However most of the time they are not needed and needlessly take space. Let's move them to their own sub-section, called .text.nolibc_. This allows ld to get rid of them if unused when passed --gc-sections. Signed-off-by: Willy Tarreau Signed-off-by: Paul E. McKenney --- tools/include/nolibc/stdlib.h | 2 +- tools/include/nolibc/string.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/include/nolibc/stdlib.h b/tools/include/nolibc/stdlib.h index 4cc1fdf6791e..da08ff30c15a 100644 --- a/tools/include/nolibc/stdlib.h +++ b/tools/include/nolibc/stdlib.h @@ -314,7 +314,7 @@ int msleep(unsigned int msecs) } /* This one is not marked static as it's needed by libgcc for divide by zero */ -__attribute__((weak,unused)) +__attribute__((weak,unused,section(".text.nolibc_raise"))) int raise(int signal) { return sys_kill(sys_getpid(), signal); diff --git a/tools/include/nolibc/string.h b/tools/include/nolibc/string.h index c550c9ba8f4c..c1661589cb3c 100644 --- a/tools/include/nolibc/string.h +++ b/tools/include/nolibc/string.h @@ -69,7 +69,7 @@ void *memmove(void *dst, const void *src, size_t len) } /* must be exported, as it's used by libgcc on ARM */ -__attribute__((weak,unused)) +__attribute__((weak,unused,section(".text.nolibc_memcpy"))) void *memcpy(void *dst, const void *src, size_t len) { return _nolibc_memcpy_up(dst, src, len); -- 2.31.1.189.g2e36527f23