mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-05-11 09:48:24 +02:00
47 lines
1.6 KiB
Diff
47 lines
1.6 KiB
Diff
Adds support for GPL symbols (those exported with EXPORT_SYMBOL_GPL instead
|
|
of EXPORT_SYMBOL) to insmod. This is a backport from later busybox versions,
|
|
it corresponds to revision 7301 in the busybox svn repository:
|
|
|
|
http://www.busybox.net/cgi-bin/viewcvs.cgi/trunk/busybox/modutils/insmod.c?rev=7301&view=markup
|
|
--- busybox-0.60.5/insmod.c 2002-09-16 06:30:10.000000000 +0100
|
|
+++ busybox-0.60.5-symbols/insmod.c 2005-06-21 20:58:57.000000000 +0100
|
|
@@ -607,6 +607,8 @@
|
|
|
|
static void arch_create_got (struct obj_file *f);
|
|
|
|
+static int obj_gpl_license(struct obj_file *f, const char **license);
|
|
+
|
|
#ifdef BB_FEATURE_NEW_MODULE_INTERFACE
|
|
static int arch_init_module (struct obj_file *f, struct new_module *);
|
|
#endif
|
|
@@ -1710,12 +1712,29 @@
|
|
size_t i;
|
|
int used = 0;
|
|
|
|
+ int gpl;
|
|
+ gpl = obj_gpl_license(f, NULL) == 0;
|
|
+
|
|
for (i = 0, s = syms; i < nsyms; ++i, ++s) {
|
|
|
|
/* Only add symbols that are already marked external. If we
|
|
override locals we may cause problems for argument initialization.
|
|
We will also create a false dependency on the module. */
|
|
struct obj_symbol *sym;
|
|
+ char *name;
|
|
+
|
|
+ /* GPL licensed modules can use symbols exported with
|
|
+ * EXPORT_SYMBOL_GPL, so ignore any GPLONLY_ prefix on the
|
|
+ * exported names. Non-GPL modules never see any GPLONLY_
|
|
+ * symbols so they cannot fudge it by adding the prefix on
|
|
+ * their references.
|
|
+ */
|
|
+ if (strncmp((char *)s->name, "GPLONLY_", 8) == 0) {
|
|
+ if (gpl)
|
|
+ ((char *)s->name) += 8;
|
|
+ else
|
|
+ continue;
|
|
+ }
|
|
|
|
sym = obj_find_symbol(f, (char *) s->name);
|
|
if (sym && !ELFW(ST_BIND) (sym->info) == STB_LOCAL) {
|