0

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
Ross Ridge
  • 38,414
  • 7
  • 81
  • 112
chasep255
  • 11,745
  • 8
  • 58
  • 115
  • See [this](http://stackoverflow.com/questions/5469274/what-does-plt-mean-here) and [this](https://sourceware.org/binutils/docs/as/Type.html). – Michael Jul 23 '15 at 19:48

1 Answers1

2

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.

Martin Rosenau
  • 17,897
  • 3
  • 19
  • 38