From 736c3780f1bbb3c52f4215c53c3484a4a75cd553 Mon Sep 17 00:00:00 2001 From: Dominik Riebeling Date: Sat, 4 May 2013 22:16:08 +0200 Subject: Change the order of global linker options and -T. 95e23de made -Wl,--gc-sections appear after -T by combining it with the global linker options. Moving the global linker options in front of -T seems to fix the crash observed on mini2g after that change -- as it seems the linker behaves differently if --gc-sections is passed after -T. Fixes FS#12857. Change-Id: Id64dc6b91726760d75a1a0cd85bb7c06208d2f45 --- tools/root.make | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/root.make b/tools/root.make index 6d62359..9e8513b 100644 --- a/tools/root.make +++ b/tools/root.make @@ -214,21 +214,23 @@ $(LINKROM): $(ROMLDS) $(call PRINTS,PP $(@F)) $(call preprocess2file,$<,$@,-DLOADADDRESS=$(LOADADDRESS)) +# Note: make sure -Wl,--gc-sections comes before -T in the linker options. +# Having the latter first caused crashes on (at least) mini2g. $(BUILDDIR)/rockbox.elf : $$(OBJ) $(FIRMLIB) $(VOICESPEEXLIB) $(CORE_LIBS) $$(LINKRAM) $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -nostdlib -o $@ $(OBJ) \ -L$(BUILDDIR)/firmware -lfirmware \ -L$(RBCODEC_BLD)/codecs $(call a2lnk, $(VOICESPEEXLIB)) \ -L$(BUILDDIR)/lib $(call a2lnk, $(CORE_LIBS)) \ - -lgcc -T$(LINKRAM) \ - $(CORE_LDOPTS) -Wl,-Map,$(BUILDDIR)/rockbox.map + -lgcc $(CORE_LDOPTS) -T$(LINKRAM) \ + -Wl,-Map,$(BUILDDIR)/rockbox.map $(BUILDDIR)/rombox.elf : $$(OBJ) $(FIRMLIB) $(VOICESPEEXLIB) $(CORE_LIBS) $$(LINKROM) $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -nostdlib -o $@ $(OBJ) \ -L$(BUILDDIR)/firmware -lfirmware \ -L$(RBCODEC_BLD)/codecs $(call a2lnk, $(VOICESPEEXLIB)) \ -L$(BUILDDIR)/lib $(call a2lnk, $(CORE_LIBS)) \ - -lgcc -T$(LINKROM) \ - $(CORE_LDOPTS) -Wl,-Map,$(BUILDDIR)/rombox.map + -lgcc $(CORE_LDOPTS) -T$(LINKROM) \ + -Wl,-Map,$(BUILDDIR)/rombox.map $(BUILDDIR)/rockbox.bin : $(BUILDDIR)/rockbox.elf $(call PRINTS,OC $(@F))$(call objcopy,$<,$@) -- cgit v1.1