andikleen / linux-misc

Various Linux kernel changes
http://halobates.de
Other
64 stars 12 forks source link

CONFIG_LTO & CONFIG_THUMB2_KERNEL is not working? #17

Open ChronoMonochrome opened 7 years ago

ChronoMonochrome commented 7 years ago

Hi!

I have successfully built LTO kernel (LK 3.0.x) for Galaxy Ace 2 thanks to your great work and thanks to participiants of some issues in this repository. Previously, I have also managed to compile THUMB2 kernel for an aforementioned device (well, with some ugly workarounds, but nevertheless, fully working). Now, I'm trying to merge THUMB2 changes, and the build ends up with the following errors:

LDFINAL vmlinux /home/chrono/1/kernel/ck/include/linux/mfd/abx500/ab8500-gpadc.h:54:5: warning: type of
'ab8500_gpadc_read_raw' does not match original declaration [-Wlto-type-mismatch] int ab8500_gpadc_read_raw(struct ab8500_gpadc gpadc, u8 channel, ^ /home/chrono/1/kernel/ck/drivers/mfd/ab8500-gpadc.c:317:5: note: 'ab8500_gpadc_read_raw' was previously declared here int ab8500_gpadc_read_raw(struct ab8500_gpadc gpadc, u8 channel, ^ /home/chrono/1/kernel/ck/drivers/mfd/ab8500-gpadc.c:317:5: note: code may be misoptimized unless -fno-strict-aliasing is used /home/chrono/1/kernel/ck/include/linux/mfd/abx500/ab8500-gpadc.h:56:5: warning: type of 'ab8500_gpadc_ad_to_voltage' does not match original declaration [-Wlto-type-mismatch] int ab8500_gpadc_ad_to_voltage(struct ab8500_gpadc gpadc, ^ /home/chrono/1/kernel/ck/drivers/mfd/ab8500-gpadc.c:166:5: note: 'ab8500_gpadc_ad_to_voltage' was previously declared here int ab8500_gpadc_ad_to_voltage(struct ab8500_gpadc gpadc, u8 channel, ^ /home/chrono/1/kernel/ck/drivers/mfd/ab8500-gpadc.c:166:5: note: code may be misoptimized unless -fno-strict-aliasing is used /home/chrono/1/kernel/ck/include/linux/mfd/abx500/ab8500-gpadc.h:44:22: warning: type of 'ab8500_gpadc_get' does not match original declaration [-Wlto-type-mismatch] struct ab8500_gpadc ab8500_gpadc_get(void); ^ /home/chrono/1/kernel/ck/drivers/mfd/ab8500-gpadc.c:150:22: note: 'ab8500_gpadc_get' was previously declared here struct ab8500_gpadc ab8500_gpadc_get(void) ^ /home/chrono/1/kernel/ck/drivers/mfd/ab8500-gpadc.c:150:22: note: code may be misoptimized unless -fno-strict-aliasing is used /tmp/cciwx8al.s: Assembler messages: /tmp/cciwx8al.s:5394: conditional infixes are deprecated in unified syntax /tmp/cciwx8al.s:5394: Error: thumb conditional instruction should be in IT block -- sbcccs r2,r2,r3' /tmp/cciwx8al.s:5394: Error: thumb conditional instruction should be in IT block --movcc r3,#0' /tmp/cciwx8al.s:5421: conditional infixes are deprecated in unified syntax /tmp/cciwx8al.s:5421: Error: thumb conditional instruction should be in IT block -- sbcccs r2,r2,r3' /tmp/cciwx8al.s:5421: Error: thumb conditional instruction should be in IT block --movcc r3,#0' /tmp/cciwx8al.s:5466: conditional infixes are deprecated in unified syntax /tmp/cciwx8al.s:5466: Error: thumb conditional instruction should be in IT block -- sbcccs r2,r2,r3' /tmp/cciwx8al.s:5466: Error: thumb conditional instruction should be in IT block --movcc r3,#0' /tmp/cciwx8al.s:5499: conditional infixes are deprecated in unified syntax /tmp/cciwx8al.s:5499: Error: thumb conditional instruction should be in IT block -- sbcccs r0,r0,r3' /tmp/cciwx8al.s:5499: Error: thumb conditional instruction should be in IT block --movcc r3,#0'

(and so on...)

I have also tried with the original (i.e. unmodified by me) CONFIG_THUMB2_KERNEL implementation, still with the same result as before. Any hints or suggestions are welcome!

~/x-tools/arm-unknown-eabihf/bin/arm-unknown-eabihf-gcc -v Using built-in specs. COLLECT_GCC=/home/chrono/x-tools/arm-unknown-eabihf/bin/arm-unknown-eabihf-gcc COLLECT_LTO_WRAPPER=/home/chrono/x-tools/arm-unknown-eabihf/libexec/gcc/arm-unknown-eabihf/6.1.0/lto-wrapper Target: arm-unknown-eabihf Configured with: /media/ROM/root/tc/.build/src/gcc-6.1.0/configure --build=x86_64-build_pc-linux-gnu --host=x86_64-build_pc-linux-gnu --target=arm-unknown-eabihf --prefix=/home/chrono/x-tools/arm-unknown-eabihf --with-local-prefix=/home/chrono/x-tools/arm-unknown-eabihf/arm-unknown-eabihf/sysroot --with-sysroot=/home/chrono/x-tools/arm-unknown-eabihf/arm-unknown-eabihf/sysroot --with-newlib --enable-threads=no --disable-shared --with-arch=armv7-a --with-tune=cortex-a9 --with-fpu=vfpv3 --with-float=hard --with-pkgversion='crosstool-NG crosstool-ng-1.22.0-248-gdf5a341' --enable-__cxa_atexit --disable-libgomp --disable-libmudflap --disable-libmpx --disable-libssp --disable-libquadmath --disable-libquadmath-support --with-gmp=/media/ROM/root/tc/.build/arm-unknown-eabihf/buildtools --with-mpfr=/media/ROM/root/tc/.build/arm-unknown-eabihf/buildtools --with-mpc=/media/ROM/root/tc/.build/arm-unknown-eabihf/buildtools --with-isl=/media/ROM/root/tc/.build/arm-unknown-eabihf/buildtools --enable-lto --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --enable-target-optspace --disable-nls --disable-multilib --enable-languages=c,c++ Thread model: single gcc version 6.1.0 (crosstool-NG crosstool-ng-1.22.0-248-gdf5a341)

~/x-tools/arm-unknown-eabihf/bin/arm-unknown-eabihf-ld -v GNU ld (crosstool-NG crosstool-ng-1.22.0-248-gdf5a341) 2.26.51.20160617 (binutils are taken from https://sourceware.org/git/?p=binutils-gdb.git;a=shortlog;h=refs/heads/users/hjl/lto-mixed/master ) I'm not using slim LTO config, as I haven't managed to get it to work (if this matter).

andikleen commented 7 years ago

Great that it works.

/home/chrono/1/kernel/ck/drivers/mfd/ab8500-gpadc.c:150:22: note: code may be misoptimized unless -fno-strict-aliasing is used /tmp/cciwx8al.s: Assembler messages: /tmp/cciwx8al.s:5394: conditional infixes are deprecated in unified syntax /tmp/cciwx8al.s:5394: Error: thumb conditional instruction should be in IT block -- sbcccs r2,r2,r3' /tmp/cciwx8al.s:5394: Error: thumb conditional instruction should be in IT block --movcc r3,#0' /tmp/cciwx8al.s:5421: conditional infixes are deprecated in unified syntax /tmp/cciwx8al.s:5421: Error: thumb conditional instruction should be in IT block -- sbcccs r2,r2,r3' /tmp/cciwx8al.s:5421: Error: thumb conditional instruction should be in IT block --movcc r3,#0' /tmp/cciwx8al.s:5466: conditional infixes are deprecated in unified syntax /tmp/cciwx8al.s:5466: Error: thumb conditional instruction should be in IT block -- sbcccs r2,r2,r3' /tmp/cciwx8al.s:5466: Error: thumb conditional instruction should be in IT block --movcc r3,#0' /tmp/cciwx8al.s:5499: conditional infixes are deprecated in unified syntax /tmp/cciwx8al.s:5499: Error: thumb conditional instruction should be in IT block -- sbcccs r0,r0,r3' /tmp/cciwx8al.s:5499: Error: thumb conditional instruction should be in IT block --movcc r3,#0'

No idea sorry. It's something Thumb specific, just triggered by LTO, or perhaps by your patch merging. You would need to ask ARM toolchain experts.

-Andi

ChronoMonochrome commented 7 years ago

Thanks for your reply anyway!

AFAIK, the whole thing is that the flag -Wa,-mimplicit-it=always must be applied for all the assembly files that are compiled with Thumb2 mode, but it doesn't happen for such generated files as /tmp/*.s. I'll later try using assembler wrapper to force applying this flag to these files, if even this wouldn't help, I probably have to ask on ARM forums.