Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp583279rdf; Fri, 3 Nov 2023 09:01:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHoAXVtgKT6pj0URCI3n+BIA+HiN3mWQMRJI9m+ExwsxL5km+K5/TtAs+31nt2veCHhVM2n X-Received: by 2002:a05:6a21:7888:b0:181:a3ae:115b with SMTP id bf8-20020a056a21788800b00181a3ae115bmr5165786pzc.61.1699027297944; Fri, 03 Nov 2023 09:01:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1699027297; cv=none; d=google.com; s=arc-20160816; b=E3SPbizBEmBrafvEwev4ADq77LXybIX2jZGzywC3lfG7GHH0j5xXsD5+vBgbW0VU2v rOVma4KnKqScaLJ5UiUeFSQXSemzsC1j2YUTEjdkhp3B6Uwg2tcbkO6I/gmDcIIJC7uW 15ejG4anIaY05ehHO9afpkLjJgc9sUf8Swaq7ksZbuQVKHganxwF/jQGTzLnxc0lsIA7 kXZrzGbZKYhms15ZKUOnw4Z0sPqz3BK+xMDssgiAjbiGyQb31kxB1kuo800Fh/hjHjqc oCxwayAyEZu0qa7ZLRGZQrpfST094iinhAdwi/TGMSjkRJFBaZybv4y7MX9M8qiajUkh QnMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=TPvuVw2DYqJuJbgyetqpKTz8pbs2WtdVBPfkFP1qpLQ=; fh=NvW3CO3GtIHRKW4YFObS4dEX0yL9bbz2APezTtyZGhQ=; b=rpJ7X07L5XAUV2uusvcMKHTx05UJzTUNoTJHLUnBvy45YWeTK/LW55enjX535GqhZX zgUjdu9p97fiEVyRg/MaoKFgPPQRs/R9TJgh4XU0UUHKJIO6BLU5dQ7AYXmBHFZkIfZ7 z0mFroFQUFqcNJf0BavIGSVnMFL0k314tx8VZxIfDESbnPfbDvnTox9+tHc9+u4Z1cam EpcxAiY7pQ3AypCzrTX+x/HUxL1iXUtWETaEov1hIbLjJxJi4DNIdPTTBoPPPEsx34vv Lfsiad0/V1QzOJnsKLxqoLtvhew/+mMexTVP33sqvgSRMpYWykKHZa94EZD7Je3yRF8N 7YZA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id bz40-20020a056a02062800b005aa7d3730dfsi1785617pgb.114.2023.11.03.09.01.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 09:01:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 159268316EF9; Fri, 3 Nov 2023 09:01:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345004AbjKCQB3 (ORCPT + 99 others); Fri, 3 Nov 2023 12:01:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343945AbjKCQB1 (ORCPT ); Fri, 3 Nov 2023 12:01:27 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41CC1D4F; Fri, 3 Nov 2023 09:01:23 -0700 (PDT) X-QQ-mid: bizesmtp78t1699027266ta08iml2 Received: from main2-ubuntu.tail147f4.ts.net ( [202.201.15.117]) by bizesmtp.qq.com (ESMTP) with id ; Sat, 04 Nov 2023 00:01:03 +0800 (CST) X-QQ-SSF: 01200000000000000000000A0000000 X-QQ-FEAT: QityeSR92A28ZPRtiE81G2IrXHWg2q27WIobMU1SAAzpzkyyfEB73YsFcjdDe bVIiFyAUAwy8zzKzjrseeMWj0rb6pexvSi+JMipbHYhQxpuclzEMg7X6cSFvfm0zUbuvUkH h53yUWwjypGaV/yCfz9llOfRSJAl345Te7BpmmwciccZriF1iTUIX3Acz0VVcqgLQLxij90 vmo9hUQ4XmPwLxfIwOPQoqiZRoQRMntdfHYmU86oxGlguDcOLX+hQcU1iiGjDNaJ56wmm5f d1CU19gnS85haVh9DhVlHm0SEjXqii66p+6zMkbYe99A6q5hm0RXrwcR0y5/I8ghUS3d/Qn 7FA36k1Kp5SCYysOg6IbHNlCGA9XQ9hupgoQtSoicunaxLd4PZDp6bU1S/y2A== X-QQ-GoodBg: 0 X-BIZMAIL-ID: 17055644200842692498 From: Yuan Tan To: falcon@tinylab.org, arnd@arndb.de, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linux-riscv@lists.infradead.org, luc.vanoostenryck@gmail.com, linux-sparse@vger.kernel.org Cc: linux@weissschuh.net, palmer@rivosinc.com, paul.walmsley@sifive.com, paulburton@kernel.org, paulmck@kernel.org, tim.bird@sony.com, tsbogend@alpha.franken.de, w@1wt.eu, tanyuan@tinylab.org, i@maskray.me Subject: [PATCH v1 08/14] DCE/DSE: add choice of methods to build reference for orphan sections Date: Sat, 4 Nov 2023 00:01:01 +0800 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrgz:qybglogicsvrgz5a-1 X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 03 Nov 2023 09:01:35 -0700 (PDT) Due to .pushsection producing orphan sections, the kernel currently uses `KEEP()` in the linker script to address this issue. Here we purpose two methods to build reference for pushed section, SHF_LINK_ORDER method and SECTION_SHF_GROUP method. The binary files compiled using both methods turn out to be identical, and it doesn't produce any side effects. Signed-off-by: Yuan Tan Signed-off-by: Zhangjin Wu --- init/Kconfig | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/init/Kconfig b/init/Kconfig index 9834dbb0ddae..9599d2de44e8 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -1740,6 +1740,56 @@ config USED_SYSCALLS If unsure, please disable TRIM_UNUSED_SYSCALLS. +choice + prompt "Trim methods" if EXPERT + default RESTRICTED_TRIM_UNUSED_SYSCALLS + depends on TRIM_UNUSED_SYSCALLS + help + This option selects the method to trim unused syscall wrongly kept. + + The binary files compiled using both methods are identical. + + If the trim methods is not specified, some syscalls are kept by + linker script and can not be trimmed. + +config RESTRICTED_TRIM_UNUSED_SYSCALLS + bool "Leave some kept syscalls (EXPERIMENTAL)" if EXPERT + help + Say Y here to trim 'unused' syscalls wrongly kept by __ex_table + like sections in kernel space. + + Some syscalls are kept by linker script and can not be trimmed. + + If unsure, choose this. + +config SECTION_SHF_LINK_ORDER_SUPPORT + bool "Using SHF_LINK_ORDER attribute (EXPERIMENTAL)" if EXPERT + depends on HAVE_SECTION_SHF_LINK_ORDER_SUPPORT + help + Say Y here to trim more 'unused' syscalls wrongly kept by __ex_table + like sections in kernel space. + + This option uses the SHF_LINK_ORDER attribute to build references for + orphan sections. Therefore, these sections are no longer kept in the + linker script. + + If unsure, not choose this. + +config SECTION_SHF_GROUP_SUPPORT + bool "Using SHF_GROUP attribute (EXPERIMENTAL)" if EXPERT + depends on HAVE_SECTION_SHF_GROUP_SUPPORT + help + Say Y here to trim more 'unused' syscalls wrongly kept by __ex_table + like sections in kernel space. + + This option uses the SHF_GROUP attribute to build references for + orphan sections. Therefore, these sections are no longer kept in the + linker script. + + If unsure, not choose this. + +endchoice + config KALLSYMS bool "Load all symbols for debugging/ksymoops" if EXPERT default y -- 2.34.1