From: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: Andi Kleen <andi@firstfloor.org>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <martin.lau@linux.dev>,
Song Liu <song@kernel.org>, Yonghong Song <yhs@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>,
Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>,
Jiri Olsa <jolsa@kernel.org>,
bpf@vger.kernel.org, Martin Liska <mliska@suse.cz>,
Jiri Slaby <jslaby@suse.cz>
Subject: [PATCH 22/46] btf, lto: Make all BTF IDs global on LTO
Date: Mon, 14 Nov 2022 12:43:20 +0100 [thread overview]
Message-ID: <20221114114344.18650-23-jirislaby@kernel.org> (raw)
In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org>
From: Andi Kleen <andi@firstfloor.org>
gcc LTO can put assembler top level statements into other assembler
files. The BTF IDs assumed that they are in the same file. So if we are
building with gcc LTO, make all BTF IDs global to work around this.
This is done by new __global_on_lto macro.
[js] do that for 8B BTF set too (commit ab21d6063c01)
[js] do global only in LTO case
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Andrii Nakryiko <andrii@kernel.org>
Cc: Martin KaFai Lau <martin.lau@linux.dev>
Cc: Song Liu <song@kernel.org>
Cc: Yonghong Song <yhs@fb.com>
Cc: John Fastabend <john.fastabend@gmail.com>
Cc: KP Singh <kpsingh@kernel.org>
Cc: Stanislav Fomichev <sdf@google.com>
Cc: Hao Luo <haoluo@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: bpf@vger.kernel.org
Signed-off-by: Andi Kleen <andi@firstfloor.org>
Signed-off-by: Martin Liska <mliska@suse.cz>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
include/linux/btf_ids.h | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/include/linux/btf_ids.h b/include/linux/btf_ids.h
index 3011757a48ef..a2bef302e42c 100644
--- a/include/linux/btf_ids.h
+++ b/include/linux/btf_ids.h
@@ -37,7 +37,7 @@ struct btf_id_set8 {
#define ____BTF_ID(symbol, word) \
asm( \
".pushsection " BTF_IDS_SECTION ",\"a\"; \n" \
-".local " #symbol " ; \n" \
+"." __global_on_lto " " #symbol " ; \n" \
".type " #symbol ", STT_OBJECT; \n" \
".size " #symbol ", 4; \n" \
#symbol ": \n" \
@@ -88,7 +88,7 @@ asm( \
".popsection; \n");
#define BTF_ID_LIST(name) \
-__BTF_ID_LIST(name, "local") \
+__BTF_ID_LIST(name, __global_on_lto) \
extern u32 name[];
#define BTF_ID_LIST_GLOBAL(name, n) \
@@ -148,8 +148,8 @@ asm( \
".popsection; \n");
#define BTF_SET_START(name) \
-__BTF_ID_LIST(name, "local") \
-__BTF_SET_START(name, "local")
+__BTF_ID_LIST(name, __global_on_lto) \
+__BTF_SET_START(name, __global_on_lto)
#define BTF_SET_START_GLOBAL(name) \
__BTF_ID_LIST(name, "globl") \
@@ -192,8 +192,8 @@ asm( \
".popsection; \n");
#define BTF_SET8_START(name) \
-__BTF_ID_LIST(name, "local") \
-__BTF_SET8_START(name, "local")
+__BTF_ID_LIST(name, __global_on_lto) \
+__BTF_SET8_START(name, __global_on_lto)
#define BTF_SET8_END(name) \
asm( \
--
2.38.1
next prev parent reply other threads:[~2022-11-14 11:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20221114114344.18650-1-jirislaby@kernel.org>
2022-11-14 11:43 ` [PATCH 21/46] btf, lto: pass scope as strings Jiri Slaby (SUSE)
2022-11-14 11:43 ` Jiri Slaby (SUSE) [this message]
2022-11-14 11:43 ` [PATCH 24/46] bpf, lto: mark interpreter jump table as __noreorder Jiri Slaby (SUSE)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221114114344.18650-23-jirislaby@kernel.org \
--to=jirislaby@kernel.org \
--cc=andi@firstfloor.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=jslaby@suse.cz \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=mliska@suse.cz \
--cc=sdf@google.com \
--cc=song@kernel.org \
--cc=yhs@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox