software/common: add LTO enable flag and cleanup.

This commit is contained in:
Florent Kermarrec 2020-03-04 08:11:21 +01:00
parent b29f443fe5
commit 1d7c6943af
1 changed files with 15 additions and 8 deletions

View File

@ -7,6 +7,12 @@ endif
RM ?= rm -f
PYTHON ?= python3
ifneq ($(CPU), lm32)
LTO = 0
else
LTO = 1
endif
ifeq ($(CLANG), 1)
CC_normal := clang -target $(TRIPLE) -integrated-as
CX_normal := clang++ -target $(TRIPLE) -integrated-as
@ -14,7 +20,7 @@ else
CC_normal := $(TARGET_PREFIX)gcc -std=gnu99
CX_normal := $(TARGET_PREFIX)g++
endif
ifneq ($(CPU), lm32)
ifneq ($(LTO), 1)
AR_normal := $(TARGET_PREFIX)gcc-ar
else
AR_normal := $(TARGET_PREFIX)ar
@ -50,8 +56,9 @@ DEPFLAGS += -MD -MP
# Toolchain options
#
INCLUDES = -I$(SOC_DIRECTORY)/software/include/base -I$(SOC_DIRECTORY)/software/include -I$(SOC_DIRECTORY)/common -I$(BUILDINC_DIRECTORY)
COMMONFLAGS = $(DEPFLAGS) -Os $(CPUFLAGS) -g3 -fomit-frame-pointer -Wall -fno-builtin -nostdinc $(INCLUDES) -ffunction-sections -fdata-sections -nostartfiles -nostdlib -nodefaultlibs
ifneq ($(CPU), lm32)
COMMONFLAGS = $(DEPFLAGS) -Os $(CPUFLAGS) -g3 -fomit-frame-pointer -Wall -fno-builtin -nostdinc $(INCLUDES)
COMMONFLAGS += -ffunction-sections -fdata-sections -nostartfiles -nostdlib -nodefaultlibs
ifneq ($(LTO), 1)
COMMONFLAGS += -flto -fuse-linker-plugin
endif
CFLAGS = $(COMMONFLAGS) -fexceptions -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes