gcc - arm-linux-gnueabi compiler options -
i using, arm-linux-gnueabi-gcc compile c programs arm processor in linux. however, not sure default arm mode compiles.
for example, c code:
test.c
unsigned int main() { return 0x1ffff; } arm-linux-gnueabi-gcc -o test test.c
now, when @ disassembly of main() function objdump, can see:
arm-linux-gnueabi-objdump -d test <main>: push {r7} add r7, sp, #0 movw r3, #65535 ; 0xffff movt r3, #1 mov r0, r3 mov sp, r7 pop {r7} bx lr
it appears disassembly thumb mode of arm (because of push instruction).
how can display disassembly follows:
.sect ".text" .global _fn _fn: movw a1,#65535 movt a1,#1 bx lr
or this
.sect ".text" .global _fn _fn: ldr a1, con1 bx lr .sect ".text" .align 4 con1: .word 0x1ffff
i saw example here:
http://e2e.ti.com/support/development_tools/compiler/f/343/t/40580.aspx
however, unable view disassembly way displayed there.
thanks.
push doesn't tell in thumb mode, in fact arm's new assembly syntax called unified assembly language
means in of cases can compile same code arm
or thumb-2
instruction sets.
other problem that, compiling in -o0
mode adds instructions easy of debugability. try -o2
, should instruction flow want.
gcc
-v
switch in arm-linux-gnueabi-gcc -v
should show how built, tells overall default options uses when compiling source code.
one last thing, targeted assembly sequence mentioned uses atpcs
register naming scheme (check objdump doc information), uses a1
instead of r0
example. can setting disassembler-options
in objdump
-m
switch. below;
$ arm-linux-gnueabihf-gcc -c -o2 -o test test.c $ arm-linux-gnueabihf-objdump -m reg-names-special-atpcs -d test test: file format elf32-littlearm disassembly of section .text.startup: 00000000 <main>: 0: f64f 70ff movw a1, #65535 ; 0xffff 4: f2c0 0001 movt a1, #1 8: 4770 bx lr a: bf00 nop
another option assembly output gcc
using -s
switch. below;
$ arm-linux-gnueabihf-gcc -s test.c
then should new file called test.s
in same folder. don't know if there option set register naming.
Comments
Post a Comment