I've compiled binutils for MIPS and I can assemble just fine, but using objcopy to dump the raw binary is not working.
Input file:
Code:
.ascii "ohai thar"
.align 2
ADDIU $zero, $zero, 0x1234
Run through:
Code:
mips-unknown-linux-gnu-as -EB -march=vr4300 -mtune=vr4300 --warn test.asm -o test.elf
test.elf is:
Code:
00000000 7f 45 4c 46 01 02 01 00 00 00 00 00 00 00 00 00 |.ELF............|
00000010 00 01 00 08 00 00 00 01 00 00 00 00 00 00 00 00 |................|
00000020 00 00 00 a4 20 00 11 00 00 34 00 00 00 00 00 28 |.... ....4.....(|
00000030 00 09 00 06 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000040 6f 68 61 69 20 74 68 61 72 00 00 00 24 00 12 34 |ohai thar...$..4|
00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000060 00 00 00 00 00 00 00 00 00 2e 73 79 6d 74 61 62 |..........symtab|
00000070 00 2e 73 74 72 74 61 62 00 2e 73 68 73 74 72 74 |..strtab..shstrt|
00000080 61 62 00 2e 74 65 78 74 00 2e 64 61 74 61 00 2e |ab..text..data..|
00000090 62 73 73 00 2e 72 65 67 69 6e 66 6f 00 2e 70 64 |bss..reginfo..pd|
000000a0 72 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |r...............|
000000b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
000000c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1b |................|
000000d0 00 00 00 01 00 00 00 06 00 00 00 00 00 00 00 40 |...............@|
000000e0 00 00 00 10 00 00 00 00 00 00 00 00 00 00 00 10 |................|
000000f0 00 00 00 00 00 00 00 21 00 00 00 01 00 00 00 03 |.......!........|
00000100 00 00 00 00 00 00 00 50 00 00 00 00 00 00 00 00 |.......P........|
00000110 00 00 00 00 00 00 00 10 00 00 00 00 00 00 00 27 |...............'|
00000120 00 00 00 08 00 00 00 03 00 00 00 00 00 00 00 50 |...............P|
00000130 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 10 |................|
00000140 00 00 00 00 00 00 00 2c 70 00 00 06 00 00 00 02 |.......,p.......|
00000150 00 00 00 00 00 00 00 50 00 00 00 18 00 00 00 00 |.......P........|
00000160 00 00 00 00 00 00 00 04 00 00 00 18 00 00 00 35 |...............5|
00000170 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 68 |...............h|
00000180 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 |................|
00000190 00 00 00 00 00 00 00 11 00 00 00 03 00 00 00 00 |................|
000001a0 00 00 00 00 00 00 00 68 00 00 00 3a 00 00 00 00 |.......h...:....|
000001b0 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 01 |................|
000001c0 00 00 00 02 00 00 00 00 00 00 00 00 00 00 02 0c |................|
000001d0 00 00 00 60 00 00 00 08 00 00 00 06 00 00 00 04 |...`............|
000001e0 00 00 00 10 00 00 00 09 00 00 00 03 00 00 00 00 |................|
000001f0 00 00 00 00 00 00 02 6c 00 00 00 01 00 00 00 00 |.......l........|
00000200 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 |................|
00000210 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000220 00 00 00 00 00 00 00 00 03 00 00 01 00 00 00 00 |................|
00000230 00 00 00 00 00 00 00 00 03 00 00 02 00 00 00 00 |................|
00000240 00 00 00 00 00 00 00 00 03 00 00 03 00 00 00 00 |................|
00000250 00 00 00 00 00 00 00 00 03 00 00 04 00 00 00 00 |................|
00000260 00 00 00 00 00 00 00 00 03 00 00 05 00 |.............|
0000026d
I can clearly see my code at 0x40. However, I then use this to strip out just the actual instructions:
Code:
mips-unknown-linux-gnu-objcopy test.elf -O binary test.dmp
And test.dmp now contains 24 zero bytes.
The only other thing I've got it to do is if I stick a ".section foobar" at the top of my source, and add "-j foobar" to the objcopy flags, then test.dmp contains nothing at all.
_________________
143
HyperNova Software is
now live (but may take a few tries to load) currently down; check out my PSP/DS/Game Boy/Windows/Linux homebrew, ROM hacks, and Gameshark codes!