aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/hack-4.19/204-module_strip.patch
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/generic/hack-4.19/204-module_strip.patch')
-rw-r--r--target/linux/generic/hack-4.19/204-module_strip.patch38
1 files changed, 18 insertions, 20 deletions
diff --git a/target/linux/generic/hack-4.19/204-module_strip.patch b/target/linux/generic/hack-4.19/204-module_strip.patch
index db65062fcf..c30bfd5c9b 100644
--- a/target/linux/generic/hack-4.19/204-module_strip.patch
+++ b/target/linux/generic/hack-4.19/204-module_strip.patch
@@ -14,7 +14,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/include/linux/module.h
+++ b/include/linux/module.h
-@@ -158,6 +158,7 @@ extern void cleanup_module(void);
+@@ -160,6 +160,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)
-@@ -201,12 +202,12 @@ extern void cleanup_module(void);
+@@ -203,12 +204,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 \
-@@ -233,7 +234,9 @@ extern typeof(name) __mod_##type##__##na
+@@ -235,7 +236,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) \
static struct module_version_attribute ___modver_attr = { \
-@@ -255,7 +258,7 @@ extern typeof(name) __mod_##type##__##na
+@@ -257,7 +260,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 */
@@ -98,7 +98,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/init/Kconfig
+++ b/init/Kconfig
-@@ -1903,6 +1903,13 @@ config TRIM_UNUSED_KSYMS
+@@ -1988,6 +1988,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
-@@ -3006,9 +3006,11 @@ static struct module *setup_load_info(st
+@@ -3002,9 +3002,11 @@ static int setup_load_info(struct load_i
static int check_modinfo(struct module *mod, struct load_info *info, int flags)
{
@@ -127,7 +127,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
if (flags & MODULE_INIT_IGNORE_VERMAGIC)
modmagic = NULL;
-@@ -3029,6 +3031,7 @@ static int check_modinfo(struct module *
+@@ -3025,6 +3027,7 @@ static int check_modinfo(struct module *
mod->name);
add_taint_module(mod, TAINT_OOT_MODULE, LOCKDEP_STILL_OK);
}
@@ -137,7 +137,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
-@@ -1982,7 +1982,9 @@ static void read_symbols(char *modname)
+@@ -1969,7 +1969,9 @@ static void read_symbols(const char *mod
symname = remove_dot(info.strtab + sym->st_name);
handle_modversions(mod, &info, sym, symname);
@@ -145,11 +145,11 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
handle_moddevtable(mod, &info, sym, symname);
+#endif
}
- if (!is_vmlinux(modname) ||
- (is_vmlinux(modname) && vmlinux_section_warnings))
-@@ -2143,8 +2145,10 @@ static void add_header(struct buffer *b,
- buf_printf(b, "#include <linux/vermagic.h>\n");
- buf_printf(b, "#include <linux/compiler.h>\n");
+ if (!is_vmlinux(modname) || vmlinux_section_warnings)
+ check_sec_ref(mod, modname, &info);
+@@ -2132,8 +2134,10 @@ static void add_header(struct buffer *b,
+ buf_printf(b, "\n");
+ buf_printf(b, "BUILD_SALT;\n");
buf_printf(b, "\n");
+#ifndef CONFIG_MODULE_STRIPPED
buf_printf(b, "MODULE_INFO(vermagic, VERMAGIC_STRING);\n");
@@ -158,7 +158,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");
-@@ -2161,8 +2165,10 @@ static void add_header(struct buffer *b,
+@@ -2150,8 +2154,10 @@ static void add_header(struct buffer *b,
static void add_intree_flag(struct buffer *b, int is_intree)
{
@@ -169,20 +169,18 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
}
/* Cannot check for assembler */
-@@ -2175,10 +2181,12 @@ static void add_retpoline(struct buffer
+@@ -2164,8 +2170,10 @@ static void add_retpoline(struct buffer
static void add_staging_flag(struct buffer *b, const char *name)
{
+#ifndef CONFIG_MODULE_STRIPPED
- static const char *staging_dir = "drivers/staging";
-
- if (strncmp(staging_dir, name, strlen(staging_dir)) == 0)
+ if (strstarts(name, "drivers/staging"))
buf_printf(b, "\nMODULE_INFO(staging, \"Y\");\n");
+#endif
}
/**
-@@ -2277,11 +2285,13 @@ static void add_depends(struct buffer *b
+@@ -2264,11 +2272,13 @@ static void add_depends(struct buffer *b
static void add_srcversion(struct buffer *b, struct module *mod)
{
@@ -196,7 +194,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
}
static void write_if_changed(struct buffer *b, const char *fname)
-@@ -2518,7 +2528,9 @@ int main(int argc, char **argv)
+@@ -2505,7 +2515,9 @@ int main(int argc, char **argv)
add_staging_flag(&buf, mod->name);
err |= add_versions(&buf, mod);
add_depends(&buf, mod, modules);