offensive-security / gcc-arm-linux-gnueabihf-4.7

gcc-arm-linux-gnueabihf-4.7/
30 stars 43 forks source link

Failed to compile the CBZ instruction #1

Open penhoi opened 7 years ago

penhoi commented 7 years ago

Hi,

I tried to compile a code snippet with a CBZ instruction, but failed.

-----------------CODE------------- main: cbz r2, local4 bx r3 local4: bx lr

-----------------compiling command---------- arm-linux-gcc -c arm.S arm.S: Assembler messages: arm.S:2: Error: selected processor does not support `cbz r2,local4'

Another try: arm-linux-gcc -c arm.S -mcpu=cortex-m3 cc1: error: target CPU does not support ARM mode

------------------arm-linux-gcc version--------- arm-linux-gcc -v Using built-in specs. Target: arm-none-linux-gnueabi Configured with: /opt/FriendlyARM/mini2440/build-toolschain/working/src/gcc-4.4.3/configure --build=i386-build_redhat-linux-gnu --host=i386-build_redhat-linux-gnu --target=arm-none-linux-gnueabi --prefix=/opt/FriendlyARM/toolschain/4.4.3 --with-sysroot=/opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-gnueabi//sys-root --enable-languages=c,c++ --disable-multilib --with-arch=armv4t --with-cpu=arm920t --with-tune=arm920t --with-float=soft --with-pkgversion=ctng-1.6.1 --disable-sjlj-exceptions --enable-__cxa_atexit --with-gmp=/opt/FriendlyARM/toolschain/4.4.3 --with-mpfr=/opt/FriendlyARM/toolschain/4.4.3 --with-ppl=/opt/FriendlyARM/toolschain/4.4.3 --with-cloog=/opt/FriendlyARM/toolschain/4.4.3 --with-mpc=/opt/FriendlyARM/toolschain/4.4.3 --with-local-prefix=/opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-gnueabi//sys-root --disable-nls --enable-threads=posix --enable-symvers=gnu --enable-c99 --enable-long-long --enable-target-optspace Thread model: posix gcc version 4.4.3 (ctng-1.6.1) ------------------THAT IS ALL---------------------------------

penhoi commented 7 years ago

I modified the code, now it works. -------------------code-------- .arch armv7 .thumb main: cbz r3, local4 bx r3 local4: bx lr ----------------------end code---------------------- By the way, is there any tool that can convert thumb binary code stream to arm binary code stream? I t may work in this way: thumb binary- > thumb assembly -> ARM assembly -> arm binary