Let's perform the following steps:
- Type the following in the running Terminal session:
$ objcopy --help
- Keep the help menu up and press Ctrl + Shift + T on your keyboard to open a new Terminal tab.
- In the new Terminal tab, type the following:
$ man objcopy
- Leave the man page up in this Terminal tab, and open up a new tab by pressing Ctrl + Shift + T on your keyboard.
- In the new Terminal tab, type the following and examine the output:
$ objcopy -O binary ch05-example ch05-example.bin
$ file ch05-example.bin
- Next, type the following in the same Terminal tab:
$ objcopy -S -x -X -v ch05-example ch05-example-objcopy-stripped
$ file ch05-example-objcopy-stripped
- After reviewing the output, type the following:
If using the 64-bit Ubuntu virtual machine
$ objcopy -I elf64-x86-64 -O pe-x86-64 -v ch05-example ch05-example-PE.exe
If using the 32-bit Ubuntu virtual machine
$ objcopy -I elf32-i386 -O pe-i386 -v ch05-example ch05-example-PE.exe
- Next, type the following in the same Terminal tab:
$ objcopy -j .text -v ch05-example ch05-example-text
$ objdump -D -M intel ch05-example-text