kernel: bump 4.9 to 4.9.96
[openwrt/staging/dedeckeh.git] / target / linux / generic / hack-4.9 / 204-module_strip.patch
index fd07cca066c7537db39cb612673774285241c1cc..c6484a8f92ced74863b17f76a1f332edd10bc63e 100644 (file)
@@ -98,7 +98,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  
 --- a/init/Kconfig
 +++ b/init/Kconfig
-@@ -2115,6 +2115,13 @@ config TRIM_UNUSED_KSYMS
+@@ -2122,6 +2122,13 @@ config TRIM_UNUSED_KSYMS
  
          If unsure, or if you need to build out-of-tree modules, say N.
  
@@ -114,7 +114,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  config MODULES_TREE_LOOKUP
 --- a/kernel/module.c
 +++ b/kernel/module.c
-@@ -2945,9 +2945,11 @@ static struct module *setup_load_info(st
+@@ -2968,9 +2968,11 @@ static struct module *setup_load_info(st
  
  static int check_modinfo(struct module *mod, struct load_info *info, int flags)
  {
@@ -127,17 +127,17 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        if (flags & MODULE_INIT_IGNORE_VERMAGIC)
                modmagic = NULL;
  
-@@ -2968,6 +2970,7 @@ static int check_modinfo(struct module *
+@@ -2991,6 +2993,7 @@ static int check_modinfo(struct module *
                                mod->name);
                add_taint_module(mod, TAINT_OOT_MODULE, LOCKDEP_STILL_OK);
        }
 +#endif
  
-       if (get_modinfo(info, "staging")) {
-               add_taint_module(mod, TAINT_CRAP, LOCKDEP_STILL_OK);
+       check_modinfo_retpoline(mod, info);
 --- a/scripts/mod/modpost.c
 +++ b/scripts/mod/modpost.c
-@@ -1964,7 +1964,9 @@ static void read_symbols(char *modname)
+@@ -1965,7 +1965,9 @@ static void read_symbols(char *modname)
                symname = remove_dot(info.strtab + sym->st_name);
  
                handle_modversions(mod, &info, sym, symname);
@@ -147,7 +147,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        }
        if (!is_vmlinux(modname) ||
             (is_vmlinux(modname) && vmlinux_section_warnings))
-@@ -2108,7 +2110,9 @@ static void add_header(struct buffer *b,
+@@ -2109,7 +2111,9 @@ static void add_header(struct buffer *b,
        buf_printf(b, "#include <linux/vermagic.h>\n");
        buf_printf(b, "#include <linux/compiler.h>\n");
        buf_printf(b, "\n");
@@ -157,7 +157,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, "__attribute__((section(\".gnu.linkonce.this_module\"))) = {\n");
-@@ -2125,16 +2129,20 @@ static void add_header(struct buffer *b,
+@@ -2126,24 +2130,30 @@ static void add_header(struct buffer *b,
  
  static void add_intree_flag(struct buffer *b, int is_intree)
  {
@@ -167,6 +167,16 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
 +#endif
  }
  
+ /* Cannot check for assembler */
+ static void add_retpoline(struct buffer *b)
+ {
++#ifndef CONFIG_MODULE_STRIPPED
+       buf_printf(b, "\n#ifdef RETPOLINE\n");
+       buf_printf(b, "MODULE_INFO(retpoline, \"Y\");\n");
+       buf_printf(b, "#endif\n");
++#endif
+ }
  static void add_staging_flag(struct buffer *b, const char *name)
  {
 +#ifndef CONFIG_MODULE_STRIPPED
@@ -178,7 +188,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  }
  
  /* In kernel, this size is defined in linux/module.h;
-@@ -2238,11 +2246,13 @@ static void add_depends(struct buffer *b
+@@ -2247,11 +2257,13 @@ static void add_depends(struct buffer *b
  
  static void add_srcversion(struct buffer *b, struct module *mod)
  {
@@ -192,7 +202,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  }
  
  static void write_if_changed(struct buffer *b, const char *fname)
-@@ -2476,7 +2486,9 @@ int main(int argc, char **argv)
+@@ -2486,7 +2498,9 @@ int main(int argc, char **argv)
                add_staging_flag(&buf, mod->name);
                err |= add_versions(&buf, mod);
                add_depends(&buf, mod, modules);