generic: 6.1: refresh hack patches
[openwrt/staging/ldir.git] / target / linux / generic / hack-6.1 / 204-module_strip.patch
index ee39d15095d9723d7d9d55c0d0989c5832720af7..f0949d32fddd197a2cfd3b0636793e6fa5b134cd 100644 (file)
@@ -14,7 +14,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
 
 --- a/include/linux/module.h
 +++ b/include/linux/module.h
-@@ -164,6 +164,7 @@ extern void cleanup_module(void);
+@@ -163,6 +163,7 @@ extern void cleanup_module(void);
  
  /* Generic info of form tag = "info" */
  #define MODULE_INFO(tag, info) __MODULE_INFO(tag, tag, info)
@@ -22,7 +22,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  
  /* For userspace: you can also call me... */
  #define MODULE_ALIAS(_alias) MODULE_INFO(alias, _alias)
-@@ -233,12 +234,12 @@ extern void cleanup_module(void);
+@@ -232,12 +233,12 @@ extern void cleanup_module(void);
   * Author(s), use "Name <email>" or just "Name", for multiple
   * authors use multiple MODULE_AUTHOR() statements/lines.
   */
@@ -38,7 +38,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  /* Creates an alias so file2alias.c can find device table. */
  #define MODULE_DEVICE_TABLE(type, name)                                       \
  extern typeof(name) __mod_##type##__##name##_device_table             \
-@@ -265,7 +266,9 @@ extern typeof(name) __mod_##type##__##na
+@@ -264,7 +265,9 @@ extern typeof(name) __mod_##type##__##na
   */
  
  #if defined(MODULE) || !defined(CONFIG_SYSFS)
@@ -49,14 +49,14 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  #else
  #define MODULE_VERSION(_version)                                      \
        MODULE_INFO(version, _version);                                 \
-@@ -288,7 +291,7 @@ extern typeof(name) __mod_##type##__##na
+@@ -287,7 +290,7 @@ extern typeof(name) __mod_##type##__##na
  /* Optional firmware file (or files) needed by the module
   * format is simply firmware file name.  Multiple firmware
   * files require multiple MODULE_FIRMWARE() specifiers */
 -#define MODULE_FIRMWARE(_firmware) MODULE_INFO(firmware, _firmware)
 +#define MODULE_FIRMWARE(_firmware) MODULE_INFO_STRIP(firmware, _firmware)
  
- #define MODULE_IMPORT_NS(ns) MODULE_INFO(import_ns, #ns)
+ #define MODULE_IMPORT_NS(ns)  MODULE_INFO(import_ns, __stringify(ns))
  
 --- a/include/linux/moduleparam.h
 +++ b/include/linux/moduleparam.h
@@ -88,9 +88,9 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  
 --- a/kernel/module/Kconfig
 +++ b/kernel/module/Kconfig
-@@ -2352,6 +2352,13 @@ config UNUSED_KSYMS_WHITELIST
-         one per line. The path can be absolute, or relative to the kernel
-         source tree.
+@@ -290,4 +290,11 @@ config MODULES_TREE_LOOKUP
+       def_bool y
+       depends on PERF_EVENTS || TRACING || CFI_CLANG
  
 +config MODULE_STRIPPED
 +      bool "Reduce module size"
@@ -100,11 +100,9 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
 +        device tables, etc.
 +
  endif # MODULES
- config MODULES_TREE_LOOKUP
 --- a/kernel/module/main.c
 +++ b/kernel/module/main.c
-@@ -1218,6 +1218,7 @@ static struct module_attribute *modinfo_
+@@ -988,6 +988,7 @@ size_t modinfo_attrs_count = ARRAY_SIZE(
  
  static const char vermagic[] = VERMAGIC_STRING;
  
@@ -112,7 +110,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  int try_to_force_load(struct module *mod, const char *reason)
  {
  #ifdef CONFIG_MODULE_FORCE_LOAD
-@@ -1229,6 +1230,7 @@ static int try_to_force_load(struct modu
+@@ -999,6 +1000,7 @@ int try_to_force_load(struct module *mod
        return -ENOEXEC;
  #endif
  }
@@ -120,7 +118,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  
  static char *get_modinfo(const struct load_info *info, const char *tag);
  static char *get_next_modinfo(const struct load_info *info, const char *tag,
-@@ -3266,9 +3268,11 @@ static int setup_load_info(struct load_i
+@@ -1950,9 +1952,11 @@ static int setup_load_info(struct load_i
  
  static int check_modinfo(struct module *mod, struct load_info *info, int flags)
  {
@@ -133,7 +131,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        if (flags & MODULE_INIT_IGNORE_VERMAGIC)
                modmagic = NULL;
  
-@@ -3289,6 +3293,7 @@ static int check_modinfo(struct module *
+@@ -1973,6 +1977,7 @@ static int check_modinfo(struct module *
                                mod->name);
                add_taint_module(mod, TAINT_OOT_MODULE, LOCKDEP_STILL_OK);
        }
@@ -143,7 +141,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  
 --- a/scripts/mod/modpost.c
 +++ b/scripts/mod/modpost.c
-@@ -2034,7 +2034,9 @@ static void read_symbols(const char *mod
+@@ -1817,7 +1817,9 @@ static void read_symbols(const char *mod
                symname = remove_dot(info.strtab + sym->st_name);
  
                handle_symbol(mod, &info, sym, symname);
@@ -153,7 +151,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        }
  
        for (sym = info.symtab_start; sym < info.symtab_stop; sym++) {
-@@ -2213,8 +2215,10 @@ static void add_header(struct buffer *b,
+@@ -1980,8 +1982,10 @@ static void add_header(struct buffer *b,
        buf_printf(b, "BUILD_SALT;\n");
        buf_printf(b, "BUILD_LTO_INFO;\n");
        buf_printf(b, "\n");
@@ -164,7 +162,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        buf_printf(b, "\n");
        buf_printf(b, "__visible struct module __this_module\n");
        buf_printf(b, "__section(\".gnu.linkonce.this_module\") = {\n");
-@@ -2231,8 +2235,10 @@ static void add_header(struct buffer *b,
+@@ -1995,8 +1999,10 @@ static void add_header(struct buffer *b,
        buf_printf(b, "\t.arch = MODULE_ARCH_INIT,\n");
        buf_printf(b, "};\n");
  
@@ -175,7 +173,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  
        buf_printf(b,
                   "\n"
-@@ -2245,8 +2251,10 @@ static void add_retpoline(struct buffer
+@@ -2004,8 +2010,10 @@ static void add_header(struct buffer *b,
                   "MODULE_INFO(retpoline, \"Y\");\n"
                   "#endif\n");
  
@@ -186,7 +184,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  
        if (strstarts(mod->name, "tools/testing"))
                buf_printf(b, "\nMODULE_INFO(test, \"Y\");\n");
-@@ -2326,11 +2334,13 @@ static void add_depends(struct buffer *b
+@@ -2101,11 +2109,13 @@ static void add_depends(struct buffer *b
  
  static void add_srcversion(struct buffer *b, struct module *mod)
  {
@@ -200,7 +198,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  }
  
  static void write_buf(struct buffer *b, const char *fname)
-@@ -2579,7 +2589,9 @@ int main(int argc, char **argv)
+@@ -2191,7 +2201,9 @@ static void write_mod_c_file(struct modu
        add_exported_symbols(&buf, mod);
        add_versions(&buf, mod);
        add_depends(&buf, mod);