aboutsummaryrefslogtreecommitdiff
path: root/Arduino.mk
diff options
context:
space:
mode:
authorKevin P. Fleming <kevin@km6g.us>2020-10-19 06:21:45 -0400
committerKevin P. Fleming <kevin@km6g.us>2020-10-19 06:21:45 -0400
commit37e757599abb3658d604a84bc6603997ebec5200 (patch)
treed484463d4ea9710d92b36167637297a7ac0fa902 /Arduino.mk
parentc7eb909b849e354fdb7630d11405ea6de706f1ba (diff)
Use C++ compiler when linking for SAMD-based boards
The Arduino IDE supports full usage of C++ (including the standard library) on SAMD-based boards, so the final linking of the executable must be done using the C++ compiler. Closes #644.
Diffstat (limited to 'Arduino.mk')
-rw-r--r--Arduino.mk4
1 files changed, 2 insertions, 2 deletions
diff --git a/Arduino.mk b/Arduino.mk
index 30bf36b..2bc36f6 100644
--- a/Arduino.mk
+++ b/Arduino.mk
@@ -1674,9 +1674,9 @@ pre-build:
# copied from arduino with start-group, end-group
$(TARGET_ELF): $(LOCAL_OBJS) $(CORE_LIB) $(OTHER_OBJS)
-# sam devices need start and end group
+# sam devices need start and end group, and must be linked using C++ compiler
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
+ $(CXX) $(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) $(OTHER_OBJS) $(OTHER_LIBS) $(CORE_LIB) -lc -lm $(LINKER_SCRIPTS)