]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/busybox-0.60.5-insmod_gpl_symbols.patch
git-svn-id: http://svn.ipfire.org/svn/ipfire/IPFire/source@16 ea5c0bd1-69bd-2848...
[ipfire-2.x.git] / src / patches / busybox-0.60.5-insmod_gpl_symbols.patch
1 Adds support for GPL symbols (those exported with EXPORT_SYMBOL_GPL instead
2 of EXPORT_SYMBOL) to insmod. This is a backport from later busybox versions,
3 it corresponds to revision 7301 in the busybox svn repository:
4
5 http://www.busybox.net/cgi-bin/viewcvs.cgi/trunk/busybox/modutils/insmod.c?rev=7301&view=markup
6 --- busybox-0.60.5/insmod.c 2002-09-16 06:30:10.000000000 +0100
7 +++ busybox-0.60.5-symbols/insmod.c 2005-06-21 20:58:57.000000000 +0100
8 @@ -607,6 +607,8 @@
9
10 static void arch_create_got (struct obj_file *f);
11
12 +static int obj_gpl_license(struct obj_file *f, const char **license);
13 +
14 #ifdef BB_FEATURE_NEW_MODULE_INTERFACE
15 static int arch_init_module (struct obj_file *f, struct new_module *);
16 #endif
17 @@ -1710,12 +1712,29 @@
18 size_t i;
19 int used = 0;
20
21 + int gpl;
22 + gpl = obj_gpl_license(f, NULL) == 0;
23 +
24 for (i = 0, s = syms; i < nsyms; ++i, ++s) {
25
26 /* Only add symbols that are already marked external. If we
27 override locals we may cause problems for argument initialization.
28 We will also create a false dependency on the module. */
29 struct obj_symbol *sym;
30 + char *name;
31 +
32 + /* GPL licensed modules can use symbols exported with
33 + * EXPORT_SYMBOL_GPL, so ignore any GPLONLY_ prefix on the
34 + * exported names. Non-GPL modules never see any GPLONLY_
35 + * symbols so they cannot fudge it by adding the prefix on
36 + * their references.
37 + */
38 + if (strncmp((char *)s->name, "GPLONLY_", 8) == 0) {
39 + if (gpl)
40 + ((char *)s->name) += 8;
41 + else
42 + continue;
43 + }
44
45 sym = obj_find_symbol(f, (char *) s->name);
46 if (sym && !ELFW(ST_BIND) (sym->info) == STB_LOCAL) {