Skip to content

Commit 0bdd6e7

Browse files
Eugeniy Paltsevvineetgarc
authored andcommitted
ARC: build: allow users to specify -mcpu
kernel build system used to add -mcpu for each ARC ISA as default. These days there are versions and varaints of ARC HS cores some of which have specific -mcpu options to fine tune / optimize generated code. So allow users/external build systems to specify their own -mcpu This will be used in future patches for HSDK-4xD board support which uses specific -mcpu to utilize dual issue scheduling of the core. Signed-off-by: Eugeniy Paltsev <[email protected]> Signed-off-by: Vineet Gupta <[email protected]> [abrodkin/vgupta: rewrote changelog]
1 parent 97d0b5d commit 0bdd6e7

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

arch/arc/Kconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,15 @@ config ARC_CPU_HS
170170

171171
endchoice
172172

173+
config ARC_TUNE_MCPU
174+
string "Override default -mcpu compiler flag"
175+
default ""
176+
help
177+
Override default -mcpu=xxx compiler flag (which is set depending on
178+
the ISA version) with the specified value.
179+
NOTE: If specified flag isn't supported by current compiler the
180+
ISA default value will be used as a fallback.
181+
173182
config CPU_BIG_ENDIAN
174183
bool "Enable Big Endian Mode"
175184
help

arch/arc/Makefile

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,25 @@ CROSS_COMPILE := $(call cc-cross-prefix, arc-linux- arceb-linux-)
1010
endif
1111

1212
cflags-y += -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__
13-
cflags-$(CONFIG_ISA_ARCOMPACT) += -mA7
14-
cflags-$(CONFIG_ISA_ARCV2) += -mcpu=hs38
13+
14+
tune-mcpu-def-$(CONFIG_ISA_ARCOMPACT) := -mA7
15+
tune-mcpu-def-$(CONFIG_ISA_ARCV2) := -mcpu=hs38
16+
17+
ifeq ($(CONFIG_ARC_TUNE_MCPU),"")
18+
cflags-y += $(tune-mcpu-def-y)
19+
else
20+
tune-mcpu := $(shell echo $(CONFIG_ARC_TUNE_MCPU))
21+
tune-mcpu-ok := $(call cc-option-yn, $(tune-mcpu))
22+
ifeq ($(tune-mcpu-ok),y)
23+
cflags-y += $(tune-mcpu)
24+
else
25+
# The flag provided by 'CONFIG_ARC_TUNE_MCPU' option isn't known by this compiler
26+
# (probably the compiler is too old). Use ISA default mcpu flag instead as a safe option.
27+
$(warning ** WARNING ** CONFIG_ARC_TUNE_MCPU flag '$(tune-mcpu)' is unknown, fallback to '$(tune-mcpu-def-y)')
28+
cflags-y += $(tune-mcpu-def-y)
29+
endif
30+
endif
31+
1532

1633
ifdef CONFIG_ARC_CURR_IN_REG
1734
# For a global register defintion, make sure it gets passed to every file

0 commit comments

Comments
 (0)