提交 a25c13b3 编写于 作者: N Nick Desaulniers 提交者: Linus Torvalds

compiler.h: avoid escaped section names

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__())).

Fixes: commit e04462fb ("Compiler Attributes: remove uses of __attribute__ from compiler.h")
Signed-off-by: NNick Desaulniers <ndesaulniers@google.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Cc: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Cc: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Cc: Nathan Chancellor <natechancellor@gmail.com>
Cc: Arvind Sankar <nivedita@alum.mit.edu>
Link: https://bugs.llvm.org/show_bug.cgi?id=42950
Link: https://lkml.kernel.org/r/20200929194318.548707-1-ndesaulniers@google.comSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 c8db3b0a
...@@ -155,7 +155,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, ...@@ -155,7 +155,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
extern typeof(sym) sym; \ extern typeof(sym) sym; \
static const unsigned long __kentry_##sym \ static const unsigned long __kentry_##sym \
__used \ __used \
__section("___kentry" "+" #sym ) \ __attribute__((__section__("___kentry+" #sym))) \
= (unsigned long)&sym; = (unsigned long)&sym;
#endif #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册