diff options
-rw-r--r-- | CMakeLists.txt | 3 | ||||
-rw-r--r-- | command_line/CmdLine/Src/CLLicenses.c | 2 | ||||
-rw-r--r-- | command_line/CmdLine/Src/Callbacks/CLDropinCallbacks_V10.cpp | 6 | ||||
-rw-r--r-- | compiler_and_linker/unsorted/CCompiler.c | 12 | ||||
-rw-r--r-- | compiler_and_linker/unsorted/CMachine.c | 30 | ||||
-rw-r--r-- | compiler_and_linker/unsorted/CParser.c | 33 | ||||
-rw-r--r-- | compiler_and_linker/unsorted/IrOptimizer.c | 2 | ||||
-rw-r--r-- | compiler_and_linker/unsorted/IroDump.c | 4 | ||||
-rw-r--r-- | compiler_and_linker/unsorted/ObjGenMachO.c | 6 | ||||
-rw-r--r-- | compiler_and_linker/unsorted/Operands.c | 8 | ||||
-rw-r--r-- | compiler_and_linker/unsorted/PCodeAssembly.c | 4 | ||||
-rw-r--r-- | compiler_and_linker/unsorted/PCodeListing.c | 4 | ||||
-rw-r--r-- | compiler_and_linker/unsorted/uDump.c | 4 | ||||
-rw-r--r-- | includes/cmdline.h | 2 | ||||
-rw-r--r-- | includes/common.h | 9 | ||||
-rw-r--r-- | includes/compiler/CParser.h | 2 | ||||
-rw-r--r-- | includes/compiler/ObjGenMachO.h | 55 | ||||
-rw-r--r-- | includes/plugin.h | 2 | ||||
-rw-r--r-- | notes | 17 |
19 files changed, 115 insertions, 90 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 7760667..e188ad0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,8 @@ include_directories(.) include_directories(includes) include_directories(sdk_hdrs) -# add_compile_definitions(CW_PATCH_DEBUG) +# add_compile_definitions(CW_ENABLE_IRO_DEBUG) +add_compile_definitions(CW_ENABLE_PCODE_DEBUG CW_TARGET_MACH CW_CLT) add_executable(mwcc command_line/CmdLine/Src/Clients/CLStaticMain.c diff --git a/command_line/CmdLine/Src/CLLicenses.c b/command_line/CmdLine/Src/CLLicenses.c index a58d58d..5602488 100644 --- a/command_line/CmdLine/Src/CLLicenses.c +++ b/command_line/CmdLine/Src/CLLicenses.c @@ -6,7 +6,7 @@ void License_Initialize(void) { void License_Terminate(void) { } -SInt32 License_Checkout(void) { +SInt32 License_Checkout(const char *featureName, const char *licenseVersion, Boolean flag, char *errorBuf) { return 0xD0AD0A; } diff --git a/command_line/CmdLine/Src/Callbacks/CLDropinCallbacks_V10.cpp b/command_line/CmdLine/Src/Callbacks/CLDropinCallbacks_V10.cpp index f231060..965e414 100644 --- a/command_line/CmdLine/Src/Callbacks/CLDropinCallbacks_V10.cpp +++ b/command_line/CmdLine/Src/Callbacks/CLDropinCallbacks_V10.cpp @@ -1182,12 +1182,12 @@ CWResult UCBSecretPeekHandle(CWPluginContext context, CWMemHandle memHandle, Han } } -CWResult UCBCheckoutLicense(CWPluginContext context, const char *a, const char *b, SInt32 c, void *d, SInt32 *cookiePtr) { +CWResult UCBCheckoutLicense(CWPluginContext context, const char *featureName, const char *licenseVersion, SInt32 flags, void *reserved, SInt32 *cookie) { if (optsCmdLine.verbose > 3) CLPrint("Callback: %s\n", "UCBCheckoutLicense"); - if (cookiePtr) - *cookiePtr = 0xD0A; + if (cookie) + *cookie = 0xD0A; return cwErrInvalidCallback; } diff --git a/compiler_and_linker/unsorted/CCompiler.c b/compiler_and_linker/unsorted/CCompiler.c index 06d518f..1eb6cd0 100644 --- a/compiler_and_linker/unsorted/CCompiler.c +++ b/compiler_and_linker/unsorted/CCompiler.c @@ -23,8 +23,13 @@ static void get_extension(ConstStringPtr src, char *dst) { if (ep >= 2) { int x; - for (x = 0; (x + ep) <= src[0]; x++) + for (x = 0; (x + ep) <= src[0]; x++) { +#ifdef CW_CLT dst[x] = src[x + ep]; +#else + dst[x] = tolower(src[x + ep]); +#endif + } dst[x] = 0; } } @@ -71,7 +76,7 @@ static int setup_param_block(CWPluginContext context) { cparams.targetOS = tinfo.targetOS; cparams.targetCPU = tinfo.targetCPU; cparams.idetargetname = target_name; - return CWGetTargetName(context, target_name, sizeof(target_name)) == cwNoErr; + return CWGetTargetName(context, cparams.idetargetname, sizeof(target_name)) == cwNoErr; } static short store_compile_results(void) { @@ -231,7 +236,8 @@ CWPLUGIN_ENTRY(MWC_main)(CWPluginContext context) { CodeGen_InitBackEndOptions(); CodeGen_UpdateOptimizerOptions(); CodeGen_UpdateBackEndOptions(); - if (C_Compiler(&cparams)) + result = C_Compiler(&cparams); + if (result != noErr) result = store_compile_results(); else result = cwErrRequestFailed; diff --git a/compiler_and_linker/unsorted/CMachine.c b/compiler_and_linker/unsorted/CMachine.c index c62faf5..eff2243 100644 --- a/compiler_and_linker/unsorted/CMachine.c +++ b/compiler_and_linker/unsorted/CMachine.c @@ -132,7 +132,7 @@ void CMach_Configure(void) { SInt32 CMach_GetQUALalign(UInt32 qual) { SInt32 result = 0; - SInt32 chk; + UInt32 chk; if ((chk = (qual & Q_ALIGNED_MASK))) { if (chk == Q_ALIGNED_1) @@ -183,10 +183,14 @@ SInt32 CMach_ArgumentAlignment(Type *type) { copts.structalignment = save_align_mode; copts.oldalignment = save_oldalignment; - if (type->type == TYPESTRUCT && !TYPE_STRUCT(type)->members && TYPE_STRUCT(type)->align > align) - align = TYPE_STRUCT(type)->align; - - return align; + if (type->type == TYPESTRUCT && !TYPE_STRUCT(type)->members) { + if (TYPE_STRUCT(type)->align > align) + return TYPE_STRUCT(type)->align; + else + return align; + } else { + return align; + } } // TODO: investigate if this returns SInt16 actually @@ -540,23 +544,23 @@ CInt64 CMach_CalcIntConvertFromFloat(Type *type, Float fval) { } void CMach_InitIntMem(Type *type, CInt64 val, void *mem) { - UInt32 lg; - UInt16 sh; - UInt8 ch; + SInt32 lg; + SInt16 sh; + SInt8 ch; switch (type->type) { case TYPEINT: switch (type->size) { case 1: - ch = (UInt8) CInt64_GetULong(&val); + ch = CInt64_GetULong(&val); memcpy(mem, &ch, 1); break; case 2: - sh = (UInt16) CTool_EndianConvertWord16(CInt64_GetULong(&val)); + sh = CTool_EndianConvertWord16(CInt64_GetULong(&val)); memcpy(mem, &sh, 2); break; case 4: - lg = (UInt32) CTool_EndianConvertWord32(CInt64_GetULong(&val)); + lg = CTool_EndianConvertWord32(CInt64_GetULong(&val)); memcpy(mem, &lg, 4); break; case 8: @@ -1299,7 +1303,7 @@ UInt8 CMach_GetFunctionResultClass(TypeFunc *tfunc) { return 0; case TYPECLASS: case TYPEMEMBERPOINTER: - return CMach_PassResultInHiddenArg(tfunc->functype) ? 1 : 0; + return CMach_PassResultInHiddenArg(tfunc->functype) != 0; default: return 0; } @@ -1315,7 +1319,7 @@ Boolean CMach_PassResultInHiddenArg(Type *type) { case TYPECLASS: return 1; case TYPEMEMBERPOINTER: - return (type->size == 4) ? 0 : 1; + return (type->size != 4); default: return 0; } diff --git a/compiler_and_linker/unsorted/CParser.c b/compiler_and_linker/unsorted/CParser.c index 075932e..92d75c1 100644 --- a/compiler_and_linker/unsorted/CParser.c +++ b/compiler_and_linker/unsorted/CParser.c @@ -519,9 +519,8 @@ void CParser_PrintUniqueID(char *buf) { ptr = mybuf; id = CParser_GetUniqueID(); while (id) { - *ptr = '0' + (id - ((id / 10) * 10)); + *(ptr++) = '0' + (id - ((id / 10) * 10)); id = id / 10; - ptr++; } while (ptr > mybuf) @@ -541,7 +540,7 @@ HashNameNode *CParser_GetUniqueName(void) { return GetHashNameNodeExport(buf); } -HashNameNode *CParser_NameConcat(char *a, char *b) { +HashNameNode *CParser_NameConcat(const char *a, const char *b) { char mybuf[256]; char *buf; char *dst; @@ -658,18 +657,18 @@ static void CParser_SetCFMFlags(Object *object, DeclInfo *declinfo) { if (object->datatype == DDATA) { if (copts.cfm_export) - object->flags |= OBJECT_FLAGS_40; + object->flags = object->flags | OBJECT_FLAGS_40; if (copts.cfm_internal) - object->flags |= OBJECT_FLAGS_10; + object->flags = object->flags | OBJECT_FLAGS_10; } else if (copts.cfm_internal) { - object->flags |= OBJECT_FLAGS_10; + object->flags = object->flags | OBJECT_FLAGS_10; } else { if (copts.cfm_import) - object->flags |= OBJECT_FLAGS_20; + object->flags = object->flags | OBJECT_FLAGS_20; if (copts.cfm_export) - object->flags |= OBJECT_FLAGS_40; + object->flags = object->flags | OBJECT_FLAGS_40; if (copts.cfm_lib_export) - object->flags |= OBJECT_FLAGS_20 | OBJECT_FLAGS_40; + object->flags = object->flags | OBJECT_FLAGS_20 | OBJECT_FLAGS_40; } } @@ -1686,7 +1685,7 @@ Boolean CParser_IsConst(Type *type, UInt32 qual) { break; } - return qual & Q_CONST; + return (qual & Q_CONST) != 0; } Boolean CParser_IsVolatile(Type *type, UInt32 qual) { @@ -1702,7 +1701,7 @@ Boolean CParser_IsVolatile(Type *type, UInt32 qual) { break; } - return (qual & Q_VOLATILE) ? 1 : 0; + return (qual & Q_VOLATILE) != 0; } Boolean is_const_object(Object *obj) { @@ -2105,15 +2104,15 @@ void CParser_ParseDeclSpec(DeclInfo *declinfo, Boolean flag) { if (tk != TK_EXPORT) CError_Error(CErrorStr107); else - declinfo->exportflags |= EXPORT_FLAGS_EXPORT; + declinfo->exportflags = declinfo->exportflags | EXPORT_FLAGS_EXPORT; } else if (!strcmp("internal", tkidentifier->name)) { - declinfo->exportflags |= EXPORT_FLAGS_INTERNAL; + declinfo->exportflags = declinfo->exportflags | EXPORT_FLAGS_INTERNAL; } else if (!strcmp("import", tkidentifier->name) || !strcmp("dllimport", tkidentifier->name)) { - declinfo->exportflags |= EXPORT_FLAGS_IMPORT; + declinfo->exportflags = declinfo->exportflags | EXPORT_FLAGS_IMPORT; } else if (!strcmp("export", tkidentifier->name) || !strcmp("dllexport", tkidentifier->name)) { - declinfo->exportflags |= EXPORT_FLAGS_EXPORT; + declinfo->exportflags = declinfo->exportflags | EXPORT_FLAGS_EXPORT; } else if (!strcmp("lib_export", tkidentifier->name)) { - declinfo->exportflags |= EXPORT_FLAGS_IMPORT | EXPORT_FLAGS_EXPORT; + declinfo->exportflags = declinfo->exportflags | EXPORT_FLAGS_IMPORT | EXPORT_FLAGS_EXPORT; } else if (!strcmp("weak", tkidentifier->name)) { declinfo->qual |= Q_OVERLOAD; } else { @@ -3157,7 +3156,7 @@ void CParser_NewCallBackAction(Object *obj, TypeClass *tclass) { act->obj = obj; act->tclass = tclass; callbackactions = act; - obj->flags |= OBJECT_FLAGS_8; + obj->flags = obj->flags | OBJECT_FLAGS_8; } void CParser_NewClassAction(TypeClass *tclass) { diff --git a/compiler_and_linker/unsorted/IrOptimizer.c b/compiler_and_linker/unsorted/IrOptimizer.c index 87be84c..121c65f 100644 --- a/compiler_and_linker/unsorted/IrOptimizer.c +++ b/compiler_and_linker/unsorted/IrOptimizer.c @@ -121,7 +121,7 @@ Statement *IRO_Optimizer(Object *func, Statement *statements) { CError_ASSERT(234, stIsSetup); -#ifdef CW_PATCH_DEBUG +#ifdef CW_ENABLE_IRO_DEBUG if (copts.debuglisting) IRO_Log = 1; #endif diff --git a/compiler_and_linker/unsorted/IroDump.c b/compiler_and_linker/unsorted/IroDump.c index c59aa7b..38412ea 100644 --- a/compiler_and_linker/unsorted/IroDump.c +++ b/compiler_and_linker/unsorted/IroDump.c @@ -295,7 +295,7 @@ void IRO_DumpBits(char *name, BitVector *bv) { } void IRO_DumpAfterPhase(char *str, Boolean flag) { -#ifdef CW_PATCH_DEBUG +#ifdef CW_ENABLE_IRO_DEBUG if (copts.debuglisting) flag = 1; #endif @@ -445,7 +445,7 @@ void IRO_DumpExprs(void) { } void IRO_SetupDump(void) { -#ifdef CW_PATCH_DEBUG +#ifdef CW_ENABLE_IRO_DEBUG IRO_Log = 1; #endif diff --git a/compiler_and_linker/unsorted/ObjGenMachO.c b/compiler_and_linker/unsorted/ObjGenMachO.c index 10ce456..244a1bc 100644 --- a/compiler_and_linker/unsorted/ObjGenMachO.c +++ b/compiler_and_linker/unsorted/ObjGenMachO.c @@ -16,6 +16,10 @@ #include "compiler/objects.h" #include "cos.h" +#ifndef CW_TARGET_MACH +#error "Wrong configuration for ObjGenMachO" +#endif + #ifdef __MWERKS__ #pragma options align=mac68k #endif @@ -1290,7 +1294,7 @@ MachOSection *ObjGen_DeclareFunction(Object *object) { return section; } -MachOSection *ObjGen_DeclareCode(Object *object) { +MachOSection *ObjGen_DeclareCode(Object *object, SInt32 size) { MachOSection *section; section = ObjGen_DeclareFunction(object); diff --git a/compiler_and_linker/unsorted/Operands.c b/compiler_and_linker/unsorted/Operands.c index 2b717e9..e61d5b0 100644 --- a/compiler_and_linker/unsorted/Operands.c +++ b/compiler_and_linker/unsorted/Operands.c @@ -26,7 +26,7 @@ void load_immediate(short reg, SInt32 value) { if (copts.optimizationlevel > 1 && value) tmpreg = used_virtual_registers[RegClass_GPR]++; emitpcode(PC_LIS, tmpreg2 = tmpreg, 0, (short) HIGH_PART(value)); - if (value) + if (LOW_PART(value)) emitpcode(PC_ADDI, reg, tmpreg2, 0, LOW_PART(value)); } else { emitpcode(PC_LI, reg, value); @@ -263,7 +263,7 @@ void combine(Operand *opA, Operand *opB, short output_reg, Operand *opOut) { emitpcode(PC_ADDI, opOut->regOffset, opB->regOffset, 0, LOW_PART(opA->immediate)); } else { emitpcode(PC_ADDIS, opOut->regOffset, opB->regOffset, 0, (short) HIGH_PART(opA->immediate)); - if (opA->immediate != 0) + if (LOW_PART(opA->immediate)) emitpcode(PC_ADDI, opOut->regOffset, opOut->regOffset, 0, LOW_PART(opA->immediate)); } break; @@ -384,7 +384,7 @@ void Coerce_to_register(Operand *op, Type *type, short output_reg) { if (copts.optimizationlevel > 1 && offset) tmp = used_virtual_registers[RegClass_GPR]++; emitpcode(PC_LIS, tmp, 0, (short) HIGH_PART(offset)); - if (offset) + if (LOW_PART(offset)) emitpcode(PC_ADDI, reg, tmp, 0, LOW_PART(offset)); } break; @@ -533,7 +533,7 @@ void coerce_to_register_pair(Operand *op, Type *type, short output_reg, short ou if (copts.optimizationlevel > 1 && offset) tmp1 = used_virtual_registers[RegClass_GPR]++; emitpcode(PC_LIS, tmp1, 0, (short) HIGH_PART(offset)); - if (offset) + if (LOW_PART(offset)) emitpcode(PC_ADDI, reg, tmp1, 0, LOW_PART(offset)); } regHi = output_regHi ? output_regHi : used_virtual_registers[RegClass_GPR]++; diff --git a/compiler_and_linker/unsorted/PCodeAssembly.c b/compiler_and_linker/unsorted/PCodeAssembly.c index cd3f376..58a3d51 100644 --- a/compiler_and_linker/unsorted/PCodeAssembly.c +++ b/compiler_and_linker/unsorted/PCodeAssembly.c @@ -1540,7 +1540,7 @@ SInt32 assemblefunction(Object *func, EntryPoint *entrypoints) { SInt32 codesize; SInt32 tbsize; SInt32 offset; - MachOSection *section; + SectionHandle section; EntryPoint *ep; WeirdOperand wop; @@ -1567,7 +1567,7 @@ SInt32 assemblefunction(Object *func, EntryPoint *entrypoints) { func->section = SECT_TEXT; offset = tbsize; - section = ObjGen_DeclareCode(func); + section = ObjGen_DeclareCode(func, codesize + tbsize); gl = ObjGen_GetSectionGList(section); codebase = gl->size; diff --git a/compiler_and_linker/unsorted/PCodeListing.c b/compiler_and_linker/unsorted/PCodeListing.c index 485d52d..7a9fa13 100644 --- a/compiler_and_linker/unsorted/PCodeListing.c +++ b/compiler_and_linker/unsorted/PCodeListing.c @@ -150,7 +150,7 @@ void pcinitlisting() { } void pccleanuplisting(void) { -#ifdef CW_PATCH_DEBUG +#ifdef CW_ENABLE_PCODE_DEBUG // this code is not based on the original as we don't have it if (pcfile) { fclose(pcfile); @@ -160,7 +160,7 @@ void pccleanuplisting(void) { } void pclistblocks(char *name1, char *name2) { -#ifdef CW_PATCH_DEBUG +#ifdef CW_ENABLE_PCODE_DEBUG // this code is not based on the original as we don't have it PCodeBlock *block; if (copts.debuglisting) { diff --git a/compiler_and_linker/unsorted/uDump.c b/compiler_and_linker/unsorted/uDump.c index 58bc589..e7ed2d2 100644 --- a/compiler_and_linker/unsorted/uDump.c +++ b/compiler_and_linker/unsorted/uDump.c @@ -68,7 +68,7 @@ void SetupDumpIR(void) { } void CleanupDumpIR(void) { -#ifdef CW_PATCH_DEBUG +#ifdef CW_ENABLE_PCODE_DEBUG // this code is not based on the original as we don't have it if (outfile) { fclose(outfile); @@ -78,7 +78,7 @@ void CleanupDumpIR(void) { } void DumpIR(Statement *statements, Object *func) { -#ifdef CW_PATCH_DEBUG +#ifdef CW_ENABLE_PCODE_DEBUG // this code is not based on the original as we don't have it if (copts.debuglisting) { if (!outfile) diff --git a/includes/cmdline.h b/includes/cmdline.h index cfa6c3d..d25e70b 100644 --- a/includes/cmdline.h +++ b/includes/cmdline.h @@ -773,7 +773,7 @@ extern void FreeIncludeFile(Handle text); /* CLLicenses.c */ extern void License_Initialize(void); extern void License_Terminate(void); -extern SInt32 License_Checkout(/* unknown args */); +extern SInt32 License_Checkout(const char *featureName, const char *licenseVersion, Boolean flag, char *errorBuf); extern void License_Refresh(/* unknown args */); extern void License_Checkin(/* unknown args */); extern void License_AutoCheckin(void); diff --git a/includes/common.h b/includes/common.h index baedfe9..1b0ce22 100644 --- a/includes/common.h +++ b/includes/common.h @@ -19,13 +19,16 @@ #undef toupper #undef tolower +#ifdef CW_CLT // What the fuck is this haha // typedef char * va_list; #define va_start(a,b) (a = ((va_list) __builtin_next_arg(b))) #define va_arg(a,b) (*(b *) (void *) ((a = (char *) (((((unsigned long)(a)) + ((__alignof__ (b) == 16) ? 15 : 3)) & ~((__alignof__ (b) == 16) ? 15 : 3)) + ((sizeof (b) + 3) & ~3))) - ((sizeof (b) + 3) & ~3))) #define va_end(a) ((void)0) - #define alloca(x) __alloca(x) +#else +#include <stdarg.h> +#endif #define CW_INLINE inline @@ -168,7 +171,11 @@ enum { typedef struct FSSpec { SInt16 vRefNum; SInt32 parID; +#ifdef CW_CLT Str255 name; +#else + Str63 name; +#endif } FSSpec; typedef struct FInfo { diff --git a/includes/compiler/CParser.h b/includes/compiler/CParser.h index 65d046a..6b95561 100644 --- a/includes/compiler/CParser.h +++ b/includes/compiler/CParser.h @@ -342,7 +342,7 @@ extern SInt32 CParser_GetUniqueID(void); extern void CParser_PrintUniqueID(char *buf); extern void CParser_SetUniqueID(SInt32 id); extern HashNameNode *CParser_GetUniqueName(void); -extern HashNameNode *CParser_NameConcat(char *a, char *b); +extern HashNameNode *CParser_NameConcat(const char *a, const char *b); extern HashNameNode *CParser_AppendUniqueName(char *prefix); extern HashNameNode *CParser_AppendUniqueNameFile(char *prefix); extern Boolean IsTempName(HashNameNode *name); diff --git a/includes/compiler/ObjGenMachO.h b/includes/compiler/ObjGenMachO.h index edc4944..4088a7f 100644 --- a/includes/compiler/ObjGenMachO.h +++ b/includes/compiler/ObjGenMachO.h @@ -2,7 +2,14 @@ #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, @@ -16,11 +23,31 @@ typedef enum MWReloc { MW_RELOC_9 = 9 } MWReloc; -extern Boolean declare_readonly; -extern SInt32 symdeclend; extern SInt32 symdecloffset; -// this conflicts with other files -//extern SInt32 nexttypeid; +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]; @@ -30,26 +57,13 @@ extern SInt32 pic_base_offset; extern SInt32 ObjGen_MakeSectReloc(MachOSection *section); extern SInt32 ObjGen_GetHashNodeRelocID(Object *object, MachOSection *section, SInt32 value); -extern void ObjGen_Setup(void); extern void ObjGen_DeclareFloatConst(Object *object); extern void ObjGen_DeclareVectorConst(Object *object); -extern void ObjGen_Finish(void); -extern void ObjGen_Cleanup(void); -extern void ObjGen_SetupSym(void); -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_SegmentName(void); -extern void ObjGen_SymFunc(Object *function); extern void ObjGenMach_SymFuncEnd(Object *function, UInt32 offset); extern void ObjGen_CodeSetup(void); -extern void ObjGen_CodeCleanup(void); -extern void ObjGen_SrcBreakName(HashNameNode *name, SInt32 fileModDate, Boolean flag); -extern GList *ObjGen_GetSectionGList(MachOSection *section); extern MachOSection *ObjGen_DeclareFunction(Object *object); -extern MachOSection *ObjGen_DeclareCode(Object *object); extern MachOSection *ObjGen_DeclareMachSection(/* unknown args */); extern void ObjGen_Relocate(MachOSection *section, SInt32 offset, SInt32 relocID, RelocType relocType, MWReloc mwRelType); -extern void ObjGen_RelocateObj(MachOSection *section, SInt32 offset, Object *object, 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); @@ -59,17 +73,12 @@ 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_DeclareEntry(Object *object, SInt32 offset); -extern void ObjGen_DeclareExceptionTables(Object *object, SInt32 codesize, char *data, SInt32 len, OLinkList *refs); extern void ObjGen_DeclareCodeLabel(Object *labelobj, SInt32 offset, Object *funcobj); -extern void ObjGen_DeclareSwitchTable(Object *tableobj, Object *funcobj); -extern void ObjGen_DeclareTracebackTable(Object *tableobj, void *data, SInt32 size); -extern void ObjGen_DeclareSymInfo(void); -extern void ObjGen_Line(UInt32 line, UInt32 offset); 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 diff --git a/includes/plugin.h b/includes/plugin.h index 6fad976..01b0c9a 100644 --- a/includes/plugin.h +++ b/includes/plugin.h @@ -270,7 +270,7 @@ extern CWResult UCBCacheAccessPathList(CWPluginContext context); extern CWResult UCBSecretAttachHandle(CWPluginContext context, Handle handle, CWMemHandle *memHandle); extern CWResult UCBSecretDetachHandle(CWPluginContext context, CWMemHandle memHandle, Handle *handle); extern CWResult UCBSecretPeekHandle(CWPluginContext context, CWMemHandle memHandle, Handle *handle); -extern CWResult UCBCheckoutLicense(CWPluginContext context, const char *a, const char *b, SInt32 c, void *d, SInt32 *cookiePtr); +extern CWResult UCBCheckoutLicense(CWPluginContext context, const char *featureName, const char *licenseVersion, SInt32 flags, void *reserved, SInt32 *cookie); extern CWResult UCBCheckinLicense(CWPluginContext context, SInt32 cookie); extern CWResult UCBResolveRelativePath(CWPluginContext context, const CWRelativePath *relativePath, CWFileSpec *fileSpec, Boolean create); extern CWResult UCBMacOSErrToCWResult(CWPluginContext context, OSErr err); @@ -1,18 +1,13 @@ OS X: -~/bin/mwccppc -c -g -opt l=4,noschedule,speed -enum min -Iincludes -Isdk_hdrs -w all,nounused -wchar_t on -bool off -Cpp_exceptions off +~/bin/mwccppc -c -g -DCW_TARGET_MACH -DCW_CLT -opt l=4,noschedule,speed -enum min -Iincludes -Isdk_hdrs -w all,nounused -wchar_t on -bool off -Cpp_exceptions off -OS 9: +OS 9 wine setup (does not match): export MWCIncludes="/Users/ash/src/mwcc/native_copy/msl_c_pro7/MSL_Common/Include;/Users/ash/src/mwcc/native_copy/msl_c_pro7/MSL_MacOS/Include" -wine ../reversing/v7_0_mwcppc.exe -g -opt l=4,speed -enum min -Iincludes -Isdk_hdrs -w all,nounused,notinlined -wchar_t on -bool off -Cpp_exceptions off -maxwarnings 10 +wine ../reversing/v7_0_mwcppc.exe -g -DCW_TARGET_MACH -opt l=4,speed -enum min -Iincludes -Isdk_hdrs -w all,nounused,notinlined -wchar_t on -bool off -Cpp_exceptions off -maxwarnings 10 -TODO: -- locate COS stuff based off EPPC 8 debug info - - command_line/C++_Parser/Src/Library/OptimizerHelpers.c - - compiler_and_linker/CmdLine_Tools/Embedded_PPC/Tools_EPPC/Src/Options/Glue/TargetOptimizerHelpers-eppc.c - - compiler_and_linker/FrontEnd/Common/COSToolsMemory.h - - compiler_and_linker/FrontEnd/Common/COSToolsFileSpecs.h - - compiler_and_linker/FrontEnd/Common/COSToolsWin32.c -also worth checking ~/s/mwcc/reversing/ftp_backup/Metrowerks/CWPPC6/ext_65/Disk1/PPC_EABI_Tools-CLT/mwcceppc.exe strings +OS 9 mpw-emu setup: +export MWCIncludes=":msl_c_pro7:MSL_Common:Include,:msl_c_pro7:MSL_MacOS:Include" +mpw-emu mwcppc_v7 -g -DCW_TARGET_MACH -opt l=4,speed,nopeephole,noschedule -enum min -convertpaths -Iincludes -Isdk_hdrs -w all,nounused,notinlined -wchar_t on -bool off -Cpp_exceptions off -maxwarnings 10 * - has issues |