- MachObj_addrel
void MachObj_addrel(int seg, targ_size_t offset, Symbol* targsym, uint targseg, int rtype, int val)
Add a relocation entry for seg/offset.
- MachObj_addstr
IDXSTR MachObj_addstr(Outbuffer* strtab, const(char)* str)
Output a string into a string table
Input:
strtab = string table for entry
str = string to add
- MachObj_alias
void MachObj_alias(const(char)* n1, const(char)* n2)
Output an alias definition record.
- MachObj_allowZeroSize
bool MachObj_allowZeroSize()
Do we allow zero sized objects?
- MachObj_byte
void MachObj_byte(int seg, targ_size_t offset, uint byte_)
Output byte to object file.
- MachObj_bytes
uint MachObj_bytes(int seg, targ_size_t offset, uint nbytes, void* p)
Output bytes to object file.
- MachObj_codeseg
int MachObj_codeseg(char* name, int suffix)
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
- MachObj_comdat
int MachObj_comdat(Symbol* s)
Undocumented in source. Be warned that the author may not have intended to support it.
- MachObj_comdatsize
int MachObj_comdatsize(Symbol* s, targ_size_t symsize)
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
- MachObj_common_block
int MachObj_common_block(Symbol* s, targ_size_t size, targ_size_t count)
Output a common block definition.
Input:
p . external identifier
size size in bytes of each elem
count number of elems
- MachObj_common_block
int MachObj_common_block(Symbol* s, int flag, targ_size_t size, targ_size_t count)
Undocumented in source. Be warned that the author may not have intended to support it.
- MachObj_compiler
void MachObj_compiler()
Embed compiler version in .obj file.
- MachObj_data_readonly
int MachObj_data_readonly(char* p, int len, int* pseg)
Ouput read only data for data
- MachObj_data_readonly
int MachObj_data_readonly(char* p, int len)
Undocumented in source. Be warned that the author may not have intended to support it.
- MachObj_data_start
int MachObj_data_start(Symbol* sdata, targ_size_t datasize, int seg)
Update data information about symbol
align for output and assign segment
if not already specified.
- MachObj_ehsections
void MachObj_ehsections()
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.
- MachObj_ehtables
void MachObj_ehtables(Symbol* sfunc, uint size, Symbol* ehsym)
Stuff the following data (instance of struct FuncTable) in a separate segment:
pointer to function
pointer to ehsym
length of function
- MachObj_exestr
void MachObj_exestr(const(char)* p)
Embed string in executable.
- MachObj_export_symbol
void MachObj_export_symbol(Symbol* s, uint argsize)
- MachObj_external
int MachObj_external(Symbol* s)
Output an external for existing symbol.
Input:
s Symbol to do EXTDEF on
(Name is to be mangled)
- MachObj_external_def
int MachObj_external_def(const(char)* name)
Output an external symbol for name.
Input:
name Name to do EXTDEF on
(Not to be mangled)
- MachObj_far16thunk
void MachObj_far16thunk(Symbol* s)
Generate far16 thunk.
Input:
s Symbol to generate a thunk for
- MachObj_filename
void MachObj_filename(const(char)* modname)
- MachObj_fltused
void MachObj_fltused()
Mark object file as using floating point.
- MachObj_func_start
void MachObj_func_start(Symbol* sfunc)
Update function info before codgen
- MachObj_func_term
void MachObj_func_term(Symbol* sfunc)
Update function info after codgen
- MachObj_getGOTsym
Symbol* MachObj_getGOTsym()
- MachObj_getsegment
int MachObj_getsegment(const(char)* sectname, const(char)* segname, int align_, int flags)
Get segment.
Input:
align_ segment alignment as power of 2
- MachObj_gotref
void MachObj_gotref(Symbol* s)
- MachObj_includelib
bool MachObj_includelib(const(char)* name)
- MachObj_init
Obj MachObj_init(Outbuffer* objbuf, const(char)* filename, const(char)* csegname)
Perform initialization that applies to all .o output files.
Called before any other obj_xxx routines
- MachObj_initfile
void MachObj_initfile(const(char)* filename, const(char)* csegname, const(char)* modname)
Initialize the start of object output for this particular .o file.
- MachObj_jmpTableSegment
int MachObj_jmpTableSegment(Symbol* s)
- MachObj_lidata
void MachObj_lidata(int seg, targ_size_t offset, targ_size_t count)
Output an iterated data block of 0s.
- MachObj_linkerdirective
bool MachObj_linkerdirective(const(char)* name)
- MachObj_linnum
void MachObj_linnum(Srcpos srcpos, int seg, targ_size_t offset)
Record file and line number at segment and offset.
The actual .debug_line segment is put out by dwarf_termfile().
- MachObj_moduleinfo
void MachObj_moduleinfo(Symbol* scc)
Stuff pointer to ModuleInfo in its own segment.
- MachObj_pubdef
void MachObj_pubdef(int seg, Symbol* s, targ_size_t offset)
Undocumented in source. Be warned that the author may not have intended to support it.
- MachObj_pubdefsize
void MachObj_pubdefsize(int seg, Symbol* s, targ_size_t offset, targ_size_t symsize)
Output a public definition.
Input:
seg = segment index that symbol is defined in
s . symbol
offset = offset of name within segment
- MachObj_readonly_comdat
int MachObj_readonly_comdat(Symbol* s)
Undocumented in source. Be warned that the author may not have intended to support it.
- MachObj_refGOTsym
void MachObj_refGOTsym()
Undocumented in source. Be warned that the author may not have intended to support it.
- MachObj_reftocodeseg
void MachObj_reftocodeseg(int seg, targ_size_t offset, targ_size_t val)
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
- MachObj_reftodatseg
void MachObj_reftodatseg(int seg, targ_size_t offset, targ_size_t val, uint targetdatum, int flags)
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
- MachObj_reftoident
int MachObj_reftoident(int seg, targ_size_t offset, Symbol* s, targ_size_t val, int flags)
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
- MachObj_setModuleCtorDtor
void MachObj_setModuleCtorDtor(Symbol* sfunc, bool isCtor)
Stuff pointer to function in its own segment.
Used for static ctor and dtor lists.
- MachObj_setcodeseg
void MachObj_setcodeseg(int seg)
Reset code seg to existing seg.
Used after a COMDAT for a function is done.
- MachObj_startaddress
void MachObj_startaddress(Symbol* s)
- MachObj_staticctor
void MachObj_staticctor(Symbol* s, int , int )
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
- MachObj_staticdtor
void MachObj_staticdtor(Symbol* s)
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
- MachObj_string_literal_segment
int MachObj_string_literal_segment(uint sz)
Get segment for readonly string literals.
The linker will pool strings in this section.
- MachObj_sym_cdata
Symbol* MachObj_sym_cdata(tym_t ty, char* p, int len)
Ouput read only data and generate a symbol for it.
- MachObj_term
void MachObj_term(const(char)* objfilename)
- MachObj_termfile
void MachObj_termfile()
Fixup and terminate object file.
- MachObj_tlsseg
seg_data* MachObj_tlsseg()
Define segments for Thread Local Storage for 32bit.
Output:
seg_tlsseg set to segment number for TLS segment.
- MachObj_tlsseg_bss
seg_data* MachObj_tlsseg_bss()
Define segments for Thread Local Storage.
Output:
seg_tlsseg_bss set to segment number for TLS segment.
- MachObj_tlsseg_data
seg_data* MachObj_tlsseg_data()
Define segments for Thread Local Storage data.
Output:
seg_tlsseg_data set to segment number for TLS data segment.
- MachObj_tlv_bootstrap
Symbol* MachObj_tlv_bootstrap()
Returns the symbol for the __tlv_bootstrap function.
- MachObj_user
void MachObj_user(const(char)* p)
- MachObj_wkext
void MachObj_wkext(Symbol* s1, Symbol* s2)
Output a weak extern record.
- MachObj_write_byte
void MachObj_write_byte(seg_data* pseg, uint byte_)
- MachObj_write_bytes
void MachObj_write_bytes(seg_data* pseg, uint nbytes, void* p)
- MachObj_write_pointerRef
void MachObj_write_pointerRef(Symbol* s, uint off)
Undocumented in source. Be warned that the author may not have intended to support it.
- MachObj_write_zeros
void MachObj_write_zeros(seg_data* pseg, targ_size_t count)
Append an iterated data block of 0s.
(uninitialized data only)
- SecHdrTab
section* SecHdrTab()
Undocumented in source. Be warned that the author may not have intended to support it.
- SecHdrTab64
section_64* SecHdrTab64()
Undocumented in source. Be warned that the author may not have intended to support it.
- dwarf_eh_frame_fixup
int dwarf_eh_frame_fixup(int dfseg, targ_size_t offset, Symbol* s, targ_size_t val, Symbol* fdesym)
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
- getsegment2
int getsegment2(int seg, const(char)* sectname, const(char)* segname, int align_, int flags)
- mach_dwarf_reftoident
int mach_dwarf_reftoident(int seg, targ_size_t offset, Symbol* s, targ_size_t val)
Generate fixup specific to .eh_frame and .gcc_except_table sections.
- mach_numbersyms
void mach_numbersyms()
Number symbols so they are
ordered as locals, public and then extern/comdef
- mach_relsort
void mach_relsort(Outbuffer* buf)
Undocumented in source. Be warned that the author may not have intended to support it.
- mach_seg_data_isCode
int mach_seg_data_isCode(seg_data sd)
Returns !=0 if this segment is a code segment.
- machobjfile_delete
void machobjfile_delete()
Close and delete .OBJ file.
- machobjfile_term
void machobjfile_term()
- patch
void patch(seg_data* pseg, targ_size_t offset, int seg, targ_size_t value)
Undocumented in source. Be warned that the author may not have intended to support it.
- patchAddr
int32_t* patchAddr(int seg, targ_size_t offset)
Patch pseg/offset by adding in the vmaddr difference from
pseg/offset to start of seg.
- patchAddr64
int32_t* patchAddr64(int seg, targ_size_t offset)
Undocumented in source. Be warned that the author may not have intended to support it.
- qsort
void qsort(void* base, size_t nmemb, size_t size, _compare_fp_t compar)
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
Compiler implementation of the D programming language.