This patch adds the ability to create entries for kernel symbol flag bitsets in kflagstab. Modpost populates only the GPL-only flag for now.
Unified · Split
| @@ -69,4 +69,11 @@ · 68 unmodified lines | ||
| 69 | 69 | ".long " #crc "\n" \ |
| 70 | 70 | ".previous" "\n") |
| 71 | 71 | |
| 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 | + | |
| 72 | 79 | #endif /* __LINUX_EXPORT_INTERNAL_H__ */ |
| @@ -244,6 +244,11 @@ static struct symbol *alloc_symbol(const char *name) · 243 unmodified lines | ||
| 244 | 244 | return s; |
| 245 | 245 | } |
| 246 | 246 | |
| 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 | + | |
| 247 | 252 | /* For the hash of exported symbols */ |
| 248 | 253 | static void hash_add_symbol(struct symbol *sym) |
| 249 | 254 | { |
| @@ -1874,6 +1879,9 @@ static void add_exported_symbols(struct buffer *buf, struct module *mod) · 1624 unmodified lines | ||
| 1874 | 1879 | buf_printf(buf, "KSYMTAB_%s(%s, \"%s\", \"%s\");\n", |
| 1875 | 1880 | sym->is_func ? "FUNC" : "DATA", sym->name, |
| 1876 | 1881 | 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)); | |
| 1877 | 1885 | } |
| 1878 | 1886 | |
| 1879 | 1887 | if (!modversions) |