Skip to content

Commit ef9a7c7

Browse files
Prakash Suryabobrik
andauthored
Redefine asm_inline for Linux 5.4+, Fixes #2546 (#2547) (#5)
Here's the upstream commit that introduced `asm_inline`: * torvalds/linux@eb11186 Without this patch BCC fails with the following: ``` $ sudo /usr/share/bcc/tools/opensnoop In file included from /virtual/main.c:2: In file included from include/uapi/linux/ptrace.h:142: In file included from ./arch/x86/include/asm/ptrace.h:5: ./arch/x86/include/asm/segment.h:254:2: error: expected '(' after 'asm' alternative_io ("lsl %[seg],%[p]", ^ ./arch/x86/include/asm/alternative.h:240:2: note: expanded from macro 'alternative_io' asm_inline volatile (ALTERNATIVE(oldinstr, newinstr, feature) \ ^ include/linux/compiler_types.h:210:24: note: expanded from macro 'asm_inline' ^ ``` Co-authored-by: Ivan Babrou <ibobrik@gmail.com>
1 parent 7e71ead commit ef9a7c7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/cc/export/helpers.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ R"********(
1717
#ifndef __BPF_HELPERS_H
1818
#define __BPF_HELPERS_H
1919

20+
/* In Linux 5.4 asm_inline was introduced, but it's not supported by clang.
21+
* Redefine it to just asm to enable successful compilation.
22+
*/
23+
#ifdef asm_inline
24+
#undef asm_inline
25+
#define asm_inline asm
26+
#endif
27+
2028
/* Before bpf_helpers.h is included, uapi bpf.h has been
2129
* included, which references linux/types.h. This will bring
2230
* in asm_volatile_goto definition if permitted based on

0 commit comments

Comments
 (0)