Skip to content

Commit bfafddd

Browse files
nickdesaulniersojeda
authored andcommitted
include/linux/compiler.h: fix Oops for Clang-compiled kernels
GCC unescapes escaped string section names while Clang does not. Because __section uses the `#` stringification operator for the section name, it doesn't need to be escaped. This fixes an Oops observed in distro's that use systemd and not net.core.bpf_jit_enable=1, when their kernels are compiled with Clang. Link: ClangBuiltLinux/linux#619 Link: https://bugs.llvm.org/show_bug.cgi?id=42950 Link: https://marc.info/?l=linux-netdev&m=156412960619946&w=2 Link: https://lore.kernel.org/lkml/[email protected]/ Acked-by: Will Deacon <[email protected]> Reported-by: Sedat Dilek <[email protected]> Suggested-by: Josh Poimboeuf <[email protected]> Tested-by: Sedat Dilek <[email protected]> Signed-off-by: Nick Desaulniers <[email protected]> [Cherry-picked from the __section cleanup series for 5.3] [Adjusted commit message] Signed-off-by: Miguel Ojeda <[email protected]>
1 parent 089cf7f commit bfafddd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

include/linux/compiler.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
2424
long ______r; \
2525
static struct ftrace_likely_data \
2626
__aligned(4) \
27-
__section("_ftrace_annotated_branch") \
27+
__section(_ftrace_annotated_branch) \
2828
______f = { \
2929
.data.func = __func__, \
3030
.data.file = __FILE__, \
@@ -60,7 +60,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
6060
#define __trace_if_value(cond) ({ \
6161
static struct ftrace_branch_data \
6262
__aligned(4) \
63-
__section("_ftrace_branch") \
63+
__section(_ftrace_branch) \
6464
__if_trace = { \
6565
.func = __func__, \
6666
.file = __FILE__, \
@@ -118,7 +118,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
118118
".popsection\n\t"
119119

120120
/* Annotate a C jump table to allow objtool to follow the code flow */
121-
#define __annotate_jump_table __section(".rodata..c_jump_table")
121+
#define __annotate_jump_table __section(.rodata..c_jump_table)
122122

123123
#else
124124
#define annotate_reachable()
@@ -298,7 +298,7 @@ unsigned long read_word_at_a_time(const void *addr)
298298
* visible to the compiler.
299299
*/
300300
#define __ADDRESSABLE(sym) \
301-
static void * __section(".discard.addressable") __used \
301+
static void * __section(.discard.addressable) __used \
302302
__PASTE(__addressable_##sym, __LINE__) = (void *)&sym;
303303

304304
/**

0 commit comments

Comments
 (0)