Skip to content
This repository has been archived by the owner on Mar 7, 2021. It is now read-only.

Build fails on v5.0+ against kernels built with gcc #123

Closed
geofft opened this issue Aug 18, 2019 · 5 comments
Closed

Build fails on v5.0+ against kernels built with gcc #123

geofft opened this issue Aug 18, 2019 · 5 comments
Labels
build-system Bugs or features related to building modules

Comments

@geofft
Copy link
Collaborator

geofft commented Aug 18, 2019

Since torvalds/linux@e9666d1, detection for asm goto (which gcc supports and clang does not) got moved from a check at each build to a check in the kernel config, so a kernel built with gcc will have CONFIG_CC_HAS_ASM_GOTO, which breaks the build with clang / breaks bindgen's ability to parse the code with clang. (I haven't tested it, but I expect a kernel built with clang to work fine.)

See discussion in lizhuohua/linux-kernel-module-rust#1.

@geofft
Copy link
Collaborator Author

geofft commented Aug 18, 2019

Good news and bad news:

  • Extremely recent versions of clang (the clang 9 snapshot on https://apt.llvm.org works) support asm gotos, so they do work fine.
  • If you have such a version of clang, it breaks older kernels because now the build time check thinks that clang supports asm goto but some of the ifdefs are wrong, or something? With kernel 4.19 I get "implicit declaration of function 'asm_volatile_goto'" in arch/x86/include/asm/jump_lable.h. Switching back to clang 7 from Debian stable works....

@alex alex added the build-system Bugs or features related to building modules label Sep 1, 2019
@alex
Copy link
Member

alex commented Aug 9, 2020

@geofft I think this got fixed somewhere along the way, I'm definitely building on 5.x kernels.

@alex alex closed this as completed Aug 9, 2020
@geofft
Copy link
Collaborator Author

geofft commented Aug 9, 2020

Oh hey thanks for the reminder, I definitely regressed this last night while trying to get rid of kernel-cflags-finder and this probably explains why.

@geofft
Copy link
Collaborator Author

geofft commented Aug 9, 2020

@alex so, there is one particular case still broken - clang 9+ and kernel <5 (my last bullet point above).
https://travis-ci.com/github/fishinabarrel/linux-kernel-module-rust/builds/179047119
clang 9+ and kernel >=5 is fine. (clang <9 and kernel >=5 definitely won't work because of lack of asm goto support.)

Do we want to open a ticket for the new-clang-old-kernel case and see if it's solvable, or do we just want to document it as a restriction?

@alex
Copy link
Member

alex commented Aug 9, 2020 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
build-system Bugs or features related to building modules
Projects
None yet
Development

No branches or pull requests

2 participants