linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] compiler.h: avoid escaped section names
@ 2020-09-29 19:43 Nick Desaulniers
  2020-09-29 20:08 ` Arvind Sankar
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Nick Desaulniers @ 2020-09-29 19:43 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Miguel Ojeda, Nick Desaulniers, Luc Van Oostenryck,
	Nathan Chancellor, linux-sparse, linux-kernel, clang-built-linux

The stringification operator, `#`, in the preprocessor escapes strings.
For example, `# "foo"` becomes `"\"foo\""`.  GCC and Clang differ in how
they treat section names that contain \".

The portable solution is to not use a string literal with the
preprocessor stringification operator.

In this case, since __section unconditionally uses the stringification
operator, we actually want the more verbose
__attribute__((__section__())).

Link: https://bugs.llvm.org/show_bug.cgi?id=42950
Fixes: commit e04462fb82f8 ("Compiler Attributes: remove uses of __attribute__ from compiler.h")
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
 include/linux/compiler.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 92ef163a7479..ac45f6d40d39 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -155,7 +155,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
 	extern typeof(sym) sym;					\
 	static const unsigned long __kentry_##sym		\
 	__used							\
-	__section("___kentry" "+" #sym )			\
+	__attribute__((__section__("___kentry+" #sym)))		\
 	= (unsigned long)&sym;
 #endif
 
-- 
2.28.0.709.gb0816b6eb0-goog


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-09-30 23:10 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-29 19:43 [PATCH] compiler.h: avoid escaped section names Nick Desaulniers
2020-09-29 20:08 ` Arvind Sankar
2020-09-29 20:13   ` Arvind Sankar
2020-09-29 20:25   ` Nick Desaulniers
2020-09-29 20:30     ` Nick Desaulniers
2020-09-29 20:47       ` Arvind Sankar
2020-09-29 20:59         ` Nick Desaulniers
2020-09-30 15:40     ` Joe Perches
2020-09-30 18:33       ` Joe Perches
2020-09-30 23:10         ` convert_section.pl attached Joe Perches
2020-09-29 21:33 ` [PATCH] compiler.h: avoid escaped section names Miguel Ojeda
2020-09-30  8:33 ` David Laight

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).