bcc
bcc copied to clipboard
Multiple tools show duplicate-decl-specifier warning with clang 19
Multiple tools show the following warning when used with clang 19:
In file included from /virtual/main.c:14:
In file included from include/uapi/linux/ptrace.h:183:
In file included from arch/x86/include/asm/ptrace.h:175:
In file included from arch/x86/include/asm/paravirt_types.h:12:
In file included from arch/x86/include/asm/nospec-branch.h:15:
arch/x86/include/asm/current.h:47:10: warning: multiple identical address spaces specified for type [-Wduplicate-decl-specifier]
47 | return this_cpu_read_const(const_pcpu_hot.current_task);
| ^
arch/x86/include/asm/percpu.h:577:36: note: expanded from macro 'this_cpu_read_const'
577 | #define this_cpu_read_const(pcp) __raw_cpu_read_const(pcp)
| ^
arch/x86/include/asm/percpu.h:163:35: note: expanded from macro '__raw_cpu_read_const'
163 | #define __raw_cpu_read_const(pcp) __raw_cpu_read(, , pcp)
| ^
arch/x86/include/asm/percpu.h:155:30: note: expanded from macro '__raw_cpu_read'
155 | *(qual __my_cpu_type(pcp) *)__my_cpu_ptr(&(pcp)); \
| ^
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
arch/x86/include/asm/percpu.h:94:40: note: expanded from macro '__my_cpu_type'
94 | #define __my_cpu_type(var) typeof(var) __percpu_seg_override
| ^
arch/x86/include/asm/percpu.h:45:32: note: expanded from macro '__percpu_seg_override'
45 | # define __percpu_seg_override __seg_gs
| ^
<built-in>:362:33: note: expanded from macro '__seg_gs'
362 | #define __seg_gs __attribute__((address_space(256)))
| ^
The tools otherwise still work as expected. AFAICT, the issue lies in the kernel headers. A patch was posted upstream but haven't been taken yet: https://lore.kernel.org/all/[email protected]/
Applying this patch does indeed get rid of the warning.
@jeromemarchand Thanks for the heads-up. The above commit has not merged yet and I have not tested bcc with latest 5.12/5.13 yet.
unsure if this is related, just to mention this also seen with shmsnoop-bpfcc on Debian GNU/Linux 12 (bookworm) kernel
#shmsnoop-bpfcc
In file included from /virtual/main.c:2:
In file included from include/uapi/linux/ptrace.h:183:
In file included from arch/x86/include/asm/ptrace.h:175:
In file included from arch/x86/include/asm/paravirt_types.h:12:
In file included from arch/x86/include/asm/nospec-branch.h:15:
arch/x86/include/asm/current.h:47:10: warning: multiple identical address spaces specified for type [-Wduplicate-decl-specifier]
return this_cpu_read_const(const_pcpu_hot.current_task);
^
arch/x86/include/asm/percpu.h:577:36: note: expanded from macro 'this_cpu_read_const'
#define this_cpu_read_const(pcp) __raw_cpu_read_const(pcp)
^
arch/x86/include/asm/percpu.h:163:35: note: expanded from macro '__raw_cpu_read_const'
#define __raw_cpu_read_const(pcp) __raw_cpu_read(, , pcp)
^
arch/x86/include/asm/percpu.h:155:30: note: expanded from macro '__raw_cpu_read'
*(qual __my_cpu_type(pcp) *)__my_cpu_ptr(&(pcp)); \
^
note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
arch/x86/include/asm/percpu.h:94:40: note: expanded from macro '__my_cpu_type'
#define __my_cpu_type(var) typeof(var) __percpu_seg_override
^
arch/x86/include/asm/percpu.h:45:32: note: expanded from macro '__percpu_seg_override'
# define __percpu_seg_override __seg_gs
^
<built-in>:329:33: note: expanded from here
#define __seg_gs __attribute__((address_space(256)))
^