[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221114114344.18650-22-jirislaby@kernel.org>
Date: Mon, 14 Nov 2022 12:43:19 +0100
From: "Jiri Slaby (SUSE)" <jirislaby@...nel.org>
To: linux-kernel@...r.kernel.org
Cc: Jiri Slaby <jslaby@...e.cz>, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
Martin KaFai Lau <martin.lau@...ux.dev>,
Song Liu <song@...nel.org>, Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>,
Stanislav Fomichev <sdf@...gle.com>,
Hao Luo <haoluo@...gle.com>, Jiri Olsa <jolsa@...nel.org>,
bpf@...r.kernel.org, Martin Liska <mliska@...e.cz>
Subject: [PATCH 21/46] btf, lto: pass scope as strings
From: Jiri Slaby <jslaby@...e.cz>
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 <ast@...nel.org>
Cc: Daniel Borkmann <daniel@...earbox.net>
Cc: Andrii Nakryiko <andrii@...nel.org>
Cc: Martin KaFai Lau <martin.lau@...ux.dev>
Cc: Song Liu <song@...nel.org>
Cc: Yonghong Song <yhs@...com>
Cc: John Fastabend <john.fastabend@...il.com>
Cc: KP Singh <kpsingh@...nel.org>
Cc: Stanislav Fomichev <sdf@...gle.com>
Cc: Hao Luo <haoluo@...gle.com>
Cc: Jiri Olsa <jolsa@...nel.org>
Cc: bpf@...r.kernel.org
Cc: Martin Liska <mliska@...e.cz>
Signed-off-by: Jiri Slaby <jslaby@...e.cz>
---
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( \
--
2.38.1
Powered by blists - more mailing lists