vmlinux.lds.h: Split ELF_DETAILS from STABS_DEBUG
authorKees Cook <keescook@chromium.org>
Fri, 21 Aug 2020 19:42:45 +0000 (12:42 -0700)
committerIngo Molnar <mingo@kernel.org>
Tue, 1 Sep 2020 07:50:35 +0000 (09:50 +0200)
The .comment section doesn't belong in STABS_DEBUG. Split it out into a
new macro named ELF_DETAILS. This will gain other non-debug sections
that need to be accounted for when linking with --orphan-handling=warn.

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: linux-arch@vger.kernel.org
Link: https://lore.kernel.org/r/20200821194310.3089815-5-keescook@chromium.org
24 files changed:
arch/alpha/kernel/vmlinux.lds.S
arch/arc/kernel/vmlinux.lds.S
arch/arm/kernel/vmlinux-xip.lds.S
arch/arm/kernel/vmlinux.lds.S
arch/arm64/kernel/vmlinux.lds.S
arch/csky/kernel/vmlinux.lds.S
arch/hexagon/kernel/vmlinux.lds.S
arch/ia64/kernel/vmlinux.lds.S
arch/mips/kernel/vmlinux.lds.S
arch/nds32/kernel/vmlinux.lds.S
arch/nios2/kernel/vmlinux.lds.S
arch/openrisc/kernel/vmlinux.lds.S
arch/parisc/boot/compressed/vmlinux.lds.S
arch/parisc/kernel/vmlinux.lds.S
arch/powerpc/kernel/vmlinux.lds.S
arch/riscv/kernel/vmlinux.lds.S
arch/s390/kernel/vmlinux.lds.S
arch/sh/kernel/vmlinux.lds.S
arch/sparc/kernel/vmlinux.lds.S
arch/um/kernel/dyn.lds.S
arch/um/kernel/uml.lds.S
arch/x86/boot/compressed/vmlinux.lds.S
arch/x86/kernel/vmlinux.lds.S
include/asm-generic/vmlinux.lds.h

index bc6f727..5b78d64 100644 (file)
@@ -72,6 +72,7 @@ SECTIONS
 
        STABS_DEBUG
        DWARF_DEBUG
+       ELF_DETAILS
 
        DISCARDS
 }
index 54139a6..33ce59d 100644 (file)
@@ -122,6 +122,7 @@ SECTIONS
        _end = . ;
 
        STABS_DEBUG
+       ELF_DETAILS
        DISCARDS
 
        .arcextmap 0 : {
index 6d2be99..3d4e88f 100644 (file)
@@ -152,6 +152,7 @@ SECTIONS
        _end = .;
 
        STABS_DEBUG
+       ELF_DETAILS
 }
 
 /*
index 7f24bc0..5592f14 100644 (file)
@@ -151,6 +151,7 @@ SECTIONS
        _end = .;
 
        STABS_DEBUG
+       ELF_DETAILS
 }
 
 #ifdef CONFIG_STRICT_KERNEL_RWX
index ec8e894..13fc2ec 100644 (file)
@@ -241,6 +241,7 @@ SECTIONS
        _end = .;
 
        STABS_DEBUG
+       ELF_DETAILS
 
        HEAD_SYMBOLS
 }
index f05b413..f03033e 100644 (file)
@@ -109,6 +109,7 @@ SECTIONS
 
        STABS_DEBUG
        DWARF_DEBUG
+       ELF_DETAILS
 
        DISCARDS
 }
index 0ca2471..35b18e5 100644 (file)
@@ -67,5 +67,6 @@ SECTIONS
 
        STABS_DEBUG
        DWARF_DEBUG
+       ELF_DETAILS
 
 }
index d259690..9b26578 100644 (file)
@@ -218,6 +218,7 @@ SECTIONS {
 
        STABS_DEBUG
        DWARF_DEBUG
+       ELF_DETAILS
 
        /* Default discards */
        DISCARDS
index f185a85..5e97e9d 100644 (file)
@@ -202,6 +202,7 @@ SECTIONS
 
        STABS_DEBUG
        DWARF_DEBUG
+       ELF_DETAILS
 
        /* These must appear regardless of  .  */
        .gptab.sdata : {
index 7a6c1ce..6a91b96 100644 (file)
@@ -64,6 +64,7 @@ SECTIONS
 
        STABS_DEBUG
        DWARF_DEBUG
+       ELF_DETAILS
 
        DISCARDS
 }
index c55a7cf..126e114 100644 (file)
@@ -58,6 +58,7 @@ SECTIONS
 
        STABS_DEBUG
        DWARF_DEBUG
+       ELF_DETAILS
 
        DISCARDS
 }
index 60449fd..d287dbb 100644 (file)
@@ -115,6 +115,7 @@ SECTIONS
        /* Throw in the debugging sections */
        STABS_DEBUG
        DWARF_DEBUG
+       ELF_DETAILS
 
         /* Sections to be discarded -- must be last */
        DISCARDS
index 2ac3a64..ab7b439 100644 (file)
@@ -84,6 +84,7 @@ SECTIONS
        }
 
        STABS_DEBUG
+       ELF_DETAILS
        .note 0 : { *(.note) }
 
        /* Sections to be discarded */
index 53e29d8..2769eb9 100644 (file)
@@ -164,6 +164,7 @@ SECTIONS
        _end = . ;
 
        STABS_DEBUG
+       ELF_DETAILS
        .note 0 : { *(.note) }
 
        /* Sections to be discarded */
index 326e113..e0548b4 100644 (file)
@@ -360,8 +360,8 @@ SECTIONS
        PROVIDE32 (end = .);
 
        STABS_DEBUG
-
        DWARF_DEBUG
+       ELF_DETAILS
 
        DISCARDS
        /DISCARD/ : {
index f3586e3..6f3af7b 100644 (file)
@@ -97,6 +97,7 @@ SECTIONS
 
        STABS_DEBUG
        DWARF_DEBUG
+       ELF_DETAILS
 
        DISCARDS
 }
index 3769549..177ccfb 100644 (file)
@@ -181,6 +181,7 @@ SECTIONS
        /* Debugging sections.  */
        STABS_DEBUG
        DWARF_DEBUG
+       ELF_DETAILS
 
        /* Sections to be discarded */
        DISCARDS
index bde7a6c..3161b9c 100644 (file)
@@ -76,6 +76,7 @@ SECTIONS
 
        STABS_DEBUG
        DWARF_DEBUG
+       ELF_DETAILS
 
        DISCARDS
 }
index f99e99e..d55ae65 100644 (file)
@@ -187,6 +187,7 @@ SECTIONS
 
        STABS_DEBUG
        DWARF_DEBUG
+       ELF_DETAILS
 
        DISCARDS
 }
index f500148..dacbfab 100644 (file)
@@ -164,8 +164,8 @@ SECTIONS
   PROVIDE (end = .);
 
   STABS_DEBUG
-
   DWARF_DEBUG
+  ELF_DETAILS
 
   DISCARDS
 }
index 3b6dab3..45d957d 100644 (file)
@@ -108,8 +108,8 @@ SECTIONS
   PROVIDE (end = .);
 
   STABS_DEBUG
-
   DWARF_DEBUG
+  ELF_DETAILS
 
   DISCARDS
 }
index 29df99b..3c2ee9a 100644 (file)
@@ -82,6 +82,8 @@ SECTIONS
        . = ALIGN(PAGE_SIZE);   /* keep ZO size page aligned */
        _end = .;
 
+       ELF_DETAILS
+
        DISCARDS
 }
 
index 9a03e5b..0cc035c 100644 (file)
@@ -411,6 +411,7 @@ SECTIONS
 
        STABS_DEBUG
        DWARF_DEBUG
+       ELF_DETAILS
 
        DISCARDS
 }
index 6b89a03..cadcbc3 100644 (file)
@@ -34,6 +34,7 @@
  *
  *     STABS_DEBUG
  *     DWARF_DEBUG
+ *     ELF_DETAILS
  *
  *     DISCARDS                // must be the last
  * }
                .debug_macro    0 : { *(.debug_macro) }                 \
                .debug_addr     0 : { *(.debug_addr) }
 
-               /* Stabs debugging sections.  */
+/* Stabs debugging sections. */
 #define STABS_DEBUG                                                    \
                .stab 0 : { *(.stab) }                                  \
                .stabstr 0 : { *(.stabstr) }                            \
                .stab.excl 0 : { *(.stab.excl) }                        \
                .stab.exclstr 0 : { *(.stab.exclstr) }                  \
                .stab.index 0 : { *(.stab.index) }                      \
-               .stab.indexstr 0 : { *(.stab.indexstr) }                \
+               .stab.indexstr 0 : { *(.stab.indexstr) }
+
+/* Required sections not related to debugging. */
+#define ELF_DETAILS                                                    \
                .comment 0 : { *(.comment) }
 
 #ifdef CONFIG_GENERIC_BUG