2
votes

I am compiling C-programs to elf32-bigmips assembly code, and I have managed to get the assembly output using the following commands (for an example program using O1).

mips-elf-gcc -O1 -c -g fib.c

mips-elf-objdump -D -S -M no-aliases -j .rodata -j .text -j .bss -j .data fib.o > fib-O1.asm

However, this gives me assembly code where the linking part is missing. I am using constant arrays with data in my code, and these arrays are all references in the assembly code as if they were starting at memory location 0, i.e. no memory address offsets! I suspect that this is because the linker information is missing?

  • How can I get the post-linker assembly code with the correct memory referencing?

Thanks

1

1 Answers

3
votes

The -c option means Compile and assemble, but do not link. Remove it if you also want to link the object code into an executable, and then run objdump.