How to produce the assembly from c using gcc

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
jason7007

How to produce the assembly from c using gcc

Post 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.
proxy

Re:How to produce the assembly from c using gcc

Post 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
Ytinasni

Re:How to produce the assembly from c using gcc

Post 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')
jason7007

Re:How to produce the assembly from c using gcc

Post 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.
earlz

Re:How to produce the assembly from c using gcc

Post by earlz »

can't as far as i know wihtout some third party software to convert the syntax
Post Reply