kernel: Make the patches apply on top of 4.19
[oweals/openwrt.git] / target / linux / generic / hack-4.19 / 221-module_exports.patch
index 250bf1180f0c85e4231ffcb0b8730f3440f23f25..cd5ae5830c5f392425e0efc6e6ad1336a1f4f88c 100644 (file)
@@ -27,27 +27,27 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
 +#define SYMTAB_DISCARD_GPL
 +#endif
 +
- #include <linux/export.h>
  /* Align . to a 8 byte boundary equals to maximum function alignment. */
-@@ -341,14 +351,14 @@
+ #define ALIGN_FUNCTION()  . = ALIGN(8)
+@@ -372,14 +382,14 @@
        /* Kernel symbol table: Normal symbols */                       \
        __ksymtab         : AT(ADDR(__ksymtab) - LOAD_OFFSET) {         \
-               VMLINUX_SYMBOL(__start___ksymtab) = .;                  \
+               __start___ksymtab = .;                                  \
 -              KEEP(*(SORT(___ksymtab+*)))                             \
 +              SYMTAB_KEEP                                             \
-               VMLINUX_SYMBOL(__stop___ksymtab) = .;                   \
+               __stop___ksymtab = .;                                   \
        }                                                               \
                                                                        \
        /* Kernel symbol table: GPL-only symbols */                     \
        __ksymtab_gpl     : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) {     \
-               VMLINUX_SYMBOL(__start___ksymtab_gpl) = .;              \
+               __start___ksymtab_gpl = .;                              \
 -              KEEP(*(SORT(___ksymtab_gpl+*)))                         \
 +              SYMTAB_KEEP_GPL                                         \
-               VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .;               \
+               __stop___ksymtab_gpl = .;                               \
        }                                                               \
                                                                        \
-@@ -410,7 +420,7 @@
+@@ -441,7 +451,7 @@
                                                                        \
        /* Kernel symbol table: strings */                              \
          __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) {       \
@@ -56,7 +56,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        }                                                               \
                                                                        \
        /* __*init sections */                                          \
-@@ -793,6 +803,8 @@
+@@ -841,6 +851,8 @@
        EXIT_TEXT                                                       \
        EXIT_DATA                                                       \
        EXIT_CALL                                                       \
@@ -67,8 +67,8 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        }
 --- a/include/linux/export.h
 +++ b/include/linux/export.h
-@@ -60,12 +60,19 @@ extern struct module __this_module;
- #define __CRC_SYMBOL(sym, sec)
+@@ -74,12 +74,19 @@ struct kernel_symbol {
+ };
  #endif
  
 +#ifdef MODULE
@@ -82,15 +82,15 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        extern typeof(sym) sym;                                         \
        __CRC_SYMBOL(sym, sec)                                          \
        static const char __kstrtab_##sym[]                             \
--      __attribute__((section("__ksymtab_strings"), aligned(1)))       \
+-      __attribute__((section("__ksymtab_strings"), used, aligned(1))) \
 +      __attribute__((section("__ksymtab_strings"                      \
-+        __EXPORT_SUFFIX(sym)), aligned(1)))                           \
-       = VMLINUX_SYMBOL_STR(sym);                                      \
-       static const struct kernel_symbol __ksymtab_##sym               \
-       __used                                                          \
++        __EXPORT_SUFFIX(sym)), used, aligned(1)))                     \
+       = #sym;                                                         \
+       __KSYMTAB_ENTRY(sym, sec)
 --- a/scripts/Makefile.build
 +++ b/scripts/Makefile.build
-@@ -432,7 +432,7 @@ targets += $(extra-y) $(MAKECMDGOALS) $(
+@@ -408,7 +408,7 @@ targets += $(extra-y) $(MAKECMDGOALS) $(
  # Linker scripts preprocessor (.lds.S -> .lds)
  # ---------------------------------------------------------------------------
  quiet_cmd_cpp_lds_S = LDS     $@