In preparation for adding --orphan-handling=warn, explicitly keep the
.ARM.attributes section by expanding the existing ELF_DETAILS macro into
ARM_DETAILS.

Suggested-by: Nick Desaulniers <[email protected]>
Link: 
https://lore.kernel.org/lkml/cakwvodk-racgq5pxsogs6vtifbtrk5fmkmnolxrqmaovv0n...@mail.gmail.com/
Signed-off-by: Kees Cook <[email protected]>
---
 arch/arm/include/asm/vmlinux.lds.h | 4 ++++
 arch/arm/kernel/vmlinux-xip.lds.S  | 2 +-
 arch/arm/kernel/vmlinux.lds.S      | 2 +-
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/arm/include/asm/vmlinux.lds.h 
b/arch/arm/include/asm/vmlinux.lds.h
index a08f4301b718..c4af5182ab48 100644
--- a/arch/arm/include/asm/vmlinux.lds.h
+++ b/arch/arm/include/asm/vmlinux.lds.h
@@ -52,6 +52,10 @@
                ARM_MMU_DISCARD(*(__ex_table))                          \
                COMMON_DISCARDS
 
+#define ARM_DETAILS                                                    \
+               ELF_DETAILS                                             \
+               .ARM.attributes 0 : { *(.ARM.attributes) }
+
 #define ARM_STUBS_TEXT                                                 \
                *(.gnu.warning)                                         \
                *(.glue_7)                                              \
diff --git a/arch/arm/kernel/vmlinux-xip.lds.S 
b/arch/arm/kernel/vmlinux-xip.lds.S
index 904c31fa20ed..57fcbf55f913 100644
--- a/arch/arm/kernel/vmlinux-xip.lds.S
+++ b/arch/arm/kernel/vmlinux-xip.lds.S
@@ -150,7 +150,7 @@ SECTIONS
        _end = .;
 
        STABS_DEBUG
-       ELF_DETAILS
+       ARM_DETAILS
 }
 
 /*
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index bb950c896a67..1d3d3b599635 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -149,7 +149,7 @@ SECTIONS
        _end = .;
 
        STABS_DEBUG
-       ELF_DETAILS
+       ARM_DETAILS
 }
 
 #ifdef CONFIG_STRICT_KERNEL_RWX
-- 
2.25.1

Reply via email to