Merge tag 'kbuild-v5.12' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy...
[linux-block.git] / include / asm-generic / vmlinux.lds.h
index b3d4ceaf19edffbef3911a3311549d45d2f1a24b..fbc0ca8d903b22478ca89c58fe0f58d7d4f2aaf6 100644 (file)
  * .data. We don't want to pull in .data..other sections, which Linux
  * has defined. Same for text and bss.
  *
+ * With LTO_CLANG, the linker also splits sections by default, so we need
+ * these macros to combine the sections during the final link.
+ *
  * RODATA_MAIN is not used because existing code already defines .rodata.x
  * sections to be brought in with rodata.
  */
-#ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
+#if defined(CONFIG_LD_DEAD_CODE_DATA_ELIMINATION) || defined(CONFIG_LTO_CLANG)
 #define TEXT_MAIN .text .text.[0-9a-zA-Z_]*
-#define DATA_MAIN .data .data.[0-9a-zA-Z_]* .data..LPBX*
+#define DATA_MAIN .data .data.[0-9a-zA-Z_]* .data..L* .data..compoundliteral* .data.$__unnamed_* .data.$Lubsan_*
 #define SDATA_MAIN .sdata .sdata.[0-9a-zA-Z_]*
-#define RODATA_MAIN .rodata .rodata.[0-9a-zA-Z_]*
-#define BSS_MAIN .bss .bss.[0-9a-zA-Z_]*
+#define RODATA_MAIN .rodata .rodata.[0-9a-zA-Z_]* .rodata..L*
+#define BSS_MAIN .bss .bss.[0-9a-zA-Z_]* .bss..compoundliteral*
 #define SBSS_MAIN .sbss .sbss.[0-9a-zA-Z_]*
 #else
 #define TEXT_MAIN .text
 #define THERMAL_TABLE(name)
 #endif
 
+#ifdef CONFIG_DTPM
+#define DTPM_TABLE()                                                   \
+       . = ALIGN(8);                                                   \
+       __dtpm_table = .;                                               \
+       KEEP(*(__dtpm_table))                                           \
+       __dtpm_table_end = .;
+#else
+#define DTPM_TABLE()
+#endif
+
 #define KERNEL_DTB()                                                   \
        STRUCT_ALIGN();                                                 \
        __dtb_start = .;                                                \
        . = ALIGN(8);                                                   \
        __start_static_call_sites = .;                                  \
        KEEP(*(.static_call_sites))                                     \
-       __stop_static_call_sites = .;
+       __stop_static_call_sites = .;                                   \
+       __start_static_call_tramp_key = .;                              \
+       KEEP(*(.static_call_tramp_key))                                 \
+       __stop_static_call_tramp_key = .;
 
 /*
  * Allow architectures to handle ro_after_init data on their
        }                                                               \
                                                                        \
        /* Built-in firmware blobs */                                   \
-       .builtin_fw        : AT(ADDR(.builtin_fw) - LOAD_OFFSET) {      \
+       .builtin_fw : AT(ADDR(.builtin_fw) - LOAD_OFFSET) ALIGN(8) {    \
                __start_builtin_fw = .;                                 \
                KEEP(*(.builtin_fw))                                    \
                __end_builtin_fw = .;                                   \
                __stop___ksymtab_gpl = .;                               \
        }                                                               \
                                                                        \
-       /* Kernel symbol table: Normal unused symbols */                \
-       __ksymtab_unused  : AT(ADDR(__ksymtab_unused) - LOAD_OFFSET) {  \
-               __start___ksymtab_unused = .;                           \
-               KEEP(*(SORT(___ksymtab_unused+*)))                      \
-               __stop___ksymtab_unused = .;                            \
-       }                                                               \
-                                                                       \
-       /* Kernel symbol table: GPL-only unused symbols */              \
-       __ksymtab_unused_gpl : AT(ADDR(__ksymtab_unused_gpl) - LOAD_OFFSET) { \
-               __start___ksymtab_unused_gpl = .;                       \
-               KEEP(*(SORT(___ksymtab_unused_gpl+*)))                  \
-               __stop___ksymtab_unused_gpl = .;                        \
-       }                                                               \
-                                                                       \
-       /* Kernel symbol table: GPL-future-only symbols */              \
-       __ksymtab_gpl_future : AT(ADDR(__ksymtab_gpl_future) - LOAD_OFFSET) { \
-               __start___ksymtab_gpl_future = .;                       \
-               KEEP(*(SORT(___ksymtab_gpl_future+*)))                  \
-               __stop___ksymtab_gpl_future = .;                        \
-       }                                                               \
-                                                                       \
        /* Kernel symbol table: Normal symbols */                       \
        __kcrctab         : AT(ADDR(__kcrctab) - LOAD_OFFSET) {         \
                __start___kcrctab = .;                                  \
                __stop___kcrctab_gpl = .;                               \
        }                                                               \
                                                                        \
-       /* Kernel symbol table: Normal unused symbols */                \
-       __kcrctab_unused  : AT(ADDR(__kcrctab_unused) - LOAD_OFFSET) {  \
-               __start___kcrctab_unused = .;                           \
-               KEEP(*(SORT(___kcrctab_unused+*)))                      \
-               __stop___kcrctab_unused = .;                            \
-       }                                                               \
-                                                                       \
-       /* Kernel symbol table: GPL-only unused symbols */              \
-       __kcrctab_unused_gpl : AT(ADDR(__kcrctab_unused_gpl) - LOAD_OFFSET) { \
-               __start___kcrctab_unused_gpl = .;                       \
-               KEEP(*(SORT(___kcrctab_unused_gpl+*)))                  \
-               __stop___kcrctab_unused_gpl = .;                        \
-       }                                                               \
-                                                                       \
-       /* Kernel symbol table: GPL-future-only symbols */              \
-       __kcrctab_gpl_future : AT(ADDR(__kcrctab_gpl_future) - LOAD_OFFSET) { \
-               __start___kcrctab_gpl_future = .;                       \
-               KEEP(*(SORT(___kcrctab_gpl_future+*)))                  \
-               __stop___kcrctab_gpl_future = .;                        \
-       }                                                               \
-                                                                       \
        /* Kernel symbol table: strings */                              \
         __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) {        \
                *(__ksymtab_strings)                                    \
        ACPI_PROBE_TABLE(irqchip)                                       \
        ACPI_PROBE_TABLE(timer)                                         \
        THERMAL_TABLE(governor)                                         \
+       DTPM_TABLE()                                                    \
        EARLYCON_TABLE()                                                \
        LSM_TABLE()                                                     \
        EARLY_LSM_TABLE()                                               \