ANDROID: modpost: add protected exports to vmlinux

Protected exports are placed in the __kexporttab section.

Bug: 519119852
Change-Id: Iab22863baefe7c4575604e18ed403aef8ee3b7c5
Signed-off-by: Siddharth Nayyar <sidnayyar@google.com>
This commit is contained in:
Siddharth Nayyar authored and Sid Nayyar committed 2026-06-04 01:46:10 -07:00
1 parent 41d03c973a
commit 2493fa846d
3 files changed
+29

No files matched your search

+16
View File
@@ -1917,6 +1917,21 @@ static void add_exported_symbols(struct buffer *buf, struct module *mod)
}
}
static void add_protected_exports(struct buffer *buf)
{
struct module *mod;
struct symbol *sym;
buf_printf(buf, "\n");
list_for_each_entry(mod, &modules, list) {
if (mod->protect_exports) {
list_for_each_entry(sym, &mod->exported_symbols, list)
buf_printf(buf, "PROTECT_EXPORT(%s);\n",
sym->name);
}
}
}
/**
* Record CRCs for unresolved symbols, supporting long names
*/
@@ -2103,6 +2118,7 @@ static void write_vmlinux_export_c_file(struct module *mod)
"#include <linux/export-internal.h>\n");
add_exported_symbols(&buf, mod);
add_protected_exports(&buf);
buf_printf(&buf,
"#include <linux/module.h>\n"
+1
View File
@@ -126,6 +126,7 @@ struct module {
bool seen;
bool has_init;
bool has_cleanup;
bool protect_exports;
char srcversion[25];
// Missing namespace dependencies
struct list_head missing_namespaces;