Bcc: Missing support for asm_inline in Linux 5.4

Created on 10 Oct 2019  路  2Comments  路  Source: iovisor/bcc

I'm observing the following issue:

$ 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'
#define asm_inline asm __inline
                       ^

The cause appears to be this commit landed in 5.4.0-rc1:

If I replace asm_inline with asm in the kernel headers, it works just fine.

I do have CONFIG_CC_HAS_ASM_INLINE=y:

The kernel is compiled with GCC 9.2.0, BCC is using LLVM9.

Most helpful comment

Adding the following at the very top of opensnoop C code also works:

#ifdef asm_inline
#undef asm_inline
#define asm_inline asm
#endif

Should I make a PR to insert this in BFrontendAction::DoMiscWorkAround() or is there a better way?

All 2 comments

Adding the following at the very top of opensnoop C code also works:

#ifdef asm_inline
#undef asm_inline
#define asm_inline asm
#endif

Should I make a PR to insert this in BFrontendAction::DoMiscWorkAround() or is there a better way?

Could you add the workaround to helpers.h? There is already asm_volatile_goto workaround there?
Yes, please do help submit a pull request. Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

paipanka picture paipanka  路  6Comments

anisse picture anisse  路  8Comments

saobao913 picture saobao913  路  8Comments

brendangregg picture brendangregg  路  4Comments

woodliu picture woodliu  路  8Comments