OSDN Git Service

vmlinux.lds.h: wrap built-in firmware support under FW_LOADER
authorLuis Chamberlain <mcgrof@kernel.org>
Thu, 21 Oct 2021 15:58:38 +0000 (08:58 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 22 Oct 2021 12:13:58 +0000 (14:13 +0200)
The firmware loader built-in firmware is only available when FW_LOADER
is built-in, so tuck away the sections for built-in firmware under it.

This ensures no oddball user tries to uses these sections without
first enabling FW_LOADER=y.

Reviewed-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Link: https://lore.kernel.org/r/20211021155843.1969401-6-mcgrof@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/asm-generic/vmlinux.lds.h

index f2984af..ad792e2 100644 (file)
                __end_pci_fixups_suspend_late = .;                      \
        }                                                               \
                                                                        \
-       /* Built-in firmware blobs */                                   \
-       .builtin_fw : AT(ADDR(.builtin_fw) - LOAD_OFFSET) ALIGN(8) {    \
-               __start_builtin_fw = .;                                 \
-               KEEP(*(.builtin_fw))                                    \
-               __end_builtin_fw = .;                                   \
-       }                                                               \
-                                                                       \
+       FW_LOADER_BUILT_IN_DATA                                         \
        TRACEDATA                                                       \
                                                                        \
        PRINTK_INDEX                                                    \
 #define ORC_UNWIND_TABLE
 #endif
 
+/* Built-in firmware blobs */
+#ifdef CONFIG_FW_LOADER
+#define FW_LOADER_BUILT_IN_DATA                                                \
+       .builtin_fw : AT(ADDR(.builtin_fw) - LOAD_OFFSET) ALIGN(8) {    \
+               __start_builtin_fw = .;                                 \
+               KEEP(*(.builtin_fw))                                    \
+               __end_builtin_fw = .;                                   \
+       }
+#else
+#define FW_LOADER_BUILT_IN_DATA
+#endif
+
 #ifdef CONFIG_PM_TRACE
 #define TRACEDATA                                                      \
        . = ALIGN(4);                                                   \