Message ID | 7807078d4612beaa3f450df9f3f3cf70b2bccb4a.1699025537.git.tanyuan@tinylab.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:8f47:0:b0:403:3b70:6f57 with SMTP id j7csp1141109vqu; Fri, 3 Nov 2023 09:02:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEueKWrPtLAZpyhJdjl6d1FT3h2zsEUe9zcHuUk9wLb8cXijbz0E8C4LKKtm89NHJ0bgVQV X-Received: by 2002:a05:6358:91e:b0:168:e2ec:593 with SMTP id r30-20020a056358091e00b00168e2ec0593mr28709725rwi.22.1699027346589; Fri, 03 Nov 2023 09:02:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1699027346; cv=none; d=google.com; s=arc-20160816; b=sj/5W7SejMfbLrdZYJBj0rVXOMG1ruroBzLjH5yhDZ01HpXcpDppId4pSNOOeQ4Gsi lJ8RCZSqRiwui4wAKasg+J0ojnnYyUXXvP83OEMBzrH4P6bBPejiU53OxVAEi0yfSxY1 oQlzjp9jn3fxa7BWtjEmEm2QP8TuN+yzLkZaQOwbAtTUxgxAuI/J0Meu7JC79S3er9+n 78paY0Mhg0gtymcaauqa0Hmhl3whyn3M7Yv9tiBEujEKv6vZ9LhcnkXLi5f473KvnYxY 3XB0dK+XLDucQorRpm/D/UZgQg/P+UdAH20dfJqQf4g6BRv7A9guYy2Ob9//RsAACHJM rcjA== 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=f9nXIUwNePfy54JRc+pYeAbLGPpa0xZCKMAxDNMgXD4=; fh=NvW3CO3GtIHRKW4YFObS4dEX0yL9bbz2APezTtyZGhQ=; b=qFkoFGnd2Lh7AgAM1Vjv2CO4dd+zxEo6M4hQvuYPchN6RwvPMzSgyiunCJLzmBUq3d ogH14ejElEB4hKz2y1Oo8gmHEfnuM9cF3wtsS8JGO6ViAKqmvP3O1e1yo9+hl521Zywc wLIzSQIh2LX70m3OgTX5S6d4TbluIaYbm3zw0S1qhHAIHKeWfmT/tNNOCb1fskOgLnjt SZeYAiG7uU3RDIlUCg0WwJTWtKt+QYCphmMJqI3y8QRiaM5xUXL8RPpIOQJjxMR20wdC FLbepgDrIzePVuDSf/kijcp06ykvFeLLPGM5mGv3A3H4kB7VlcuYN3/LhBiMQhr/pyvY psEA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id c130-20020a633588000000b005b9b68add85si1738176pga.254.2023.11.03.09.02.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 09:02:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id 4B0EF821FBA4; Fri, 3 Nov 2023 09:02:23 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344951AbjKCQCT (ORCPT <rfc822;heyuhang3455@gmail.com> + 35 others); Fri, 3 Nov 2023 12:02:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344745AbjKCQCR (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 3 Nov 2023 12:02:17 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.155.65.254]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37180D4E; Fri, 3 Nov 2023 09:02:13 -0700 (PDT) X-QQ-mid: bizesmtp66t1699027320t0x8xgof Received: from main2-ubuntu.tail147f4.ts.net ( [202.201.15.117]) by bizesmtp.qq.com (ESMTP) with id ; Sat, 04 Nov 2023 00:01:57 +0800 (CST) X-QQ-SSF: 01200000000000B06000000A0000000 X-QQ-FEAT: WQH7Uj+YMzXZTIeeYrzzH5itva0gXKImwAhNhNH+6I4DrfveqC5LRL/AcrFVZ 2/7bONsuYtIn2ySjQU5hL5gWFOT7EvhlXQ1iFCFG8OaKZP82pUKHeAwChH+M65VreM8t5le MEaIGsQTivG4RvqDkHbOYJyCINDKGWbhCKa0dUgjtXcRjNQmYo+pBt7KJc23OgX11rPo9HH eolIdA7eZrnIQZKidwNzLUodbR1P5fT1YDTe/GJ96w1sqVpiiORBTxHvJJR8fCReTgImbhn xk8Hctv3kJsMKpvxmjJqlVVP2vs4VDq6gBW71Z2pzucXzcbSYEcpsDNDwo0ITDvRO3EglyR gZFh+VYSI8gOs/YSPsMhwdqkvgrOUqcnzKKQlenAv7mO2o1OXg= X-QQ-GoodBg: 0 X-BIZMAIL-ID: 8381555887930633905 From: Yuan Tan <tanyuan@tinylab.org> 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 09/14] DCE/DSE: inhibit .size directive for SHF_GROUP Date: Sat, 4 Nov 2023 00:01:55 +0800 Message-Id: <7807078d4612beaa3f450df9f3f3cf70b2bccb4a.1699025537.git.tanyuan@tinylab.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <cover.1699025537.git.tanyuan@tinylab.org> References: <cover.1699025537.git.tanyuan@tinylab.org> 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 agentk.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Fri, 03 Nov 2023 09:02:23 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781559299215921856 X-GMAIL-MSGID: 1781559299215921856 |
Series |
DCE/DSE: Add Dead Syscalls Elimination support, part2
|
|
Commit Message
Yuan Tan
Nov. 3, 2023, 4:01 p.m. UTC
.size directive fails in some functions with SHF_GROUP, this is not really required for normal building, inhibit it to silence the compiling failures with SHF_GROUP. Signed-off-by: Yuan Tan <tanyuan@tinylab.org> Signed-off-by: Zhangjin Wu <falcon@tinylab.org> --- Makefile | 3 +++ 1 file changed, 3 insertions(+)
Comments
On Fri, Nov 3, 2023 at 9:01 AM Yuan Tan <tanyuan@tinylab.org> wrote: > > .size directive fails in some functions with SHF_GROUP, this is not > really required for normal building, inhibit it to silence the compiling > failures with SHF_GROUP. > > Signed-off-by: Yuan Tan <tanyuan@tinylab.org> > Signed-off-by: Zhangjin Wu <falcon@tinylab.org> > --- > Makefile | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/Makefile b/Makefile > index a4e522b747cb..f67b6e8d2c45 100644 > --- a/Makefile > +++ b/Makefile > @@ -936,6 +936,9 @@ endif > # `rustc`'s `-Zfunction-sections` applies to data too (as of 1.59.0). > ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION > KBUILD_CFLAGS_KERNEL += -ffunction-sections -fdata-sections > +ifdef CONFIG_SECTION_SHF_GROUP_SUPPORT > +KBUILD_CFLAGS_KERNEL += -finhibit-size-directive > +endif > KBUILD_RUSTFLAGS_KERNEL += -Zfunction-sections=y > LDFLAGS_vmlinux += --gc-sections > ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION_DEBUG > -- > 2.34.1 > Clang doesn't support -finhibit-size-directive, so this would break Clang builds. GCC has had this option since 1992, but it is not used in the wild. https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#index-finhibit-size-directive says > ... This option is used when compiling crtstuff.c; you should not need to use it for anything else. What problem have you seen with .size directives (st_size field in symbol table entries)? % cat a.c int v; void f() {} % diff -u0 <(gcc -S a.c -o -) <(gcc -S -finhibit-size-directive a.c -o -) --- /proc/self/fd/11 2023-11-05 12:42:51.298618475 -0800 +++ /proc/self/fd/15 2023-11-05 12:42:51.298618475 -0800 @@ -7 +6,0 @@ - .size v, 4 @@ -27 +25,0 @@ - .size f, .-f
Hi, Fangrui Thank you for your time :) On 11/6/2023 4:50 AM, Fangrui Song wrote: > On Fri, Nov 3, 2023 at 9:01 AM Yuan Tan <tanyuan@tinylab.org> wrote: > > > > .size directive fails in some functions with SHF_GROUP, this is not > > really required for normal building, inhibit it to silence the compiling > > failures with SHF_GROUP. > > > > Signed-off-by: Yuan Tan <tanyuan@tinylab.org> > > Signed-off-by: Zhangjin Wu <falcon@tinylab.org> > > --- > > Makefile | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/Makefile b/Makefile > > index a4e522b747cb..f67b6e8d2c45 100644 > > --- a/Makefile > > +++ b/Makefile > > @@ -936,6 +936,9 @@ endif > > # `rustc`'s `-Zfunction-sections` applies to data too (as of 1.59.0). > > ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION > > KBUILD_CFLAGS_KERNEL += -ffunction-sections -fdata-sections > > +ifdef CONFIG_SECTION_SHF_GROUP_SUPPORT > > +KBUILD_CFLAGS_KERNEL += -finhibit-size-directive > > +endif > > KBUILD_RUSTFLAGS_KERNEL += -Zfunction-sections=y > > LDFLAGS_vmlinux += --gc-sections > > ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION_DEBUG > > -- > > 2.34.1 > > > > Clang doesn't support -finhibit-size-directive, so this would break > Clang builds. Currently, Clang doesn't support LD_DEAD_CODE_DATA_ELIMINATION. So in this patch series I didn't take much thought about clang. > > GCC has had this option since 1992, but it is not used in the wild. > https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#index-finhibit-size-directive > says > > > ... This option is used when compiling crtstuff.c; you should not need to use it for anything else. > > What problem have you seen with .size directives (st_size field in > symbol table entries)? $ make ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- fs/ioctl.o /tmp/ccy5E3wN.s: Error: .size expression for __riscv_sys_ioctl does not evaluate to a constant make[3]: *** [scripts/Makefile.build:243: fs/ioctl.o] Error 1 make[2]: *** [scripts/Makefile.build:480: fs] Error 2 make[1]: *** [/home/tanyuan/projects/linux/Makefile:1916: .] Error 2 make: *** [Makefile:234: __sub-make] Error 2 And the fs/ioctl.s is like .section .text.__riscv_sys_ioctl,"ax",@progbits .align 1 .globl __riscv_sys_ioctl .type __riscv_sys_ioctl, @function __riscv_sys_ioctl: ... ... .size __riscv_sys_ioctl, .-__riscv_sys_ioctl I cannot understand this error and this option just solve the problem :) > > % cat a.c > int v; > void f() {} > % diff -u0 <(gcc -S a.c -o -) <(gcc -S -finhibit-size-directive a.c -o -) > --- /proc/self/fd/11 2023-11-05 12:42:51.298618475 -0800 > +++ /proc/self/fd/15 2023-11-05 12:42:51.298618475 -0800 > @@ -7 +6,0 @@ > - .size v, 4 > @@ -27 +25,0 @@ > - .size f, .-f > >
diff --git a/Makefile b/Makefile index a4e522b747cb..f67b6e8d2c45 100644 --- a/Makefile +++ b/Makefile @@ -936,6 +936,9 @@ endif # `rustc`'s `-Zfunction-sections` applies to data too (as of 1.59.0). ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION KBUILD_CFLAGS_KERNEL += -ffunction-sections -fdata-sections +ifdef CONFIG_SECTION_SHF_GROUP_SUPPORT +KBUILD_CFLAGS_KERNEL += -finhibit-size-directive +endif KBUILD_RUSTFLAGS_KERNEL += -Zfunction-sections=y LDFLAGS_vmlinux += --gc-sections ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION_DEBUG