Because the Mach-O relocations cannot be computed until after all the segments are written out, and we need more information than the Mach-O relocations provide, make our own relocation type. Later, translate to Mach-O relocation structure.
Add a relocation entry for seg/offset.
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
Setup for Symbol s to go into a COMDAT segment. Output (if s is a function): 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
Update data information about symbol align for output and assign segment if not already specified.
Put out symbols that define the beginning/end of the .deh_eh section. This gets called if this is the module with "main()" in it.
Stuff the following data (instance of struct FuncTable) 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 segment. Input: align_ segment alignment as power of 2
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 in its own segment.
Output a public definition. Input: seg = segment index that symbol is defined in s . symbol offset = offset of name within segment
Refer to address that is in the current function code (funcsym_p). 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:offset = the address being fixed up val = displacement from start of target segment targetdatum = target segment number (DATA, CDATA or UDATA, etc.) flags = CFoff, CFseg
Refer to an identifier. Input: seg = 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 CFpc32: RIP addressing, val is 0, -1, -2 or -4 CFoffset64: 8 byte offset for 64 bit builds
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 for 32bit. 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.
Define segments for Thread Local Storage data. Output: seg_tlsseg_data set to segment number for TLS data segment.
Returns the symbol for the __tlv_bootstrap function.
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)
Generate LSDA and PC_Begin fixups in the __eh_frame segment encoded as DW_EH_PE_pcrel|ptr. 64 bits LSDA [0] address x0071 symbolnum 6 pcrel 0 length 3 extern 1 type 5 RELOC_SUBTRACTOR __Z3foov.eh [1] address x0071 symbolnum 1 pcrel 0 length 3 extern 1 type 0 RELOC_UNSIGNED GCC_except_table2
Generate fixup specific to .eh_frame and .gcc_except_table sections.
Write to the object file
Number symbols so they are ordered as locals, public and then extern/comdef
Output file name record.
Mangle a name.
Close and delete .OBJ file.
Terminate.
Patch pseg/offset by adding in the vmaddr difference from pseg/offset to start of seg.
Returns !=0 if this segment is a code segment.
Section index for the __thread_vars/__tls_data section.
Section index for the __thread_bss section.
Section index for the __thread_data section.
Compiler implementation of the D programming language.