generic: 5.15: refresh hack patch
[openwrt/staging/mkresin.git] / target / linux / generic / hack-5.15 / 204-module_strip.patch
index 645074821f22f91ca6096ee3cede2cdeb2bee3f7..0968d6a135be147ec6988054f0f611f696fd3633 100644 (file)
@@ -14,7 +14,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
 
 --- a/include/linux/module.h
 +++ b/include/linux/module.h
-@@ -161,6 +161,7 @@ extern void cleanup_module(void);
+@@ -164,6 +164,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)
-@@ -230,12 +231,12 @@ extern void cleanup_module(void);
+@@ -233,12 +234,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             \
-@@ -262,7 +263,9 @@ extern typeof(name) __mod_##type##__##na
+@@ -265,7 +266,9 @@ extern typeof(name) __mod_##type##__##na
   */
  
  #if defined(MODULE) || !defined(CONFIG_SYSFS)
@@ -49,7 +49,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  #else
  #define MODULE_VERSION(_version)                                      \
        MODULE_INFO(version, _version);                                 \
-@@ -285,7 +288,7 @@ extern typeof(name) __mod_##type##__##na
+@@ -288,7 +291,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 */
@@ -75,9 +75,9 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
 +#endif
 +
  #define __MODULE_INFO(tag, name, info)                                          \
static const char __UNIQUE_ID(name)[]                                   \
-   __used __section(".modinfo") __attribute__((unused, aligned(1)))      \
-@@ -31,7 +41,7 @@ static const char __UNIQUE_ID(name)[]
      static const char __UNIQUE_ID(name)[]                             \
+               __used __section(".modinfo") __aligned(1)                 \
+@@ -31,7 +41,7 @@
  /* One for each parameter, describing how to use it.  Some files do
     multiple of these per line, so can't just use MODULE_INFO. */
  #define MODULE_PARM_DESC(_parm, desc) \
@@ -104,7 +104,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  config MODULES_TREE_LOOKUP
 --- a/kernel/module.c
 +++ b/kernel/module.c
-@@ -1285,6 +1285,7 @@ static struct module_attribute *modinfo_
+@@ -1218,6 +1218,7 @@ static struct module_attribute *modinfo_
  
  static const char vermagic[] = VERMAGIC_STRING;
  
@@ -112,7 +112,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  static int try_to_force_load(struct module *mod, const char *reason)
  {
  #ifdef CONFIG_MODULE_FORCE_LOAD
-@@ -1296,6 +1297,7 @@ static int try_to_force_load(struct modu
+@@ -1229,6 +1230,7 @@ static int try_to_force_load(struct modu
        return -ENOEXEC;
  #endif
  }
@@ -120,7 +120,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  
  #ifdef CONFIG_MODVERSIONS
  
-@@ -3247,9 +3249,11 @@ static int setup_load_info(struct load_i
+@@ -3227,9 +3229,11 @@ static int setup_load_info(struct load_i
  
  static int check_modinfo(struct module *mod, struct load_info *info, int flags)
  {
@@ -133,7 +133,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        if (flags & MODULE_INIT_IGNORE_VERMAGIC)
                modmagic = NULL;
  
-@@ -3270,6 +3274,7 @@ static int check_modinfo(struct module *
+@@ -3250,6 +3254,7 @@ static int check_modinfo(struct module *
                                mod->name);
                add_taint_module(mod, TAINT_OOT_MODULE, LOCKDEP_STILL_OK);
        }
@@ -143,7 +143,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  
 --- a/scripts/mod/modpost.c
 +++ b/scripts/mod/modpost.c
-@@ -2037,7 +2037,9 @@ static void read_symbols(const char *mod
+@@ -2033,7 +2033,9 @@ static void read_symbols(const char *mod
                symname = remove_dot(info.strtab + sym->st_name);
  
                handle_symbol(mod, &info, sym, symname);
@@ -153,9 +153,9 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        }
  
        for (sym = info.symtab_start; sym < info.symtab_stop; sym++) {
-@@ -2250,8 +2252,10 @@ static void add_header(struct buffer *b,
-       buf_printf(b, "\n");
+@@ -2212,8 +2214,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");
 +#ifndef CONFIG_MODULE_STRIPPED
        buf_printf(b, "MODULE_INFO(vermagic, VERMAGIC_STRING);\n");
@@ -164,7 +164,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");
-@@ -2268,8 +2272,10 @@ static void add_header(struct buffer *b,
+@@ -2230,8 +2234,10 @@ static void add_header(struct buffer *b,
  
  static void add_intree_flag(struct buffer *b, int is_intree)
  {
@@ -175,7 +175,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  }
  
  /* Cannot check for assembler */
-@@ -2282,8 +2288,10 @@ static void add_retpoline(struct buffer
+@@ -2244,8 +2250,10 @@ static void add_retpoline(struct buffer
  
  static void add_staging_flag(struct buffer *b, const char *name)
  {
@@ -186,7 +186,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  }
  
  /**
-@@ -2367,11 +2375,13 @@ static void add_depends(struct buffer *b
+@@ -2325,11 +2333,13 @@ static void add_depends(struct buffer *b
  
  static void add_srcversion(struct buffer *b, struct module *mod)
  {
@@ -200,9 +200,9 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  }
  
  static void write_buf(struct buffer *b, const char *fname)
-@@ -2630,7 +2640,9 @@ int main(int argc, char **argv)
+@@ -2578,7 +2588,9 @@ int main(int argc, char **argv)
                add_staging_flag(&buf, mod->name);
-               err |= add_versions(&buf, mod);
+               add_versions(&buf, mod);
                add_depends(&buf, mod);
 +#ifndef CONFIG_MODULE_STRIPPED
                add_moddevtable(&buf, mod);