Correspondence of relocation types 386 32 bit in 64 64 in 64 R_386_32 R_X86_64_32 R_X86_64_64 R_386_GOTOFF R_X86_64_PC32 R_X86_64_ R_386_GOTPC R_X86_64_ R_X86_64_ R_386_GOT32 R_X86_64_ R_X86_64_ R_386_TLS_GD R_X86_64_TLSGD R_X86_64_ R_386_TLS_IE R_X86_64_GOTTPOFF R_X86_64_ R_386_TLS_LE R_X86_64_TPOFF32 R_X86_64_ R_386_PLT32 R_X86_64_PLT32 R_X86_64_ R_386_PC32 R_X86_64_PC32 R_X86_64_
Output a string into a string table Input: strtab = string table for entry str = string to add
Output an alias definition record.
Do we allow zero sized objects?
Output byte to object file.
Output bytes to object file.
Define a new code segment. Input: name name of segment, if null then revert to default suffix 0 use name as is 1 append "_TEXT" to name Output: cseg segment index of new current code segment Offset(cseg) starting offset in cseg
Output a common block definition. Input: p . external identifier size size in bytes of each elem count number of elems
Embed compiler version in .obj file.
Ouput read only data for data. Output: *pseg segment of that data
Update data information about symbol align for output and assign segment if not already specified.
Don't need to generate section brackets, use __start_SEC/__stop_SEC instead.
Stuff the following data in a separate segment: pointer to function pointer to ehsym length of function
Embed string in executable.
Export a function name.
Output an external for existing symbol. Input: s Symbol to do EXTDEF on (Name is to be mangled)
Output an external symbol for name. Input: name Name to do EXTDEF on (Not to be mangled)
Generate far16 thunk. Input: s Symbol to generate a thunk for
Mark object file as using floating point.
Update function info before codgen
Update function info after codgen
Get corresponding seg_data entry for an existing or newly added section.
Output library name.
Perform initialization that applies to all .o output files. Called before any other obj_xxx routines
Initialize the start of object output for this particular .o file.
Output an iterated data block of 0s.
Output linker directive.
Record file and line number at segment and offset. The actual .debug_line segment is put out by dwarf_termfile().
Stuff pointer to ModuleInfo into its own section (minfo).
Output a public definition. Input: seg = segment index that symbol is defined in s . symbol offset = offset of name within segment
Output a public definition. Input: seg = segment index that symbol is defined in s . symbol offset = offset of name within segment symsize size of symbol
Refer to address that is in the code segment. Only offsets are output, regardless of the memory model. Used to put values in switch address tables. Input: seg = where the address is going (CODE or DATA) offset = offset within seg val = displacement from start of this module
Refer to address that is in the data segment. Input: seg = where the address is going offset = offset within seg val = displacement from address targetdatum = DATA, CDATA or UDATA, depending where the address is flags = CFoff, CFseg, CFoffset64, CFswitch
Refer to an identifier. Input: segtyp = where the address is going (CODE or DATA) offset = offset within seg s = Symbol table entry for identifier val = displacement from identifier flags = CFselfrel: self-relative CFseg: get segment CFoff: get offset CFoffset64: 64 bit fixup CFpc32: I64: PC relative 32 bit fixup
Stuff pointer to function in its own segment. Used for static ctor and dtor lists.
Reset code seg to existing seg. Used after a COMDAT for a function is done.
Set start address
Symbol is the function that calls the static constructors. Put a pointer to it into a special segment that the startup code looks at. Input: s static constructor function dtor !=0 if leave space for static destructor seg 1: user 2: lib 3: compiler
Symbol is the function that calls the static destructors. Put a pointer to it into a special segment that the exit code looks at. Input: s static destructor function
Get segment for readonly string literals. The linker will pool strings in this section.
Ouput read only data and generate a symbol for it.
Terminate package.
Fixup and terminate object file.
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. Output: seg_tlsseg set to segment number for TLS segment.
Define segments for Thread Local Storage. Output: seg_tlsseg_bss set to segment number for TLS segment.
Embed string in obj.
Output a weak extern record.
Append byte to segment.
Append bytes to segment.
Append an iterated data block of 0s. (uninitialized data only)
Write/Append a relocatable value to the given segment and offset. Input: targseg = the target segment for the relocation offset = offset within target segment reltype = ELF relocation type R_ARCH_XXXX symidx = symbol base for relocation val = addend or displacement from symbol
Generate fixup specific to .eh_frame and .gcc_except_table sections.
Write to the object file
Renumber symbols so they are ordered as locals, weak and then global
Output file name record.
Mangle a name.
Close and delete .OBJ file.
Terminate.
FreeBSD uses ELF, but the linker crashes with Elf comdats with the following message: /usr/bin/ld: BFD 2.15 FreeBSD 2004-05-23 internal error, aborting at /usr/src/gnu/usr.bin/binutils/libbfd/../../../../contrib/binutils/bfd/elfcode.h line 213 in bfd_elf32_swap_symbol_out For the time being, just stick with Linux.
If set, produce .init_array/.fini_array instead of legacy .ctors/.dtors . OpenBSD added the support in Aug 2016. Other supported platforms has supported .init_array for years.
Output a relocation entry for a segment Input: seg = where the address is going offset = offset within seg type = ELF relocation type R_ARCH_XXXX index = Related symbol table index val = addend or displacement from address
Compiler implementation of the D programming language.