diff options
author | Ash Wolf <ninji@wuffs.org> | 2023-01-13 01:38:15 +0000 |
---|---|---|
committer | Ash Wolf <ninji@wuffs.org> | 2023-01-13 01:38:15 +0000 |
commit | 08d21a052b9afc37292ec3fad390502610e2cb32 (patch) | |
tree | 270737c790f5d1bb05f68498f8233640ada6a0c5 /compiler_and_linker/unsorted/ObjGenMachO.c | |
parent | 54628993e0038c7bea9c064491974985b6699502 (diff) | |
parent | 9d985413ce2b60a1a8cf001913ee8dac81c03aac (diff) | |
download | MWCC-08d21a052b9afc37292ec3fad390502610e2cb32.tar.gz MWCC-08d21a052b9afc37292ec3fad390502610e2cb32.zip |
Merge remote-tracking branch 'origin/main'
Diffstat (limited to 'compiler_and_linker/unsorted/ObjGenMachO.c')
-rw-r--r-- | compiler_and_linker/unsorted/ObjGenMachO.c | 16 |
1 files changed, 11 insertions, 5 deletions
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 { |