Files
af/tools/set_o32abi_bit.py
Derek Hensley 33ec543467 Libultra OK (#20)
* Identify last 2 libultra files

* BSS left

* Update not built files

* libultra OK

* Makefile formating

* Identify last couple data files

* libultra section headers

* Paddings

* Fix one padding

* move non_shared to CLFAGS and ASFLAGS

* git subrepo pull --force lib/ultralib

subrepo:
  subdir:   "lib/ultralib"
  merged:   "b376559"
upstream:
  origin:   "git@github.com:decompals/ultralib.git"
  branch:   "main"
  commit:   "b376559"
git-subrepo:
  version:  "0.4.6"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "110b9eb"

* Remove duplicate -non_shared

* .hasm

* Jenkins

* GBIDEFINE
2023-07-31 20:42:21 -04:00

28 lines
713 B
Python
Executable File

#!/usr/bin/env python3
import argparse, struct, sys
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('file', help='input file')
args = parser.parse_args()
with open(args.file, 'r+b') as f:
magic = struct.unpack('>I', f.read(4))[0]
if magic != 0x7F454C46:
print('Error: Not an ELF file')
sys.exit(1)
f.seek(36)
flags = struct.unpack('>I', f.read(4))[0]
if flags & 0xF0000000 != 0x20000000: # test for mips3
print('Error: Architecture not mips3')
sys.exit(1)
flags |= 0x00001000 # set EF_MIPS_ABI_O32
f.seek(36)
f.write(struct.pack('>I', flags))