[PATCH kernel 2/3] powerpc/llvm: Sample config for LLVM LTO

Alexey Kardashevskiy aik at ozlabs.ru
Wed Feb 16 12:28:47 AEDT 2022



On 2/12/22 11:05, Nick Desaulniers wrote:
> On Thu, Feb 10, 2022 at 6:31 PM Alexey Kardashevskiy <aik at ozlabs.ru> wrote:
>>
>> The config is a copy of ppc64_defconfig with a few tweaks. This could be
>> a smaller config to merge into ppc64_defconfig but unfortunately
>> merger does not allow disabling already enabled options.
> 
> Cool series!
> 
>>
>> This is a command line to compile the kernel using the upstream llvm:
>>
>> make -j64 O=/home/aik/pbuild/kernels-llvm/ \
>>   "KCFLAGS=-Wmissing-braces -Wno-array-bounds" \
>>   ARCH=powerpc LLVM_IAS=1 ppc64le_lto_defconfig CC=clang LLVM=1
> 
> That command line invocation is kind of a mess, and many things
> shouldn't be necessary.
> 
> O= is just noise; if folks are doing in tree builds then that doesn't
> add anything meaningful.
> KCFLAGS= why? I know -Warray-bounds is being worked on actively, but
> do we have instances of -Wmissing-braces at the moment? Let's get
> those fixed up.
> LLVM_IAS=1 is implied by LLVM=1.
> CC=clang is implied by LLVM=1
> 
> why add a new config? I think it would be simpler to just show command
> line invocations of `./scripts/config -e` and `make`. No new config
> required.



I should have added "RFC" in this one as the purpose of the patch is to 
show what works right now and not for actual submission.


>>
>> Forces CONFIG_BTRFS_FS=y to make CONFIG_ZSTD_COMPRESS=y to fix:
>> ld.lld: error: linking module flags 'Code Model': IDs have conflicting values in 'lib/built-in.a(entropy_common.o at 5332)' and 'ld-temp.o'
>>
>> because modules are linked with -mcmodel=large but the kernel uses -mcmodel=medium
> 
> Please file a bug about this.
> https://github.com/ClangBuiltLinux/linux/issues
> 
>>
>> Enables CONFIG_USERFAULTFD=y as otherwise vm_userfaultfd_ctx becomes
>> 0 bytes long and clang sanitizer crashes as
>> https://bugs.llvm.org/show_bug.cgi?id=500375

> 
> The above hyperlink doesn't work for me. Upstream llvm just moved from
> bugzilla to github issue tracker.


aah this is the correct one:
https://bugs.llvm.org/show_bug.cgi?id=50037

> 
> https://github.com/llvm/llvm-project/issues

oh ok.

>>
>> Disables CONFIG_FTR_FIXUP_SELFTEST as it uses FTR_SECTION_ELSE with
>> conditional branches. There are other places like this and the following
>> patches address that.
>>
>> Disables CONFIG_FTRACE_MCOUNT_USE_RECORDMCOUNT as CONFIG_HAS_LTO_CLANG
>> depends on it being disabled. In order to avoid disabling way too many
>> options (like DYNAMIC_FTRACE/FUNCTION_TRACER), this converts
>> FTRACE_MCOUNT_USE_RECORDMCOUNT from def_bool to bool.
>>
>> Note that even with this config there is a good chance that LTO
>> is going to fail linking vmlinux because of the "bc" problem.
> 
> I think rather than adding a new config with LTO enabled and a few
> things turned off, it would be better to not allow LTO to be
> selectable if those things are turned on, until the combination of the
> two are fixed.

Well, if I want people to try this thing, I kinda need to provide an 
easy way to allow LTO. The new config seemed the easiest (== the 
shortest) :)


More information about the Linuxppc-dev mailing list