Simplifying assembly code generated from gcc -


i wanted demonstrate how different c functions turned arm assembly code using gcc, tried compiling function

int f(int a) {   return a+1; } 

using command:

gcc -o3 -s test.c 

to get:

        .arch armv6         .eabi_attribute 27, 3         .eabi_attribute 28, 1         .fpu vfp         .eabi_attribute 20, 1         .eabi_attribute 21, 1         .eabi_attribute 23, 3         .eabi_attribute 24, 1         .eabi_attribute 25, 1         .eabi_attribute 26, 2         .eabi_attribute 30, 2         .eabi_attribute 18, 4         .file   "test.c"         .text         .align  2         .global f         .type   f, %function f:         @ args = 0, pretend = 0, frame = 0         @ frame_needed = 0, uses_anonymous_args = 0         @ link register save eliminated.         add     r0, r0, #1         bx      lr         .size   f, .-f         .ident  "gcc: (debian 4.6.3-14+rpi1) 4.6.3"         .section        .note.gnu-stack,"",%progbits 

however, gives whole lot of side information looks bit intimidating novice. there way tell gcc emit more concise assembly? ideal like:

f:         add     r0, r0, #1         bx      lr 

but shorter helpful.

i tried looking through options here , tried using -g0, gave same output.


Popular posts from this blog