mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
cpu/msp430_common: Fix linking with binutils 2.40
An `INSERT AFTER` directive no longer can refer to a different linker script included with `-T path/to/script.ld`. Instead, this adds wrapper linker scripts that just `INCLUDE` the three individual linker scripts. This way, the xfa.ld can safely refer back to sections defined in the vendor linker script. For some reason, this approach cause the exact issue it fixes for binutils 2.40 with the binutils in the CI. We stick with the old linker flags with binutils prior 2.40 to be compatible with both conflicting behaviors. The best approach would be to come up with something that works across different versions of binutils; but no such solution materialized.
This commit is contained in:
parent
812c216f0c
commit
b123f1071a
3
cpu/msp430_common/ldscripts/riot-msp430f1611.ld
Normal file
3
cpu/msp430_common/ldscripts/riot-msp430f1611.ld
Normal file
@ -0,0 +1,3 @@
|
||||
INCLUDE msp430f1611.ld
|
||||
INCLUDE msp430_common.ld
|
||||
INCLUDE xfa.ld
|
3
cpu/msp430_common/ldscripts/riot-msp430f1612.ld
Normal file
3
cpu/msp430_common/ldscripts/riot-msp430f1612.ld
Normal file
@ -0,0 +1,3 @@
|
||||
INCLUDE msp430f1612.ld
|
||||
INCLUDE msp430_common.ld
|
||||
INCLUDE xfa.ld
|
3
cpu/msp430_common/ldscripts/riot-msp430f1617.ld
Normal file
3
cpu/msp430_common/ldscripts/riot-msp430f1617.ld
Normal file
@ -0,0 +1,3 @@
|
||||
INCLUDE msp430f1617.ld
|
||||
INCLUDE msp430_common.ld
|
||||
INCLUDE xfa.ld
|
3
cpu/msp430_common/ldscripts/riot-msp430f2617.ld
Normal file
3
cpu/msp430_common/ldscripts/riot-msp430f2617.ld
Normal file
@ -0,0 +1,3 @@
|
||||
INCLUDE msp430f2617.ld
|
||||
INCLUDE msp430_common.ld
|
||||
INCLUDE xfa.ld
|
@ -13,11 +13,21 @@ CFLAGS_OPT ?= -Os
|
||||
CFLAGS += $(CFLAGS_CPU) $(CFLAGS_LINK) $(CFLAGS_DBG) $(CFLAGS_OPT)
|
||||
ASFLAGS += $(CFLAGS_CPU) --defsym $(CPU_MODEL)=1 $(CFLAGS_DBG)
|
||||
|
||||
BINUTILS_VERSION := $(shell $(PREFIX)ld --version | grep -Eo '[0-9]\.[0-9]+')
|
||||
NEEDS_NEW_LINKER_SCRIPT := $(call version_is_greater_or_equal,$(BINUTILS_VERSION),2.40)
|
||||
|
||||
LINKFLAGS += $(CFLAGS_CPU) $(CFLAGS_DBG) $(CFLAGS_OPT)
|
||||
LINKFLAGS += -Wl,--gc-sections -Wl,-L$(MSP430_SUPPORT_FILES)/include
|
||||
LINKFLAGS += -T $(MSP430_SUPPORT_FILES)/include/$(CPU_MODEL).ld
|
||||
LINKFLAGS += -T $(RIOTCPU)/msp430_common/ldscripts/msp430_common.ld
|
||||
LINKFLAGS += $(RIOTCPU)/msp430_common/ldscripts/xfa.ld
|
||||
LINKFLAGS += -Wl,--gc-sections
|
||||
LINKFLAGS += -Wl,-L$(MSP430_SUPPORT_FILES)/include
|
||||
LINKFLAGS += -Wl,-L$(RIOTCPU)/msp430_common/ldscripts
|
||||
|
||||
ifeq (1,$(NEEDS_NEW_LINKER_SCRIPT))
|
||||
LINKFLAGS += -T riot-$(CPU_MODEL).ld
|
||||
else
|
||||
LINKFLAGS += -T $(MSP430_SUPPORT_FILES)/include/$(CPU_MODEL).ld
|
||||
LINKFLAGS += -T $(RIOTCPU)/msp430_common/ldscripts/msp430_common.ld
|
||||
LINKFLAGS += $(RIOTCPU)/msp430_common/ldscripts/xfa.ld
|
||||
endif
|
||||
|
||||
OPTIONAL_CFLAGS_BLACKLIST += -fdiagnostics-color
|
||||
OPTIONAL_CFLAGS_BLACKLIST += -Wformat-overflow
|
||||
|
Loading…
Reference in New Issue
Block a user