ARC: Explicitly add -mmedium-calls to CFLAGS
PATCH 1/1 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.
--- arch/arc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arc/Makefile +1 -1
@@ -16,7 +16,7 @@ endif KBUILD_DEFCONFIG := nsim_700_defconfig -cflags-y += -fno-common -pipe -fno-builtin -D__linux__ +cflags-y += -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__ cflags-$(CONFIG_ISA_ARCOMPACT) += -mA7 cflags-$(CONFIG_ISA_ARCV2) += -mcpu=archs
Signature · 1 line
2.16.2
Quoted 40 lines · Alexey Brodkin
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_PCRELagainst symbol 'unregister_filesystem' defined in .text section infs/filesystems.oarc-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.
Signed-off-by Alexey Brodkin <abrodkin at synopsys.com>--- arch/arc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arc/Makefile +0
-0
arch/arc/Makefile endif · line 21
Quoted 7 lines
arch/arc/Makefile +1
-1@@ -16,7 +16,7 @@ endif KBUILD_DEFCONFIG := nsim_700_defconfig -cflags-y += -fno-common -pipe -fno-builtin -D__linux__ +cflags-y += -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__ cflags-$(CONFIG_ISA_ARCOMPACT) += -mA7 cflags-$(CONFIG_ISA_ARCV2) += -mcpu=archs
LGTM. Bbut while we are here, can you now remove -mmedium-calls for specific files further down in the makefile.