View previous topic :: View next topic |
Author |
Message |
PurpleGerbim n00b
Joined: 10 Jul 2021 Posts: 5
|
Posted: Thu Jul 29, 2021 8:23 am Post subject: No march=znver1 option when compiling kernel with Clang |
|
|
Hello good Gentoo folk,
I've been happily running Gentoo on an AMD Ryzen processor (1800x) and compiling my kernel with the experimental USE flag, to compile the kernel with march=znver1 (Under Processor type and features -->Processor family (AMD ZEN)).
I've recently switched from GCC to Clang as the system compiler, and noticed the option went missing, even when compiling with the same USE flags and settings. Sure enough, when I set the kernel to compile with GCC again, the option reappeared.
This leads me to two questions:
1. Since I have march=native set globally, will the kernel compile with znver1 under Clang? (I don't recall it does with GCC)
2. If not, is there a way to compile the kernel with march=nativeunder Clang?
I'm not sure if I need to attach any details - if there's anything missing please let me know and I'll be sure to add it.
Thanks! |
|
Back to top |
|
|
alamahant Advocate
Joined: 23 Mar 2019 Posts: 3879
|
Posted: Thu Jul 29, 2021 9:55 am Post subject: |
|
|
Quote: |
Since I have march=native set globally, will the kernel compile with znver1 under Clang? (I don't recall it does with GCC)
|
No the kernel overrides all CFLAGS settings.It uses its own.
Try to manually add
Code: |
CONFIG_GENERIC_CPU=n
CONFIG_MNATIVE_AMD=y
|
in .config
and run make and see if it recognizes it.It will prompt you to reconfirm.
If not it means it is ignored. _________________
|
|
Back to top |
|
|
Naib Watchman
Joined: 21 May 2004 Posts: 6051 Location: Removed by Neddy
|
Posted: Thu Jul 29, 2021 6:57 pm Post subject: |
|
|
not a clang thing, its a gentoo specific patchset that hasn't been updated. I went back to 5.13.0 and checked using make LD=ld.bfd ... and with make LLVM=1 LLVM_IAS=1 and the options are not there _________________
Quote: | Removed by Chiitoo |
|
|
Back to top |
|
|
alamahant Advocate
Joined: 23 Mar 2019 Posts: 3879
|
Posted: Thu Jul 29, 2021 7:28 pm Post subject: |
|
|
Naib
Quote: |
I went back to 5.13.0 and checked
|
Indeed but in 5.13.1 they are available. _________________
|
|
Back to top |
|
|
PurpleGerbim n00b
Joined: 10 Jul 2021 Posts: 5
|
Posted: Thu Jul 29, 2021 7:28 pm Post subject: |
|
|
Hi, Thank you both for responding!
Quote: | Try to manually add
Code:
CONFIG_GENERIC_CPU=n
CONFIG_MNATIVE_AMD=y
in .config
|
make seems to ignore it as you mentioned might happen, but this error pops up as well:
Code: | .config:418:warning: override: MNATIVE_AMD changes choice state |
Quote: | not a clang thing, its a gentoo specific patchset that hasn't been updated. I went back to 5.13.0 and checked using make LD=ld.bfd ... and with make LLVM=1 LLVM_IAS=1 and the options are not there |
I guess this is it then - I had similar results.
Thanks! |
|
Back to top |
|
|
PurpleGerbim n00b
Joined: 10 Jul 2021 Posts: 5
|
Posted: Sat Aug 14, 2021 2:08 pm Post subject: |
|
|
Hi again,
I was able to get this working on the latest kernel (5.13.10-gentoo) by running
Code: | LLVM=1 LLVM_IAS=1 CC=clang HOSTCC=clang make -j$(nproc) && LLVM=1 LLVM_IAS=1 CC=clang HOSTCC=clang make modules_install && LLVM=1 LLVM_IAS=1 CC=clang HOSTCC=clang make install |
and confirmed my kernel was clang based by reading the .config. make also prompted my to choose Clang's LTO.
Even though Clang did not appear under make menuconfig, I managed to compile the kernel with it using the command above.
Thanks for pointing me in the right direction, and hope this helps! |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54237 Location: 56N 3W
|
Posted: Sat Aug 14, 2021 2:50 pm Post subject: |
|
|
PurpleGerbim,
Read the kernel Makefile.
There are some user accessible knobs you can twiddle, if you know the names. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
|