summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGriffinR <griffin.g.richards@gmail.com>2021-05-05 20:06:15 -0400
committerGitHub <noreply@github.com>2021-05-05 20:06:15 -0400
commitde3b32f76b10e9a738303945de4abab741e56505 (patch)
tree1538c9e049a3910627e5ed6a79271c1188e9580a
parent7b3a1498d610fed7472bf000f7b891e2ac050759 (diff)
parent783a167b76bef461f47d425ecc11c0b9fda30c77 (diff)
Merge pull request #1407 from ipatix/fix/modern
Fix modern target when libc functions are used.
-rw-r--r--Makefile6
-rw-r--r--ld_script_modern.txt23
2 files changed, 12 insertions, 17 deletions
diff --git a/Makefile b/Makefile
index d97634399..3cbd7f3f8 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 b69ada864..59d032bb2 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