Page 1 of 1

How to produce the assembly from c using gcc

Posted: Fri Jan 06, 2006 8:19 pm
by jason7007
Hi,
I am trying to produce the assembly listing of the Bran's Kernel Dev.
I tried to use this command, to produce the assembly main.s

gcc -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o main.o -S main.s main.c

But it did not work. What's wrong with this.

Any help will be appreciated.

Re:How to produce the assembly from c using gcc

Posted: Fri Jan 06, 2006 10:30 pm
by proxy
objdump -C -d -S --no-show-raw-insn kernel.exe > kernel.lst

works for me,

remove the -S to not try to interlace c source
remove the -C to not demangle c++ symbols

proxy

Re:How to produce the assembly from c using gcc

Posted: Fri Jan 06, 2006 11:18 pm
by Ytinasni
jason7007 wrote:gcc .... -c -o main.o -S main.s main.c
You have both -c and -S, so you are telling it to produce both compiled output and assembly.

You probably want gcc ...... -S -o main.S main.c
(read as: compile 'main.c', and put the assembly in 'main.S')

Re:How to produce the assembly from c using gcc

Posted: Sat Jan 07, 2006 8:17 am
by jason7007
Hi,

Do you mean GCC can produce one file output format at a time only?

My next question is, how to produce the Intel syntax assembly output?

Thank you very much.

Re:How to produce the assembly from c using gcc

Posted: Sat Jan 07, 2006 2:13 pm
by earlz
can't as far as i know wihtout some third party software to convert the syntax