Skip to content

Commit 0d43791

Browse files
Yuntao LiuRussell King (Oracle)
authored andcommitted
ARM: 9414/1: Fix build issue with LD_DEAD_CODE_DATA_ELIMINATION
There is a build issue with LD segmentation fault, while CONFIG_LD_DEAD_CODE_DATA_ELIMINATION is not enabled, as bellow. scripts/link-vmlinux.sh: line 49: 3796 Segmentation fault (core dumped) ${ld} ${ldflags} -o ${output} ${wl}--whole-archive ${objs} ${wl}--no-whole-archive ${wl}--start-group ${libs} ${wl}--end-group ${kallsymso} ${btf_vmlinux_bin_o} ${ldlibs} The error occurs in older versions of the GNU ld with version earlier than 2.36. It makes most sense to have a minimum LD version as a dependency for HAVE_LD_DEAD_CODE_DATA_ELIMINATION and eliminate the impact of ".reloc .text, R_ARM_NONE, ." when CONFIG_LD_DEAD_CODE_DATA_ELIMINATION is not enabled. Fixes: ed0f941 ("ARM: 9404/1: arm32: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION") Reported-by: Harith George <mail2hgg@gmail.com> Tested-by: Harith George <mail2hgg@gmail.com> Suggested-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Yuntao Liu <liuyuntao12@huawei.com> Link: https://lore.kernel.org/all/14e9aefb-88d1-4eee-8288-ef15d4a9b059@gmail.com/ Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
1 parent de9c2c6 commit 0d43791

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

arch/arm/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ config ARM
117117
select HAVE_KERNEL_XZ
118118
select HAVE_KPROBES if !XIP_KERNEL && !CPU_ENDIAN_BE32 && !CPU_V7M
119119
select HAVE_KRETPROBES if HAVE_KPROBES
120-
select HAVE_LD_DEAD_CODE_DATA_ELIMINATION
120+
select HAVE_LD_DEAD_CODE_DATA_ELIMINATION if (LD_VERSION >= 23600 || LD_IS_LLD)
121121
select HAVE_MOD_ARCH_SPECIFIC
122122
select HAVE_NMI
123123
select HAVE_OPTPROBES if !THUMB2_KERNEL

arch/arm/kernel/entry-armv.S

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@
2929
#include "entry-header.S"
3030
#include <asm/probes.h>
3131

32+
#ifdef CONFIG_HAVE_LD_DEAD_CODE_DATA_ELIMINATION
33+
#define RELOC_TEXT_NONE .reloc .text, R_ARM_NONE, .
34+
#else
35+
#define RELOC_TEXT_NONE
36+
#endif
37+
3238
/*
3339
* Interrupt handling.
3440
*/
@@ -1065,7 +1071,7 @@ vector_addrexcptn:
10651071
.globl vector_fiq
10661072

10671073
.section .vectors, "ax", %progbits
1068-
.reloc .text, R_ARM_NONE, .
1074+
RELOC_TEXT_NONE
10691075
W(b) vector_rst
10701076
W(b) vector_und
10711077
ARM( .reloc ., R_ARM_LDR_PC_G0, .L__vector_swi )
@@ -1079,7 +1085,7 @@ THUMB( .reloc ., R_ARM_THM_PC12, .L__vector_swi )
10791085

10801086
#ifdef CONFIG_HARDEN_BRANCH_HISTORY
10811087
.section .vectors.bhb.loop8, "ax", %progbits
1082-
.reloc .text, R_ARM_NONE, .
1088+
RELOC_TEXT_NONE
10831089
W(b) vector_rst
10841090
W(b) vector_bhb_loop8_und
10851091
ARM( .reloc ., R_ARM_LDR_PC_G0, .L__vector_bhb_loop8_swi )
@@ -1092,7 +1098,7 @@ THUMB( .reloc ., R_ARM_THM_PC12, .L__vector_bhb_loop8_swi )
10921098
W(b) vector_bhb_loop8_fiq
10931099

10941100
.section .vectors.bhb.bpiall, "ax", %progbits
1095-
.reloc .text, R_ARM_NONE, .
1101+
RELOC_TEXT_NONE
10961102
W(b) vector_rst
10971103
W(b) vector_bhb_bpiall_und
10981104
ARM( .reloc ., R_ARM_LDR_PC_G0, .L__vector_bhb_bpiall_swi )

0 commit comments

Comments
 (0)