mirror of
https://github.com/zeldaret/oot.git
synced 2025-02-27 03:24:45 +00:00
Set __FILE__ in asm_processor (#793)
* Set __FILE__ in asm_processor * bss fix * Update to upstream version Co-authored-by: zelda2774 <zelda2774@invalid>
This commit is contained in:
parent
e11e8b709d
commit
4e81e4a388
3 changed files with 10 additions and 5 deletions
|
@ -2254,7 +2254,6 @@ void CollisionCheck_AC_CylVsQuad(GlobalContext* globalCtx, CollisionCheckContext
|
||||||
|
|
||||||
static s8 sBssDummy0;
|
static s8 sBssDummy0;
|
||||||
static s8 sBssDummy1;
|
static s8 sBssDummy1;
|
||||||
static s8 sBssDummy2;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AC overlap check. Calculates the center of each collider element and the point of contact.
|
* AC overlap check. Calculates the center of each collider element and the point of contact.
|
||||||
|
|
|
@ -3012,11 +3012,10 @@ s16 D_80125B5C[] = { 91, 91 }; // unused
|
||||||
|
|
||||||
// Due to an unknown reason, bss ordering changes within the 5 static variables in the function below.
|
// Due to an unknown reason, bss ordering changes within the 5 static variables in the function below.
|
||||||
// In order to restore the correct order, we need a specific number of bss variables in the file before that point.
|
// In order to restore the correct order, we need a specific number of bss variables in the file before that point.
|
||||||
// For this, we introduce 3 dummy variables which end up in padding at the end of the file's bss, so they don't actually
|
// For this, we introduce 2 dummy variables which end up in padding at the end of the file's bss, so they don't actually
|
||||||
// take space.
|
// take space.
|
||||||
s8 sBssDummy1;
|
s8 sBssDummy1;
|
||||||
s8 sBssDummy2;
|
s8 sBssDummy2;
|
||||||
s8 sBssDummy3;
|
|
||||||
|
|
||||||
#ifdef NON_MATCHING
|
#ifdef NON_MATCHING
|
||||||
// mostly regalloc, minor ordering and stack usage differences
|
// mostly regalloc, minor ordering and stack usage differences
|
||||||
|
|
|
@ -755,7 +755,9 @@ def parse_source(f, opt, framepointer, input_enc, output_enc, print_source=None)
|
||||||
|
|
||||||
global_asm = None
|
global_asm = None
|
||||||
asm_functions = []
|
asm_functions = []
|
||||||
output_lines = []
|
output_lines = [
|
||||||
|
'#line 1 "' + f.name + '"'
|
||||||
|
]
|
||||||
|
|
||||||
is_cutscene_data = False
|
is_cutscene_data = False
|
||||||
|
|
||||||
|
@ -800,8 +802,8 @@ def parse_source(f, opt, framepointer, input_enc, output_enc, print_source=None)
|
||||||
include_src = StringIO()
|
include_src = StringIO()
|
||||||
with open(fpath + os.path.sep + fname, encoding=input_enc) as include_file:
|
with open(fpath + os.path.sep + fname, encoding=input_enc) as include_file:
|
||||||
parse_source(include_file, opt, framepointer, input_enc, output_enc, include_src)
|
parse_source(include_file, opt, framepointer, input_enc, output_enc, include_src)
|
||||||
|
include_src.write('#line ' + str(line_no + 1) + ' "' + f.name + '"')
|
||||||
output_lines[-1] = include_src.getvalue()
|
output_lines[-1] = include_src.getvalue()
|
||||||
include_src.write('#line ' + str(line_no) + '\n')
|
|
||||||
include_src.close()
|
include_src.close()
|
||||||
else:
|
else:
|
||||||
# This is a hack to replace all floating-point numbers in an array of a particular type
|
# This is a hack to replace all floating-point numbers in an array of a particular type
|
||||||
|
@ -856,6 +858,7 @@ def fixup_objfile(objfile_name, functions, asm_prelude, assembler, output_enc):
|
||||||
# simplicity we pad with nops/.space so that addresses match exactly, so we
|
# simplicity we pad with nops/.space so that addresses match exactly, so we
|
||||||
# don't have to fix up relocations/symbol references.
|
# don't have to fix up relocations/symbol references.
|
||||||
all_text_glabels = set()
|
all_text_glabels = set()
|
||||||
|
func_sizes = {}
|
||||||
for function in functions:
|
for function in functions:
|
||||||
ifdefed = False
|
ifdefed = False
|
||||||
for sectype, (temp_name, size) in function.data.items():
|
for sectype, (temp_name, size) in function.data.items():
|
||||||
|
@ -878,6 +881,8 @@ def fixup_objfile(objfile_name, functions, asm_prelude, assembler, output_enc):
|
||||||
else:
|
else:
|
||||||
asm.append('.space {}'.format(loc - prev_loc))
|
asm.append('.space {}'.format(loc - prev_loc))
|
||||||
to_copy[sectype].append((loc, size, temp_name, function.fn_desc))
|
to_copy[sectype].append((loc, size, temp_name, function.fn_desc))
|
||||||
|
if function.text_glabels:
|
||||||
|
func_sizes[function.text_glabels[0]] = size
|
||||||
prev_locs[sectype] = loc + size
|
prev_locs[sectype] = loc + size
|
||||||
if not ifdefed:
|
if not ifdefed:
|
||||||
all_text_glabels.update(function.text_glabels)
|
all_text_glabels.update(function.text_glabels)
|
||||||
|
@ -1041,6 +1046,8 @@ def fixup_objfile(objfile_name, functions, asm_prelude, assembler, output_enc):
|
||||||
# glabel's aren't marked as functions, making objdump output confusing. Fix that.
|
# glabel's aren't marked as functions, making objdump output confusing. Fix that.
|
||||||
if s.name in all_text_glabels:
|
if s.name in all_text_glabels:
|
||||||
s.type = STT_FUNC
|
s.type = STT_FUNC
|
||||||
|
if s.name in func_sizes:
|
||||||
|
s.st_size = func_sizes[s.name]
|
||||||
if objfile.sections[s.st_shndx].name == '.rodata' and s.st_value in moved_late_rodata:
|
if objfile.sections[s.st_shndx].name == '.rodata' and s.st_value in moved_late_rodata:
|
||||||
s.st_value = moved_late_rodata[s.st_value]
|
s.st_value = moved_late_rodata[s.st_value]
|
||||||
s.st_name += strtab_adj
|
s.st_name += strtab_adj
|
||||||
|
|
Loading…
Add table
Reference in a new issue