diff --git a/gflib/malloc.c b/gflib/malloc.c index 7229c20e8b..f54c751a4c 100644 --- a/gflib/malloc.c +++ b/gflib/malloc.c @@ -4,7 +4,7 @@ static void *sHeapStart; static u32 sHeapSize; -__attribute__((section("__EWRAM_HEAP"))) u8 gHeap[HEAP_SIZE] = {0}; +EWRAM_DATA u8 gHeap[HEAP_SIZE] = {0}; #define MALLOC_SYSTEM_ID 0xA3A3 diff --git a/gflib/malloc.h b/gflib/malloc.h index 2792ff1cb7..72e1a5e1d3 100644 --- a/gflib/malloc.h +++ b/gflib/malloc.h @@ -10,9 +10,8 @@ #define TRY_FREE_AND_SET_NULL(ptr) if (ptr != NULL) FREE_AND_SET_NULL(ptr) -// 122 KB. Max size of the heap without running into other data #define HEAP_SIZE 0x1C000 -extern u8 gHeap[]; +extern u8 gHeap[HEAP_SIZE]; void *Alloc(u32 size); void *AllocZeroed(u32 size); diff --git a/ld_script.ld b/ld_script.ld index ee0556d5a0..c4abf075f8 100644 --- a/ld_script.ld +++ b/ld_script.ld @@ -7,7 +7,7 @@ MEMORY { EWRAM (rwx) : ORIGIN = 0x2000000, LENGTH = 256K IWRAM (rwx) : ORIGIN = 0x3000000, LENGTH = 32K - ROM (rx) : ORIGIN = 0x8000000, LENGTH = 16M + ROM (rx) : ORIGIN = 0x8000000, LENGTH = 32M } /* Modify the following load addresses as needed to make more room. Alternately, delete both the @@ -21,11 +21,9 @@ SECTIONS { ewram 0x2000000 (NOLOAD) : ALIGN(4) { - *(__EWRAM_HEAP); - INCLUDE "sym_ewram.ld" - src/*.o(ewram_data); /**/ - gflib/*.o(ewram_data); /**/ + src/*.o(ewram_data); + gflib/*.o(ewram_data); *libc.a:impure.o(.data); *libc.a:locale.o(.data); diff --git a/ld_script_modern.ld b/ld_script_modern.ld index 05b2b815ff..4ccbfbaa0f 100644 --- a/ld_script_modern.ld +++ b/ld_script_modern.ld @@ -3,12 +3,11 @@ ENTRY(Start) gNumMusicPlayers = 4; gMaxLines = 0; -/* Memory Spaces */ MEMORY { EWRAM (rwx) : ORIGIN = 0x2000000, LENGTH = 256K IWRAM (rwx) : ORIGIN = 0x3000000, LENGTH = 32K - ROM (rx) : ORIGIN = 0x8000000, LENGTH = 16M + ROM (rx) : ORIGIN = 0x8000000, LENGTH = 32M } SECTIONS { @@ -16,10 +15,8 @@ SECTIONS { ewram 0x2000000 (NOLOAD) : ALIGN(4) { - *(__EWRAM_HEAP); - - src/*.o(ewram_data); /**/ - gflib/*.o(ewram_data); /**/ + src/*.o(ewram_data); + gflib/*.o(ewram_data); } > EWRAM iwram 0x3000000 (NOLOAD) : @@ -31,13 +28,11 @@ SECTIONS { *libc.a:*.o(.bss*); *libnosys.a:*.o(.bss*); - /* .bss.code starts at 0x3001AA8 */ src/m4a.o(.bss.code); - /* COMMON starts at 0x30022A8 */ - src/*.o(COMMON); /**/ - gflib/*.o(COMMON); /**/ - *libc.a:*.o(COMMON); + src/*.o(COMMON); + gflib/*.o(COMMON); + *libc.a:*.o(COMMON); *libnosys.a:*.o(COMMON); } > IWRAM diff --git a/sym_ewram.txt b/sym_ewram.txt index 414b7a3b23..31c507ee9b 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -1,3 +1,4 @@ + .include "gflib/malloc.o" .include "src/decompress.o" .include "src/main.o" .include "gflib/window.o"