[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221114114344.18650-5-jirislaby@kernel.org>
Date: Mon, 14 Nov 2022 12:43:02 +0100
From: "Jiri Slaby (SUSE)" <jirislaby@...nel.org>
To: linux-kernel@...r.kernel.org
Cc: Jiri Slaby <jslaby@...e.cz>, kernel test robot <lkp@...el.com>,
Martin Liska <mliska@...e.cz>
Subject: [PATCH 04/46] compiler.h: introduce __visible_on_lto
From: Jiri Slaby <jslaby@...e.cz>
__visible_on_lto is defined as "__visible" when gcc LTO is turned on
(see later patches), and "static" otherwise. It is needed for top-level
symbols which are referenced in assembly. It is because the assembly and
the symbol can each end up in a different file with gcc LTO. And that
leads to linker errors.
So the symbols have to be visible when gcc LTO is in charge. On the
contrary, they have to be static on non-gcc-LTO builds. Otherwise a
warning about missing declaration occurs.
Reported-by: kernel test robot <lkp@...el.com>
Cc: Martin Liska <mliska@...e.cz>
Signed-off-by: Jiri Slaby <jslaby@...e.cz>
---
include/linux/compiler.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 973a1bfd7ef5..2305a3cbe99c 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -133,6 +133,12 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
#define __annotate_jump_table
#endif /* CONFIG_OBJTOOL */
+#ifdef CONFIG_LTO_GCC
+# define __visible_on_lto __visible
+#else
+# define __visible_on_lto static
+#endif
+
#ifndef unreachable
# define unreachable() do { \
annotate_unreachable(); \
--
2.38.1
Powered by blists - more mailing lists