#ifndef COMPILER_OBJGENMACHO_H #define COMPILER_OBJGENMACHO_H #include "compiler/common.h" #ifdef CW_TARGET_MACH #include "compiler/MachO.h" typedef MachOSection *SectionHandle; #define ObjGen_SourceRef ObjGen_Line #else typedef Section SectionHandle; #endif typedef enum MWReloc { MW_RELOC_0 = 0, MW_RELOC_2_BR24 = 2, MW_RELOC_3 = 3, MW_RELOC_4 = 4, MW_RELOC_5_LO16 = 5, MW_RELOC_6_HI16 = 6, MW_RELOC_7_HA16 = 7, MW_RELOC_8 = 8, MW_RELOC_9 = 9 } MWReloc; extern SInt32 symdecloffset; extern SInt32 symdeclend; extern void ObjGen_Setup(void); extern void ObjGen_Finish(void); extern void ObjGen_Cleanup(void); extern void ObjGen_CodeCleanup(void); extern void ObjGen_SetupSym(void); extern void ObjGen_SymFunc(Object *function); extern void ObjGen_SegmentName(void); extern void ObjGen_SrcBreakName(HashNameNode *name, SInt32 fileModDate, Boolean flag); extern void ObjGen_DeclareData(Object *object, char *data, OLinkList *olinklist, UInt32 size); extern void ObjGen_DeclareReadOnlyData(Object *object, char *data, OLinkList *olinklist, UInt32 size); extern void ObjGen_DeclareSwitchTable(Object *tableobj, Object *funcobj); extern SectionHandle ObjGen_DeclareCode(Object *object, SInt32 size); extern void ObjGen_DeclareEntry(Object *object, SInt32 offset); extern void ObjGen_DeclareSymInfo(void); extern void ObjGen_DeclareExceptionTables(Object *object, SInt32 codesize, char *data, SInt32 len, OLinkList *refs); extern void ObjGen_DeclareTracebackTable(Object *tableobj, void *data, SInt32 size); extern void ObjGen_RelocateObj(SectionHandle section, SInt32 offset, Object *object, MWReloc mwRelType); extern void ObjGen_SourceRef(UInt32 line, UInt32 offset); extern GList *ObjGen_GetSectionGList(SectionHandle section); #ifdef CW_TARGET_MACH extern Boolean declare_readonly; extern GList symtypemodule; extern SInt32 last_base_offset[N_SECTIONS]; extern MachOSection *Sections[N_SECTIONS]; extern Section last_function_sect_id; extern MachOSection *last_function_sect; extern SInt32 pic_base_offset; extern SInt32 ObjGen_MakeSectReloc(MachOSection *section); extern SInt32 ObjGen_GetHashNodeRelocID(Object *object, MachOSection *section, SInt32 value); extern void ObjGen_DeclareFloatConst(Object *object); extern void ObjGen_DeclareVectorConst(Object *object); extern void ObjGenMach_SymFuncEnd(Object *function, UInt32 offset); extern void ObjGen_CodeSetup(void); extern MachOSection *ObjGen_DeclareFunction(Object *object); extern MachOSection *ObjGen_DeclareMachSection(char *segname, char *sectname, UInt32 align, UInt32 flags); extern void ObjGen_Relocate(MachOSection *section, SInt32 offset, SInt32 relocID, RelocType relocType, MWReloc mwRelType); extern SInt32 ObjGen_DeclareLiteralString(UInt32 len, char *data, SInt32 align); extern UInt32 ObjGen_GetSectSize(MachOSection *section); extern void ObjGen_GetExtName(SInt32 id, char *buf); extern void ObjGen_PicRelocate(MachOSection *section, SInt32 offset, SInt32 relocID, SInt32 picOffset); extern SInt32 ObjGen_GetRelocOffset(SInt32 id); extern Boolean ObjGen_IsExternalVar(SInt32 id); extern SInt32 ObjGen_DeclareInit(UInt32 len, char *data, SInt32 align); extern void CodeGen_GenDynLinkStub(MachOSection *a, MachOSection *b, SInt32 relocID); extern void ObjGen_DeclarePICBase(Object *object, SInt32 offset); extern void ObjGen_DeclareCodeLabel(Object *labelobj, SInt32 offset, Object *funcobj); extern void ObjGen_OutputDebugInfo(Object *funcobj); extern SInt32 ObjGen_OutputStab(SymbolData *symbol, SInt32 strIdx); extern void ObjGen_SetSectName(/* unknown args */); extern void ObjGen_DeclareInitFunction(Object *funcobj); extern Boolean ObjGen_IsExported(Object *object); #endif #endif