Use objdump to produce an assembler listing, but which includes the machine byte representation of each instruction (redirect output to a different .s file):
$ objdump -d mycode.o >mycode_obj.s
Here is mycoe_obj.s
0: 68 ac 3d 04 08 push $0x8043dac 5: 68 00 05 40 fd push $0xfd400500 a: 89 e5 mov %esp,%ebp c: b8 05 00 00 00 mov $0x5,%eax 11: 5d pop %ebp 12: c3 ret
The machine program code is 18 (0x12) bytes long and (ignoring blanks) is:
68 ac 3d 04 08 68 00 05 40 fd 89 e5 b8 05 00 00 00 5d c3