[PATCH] ARM: disable FDPIC ABI

Ben Wolsieffer posted 1 patch 3 years, 8 months ago
arch/arm/Makefile | 3 +++
1 file changed, 3 insertions(+)
[PATCH] ARM: disable FDPIC ABI
Posted by Ben Wolsieffer 3 years, 8 months ago
When building with an arm-*-uclinuxfdpiceabi toolchain, the FDPIC ABI is
enabled by default but should not be used to build the kernel.
Therefore, pass -mno-fdpic if supported by the compiler.

Signed-off-by: Ben Wolsieffer <Ben.Wolsieffer@hefring.com>
---
 arch/arm/Makefile | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index c8e3633f5434..88be49b71d40 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -22,6 +22,9 @@ GZFLAGS		:=-9
 # Never generate .eh_frame
 KBUILD_CFLAGS	+= $(call cc-option,-fno-dwarf2-cfi-asm)
 
+# Disable FDPIC ABI
+KBUILD_CFLAGS	+= $(call cc-option,-mno-fdpic)
+
 # This should work on most of the modern platforms
 KBUILD_DEFCONFIG := multi_v7_defconfig
 
-- 
2.37.0
Re: [PATCH] ARM: disable FDPIC ABI
Posted by Vladimir Murzin 3 years, 8 months ago
On 8/1/22 20:17, Ben Wolsieffer wrote:
> When building with an arm-*-uclinuxfdpiceabi toolchain, the FDPIC ABI is
> enabled by default but should not be used to build the kernel.
> Therefore, pass -mno-fdpic if supported by the compiler.
> 
> Signed-off-by: Ben Wolsieffer <Ben.Wolsieffer@hefring.com>
> ---
>  arch/arm/Makefile | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/arch/arm/Makefile b/arch/arm/Makefile
> index c8e3633f5434..88be49b71d40 100644
> --- a/arch/arm/Makefile
> +++ b/arch/arm/Makefile
> @@ -22,6 +22,9 @@ GZFLAGS		:=-9
>  # Never generate .eh_frame
>  KBUILD_CFLAGS	+= $(call cc-option,-fno-dwarf2-cfi-asm)
>  
> +# Disable FDPIC ABI
> +KBUILD_CFLAGS	+= $(call cc-option,-mno-fdpic)
> +
>  # This should work on most of the modern platforms
>  KBUILD_DEFCONFIG := multi_v7_defconfig
>  

Without patch I'm getting

scripts/link-vmlinux.sh: line 52: 312779 Segmentation fault      (core dumped) ${ld} ${ldflags} -o ${output} ${wl}--whole-archive ${objs} ${wl}--no-whole-archive ${wl}--start-group ${libs} ${wl}--end-group $@ ${ldlibs}

So, FWIW:

Reviewed-by: Vladimir Murzin <vladimir.murzin@arm.com>
Tested-by: Vladimir Murzin <vladimir.murzin@arm.com>

Unless you get any other comments, please, drop it into RMK's patch system [1].
 
[1] https://www.armlinux.org.uk/developer/patches/

P.S. 
Extra thanks for Buildroot patches, they were handy to build FDPIC toolchain and
test the patch!

Cheers
Vladimir