Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple tools show duplicate-decl-specifier warning with clang 19 #5163

Open
jeromemarchand opened this issue Nov 29, 2024 · 1 comment
Open

Comments

@jeromemarchand
Copy link
Contributor

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/20240526175655.227798-1-ubizjak@gmail.com/

Applying this patch does indeed get rid of the warning.

@yonghong-song
Copy link
Collaborator

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants