How to do it...

Let's perform the following steps:

  1. Type the following in the running Terminal session:
$ objcopy --help
  1. Keep the help menu up and press Ctrl + Shift + T on your keyboard to open a new Terminal tab.
  2. In the new Terminal tab, type the following:
$ man objcopy
  1. Leave the man page up in this Terminal tab, and open up a new tab by pressing CtrlShift + T on your keyboard.
  1. In the new Terminal tab, type the following and examine the output:
$ objcopy -O binary ch05-example ch05-example.bin
$ file ch05-example.bin
  1. 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
  1. 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
  1. 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
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.239.123