Linker and Libraries Guide

x64: Thread-Local Storage Relocation Types

The TLS relocations that are listed in the following table are defined for x64. Descriptions in the table use the following notation.

@tlsgd(%rip)

Allocates two contiguous entries in the GOT to hold a TLS_index structure. This structure is passed to __tls_get_addr(). This instruction can only be used in the exact general dynamic code sequence.

@tlsld(%rip)

Allocates two contiguous entries in the GOT to hold a TLS_index structure. This structure is passed to __tls_get_addr(). At runtime, the ti_offset offset field of the object is set to zero, and the ti_module offset is initialized. A call to the __tls_get_addr() function returns the starting offset if the dynamic TLS block. This instruction can be used in the exact code sequence.

@dtpoff

Calculates the offset of the variable relative to the start of the TLS block which contains the variable. The computed value is used as an immediate value of an addend, and is not associated with a specific register.

@dtpmod(x)

Calculates the object identifier of the object containing a TLS symbol.

@gottpoff(%rip)

Allocates a entry in the GOT, to hold a variable offset in the initial TLS block. This offset is relative to the TLS blocks end, %fs:0. The operator can only be used with a movq or addq instruction.

@tpoff(x)

Calculates the offset of a variable relative to the TLS block end, %fs:0. No GOT entry is created.

Table 8–25 x64: Thread-Local Storage Relocation Types

Name 

Value 

Field 

Calculation 

R_AMD64_DPTMOD64

16

Word64

@dtpmod(s)

R_AMD64_DTPOFF64

17

Word64

@dtpoff(s)

R_AMD64_TPOFF64

18

Word64

@tpoff(s)

R_AMD64_TLSGD

19

Word32

@tlsgd(s)

R_AMD64_TLSLD

20

Word32

@tlsld(s)

R_AMD64_DTPOFF32

21

Word32

@dtpoff(s)

R_AMD64_GOTTPOFF

22

Word32

@gottpoff(s)

R_AMD64_TPOFF32

23

Word32

@gottpoff(s)