summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcadmic <cadmic24@gmail.com>2024-08-25 07:43:07 -0700
committerGitHub <noreply@github.com>2024-08-25 16:43:07 +0200
commit7c2e0383f32683807e1ffb6d7d019cf50e7967d2 (patch)
treedb4e3a7579dddb10d6e16737be4b5c45a2c26f1e
parent7056423e5b47775da6955b2a8a3e6e10fd5c7be8 (diff)
In fix_bss.py, really always use BSS section start from map file (#2085)
-rw-r--r--src/audio/data.c2
-rw-r--r--src/audio/session_config.c1
-rwxr-xr-xtools/fix_bss.py15
3 files changed, 11 insertions, 7 deletions
diff --git a/src/audio/data.c b/src/audio/data.c
index 1c84d5e70..41d4f7522 100644
--- a/src/audio/data.c
+++ b/src/audio/data.c
@@ -69,3 +69,5 @@ u8 gSoundModeList[] = {
u8 gAudioSpecId = 0;
u8 D_80133418 = 0;
+
+u8 D_8016F0E0[0xA0]; // unused
diff --git a/src/audio/session_config.c b/src/audio/session_config.c
index 2178a12e8..c8966ad95 100644
--- a/src/audio/session_config.c
+++ b/src/audio/session_config.c
@@ -1,6 +1,5 @@
#include "global.h"
-u8 D_8016F0E0[0xA0]; // unused
AudioContext gAudioCtx;
AudioCustomUpdateFunction gAudioCustomUpdateFunction;
s32 D_801755D8[3]; // unused
diff --git a/tools/fix_bss.py b/tools/fix_bss.py
index 9b999d072..f36f79e3b 100755
--- a/tools/fix_bss.py
+++ b/tools/fix_bss.py
@@ -401,9 +401,6 @@ def determine_base_bss_ordering(
build_bss_symbols: list[BssSymbol],
bss_section: BssSection,
) -> list[BssSymbol]:
- # For the baserom, assume that the lowest address is the start of the BSS section. This might
- # not be true if the first BSS variable is not referenced, but in practice this doesn't seem
- # to happen for the files which typically have BSS ordering issues.
base_start_address = min(p.base_value for p in bss_section.pointers)
found_symbols: dict[str, BssSymbol] = {}
@@ -775,10 +772,16 @@ def main():
for file, bss_section in bss_sections.items():
if not bss_section.pointers:
continue
- # Try to detect if the section is shifted by comparing the lowest
- # address among any pointer into the section between base and build
+ # The following heuristic doesn't work for z_locale, since the first pointer into BSS is not
+ # at the start of the section. Fortunately z_locale either has one BSS variable (in GC versions)
+ # or none (in N64 versions), so we can just skip it.
+ if str(file) == "src/boot/z_locale.c":
+ continue
+ # For the baserom, assume that the lowest address is the start of the BSS section. This might
+ # not be true if the first BSS variable is not referenced, but in practice this doesn't happen
+ # (except for z_locale above).
base_min_address = min(p.base_value for p in bss_section.pointers)
- build_min_address = min(p.build_value for p in bss_section.pointers)
+ build_min_address = bss_section.start_address
if not all(
p.build_value - build_min_address == p.base_value - base_min_address
for p in bss_section.pointers