aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexey Brodkin <abrodkin@synopsys.com>2018-06-01 07:34:33 -0400
committerVineet Gupta <vgupta@synopsys.com>2018-06-13 20:46:34 -0400
commit74c11e300c103af47db5b658fdcf28002421e250 (patch)
tree0aaafe27b37fef54e16dd2f3a7a8a95dd50d0eb2
parent29dcea88779c856c7dc92040a0c01233263101d4 (diff)
ARC: Explicitly add -mmedium-calls to CFLAGS
GCC built for arc*-*-linux has "-mmedium-calls" implicitly enabled by default thus we don't see any problems during Linux kernel compilation. ----------------------------->8------------------------ arc-linux-gcc -mcpu=arc700 -Q --help=target | grep calls -mlong-calls [disabled] -mmedium-calls [enabled] ----------------------------->8------------------------ But if we try to use so-called Elf32 toolchain with GCC configured for arc*-*-elf* then we'd see the following failure: ----------------------------->8------------------------ init/do_mounts.o: In function 'init_rootfs': do_mounts.c:(.init.text+0x108): relocation truncated to fit: R_ARC_S21W_PCREL against symbol 'unregister_filesystem' defined in .text section in fs/filesystems.o arc-elf32-ld: final link failed: Symbol needs debug section which does not exist make: *** [vmlinux] Error 1 ----------------------------->8------------------------ That happens because neither "-mmedium-calls" nor "-mlong-calls" are enabled in Elf32 GCC: ----------------------------->8------------------------ arc-elf32-gcc -mcpu=arc700 -Q --help=target | grep calls -mlong-calls [disabled] -mmedium-calls [disabled] ----------------------------->8------------------------ Now to make it possible to use Elf32 toolchain for building Linux kernel we're explicitly add "-mmedium-calls" to CFLAGS. And since we add "-mmedium-calls" to the global CFLAGS there's no point in having per-file copies thus removing them. Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com> Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
-rw-r--r--arch/arc/Makefile15
1 files changed, 1 insertions, 14 deletions
diff --git a/arch/arc/Makefile b/arch/arc/Makefile
index d37f49d6a27f..6c1b20dd76ad 100644
--- a/arch/arc/Makefile
+++ b/arch/arc/Makefile
@@ -16,7 +16,7 @@ endif
16 16
17KBUILD_DEFCONFIG := nsim_700_defconfig 17KBUILD_DEFCONFIG := nsim_700_defconfig
18 18
19cflags-y += -fno-common -pipe -fno-builtin -D__linux__ 19cflags-y += -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__
20cflags-$(CONFIG_ISA_ARCOMPACT) += -mA7 20cflags-$(CONFIG_ISA_ARCOMPACT) += -mA7
21cflags-$(CONFIG_ISA_ARCV2) += -mcpu=archs 21cflags-$(CONFIG_ISA_ARCV2) += -mcpu=archs
22 22
@@ -140,16 +140,3 @@ dtbs: scripts
140 140
141archclean: 141archclean:
142 $(Q)$(MAKE) $(clean)=$(boot) 142 $(Q)$(MAKE) $(clean)=$(boot)
143
144# Hacks to enable final link due to absence of link-time branch relexation
145# and gcc choosing optimal(shorter) branches at -O3
146#
147# vineetg Feb 2010: -mlong-calls switched off for overall kernel build
148# However lib/decompress_inflate.o (.init.text) calls
149# zlib_inflate_workspacesize (.text) causing relocation errors.
150# Thus forcing all exten calls in this file to be long calls
151export CFLAGS_decompress_inflate.o = -mmedium-calls
152export CFLAGS_initramfs.o = -mmedium-calls
153ifdef CONFIG_SMP
154export CFLAGS_core.o = -mmedium-calls
155endif