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
This commit is contained in:
Dominik Riebeling 2013-05-04 22:16:08 +02:00
parent 8a1cd81b3a
commit 736c3780f1

View file

@ -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,$<,$@)