1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-28 19:25:27 +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:
zelda2774 2021-04-25 20:37:32 +02:00 committed by GitHub
parent e11e8b709d
commit 4e81e4a388
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 5 deletions

View file

@ -2254,7 +2254,6 @@ void CollisionCheck_AC_CylVsQuad(GlobalContext* globalCtx, CollisionCheckContext
static s8 sBssDummy0;
static s8 sBssDummy1;
static s8 sBssDummy2;
/**
* AC overlap check. Calculates the center of each collider element and the point of contact.

View file

@ -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.
// 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.
s8 sBssDummy1;
s8 sBssDummy2;
s8 sBssDummy3;
#ifdef NON_MATCHING
// mostly regalloc, minor ordering and stack usage differences

View file

@ -755,7 +755,9 @@ def parse_source(f, opt, framepointer, input_enc, output_enc, print_source=None)
global_asm = None
asm_functions = []
output_lines = []
output_lines = [
'#line 1 "' + f.name + '"'
]
is_cutscene_data = False
@ -800,8 +802,8 @@ def parse_source(f, opt, framepointer, input_enc, output_enc, print_source=None)
include_src = StringIO()
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)
include_src.write('#line ' + str(line_no + 1) + ' "' + f.name + '"')
output_lines[-1] = include_src.getvalue()
include_src.write('#line ' + str(line_no) + '\n')
include_src.close()
else:
# 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
# don't have to fix up relocations/symbol references.
all_text_glabels = set()
func_sizes = {}
for function in functions:
ifdefed = False
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:
asm.append('.space {}'.format(loc - prev_loc))
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
if not ifdefed:
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.
if s.name in all_text_glabels:
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:
s.st_value = moved_late_rodata[s.st_value]
s.st_name += strtab_adj