summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2013-05-04 22:16:08 +0200
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2013-05-04 22:25:24 +0200
commit736c3780f1bbb3c52f4215c53c3484a4a75cd553 (patch)
tree6f3d99aaee715bc8fb6332554a5d2d6df78d2942
parent8a1cd81b3a0275c0353767bdd2042b3a62decff9 (diff)
downloadrockbox-736c3780f1bbb3c52f4215c53c3484a4a75cd553.tar.gz
rockbox-736c3780f1bbb3c52f4215c53c3484a4a75cd553.zip
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
-rw-r--r--tools/root.make10
1 files changed, 6 insertions, 4 deletions
diff --git a/tools/root.make b/tools/root.make
index 6d623595fa..9e8513ba48 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,$<,$@)