From ddf7210407b8716973b9890cf7b59561af641b96 Mon Sep 17 00:00:00 2001 From: Pieter du Preez Date: Sat, 29 Sep 2018 23:58:07 +0200 Subject: [PATCH] Moved CORE_LIB to the last position of the defined linked objects. The linking order was changed from: $(LOCAL_OBJS) $(CORE_LIB) $(OTHER_OBJS) $(OTHER_LIBS) to: $(LOCAL_OBJS) $(OTHER_OBJS) $(OTHER_LIBS) $(CORE_LIB) This makes more sense, as OTHER_OBJS would rather depend on CORE_LIB, than the other way around. Apart from libc and libm, CORE_LIB should conceptually _always_ be the last lib in the link list, as it is the core (base of everything). BTW, this was implemented correctly for the 'sam' architecture. --- Arduino.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Arduino.mk b/Arduino.mk index fa82b0e..521a747 100644 --- a/Arduino.mk +++ b/Arduino.mk @@ -1555,7 +1555,7 @@ ifeq ($(findstring sam, $(strip $(ARCHITECTURE))), sam) $(CC) $(LINKER_SCRIPTS) -Wl,-Map=$(OBJDIR)/$(TARGET).map -o $@ $(LOCAL_OBJS) $(OTHER_OBJS) $(OTHER_LIBS) $(LDFLAGS) $(CORE_LIB) -Wl,--end-group # otherwise traditional else - $(CC) $(LDFLAGS) -o $@ $(LOCAL_OBJS) $(CORE_LIB) $(OTHER_OBJS) $(OTHER_LIBS) -lc -lm $(LINKER_SCRIPTS) + $(CC) $(LDFLAGS) -o $@ $(LOCAL_OBJS) $(OTHER_OBJS) $(OTHER_LIBS) $(CORE_LIB) -lc -lm $(LINKER_SCRIPTS) endif $(CORE_LIB): $(CORE_OBJS) $(LIB_OBJS) $(PLATFORM_LIB_OBJS) $(USER_LIB_OBJS)