diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c index b66aeda0d1..4bc7b5919b 100644 --- a/src/code/z_collision_check.c +++ b/src/code/z_collision_check.c @@ -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. diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 8592708753..d3fc173de8 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -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 diff --git a/tools/asm_processor/asm_processor.py b/tools/asm_processor/asm_processor.py index 9d5e6a749b..89da9a1fc8 100644 --- a/tools/asm_processor/asm_processor.py +++ b/tools/asm_processor/asm_processor.py @@ -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