From patchwork Mon Nov 14 11:43:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19748 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2097968wru; Mon, 14 Nov 2022 03:48:44 -0800 (PST) X-Google-Smtp-Source: AA0mqf501+Dsl/eMM3SHPPTjTLC4MWuLcy/lck870yciTgTFPqViQT4BEEaBy3VY2tsjQ6zqtG8w X-Received: by 2002:a17:907:d68b:b0:7ae:41e6:9076 with SMTP id wf11-20020a170907d68b00b007ae41e69076mr10222930ejc.321.1668426524274; Mon, 14 Nov 2022 03:48:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426524; cv=none; d=google.com; s=arc-20160816; b=KbdjcvlHSVMjKFjtquKvlimU6AxioLCq//Grfs3sq8UW8haLbAMbtR7zn42HTGGHZl 0H0tknUIOnOE5QeHrKIljqQ1wkr3fMPcS7XwxE99hWhXEs1z/2skHlwPY3x3avTI2B6e hYKRW/G3X5qIWOFogSJ2vQDeGOsE7Z01MealZqmm3DDO0BNHun7/FmR17s0hS+BPLh1D f8TMGBQKrgNI97dNFeiep1OYoaXOBkCir63ksSZMatYs75srFb/OB6LlQUAIJw0Hgpcg e+C6CWZUY/Ai9E8PHEpQtz0ySR9FZxKfjiiHmmPDytFPY1v+GYaMg2Gxz7iBHjX5+jbM pucg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xBNmJBLDVDGdH8+H48/QvaSCZLW72i3AZTvyWsazSeY=; b=WwHLDz1M8ymJ9H6zFs+uBT3cavFmsIw0u8SrfXP7eE2ukdR16Lb3m5TP4+XOga+Ur5 dFu5L3NlKLK06r9xz6c5DLh7iEo42TCxp0F/A5qBzQW8pNjzc9ET/179cHTdWV+YB/xO HEb44eWNjMFF3IX6UK/4J/YZNJ0yJD/qGc6BiMrWMao3uZs65nZVDhREMXLzfSjDG6Yh qfSTrTTDaAwf+va/s6xHvQEya8nNw2qA0x0n4cxKwOPzKzsIMmri7quHQqrXVw6z8LJb 6u8vKmG4e+DMy5s0tfAPEJDNlwnL9F0clklZGsdZuZVn9TOjQ9oB4VVhK4emOE8n3fDt BzBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XtUJF22t; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d14-20020a50fb0e000000b00461d2ed78afsi8114401edq.563.2022.11.14.03.48.20; Mon, 14 Nov 2022 03:48:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XtUJF22t; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236774AbiKNLqF (ORCPT + 99 others); Mon, 14 Nov 2022 06:46:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236672AbiKNLp2 (ORCPT ); Mon, 14 Nov 2022 06:45:28 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C1D1222BF; Mon, 14 Nov 2022 03:44:47 -0800 (PST) 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 BDD5C61045; Mon, 14 Nov 2022 11:44:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F566C433D6; Mon, 14 Nov 2022 11:44:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426286; bh=l68sB4NnR3/f4L7VL19WvqH6Dh8yt/aVZ1uJVefQMtI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XtUJF22t1vMETfxkDkDoQaLgCdasT1mX3SAV8kKRXx4VF8SppR8kmCPcKMKny+Dbh +R5/4ermD/vAqhbI6Jfl2IqEnpgRKohqOPuvB4Lr0fp79bgVEMQTN7nYEURG2V56sP uAL+oq9za5RvSqWqnegWHtzmApX55dYD+0jXvOKiYAaATRPll3qAZUolXRKuXdwIp3 tZijCM3cQmnJskEoxRP80Y42UARhTetm5DtR4MNQJ6vgwf4jlfGRFsTa01Fyg8IIcV 8YhXFJHgBjabJP8rmmWYRTzNu549Kt7BxT7QTjZNordAq51h+KaB/RMfFHwsvewfck BMu5d6NEToxzA== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Jiri Slaby , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , bpf@vger.kernel.org, Martin Liska Subject: [PATCH 21/46] btf, lto: pass scope as strings Date: Mon, 14 Nov 2022 12:43:19 +0100 Message-Id: <20221114114344.18650-22-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,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 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749472011019551705?= X-GMAIL-MSGID: =?utf-8?q?1749472011019551705?= From: Jiri Slaby gcc LTO can put assembler top level statements into other assembler files. The BTF IDs assumed that they are in the same file. We need to make all BTF IDs global to work around this. This is a preparation for that, as we will pass __global_on_lto as scope. That is macro that expands either to "globl" or "local" depending whether LTO is enabled. That wouldn't work without this patch as we stringify scope at the moment. Cc: Alexei Starovoitov Cc: Daniel Borkmann Cc: Andrii Nakryiko Cc: Martin KaFai Lau Cc: Song Liu Cc: Yonghong Song Cc: John Fastabend Cc: KP Singh Cc: Stanislav Fomichev Cc: Hao Luo Cc: Jiri Olsa Cc: bpf@vger.kernel.org Cc: Martin Liska Signed-off-by: Jiri Slaby --- include/linux/btf_ids.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/include/linux/btf_ids.h b/include/linux/btf_ids.h index 2aea877d644f..3011757a48ef 100644 --- a/include/linux/btf_ids.h +++ b/include/linux/btf_ids.h @@ -83,16 +83,16 @@ word \ #define __BTF_ID_LIST(name, scope) \ asm( \ ".pushsection " BTF_IDS_SECTION ",\"a\"; \n" \ -"." #scope " " #name "; \n" \ +"." scope " " #name "; \n" \ #name ":; \n" \ ".popsection; \n"); #define BTF_ID_LIST(name) \ -__BTF_ID_LIST(name, local) \ +__BTF_ID_LIST(name, "local") \ extern u32 name[]; #define BTF_ID_LIST_GLOBAL(name, n) \ -__BTF_ID_LIST(name, globl) +__BTF_ID_LIST(name, "globl") /* The BTF_ID_LIST_SINGLE macro defines a BTF_ID_LIST with * a single entry. @@ -142,18 +142,18 @@ asm( \ #define __BTF_SET_START(name, scope) \ asm( \ ".pushsection " BTF_IDS_SECTION ",\"a\"; \n" \ -"." #scope " __BTF_ID__set__" #name "; \n" \ +"." scope " __BTF_ID__set__" #name "; \n" \ "__BTF_ID__set__" #name ":; \n" \ ".zero 4 \n" \ ".popsection; \n"); #define BTF_SET_START(name) \ -__BTF_ID_LIST(name, local) \ -__BTF_SET_START(name, local) +__BTF_ID_LIST(name, "local") \ +__BTF_SET_START(name, "local") #define BTF_SET_START_GLOBAL(name) \ -__BTF_ID_LIST(name, globl) \ -__BTF_SET_START(name, globl) +__BTF_ID_LIST(name, "globl") \ +__BTF_SET_START(name, "globl") #define BTF_SET_END(name) \ asm( \ @@ -186,14 +186,14 @@ extern struct btf_id_set name; #define __BTF_SET8_START(name, scope) \ asm( \ ".pushsection " BTF_IDS_SECTION ",\"a\"; \n" \ -"." #scope " __BTF_ID__set8__" #name "; \n" \ +"." scope " __BTF_ID__set8__" #name "; \n" \ "__BTF_ID__set8__" #name ":; \n" \ ".zero 8 \n" \ ".popsection; \n"); #define BTF_SET8_START(name) \ -__BTF_ID_LIST(name, local) \ -__BTF_SET8_START(name, local) +__BTF_ID_LIST(name, "local") \ +__BTF_SET8_START(name, "local") #define BTF_SET8_END(name) \ asm( \