in rts/linker/PEi386.c [205:271]
static size_t makeSymbolExtra_PEi386(
ObjectCode* oc,
uint64_t index,
size_t s,
SymbolName* symbol);
#endif
static void addDLLHandle(
pathchar* dll_name,
HINSTANCE instance);
static bool verifyCOFFHeader(
uint16_t machine,
IMAGE_FILE_HEADER *hdr,
pathchar *fileName);
static bool checkIfDllLoaded(
HINSTANCE instance);
static uint32_t getSectionAlignment(
Section section);
static uint8_t* getAlignedMemory(
uint8_t* value,
Section section);
static size_t getAlignedValue(
size_t value,
Section section);
static void addCopySection(
ObjectCode *oc,
Section *s,
SectionKind kind,
SectionAlloc alloc,
void* start,
StgWord size);
static void releaseOcInfo(
ObjectCode* oc);
/* Add ld symbol for PE image base. */
#if defined(__GNUC__)
#define __ImageBase __MINGW_LSYMBOL(_image_base__)
#endif
/* Get the base of the module. */
/* This symbol is defined by ld. */
extern IMAGE_DOS_HEADER __ImageBase;
#define __image_base (void*)((HINSTANCE)&__ImageBase)
const Alignments pe_alignments[] = {
{ IMAGE_SCN_ALIGN_1BYTES , 1 },
{ IMAGE_SCN_ALIGN_2BYTES , 2 },
{ IMAGE_SCN_ALIGN_4BYTES , 4 },
{ IMAGE_SCN_ALIGN_8BYTES , 8 },
{ IMAGE_SCN_ALIGN_16BYTES , 16 },
{ IMAGE_SCN_ALIGN_32BYTES , 32 },
{ IMAGE_SCN_ALIGN_64BYTES , 64 },
{ IMAGE_SCN_ALIGN_128BYTES , 128 },
{ IMAGE_SCN_ALIGN_256BYTES , 256 },
{ IMAGE_SCN_ALIGN_512BYTES , 512 },
{ IMAGE_SCN_ALIGN_1024BYTES, 1024},
{ IMAGE_SCN_ALIGN_2048BYTES, 2048},
{ IMAGE_SCN_ALIGN_4096BYTES, 4096},
{ IMAGE_SCN_ALIGN_8192BYTES, 8192},
};