dmd.backend.mscoffobj

Compiler implementation of the D programming language.

Members

Enums

RELaddr
anonymousenum RELaddr

Because the mscoff relocations cannot be computed until after all the segments are written out, and we need more information than the mscoff relocations provide, make our own relocation type. Later, translate to mscoff relocation structure.

Functions

MsCoffObj_addScnhdr
IDXSEC MsCoffObj_addScnhdr(const(char)* scnhdr_name, uint flags)

Add new scnhdr.

MsCoffObj_addrel
void MsCoffObj_addrel(segidx_t seg, targ_size_t offset, Symbol* targsym, uint targseg, int rtype, int val)

Add a relocation entry for seg/offset.

MsCoffObj_addstr
IDXSTR MsCoffObj_addstr(Outbuffer* strtab, const(char)* str)

Output a string into a string table Input: strtab = string table for entry str = string to add

MsCoffObj_alias
void MsCoffObj_alias(const(char)* n1, const(char)* n2)

Output an alias definition record.

MsCoffObj_allowZeroSize
bool MsCoffObj_allowZeroSize()

Do we allow zero sized objects?

MsCoffObj_byte
void MsCoffObj_byte(segidx_t seg, targ_size_t offset, uint byte_)

Output byte_ to object file.

MsCoffObj_bytes
uint MsCoffObj_bytes(segidx_t seg, targ_size_t offset, uint nbytes, void* p)

Output bytes to object file.

MsCoffObj_codeseg
int MsCoffObj_codeseg(const 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

MsCoffObj_comdatsize
int MsCoffObj_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

MsCoffObj_common_block
int MsCoffObj_common_block(Symbol* s, targ_size_t size, targ_size_t count)

Output a common block definition.

MsCoffObj_compiler
void MsCoffObj_compiler()

Embed compiler version in .obj file.

MsCoffObj_data_readonly
int MsCoffObj_data_readonly(char* p, int len, segidx_t* pseg)

Ouput read only data for data

MsCoffObj_data_start
segidx_t MsCoffObj_data_start(Symbol* sdata, targ_size_t datasize, segidx_t seg)

Update data information about symbol align for output and assign segment if not already specified.

MsCoffObj_ehtables
void MsCoffObj_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

MsCoffObj_exestr
void MsCoffObj_exestr(const(char)* p)

Embed string in executable.

MsCoffObj_export_symbol
void MsCoffObj_export_symbol(Symbol* s, uint argsize)

Export a function name.

MsCoffObj_external
int MsCoffObj_external(Symbol* s)

Output an external for existing symbol. Input: s Symbol to do EXTDEF on (Name is to be mangled)

MsCoffObj_external_def
int MsCoffObj_external_def(const(char)* name)

Output an external symbol for name. Input: name Name to do EXTDEF on (Not to be mangled)

MsCoffObj_far16thunk
void MsCoffObj_far16thunk(Symbol* s)

Generate far16 thunk. Input: s Symbol to generate a thunk for

MsCoffObj_fltused
void MsCoffObj_fltused()

Mark object file as using floating point.

MsCoffObj_func_start
void MsCoffObj_func_start(Symbol* sfunc)

Update function info before codgen

MsCoffObj_func_term
void MsCoffObj_func_term(Symbol* sfunc)

Update function info after codgen

MsCoffObj_getsegment
segidx_t MsCoffObj_getsegment(const(char)* sectname, uint flags)

Get segment, which may already exist. Input: flags2 put out some data for this, so the linker will keep things in order

MsCoffObj_getsegment2
segidx_t MsCoffObj_getsegment2(IDXSEC shtidx)

Create a new segment corresponding to an existing scnhdr index shtidx

MsCoffObj_includelib
bool MsCoffObj_includelib(const(char)* name)

Output library name.

MsCoffObj_init
Obj MsCoffObj_init(Outbuffer* objbuf, const(char)* filename, const(char)* csegname)

Start a .obj file. Called before any other obj_xxx routines. One source file can generate multiple .obj files.

MsCoffObj_initfile
void MsCoffObj_initfile(const(char)* filename, const(char)* csegname, const(char)* modname)

Start a module within a .obj file. There can be multiple modules within a single .obj file.

MsCoffObj_jmpTableSegment
int MsCoffObj_jmpTableSegment(Symbol* s)
MsCoffObj_lidata
void MsCoffObj_lidata(segidx_t seg, targ_size_t offset, targ_size_t count)

Output an iterated data block of 0s.

MsCoffObj_linkerdirective
bool MsCoffObj_linkerdirective(const(char)* directive)

Output linker directive name.

MsCoffObj_linnum
void MsCoffObj_linnum(Srcpos srcpos, int seg, targ_size_t offset)

Record file and line number at segment and offset.

MsCoffObj_moduleinfo
void MsCoffObj_moduleinfo(Symbol* scc)

Stuff pointer to ModuleInfo in its own segment. Input: scc symbol for ModuleInfo

MsCoffObj_pubdef
void MsCoffObj_pubdef(segidx_t seg, Symbol* s, targ_size_t offset)

Output a public definition.

MsCoffObj_reftocodeseg
void MsCoffObj_reftocodeseg(segidx_t 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

MsCoffObj_reftodatseg
void MsCoffObj_reftodatseg(segidx_t 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

MsCoffObj_reftoident
int MsCoffObj_reftoident(segidx_t seg, targ_size_t offset, Symbol* s, targ_size_t val, int flags)

Refer to an identifier.

MsCoffObj_seg_pdata
segidx_t MsCoffObj_seg_pdata()

Return segment indices for .pdata and .xdata sections

MsCoffObj_setModuleCtorDtor
void MsCoffObj_setModuleCtorDtor(Symbol* sfunc, bool isCtor)

Stuff pointer to function in its own segment. Used for static ctor and dtor lists.

MsCoffObj_setcodeseg
void MsCoffObj_setcodeseg(int seg)

Reset code seg to existing seg. Used after a COMDAT for a function is done.

MsCoffObj_startaddress
void MsCoffObj_startaddress(Symbol* s)

Set start address

MsCoffObj_staticctor
void MsCoffObj_staticctor(Symbol* s, int dtor, int none)

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

MsCoffObj_staticdtor
void MsCoffObj_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

MsCoffObj_string_literal_segment
int MsCoffObj_string_literal_segment(uint sz)

Get segment for readonly string literals. The linker will pool strings in this section.

MsCoffObj_sym_cdata
Symbol* MsCoffObj_sym_cdata(tym_t ty, char* p, int len)

Output read only data and generate a symbol for it.

MsCoffObj_term
void MsCoffObj_term(const(char)* objfilename)

Terminate package.

MsCoffObj_termfile
void MsCoffObj_termfile()

Fixup and terminate object file.

MsCoffObj_tlsseg
seg_data* MsCoffObj_tlsseg()

Define segments for Thread Local Storage. Output: seg_tlsseg set to segment number for TLS segment.

MsCoffObj_tlsseg_bss
seg_data* MsCoffObj_tlsseg_bss()

Define segments for Thread Local Storage. Output: seg_tlsseg_bss set to segment number for TLS segment.

MsCoffObj_user
void MsCoffObj_user(const(char)* p)

Embed string in obj.

MsCoffObj_wkext
void MsCoffObj_wkext(Symbol* s1, Symbol* s2)

Output a weak extern record.

MsCoffObj_write_byte
void MsCoffObj_write_byte(seg_data* pseg, uint byte_)

Append byte to segment.

MsCoffObj_write_bytes
void MsCoffObj_write_bytes(seg_data* pseg, uint nbytes, void* p)

Append bytes to segment.

MsCoffObj_write_pointerRef
void MsCoffObj_write_pointerRef(Symbol* s, uint soff)

write a reference to a mutable pointer into the object file

MsCoffObj_write_zeros
void MsCoffObj_write_zeros(seg_data* pseg, targ_size_t count)

Append an iterated data block of 0s. (uninitialized data only)

obj_filename
void obj_filename(const(char)* modname)

Output file name record.

obj_mangle2
char* obj_mangle2(Symbol* s, char* dest)

Mangle a name.

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.

Structs

Relocation
struct Relocation

Because the mscoff relocations cannot be computed until after all the segments are written out, and we need more information than the mscoff relocations provide, make our own relocation type. Later, translate to mscoff relocation structure.

Meta