diff --git a/Makefile b/Makefile index d976343994..3cbd7f3f80 100644 --- a/Makefile +++ b/Makefile @@ -67,12 +67,14 @@ override CFLAGS += -mthumb-interwork -Wimplicit -Wparentheses -Werror -O2 -fhex- ROM := pokeemerald.gba OBJ_DIR := build/emerald LIBPATH := -L ../../tools/agbcc/lib +LIB := $(LIBPATH) -lgcc -lc -L../../libagbsyscall -lagbsyscall else CC1 = $(shell $(CC) --print-prog-name=cc1) -quiet override CFLAGS += -mthumb -mthumb-interwork -O2 -mabi=apcs-gnu -mtune=arm7tdmi -march=armv4t -fno-toplevel-reorder -Wno-pointer-to-int-cast -g ROM := pokeemerald_modern.gba OBJ_DIR := build/modern -LIBPATH := -L "$(dir $(shell $(CC) -mthumb -print-file-name=libgcc.a))" -L "$(dir $(shell $(CC) -mthumb -print-file-name=libc.a))" +LIBPATH := -L "$(dir $(shell $(CC) -mthumb -print-file-name=libgcc.a))" -L "$(dir $(shell $(CC) -mthumb -print-file-name=libnosys.a))" -L "$(dir $(shell $(CC) -mthumb -print-file-name=libc.a))" +LIB := $(LIBPATH) -lc -lnosys -lgcc -L../../libagbsyscall -lagbsyscall endif CPPFLAGS := -iquote include -iquote $(GFLIB_SUBDIR) -Wno-trigraphs -DMODERN=$(MODERN) @@ -82,8 +84,6 @@ endif LDFLAGS = -Map ../../$(MAP) -LIB := $(LIBPATH) -lgcc -lc -L../../libagbsyscall -lagbsyscall - SHA1 := $(shell { command -v sha1sum || command -v shasum; } 2>/dev/null) -c GFX := tools/gbagfx/gbagfx$(EXE) AIF := tools/aif2pcm/aif2pcm$(EXE) diff --git a/ld_script_modern.txt b/ld_script_modern.txt index b69ada8649..59d032bb25 100644 --- a/ld_script_modern.txt +++ b/ld_script_modern.txt @@ -27,6 +27,8 @@ SECTIONS { /* .bss starts at 0x3000000 */ src/*.o(.bss); gflib/*.o(.bss); + *libc.a:*.o(.bss*); + *libnosys.a:*.o(.bss*); /* .bss.code starts at 0x3001AA8 */ src/m4a.o(.bss.code); @@ -34,7 +36,8 @@ SECTIONS { /* COMMON starts at 0x30022A8 */ src/*.o(COMMON); gflib/*.o(COMMON); - *libc.a:sbrkr.o(COMMON); + *libc.a:*.o(COMMON); + *libnosys.a:*.o(COMMON); end = .; . = 0x8000; } @@ -44,19 +47,10 @@ SECTIONS { .text : ALIGN(4) { - src/crt0.o(.text); - src/*.o(.text); - gflib/*.o(.text); - asm/*.o(.text); - } =0 - - .text.unlikely : - ALIGN(4) - { - src/crt0.o(.text.unlikely); - src/*.o(.text.unlikely); - gflib/*.o(.text.unlikely); - asm/*.o(.text.unlikely); + src/crt0.o(.text*); + src/*.o(.text*); + gflib/*.o(.text*); + asm/*.o(.text*); } =0 script_data : @@ -82,6 +76,7 @@ SECTIONS { *libagbsyscall.a:*.o(.text*); *libgcc.a:*.o(.text*); *libc.a:*.o(.text*); + *libnosys.a:*.o(.text*); src/libisagbprn.o(.text); } =0