From 9d985413ce2b60a1a8cf001913ee8dac81c03aac Mon Sep 17 00:00:00 2001 From: Ash Wolf Date: Fri, 13 Jan 2023 01:36:56 +0000 Subject: fix lots more issues, add endian conversions to ObjGenMachO, add 64-bit kludge to Switch.c --- compiler_and_linker/unsorted/ObjGenMachO.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'compiler_and_linker/unsorted/ObjGenMachO.c') diff --git a/compiler_and_linker/unsorted/ObjGenMachO.c b/compiler_and_linker/unsorted/ObjGenMachO.c index 0a2c843..dfa77b8 100644 --- a/compiler_and_linker/unsorted/ObjGenMachO.c +++ b/compiler_and_linker/unsorted/ObjGenMachO.c @@ -921,7 +921,10 @@ void ObjGen_Finish(void) { if (value) { UInt32 *ptr = (UInt32 *) (*reloc->section->glist.data + reloc->offset); - *ptr = (*ptr & opMask) | (argMask & (value + (*ptr & argMask))); + *ptr = CTool_EndianConvertWord32( + (CTool_EndianConvertWord32(*ptr) & opMask) | + (argMask & (value + (CTool_EndianConvertWord32(*ptr) & argMask))) + ); } } else { switch (reloc->mwRelType) { @@ -969,7 +972,10 @@ void ObjGen_Finish(void) { if (value != 0) { UInt32 *ptr = (UInt32 *) (*reloc->section->glist.data + reloc->offset); - *ptr = (*ptr & opMask) | (argMask & (value + (*ptr & argMask))); + *ptr = CTool_EndianConvertWord32( + (CTool_EndianConvertWord32(*ptr) & opMask) | + (argMask & (value + (CTool_EndianConvertWord32(*ptr) & argMask))) + ); } if (nextRelType == PPC_RELOC_BR24) { @@ -1098,9 +1104,9 @@ static void declaredata(Object *object, char *data, OLinkList *olinklist, UInt32 SInt32 extflag; SInt32 id; - extflag = ObjGen_IsExternalVar(ObjGen_GetHashNodeRelocID(scan->obj, NULL, 0)); - id = CMangler_GetLinkName(scan->obj)->id; - ObjGen_Relocate(Sections[sectionID], offset + scan->offset, extflag + id, RT_4, MW_RELOC_0); + extflag = ObjGen_IsExternalVar(ObjGen_GetHashNodeRelocID(olinklist->obj, NULL, 0)); + id = CMangler_GetLinkName(olinklist->obj)->id; + ObjGen_Relocate(Sections[sectionID], offset + olinklist->offset, extflag + id, RT_4, MW_RELOC_0); olinklist = olinklist->next; } } else { -- cgit v1.2.3