- Mar 2018
-
ccom.uprrp.edu ccom.uprrp.edu
-
.fini
This section holds executable instructions that contribute to the process termination code. That is, when a program exits normally, the system arranges to execute the code in this section
-
init
This section holds executable instructions that contribute to the process initialization code. That is, when a program starts to run the system arranges to execute the code in this section before the main program entry point (called main in C programs)
From: http://l4u-00.jinr.ru/usoft/WWW/www_debian.org/Documentation/elf/node3.html
-
.plt
(from StackOverflow) PLT stands for Procedure Linkage Table which is, put simply, used to call external procedures/functions whose address isn't known in the time of linking, and is left to be resolved by the dynamic linker at run time.
It is jump table to functions that are in the dynamically linked libraries (printf, scanf,...).
Further reading: https://www.technovelty.org/linux/plt-and-got-the-key-to-code-sharing-and-dynamic-libraries.html
Tags
Annotators
URL
-
-
ccom.uprrp.edu ccom.uprrp.edu
-
00000055
The instruction at offset 0x55 references printf. The linker better solve this reference.
-
0000003f
The instruction at offset 0x3f references foo. The linker uses this information.
-
UND
All the symbols with UNDefined must be resolved by the linker.
-
.rodata
Read Only Data: Here you would find string literals such as the "result is %d"
-
.rel.text
For programs compiled with -c option, this section provides information to the link editor ld where and how to "patch" executable code in .text section
Tags
Annotators
URL
-
-
ccom.uprrp.edu ccom.uprrp.edu
-
comment
Comments about the compiler. You may read the raw content of any of these sections using:
objdump -s -j .comment
-
data
The .data section contains data :-)
-
.text
The .text section contains the machine language instructions of the program.
-
Section Headers:
ELF files are subdivided into sections.
A section is an area in the object file that contains information which is useful for linking: program's code, program's data (variables, array, string), relocation information and other. So, in each area, several information is grouped and it has a distinct meaning: code section only hold code, data section only holds initialized or non-initialized data, etc
-
0x0
The first function in this file is at address 0x0.
-
ELF32
32-bit ELF
-
7f 45 4c 46
The magic sequence that starts an ELF file is 0x7f 0x45 0x4c 0x46, i.e. .ELF.
Tags
Annotators
URL
-
-
ccom.uprrp.edu ccom.uprrp.edu
-
.cfi_startproc
You can read about the cfi assembler directives in https://sourceware.org/binutils/docs/as/CFI-directives.html#CFI-directives.
They are merely instructions for the assembler, similar to the preprocessor directives that you include in your C programs.
-
leave
When you compile using the gcc -fno-stack-protector, there is no validation of the stack at the end of the function.
Tags
Annotators
URL
-
-
ccom.uprrp.edu ccom.uprrp.edu
-
movl 8(%ebp), %eax
This was compiled for 32 bits, notice that the parameter to foo is being received through the stack.
Tags
Annotators
URL
-
-
ccom.uprrp.edu ccom.uprrp.edu
-
movl %edi, -20(%rbp)
This program was compiled for 64 bits and the parameter to the foo function is passed through register %edi.
-
movl -4(%rbp), %eax
The return value is passed through register %eax.
Tags
Annotators
URL
-
-
ccom.uprrp.edu ccom.uprrp.edu
-
movl %eax, %edi call foo
Setting the parameter and invoking foo.
-
"GCC: (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609"
Information about the compiler.
-
call __stack_chk_fail
By default, the gcc compiler includes instructions to detect stack smashing.
-
movl $.LC1, %edi movl $0, %eax call printf
Setting the parameters and calling the printf function.
-
.text
The .text section contains the actual assembly language instructions.
-
.comm buffer,1048576,32
This is saying "In this program there is a global variable called buffer of 1048576 bytes and 32-bit alignment.
.comm name, size,alignment
The '.comm' directive allocates storage in the data section.
Tags
Annotators
URL
-