From 294b656af15219fad4fb0276dbfffc8eb8f85b11 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Tue, 28 Apr 2026 12:15:20 +0200 Subject: [PATCH] Fix ARM compilation on Debian Forky & the new picolibc replacing newlib. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Debian Forky's gcc-arm-none-eabi uses picolibc as the default C library, replacing the old newlib-nano. Picolibc registers itself with GCC via a .specs file. That specs file automatically injects its own picolibc.ld into every link step — unless GCC sees a user-supplied -T flag at the GCC driver level. https://github.com/picolibc/picolibc/blob/main/doc/linking.md --- armsrc/Makefile | 3 ++- bootrom/Makefile | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/armsrc/Makefile b/armsrc/Makefile index 94f823cd8..6df152e80 100644 --- a/armsrc/Makefile +++ b/armsrc/Makefile @@ -214,7 +214,8 @@ $(FPGA_COMPRESSOR): $(OBJDIR)/fullimage.stage1.elf: $(VERSIONOBJ) $(OBJDIR)/fpga_all.o $(THUMBOBJ) $(ARMOBJ) $(info [=] LD $@) - $(Q)$(CROSS_LD) $(CROSS_LDFLAGS) -Wl,-T,ldscript,-Map,$(patsubst %.elf,%.map,$@) -o $@ $^ $(LIBS) +# Using -T instead of -Wl,-T is needed to prevent the linker from using the default ldscript when using picolibc instead of newlib + $(Q)$(CROSS_LD) $(CROSS_LDFLAGS) -T ldscript -Wl,-Map,$(patsubst %.elf,%.map,$@) -o $@ $^ $(LIBS) $(OBJDIR)/fullimage.data.bin: $(OBJDIR)/fullimage.stage1.elf $(info [-] GEN $@) diff --git a/bootrom/Makefile b/bootrom/Makefile index b6825530d..d261bc090 100644 --- a/bootrom/Makefile +++ b/bootrom/Makefile @@ -69,7 +69,8 @@ tarbin: $(OBJS) $(OBJDIR)/bootrom.elf: $(VERSIONOBJ) $(ASMOBJ) $(ARMOBJ) $(THUMBOBJ) $(info [=] LD $@) - $(Q)$(CROSS_LD) $(CROSS_LDFLAGS) -Wl,-T,ldscript-flash,-Map,$(patsubst %.elf,%.map,$@) -o $@ $^ $(LIBS) +# Using -T instead of -Wl,-T is needed to prevent the linker from using the default ldscript when using picolibc instead of newlib + $(Q)$(CROSS_LD) $(CROSS_LDFLAGS) -T ldscript-flash -Wl,-Map,$(patsubst %.elf,%.map,$@) -o $@ $^ $(LIBS) clean: $(Q)$(RM) $(OBJDIR)$(PATHSEP)*.o