File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -327,6 +327,7 @@ recomp::mods::CodeModLoadError recomp::mods::ModHandle::load_native_library(cons
327327 return api_error;
328328 }
329329
330+ native_library_exports.clear ();
330331 for (const std::string& export_name : lib_manifest.exports ) {
331332 recomp_func_t * cur_func;
332333 if (native_library_exports.contains (export_name)) {
@@ -2097,8 +2098,14 @@ recomp::mods::CodeModLoadError recomp::mods::ModContext::init_mod_code(uint8_t*
20972098 MEM_B (i, (gpr)cur_section_addr) = binary_data[section.rom_addr + i];
20982099 }
20992100 mod.section_load_addresses [section_index] = cur_section_addr;
2100- // Calculate the next section's address based on the size of this section and its bss.
2101- cur_section_addr += section.size + section.bss_size ;
2101+ // Calculate the bss section's address based on the size of this section.
2102+ cur_section_addr += section.size ;
2103+ // Zero the bss section.
2104+ for (size_t i = 0 ; i < section.bss_size ; i++) {
2105+ MEM_B (i, (gpr)cur_section_addr) = 0 ;
2106+ }
2107+ // Calculate the next section's address based on the size of the bss section.
2108+ cur_section_addr += section.bss_size ;
21022109 // Align the next section's address to 16 bytes.
21032110 cur_section_addr = (cur_section_addr + 15 ) & ~15 ;
21042111 // Add some empty space between mods to act as a buffer for misbehaving mods that have out of bounds accesses.
You can’t perform that action at this time.
0 commit comments