arch: arm: armv6-m: fix LTO build

This imports changes from armv7-m.
This commit is contained in:
Karel Kočí 2022-05-20 11:37:25 +02:00 committed by Xiang Xiao
parent f2bc4555bb
commit a74c707da6

View File

@ -100,6 +100,9 @@ ifeq ($(CONFIG_LTO_THIN),y)
ARCHOPTIMIZATION += -flto=thin
else ifeq ($(CONFIG_LTO_FULL),y)
ARCHOPTIMIZATION += -flto
ifeq ($(CONFIG_ARMV6M_TOOLCHAIN),GNU_EABI)
ARCHOPTIMIZATION += -fuse-linker-plugin
endif
endif
# NuttX buildroot under Linux or Cygwin
@ -143,12 +146,21 @@ else
CC = $(CROSSDEV)gcc
CXX = $(CROSSDEV)g++
CPP = $(CROSSDEV)gcc -E -P -x c
LD = $(CROSSDEV)ld
STRIP = $(CROSSDEV)strip --strip-unneeded
AR = $(CROSSDEV)ar rcs
NM = $(CROSSDEV)nm
OBJCOPY = $(CROSSDEV)objcopy
OBJDUMP = $(CROSSDEV)objdump
LD = $(CROSSDEV)ld
AR = $(CROSSDEV)ar rcs
NM = $(CROSSDEV)nm
ifeq ($(CONFIG_LTO_FULL),y)
ifeq ($(CONFIG_ARMV6M_TOOLCHAIN),GNU_EABI)
LD := $(CROSSDEV)gcc
AR := $(CROSSDEV)gcc-ar rcs
NM := $(CROSSDEV)gcc-nm
ARCHOPTIMIZATION += -fno-builtin
endif
endif
endif
# Architecture flags
@ -171,6 +183,8 @@ ifneq ($(CONFIG_CXX_RTTI),y)
ARCHCXXFLAGS += -fno-rtti
endif
LDFLAGS += -nostdlib
# Optimization of unused sections
ifeq ($(CONFIG_DEBUG_OPT_UNUSED_SECTIONS),y)