Reputation: 12185
I was reading the following code online. I am wondering what the @ symbol next to the function call means. I am also wondering what the .type does exactly. Can someone point me to a URL which explains the different .types?
.section .rodata
Lhello:
.asciz "Hello!"
.section .text
.globl someRelocations
.type someRelocations, STT_FUNC
someRelocations:
leaq Lhello(%rip), %rdi
call puts@PLT
ret
Upvotes: 0
Views: 887
Reputation: 18531
The ".type" keyword will place some information into the object file generated saying that "someRelocations" is of the type STT_FUNC (which means: it is a function).
The linker and/or debuggers may use this information. On some CPUs (such as ARM variants tht support both Thumb and ARM modes) the linker must know if "someRelocations" is a function or a variable because linking is done a bit differently for functions and variables in this case.
For the assembler the "@" is just a regular character at this point. "puts@PLT" is processed by the assembler the same way "putsXPLT" would be processed.
To be very unprecise: When a position-independent file is being generated the linker requires "@PLT" to be added to all function names.
Upvotes: 2