Can I read the object file?

Hi everyone, so I was interested to know about .obj files. I hardly know what they are doing, so I opened them in a Vim text editor, and what I found inside was alien, like lenguaje ...

Is there any way to understand this and the possible use of this?

+4
source share
3 answers

Sure.

But every other platform has a different object format. On Windows, you can use a tool like dumpbin (dumpbin comes with Visual Studio). On Linux, you can use "dumpobj" or disassemble the program.

Here is a good link for Linux:

http://www.linuxjournal.com/article/1060

PS: objdump also allows you to parse an object. As before, you used the option of "debugging" on a DOS PC ...

+4
source

The .obj files used by link.exe are in the MS COFF format.

You can find the "Microsoft PE and COFF specification" here and .obj file to match it.

Or you can use an existing tool like dumpbin .

+3
source

The readelf tool shows you some data data well:

 $ readelf -a /usr/bin/readelf ELF Header: Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 Class: ELF64 Data: 2 complement, little endian Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: EXEC (Executable file) Machine: Advanced Micro Devices X86-64 ... 

Some of its features for checking certain sections of an executable file may also be useful:

 $ readelf -p .rodata /usr/bin/readelf | more String dump of section '.rodata': [ 4] R_IA64_IMM14 [ 11] R_IA64_NONE ... [ 1f58] Personality routine: [ 1f70] __gcc_personality_v0 [ 1f85] __gxx_personality_v0 [ 1f9a] __gcj_personality_v0 [ 1faf] __gnu_objc_personality_v0 ... 

In fact, the disassembly of the code is a little stretched; if you compile your code with -g to debug characters, you can use readelf --debug-dump to read the source code of the program, enter type information, etc.

+2
source

Source: https://habr.com/ru/post/1387508/


All Articles