Answer the question
In order to leave comments, you need to log in
What do these lines mean in assembler?
I wrote a C program that simply exits with code 0:
int main(){
return 0;
}
gcc -S ./main
.file "main.c"
.text
.globl main
.type main, @function
main:
.LFB0:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
movl $0, %eax
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE0:
.size main, .-main
.ident "GCC: (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0"
.section .note.GNU-stack,"",@progbits
.file "main.c"
...
.ident "GCC: (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0"
Answer the question
In order to leave comments, you need to log in
.file "main.c"
Why is the name of the source code file in the code
$ readelf -a hello | grep FILE
28: 0000000000000000 0 FILE LOCAL DEFAULT ABS crtstuff.c
37: 0000000000000000 0 FILE LOCAL DEFAULT ABS hello.c
38: 0000000000000000 0 FILE LOCAL DEFAULT ABS crtstuff.c
41: 0000000000000000 0 FILE LOCAL DEFAULT ABS
.comment
of the object file, and from there into the executable file:$ objdump -s -j .comment hello
hello: file format elf64-x86-64
Contents of section .comment:
0000 4743433a 20284465 6269616e 20362e33 GCC: (Debian 6.3
0010 2e302d31 382b6465 62397531 2920362e .0-18+deb9u1) 6.
0020 332e3020 32303137 30353136 00 3.0 20170516.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question