History

module: populate kflagstab in modpost

This patch adds the ability to create entries for kernel symbol flag bitsets in kflagstab. Modpost populates only the GPL-only flag for now.

Siddharth Nayyar committed 7 months ago

Commit 16d0e041 parent 97433112 files · +15 −0Browse files

Unified · Split

2 files
  1. include/linux/export-internal.h +7 −0
  2. scripts/mod/modpost.c +8 −0
include/linux/export-internal.h+7−0
@@ -69,4 +69,11 @@ · 68 unmodified lines
6969 ".long " #crc "\n" \
7070 ".previous" "\n")
7171
72+#define SYMBOL_FLAGS(sym, flags) \
73+ asm(" .section \"___kflagstab+" #sym "\",\"a\"" "\n" \
74+ "__flags_" #sym ":" "\n" \
75+ " .byte " #flags "\n" \
76+ " .previous" "\n" \
77+ )
78+
7279 #endif /* __LINUX_EXPORT_INTERNAL_H__ */
scripts/mod/modpost.c+8−0
@@ -244,6 +244,11 @@ static struct symbol *alloc_symbol(const char *name) · 243 unmodified lines
244244 return s;
245245 }
246246
247+static uint8_t get_symbol_flags(const struct symbol *sym)
248+{
249+ return sym->is_gpl_only ? KSYM_FLAG_GPL_ONLY : 0;
250+}
251+
247252 /* For the hash of exported symbols */
248253 static void hash_add_symbol(struct symbol *sym)
249254 {
@@ -1874,6 +1879,9 @@ static void add_exported_symbols(struct buffer *buf, struct module *mod) · 1624 unmodified lines
18741879 buf_printf(buf, "KSYMTAB_%s(%s, \"%s\", \"%s\");\n",
18751880 sym->is_func ? "FUNC" : "DATA", sym->name,
18761881 sym->is_gpl_only ? "_gpl" : "", sym->namespace);
1882+
1883+ buf_printf(buf, "SYMBOL_FLAGS(%s, 0x%02x);\n",
1884+ sym->name, get_symbol_flags(sym));
18771885 }
18781886
18791887 if (!modversions)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t