exynos-linux-stable / crownlte

NOTE 9 kernel source with linux-stable merged in. ................................................................................................................. Supported Devices codename: Note 9 "aka. crownlte aka. N960F"
Other
16 stars 21 forks source link

[tw90-android-p] Cannot compile with Clang: Build Failures in arch/arm64/crypto* #11

Closed digitalrayne closed 5 years ago

digitalrayne commented 5 years ago

When building using the standard LineageOS prebuild arm gcc 4.9 toolchain, I get the following error relating to the optimize attribute being ignored. Is gcc 4.9 supported for this branch?

../../../../../../kernel/samsung/exynox-stable-crownlte/arch/arm64/crypto/first_file_asm.c:7:40: error: unknown attribute 'optimize' ignored [-Werror,-Wunknown-attributes]
__attribute__ ((section(".init.text"), optimize("-O0"), unused))
                                       ^
1 error generated.
/srv/src/LINEAGE_16_0/kernel/samsung/exynox-stable-crownlte/scripts/Makefile.build:334: recipe for target 'arch/arm64/crypto/first_file_asm.o' failed
make[2]: *** [arch/arm64/crypto/first_file_asm.o] Error 1
/srv/src/LINEAGE_16_0/kernel/samsung/exynox-stable-crownlte/Makefile:1124: recipe for target 'arch/arm64/crypto' failed
digitalrayne commented 5 years ago

This can be worked around by disabling CONFIG_CRYPTO_FIPS.

digitalrayne commented 5 years ago

It seems there are general issues compiling the arm64 crypto portion of the kernel with the prebuilt GCC 4.9 toolchain using the defconfig. Now that I am passed the above error, I am getting:

  CC      arch/arm64/crypto/sha2-ce-glue.o         
/tmp/sha2-ce-glue-b2f90c.s: Assembler messages:
/tmp/sha2-ce-glue-b2f90c.s:668: Error: bad expression       
/tmp/sha2-ce-glue-b2f90c.s:668: Error: junk at end of line, first unrecognized character is `3'
/tmp/sha2-ce-glue-b2f90c.s:672: Error: bad expression       
/tmp/sha2-ce-glue-b2f90c.s:672: Error: junk at end of line, first unrecognized character is `1'
clang-6.0: error: assembler command failed with exit code 1 (use -v to see invocation)
/srv/src/LINEAGE_16_0/kernel/samsung/exynox-stable-crownlte/scripts/Makefile.build:334: recipe for target 'arch/arm64/crypto/sha2-ce-glue.o' failed
make[2]: *** [arch/arm64/crypto/sha2-ce-glue.o] Error 1         
make[2]: *** Waiting for unfinished jobs....      
/tmp/sha1-ce-glue-4cfe51.s: Assembler messages:
/tmp/sha1-ce-glue-4cfe51.s:637: Error: bad expression
/tmp/sha1-ce-glue-4cfe51.s:637: Error: junk at end of line, first unrecognized character is `2'
/tmp/sha1-ce-glue-4cfe51.s:641: Error: bad expression                             
/tmp/sha1-ce-glue-4cfe51.s:641: Error: junk at end of line, first unrecognized character is `9'
clang-6.0: error: assembler command failed with exit code 1 (use -v to see invocation)
/srv/src/LINEAGE_16_0/kernel/samsung/exynox-stable-crownlte/scripts/Makefile.build:334: recipe for target 'arch/arm64/crypto/sha1-ce-glue.o' failed
make[2]: *** [arch/arm64/crypto/sha1-ce-glue.o] Error 1                                       
/srv/src/LINEAGE_16_0/kernel/samsung/exynox-stable-crownlte/Makefile:1124: recipe for target 'arch/arm64/crypto' failed
make[1]: *** [arch/arm64/crypto] Error 2
make[1]: Leaving directory '/srv/src/LINEAGE_16_0/out/target/product/crownlte/obj/KERNEL_OBJ'
Makefile:152: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2                                
make: Leaving directory '/srv/src/LINEAGE_16_0/kernel/samsung/exynox-stable-crownlte'
digitalrayne commented 5 years ago

I found a section in my board config where I was enabling (which I understand is the default now) clang 6.0 for compiling the kernel - I've disabled this an will try to rebuild.

digitalrayne commented 5 years ago

Ah, so potentially this kernel is missing the clang patchset - https://android.googlesource.com/kernel/common/+log/5d15d2e00da4bcb0bcc5e6d27dc18fe1646214f1

Namely - https://android.googlesource.com/kernel/common/+/e2b2ca94b0e101b3f24d82a1934151f29b738121

digitalrayne commented 5 years ago

Confirmed that these issues were not present with GCC, and that the clang patchsets seem to be missing from these kernel sources.

farovitus commented 5 years ago

SAMSUNG sources for 9810 are not clang ready. Kernel compiles fine with GCC.

digitalrayne commented 5 years ago

It would make sense to leave this open, then, until the CLANG patchset was merged, given all Android kernels are compiled with clang. Otherwise folks wlll keep tripping over this.

farovitus commented 5 years ago

Not "all Android kernels" are compiled with clang, but they are with gcc. Also, new devices may compile just fine with clang due to newer source.