Function dmd.backend.elfobj.ElfObj_tlsseg
Define segments for Thread Local Storage. Here's what the elf tls spec says: Field .tbss .tdata sh_name .tbss .tdata sh_type SHT_NOBITS SHT_PROGBITS sh_flags SHF_ALLOC|SHF_WRITE| SHF_ALLOC|SHF_WRITE| SHF_TLS SHF_TLS sh_addr virtual addr of section virtual addr of section sh_offset 0 file offset of initialization image sh_size size of section size of section sh_link SHN_UNDEF SHN_UNDEF sh_info 0 0 sh_addralign alignment of section alignment of section sh_entsize 0 0 We want tlsstart and tlsend to bracket all the D tls data. The default linker script (ld -verbose) says: .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } so if we assign names: tlsstart .tdata symbols .tdata. symbols .tbss tlsend .tbss. this should work. Don't care about sections emitted by other languages, as we presume they won't be storing D gc roots in their tls.
dmd .backend .code .seg_data* ElfObj_tlsseg();
Output
seg_tlsseg set to segment number for TLS segment.
Returns
segment for TLS segment