0
votes

I'm getting an error saying addeq should be in IT block. From what I can tell it is.

Here is a cut of the code, at line 455 of https://github.com/Jcfunk/g3_kernel/blob/lp-release/arch/arm/crypto/aesbs-core.S_shipped

    ite eq              @ Thumb2 thing, sanity check in ARM
    addeq   r6,r6,#0x10
    bne .Ldec_loop

Is addeq in an IT block?

From what I've googled, If-Then block, this IT block means that if EQ then ADDEQ else BNE .Ldec_loop. I feel like ADDEQ is in the IT block, but I know nothing of arm assembly. Or possibly it's a build flag conflict.

Here is make output, make V=1 zImage-dtb , possiblly the issue is one of the flags passed to AS

scripts/gcc-wrapper.py gcc -Wp,-MD,arch/arm/crypto/.aesbs-core.o.d  -nostdinc -isystem /usr/lib/gcc/arm-linux-gnueabihf/5/include -I/sdcard/build/navelA/arch/arm/include -Iarch/arm/include/generated -Iinclude  -include /sdcard/build/navelA/include/linux/kconfig.h -D__KERNEL__ -mlittle-endian -Iarch/arm/mach-msm/include -D__ASSEMBLY__ -mabi=aapcs-linux -mno-thumb-interwork -funwind-tables  -D__LINUX_ARM_ARCH__=7 -mcpu=cortex-a15  -include asm/unified.h -msoft-float -gdwarf-2        -c -o arch/arm/crypto/aesbs-core.o arch/arm/crypto/aesbs-core.S

I'm using GNU assembler version 2.25.1 (arm-linux-gnueabihf) using BFD version (GNU Binutils for Ubuntu) 2.25.1 gcc (Ubuntu 5.2.1-17ubuntu4) 5.2.1 20150911

This is part of Android kernel for LG G3, be built on arm device not cross-compiled

Build flags -nostdinc -isystem /usr/lib/gcc/arm-linux-gnueabihf/5/include -I/sdcard/build/navelA/arch/arm/include -Iarch/arm/include/generated -Iinclude -include ./include/linux/kconfig.h -D__KERNEL__ -mlittle-endian -Iarch/arm/mach-msm/include -Wall -DNDEBUG -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -mcpu=cortex-a15 -mtune=cortex-a15 -mfpu=neon-vfpv4 -marm -ffast-math -fsingle-precision-constant -fgcse-lm -fgcse-sm -fsched-spec-load -fforce-addr -Os -marm -fno-dwarf2-cfi-asm -fstack-protector -mabi=aapcs-linux -mno-thumb-interwork -funwind-tables -D__LINUX_ARM_ARCH__=7 -mcpu=cortex-a15 -msoft-float -Uarm -Wframe-larger-than=1024 -Wno-unused-but-set-variable -fomit-frame-pointer -gdwarf-2 -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -DCC_HAVE_ASM_GOTO -munaligned-access -fforce-addr -fsingle-precision-constant -mcpu=cortex-a15 -mtune=cortex-a15 -marm -mfpu=neon-vfpv4 -fgcse-las -fpredictive-commoning

1
It looks like the lines have moved to 448 since you posted the question? Anyway, to me the code looks right; addeq is inside the íte block, bne is also a part of the ite block. Try inserting a #error "wrong architecture" above line 74 .code 32, to check that it actually builds as thumb2.user1985657
@PacMan-- Your right about the line numbers. The file I linked was an older version. It is made from a perl script. From Openssl link Which I've updated but didn't commit.Jcfunk
This should have been an edit to the previous identical question, and it still doesn't really have all the necessary information: that command line has paths that don't work on anything other than your computer (I guessed some substitutions), we have no idea what gcc-wrapper.py does, what the exact state of those kernel-config-dependent autogenerated headers is, or what version of GCC you're using and how it's configured (which is actually one of the critical factors here). As it happens, though, I seem to be feeling both sufficiently psychic and sufficiently lenient today...Notlikethat
@Notlikethat correct, maybe should has said it's for an Android kernel. android.googlesource.com/kernel/msm/+/android-5.1.1_r0.21/…Jcfunk

1 Answers

0
votes

This file builds fine as part of a normal kernel build (both ARM and Thumb), so it's clearly an issue with the way you're faking that up in your GCC command line. Running it through with -E to look at the preprocessed output makes things pretty clear when you see this fragment near the top:

...
# 1 "include/generated/autoconf.h" 1
# 5 "./include/linux/kconfig.h" 2
# 1 "<command-line>" 2
# 1 "./arch/arm/include/asm/unified.h" 1
# 74 "./arch/arm/include/asm/unified.h"
 .macro it, cond
 .endm
 .macro itt, cond
 .endm
 .macro ite, cond
 .endm
...

Those headers are apparently set up for compiling as ARM code, so these macros hide the Thumb it instruction for the benefit of crusty old assemblers which might choke on them as non-ARM instructions (instead of just ignoring them as a modern unified assembler should). Thus when your assembler, which has apparently been told by GCC to emit Thumb code, ends up seeing conditional instructions without a preceding it and understandably becomes very unhappy.

Therefore, with your build command, you either need to just compile as ARM code (passing -marm is the simplest way) or dig through KBuild some more and find the necessary stuff to define to convince the kernel headers that they're building the "kernel" in Thumb mode (probably involving CONFIG_THUMB2_KERNEL).