View source code
Display the source code in dmd/backend/machobj.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone.

Module dmd.backend.machobj

Generate Mach-O object files

Compiler implementation of the D programming language.


dwarf_eh_frame_fixup(dfseg, offset, s, val, 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 [1] address x0071 symbolnum 1 pcrel 0 length 3 extern 1 type 0 RELOC_UNSIGNED GCC_except_table2
getsegment2(seg, sectname, segname, align_, flags) Memoize seg index.
mach_dwarf_reftoident(seg, offset, s, val) Generate fixup specific to .eh_frame and .gcc_except_table sections.
mach_numbersyms() Number symbols so they are ordered as locals, public and then extern/comdef
mach_seg_data_isCode(sd) Returns !=0 if this segment is a code segment.
MachObj_addrel(seg, offset, targsym, targseg, rtype, val) Add a relocation entry for seg/offset.
MachObj_addstr(strtab, str) Output a string into a string table
MachObj_alias(n1, n2) Output an alias definition record.
MachObj_allowZeroSize() Do we allow zero sized objects?
MachObj_byte(seg, offset, byte_) Output byte to object file.
MachObj_bytes(seg, offset, nbytes, p) Output bytes to object file.
MachObj_codeseg(name, suffix) Define a new code segment.
MachObj_comdatsize(s, 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(s, size, count) Output a common block definition.
MachObj_compiler(p) Embed compiler version in .obj file.
MachObj_data_readonly(p, len, pseg) Ouput read only data for data
MachObj_data_start(sdata, datasize, seg) Update data information about symbol align for output and assign segment if not already specified.
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(sfunc, size, ehsym) Stuff the following data (instance of struct FuncTable) in a separate segment: pointer to function pointer to ehsym length of function
MachObj_exestr(p) Embed string in executable.
MachObj_export_symbol(s, argsize) Export a function name.
MachObj_external(s) Output an external for existing symbol.
MachObj_external_def(name) Output an external symbol for name.
MachObj_far16thunk(s) Generate far16 thunk.
MachObj_filename(modname) Output file name record.
MachObj_fltused() Mark object file as using floating point.
MachObj_func_start(sfunc) Update function info before codgen
MachObj_func_term(sfunc) Update function info after codgen
MachObj_getsegment(sectname, segname, align_, flags) Get segment.
MachObj_includelib(name) Output library name.
MachObj_init(objbuf, filename, csegname) Perform initialization that applies to all .o output files. Called before any other obj_xxx routines
MachObj_initfile(filename, csegname, modname) Initialize the start of object output for this particular .o file.
MachObj_lidata(seg, offset, count) Output an iterated data block of 0s.
MachObj_linkerdirective(name) Output linker directive.
MachObj_linnum(srcpos, seg, offset) Line number support.
MachObj_moduleinfo(scc) Stuff pointer to ModuleInfo in its own segment.
MachObj_pubdefsize(seg, s, offset, symsize) Output a public definition.
MachObj_reftocodeseg(seg, offset, 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.
MachObj_reftodatseg(seg, offset, val, targetdatum, flags) Refer to address that is in the data segment.
MachObj_reftoident(seg, offset, s, val, flags) Refer to an identifier.
MachObj_setcodeseg(seg) Reset code seg to existing seg. Used after a COMDAT for a function is done.
MachObj_setModuleCtorDtor(sfunc, isCtor) Stuff pointer to function in its own segment. Used for static ctor and dtor lists.
MachObj_startaddress(s) Set start address
MachObj_staticctor(s, __param_1, __param_2) Symbol is the function that calls the static constructors. Put a pointer to it into a special segment that the startup code looks at.
MachObj_staticdtor(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.
MachObj_string_literal_segment(sz) Get segment for readonly string literals. The linker will pool strings in this section.
MachObj_sym_cdata(ty, p, len) Ouput read only data and generate a symbol for it.
MachObj_term(objfilename) Terminate package.
MachObj_termfile() Fixup and terminate object file.
MachObj_tlsseg() Define segments for Thread Local Storage for 32bit.
MachObj_tlsseg_bss() Define segments for Thread Local Storage.
MachObj_tlsseg_data() Define segments for Thread Local Storage data.
MachObj_tlv_bootstrap() Returns the symbol for the _tlv_bootstrap function.
MachObj_user(p) Embed string in obj.
MachObj_wkext(s1, s2) Output a weak extern record.
MachObj_write_byte(pseg, byte_) Append byte to segment.
MachObj_write_bytes(pseg, a) Append bytes to segment.
MachObj_write_zeros(pseg, count) Append an iterated data block of 0s. (uninitialized data only)
machobjfile_delete() Close and delete .OBJ file.
machobjfile_term() Terminate.
patchAddr(seg, offset) Patch pseg/offset by adding in the vmaddr difference from pseg/offset to start of seg.

Global variables

seg_tlsseg_data int Section index for the _thread_data section.


Walter Bright


Boost License 1.0