aboutsummaryrefslogtreecommitdiff
path: root/modutils/insmod.c
diff options
context:
space:
mode:
Diffstat (limited to 'modutils/insmod.c')
-rw-r--r--modutils/insmod.c131
1 files changed, 65 insertions, 66 deletions
diff --git a/modutils/insmod.c b/modutils/insmod.c
index 6b81ca754..c21f22b74 100644
--- a/modutils/insmod.c
+++ b/modutils/insmod.c
@@ -5,9 +5,8 @@
5 * This version of insmod supports x86, ARM, SH3/4, powerpc, m68k, 5 * This version of insmod supports x86, ARM, SH3/4, powerpc, m68k,
6 * and MIPS. 6 * and MIPS.
7 * 7 *
8 * 8 * Copyright (C) 1999,2000 by Lineo, inc. and Erik Andersen
9 * Copyright (C) 1999,2000,2001 by Lineo, inc. 9 * Copyright (C) 1999,2000,2001 by Erik Andersen <andersee@debian.org>
10 * Written by Erik Andersen <andersen@lineo.com>
11 * and Ron Alder <alder@lineo.com> 10 * and Ron Alder <alder@lineo.com>
12 * 11 *
13 * Modified by Bryan Rittmeyer <bryan@ixiacom.com> to support SH4 12 * Modified by Bryan Rittmeyer <bryan@ixiacom.com> to support SH4
@@ -22,7 +21,7 @@
22 * PowerPC specific code stolen from modutils-2.3.16, 21 * PowerPC specific code stolen from modutils-2.3.16,
23 * written by Paul Mackerras, Copyright 1996, 1997 Linux International. 22 * written by Paul Mackerras, Copyright 1996, 1997 Linux International.
24 * I've only tested the code on mpc8xx platforms in big-endian mode. 23 * I've only tested the code on mpc8xx platforms in big-endian mode.
25 * Did some cleanup and added BB_USE_xxx_ENTRIES... 24 * Did some cleanup and added CONFIG_USE_xxx_ENTRIES...
26 * 25 *
27 * Quinn Jensen <jensenq@lineo.com> added MIPS support 23-Feb-2001. 26 * Quinn Jensen <jensenq@lineo.com> added MIPS support 23-Feb-2001.
28 * based on modutils-2.4.2 27 * based on modutils-2.4.2
@@ -66,39 +65,39 @@
66#include <sys/utsname.h> 65#include <sys/utsname.h>
67#include "busybox.h" 66#include "busybox.h"
68 67
69#ifdef BB_FEATURE_NEW_MODULE_INTERFACE 68#ifdef CONFIG_FEATURE_NEW_MODULE_INTERFACE
70# undef BB_FEATURE_OLD_MODULE_INTERFACE 69# undef CONFIG_FEATURE_OLD_MODULE_INTERFACE
71# define new_sys_init_module init_module 70# define new_sys_init_module init_module
72#else 71#else
73# define old_sys_init_module init_module 72# define old_sys_init_module init_module
74#endif 73#endif
75 74
76#ifdef BB_FEATURE_INSMOD_LOADINKMEM 75#ifdef CONFIG_FEATURE_INSMOD_LOADINKMEM
77#define LOADBITS 0 76#define LOADBITS 0
78#else 77#else
79#define LOADBITS 1 78#define LOADBITS 1
80#endif 79#endif
81 80
82#if defined(__powerpc__) 81#if defined(__powerpc__)
83#define BB_USE_PLT_ENTRIES 82#define CONFIG_USE_PLT_ENTRIES
84#define BB_PLT_ENTRY_SIZE 16 83#define CONFIG_PLT_ENTRY_SIZE 16
85#endif 84#endif
86 85
87#if defined(__arm__) 86#if defined(__arm__)
88#define BB_USE_PLT_ENTRIES 87#define CONFIG_USE_PLT_ENTRIES
89#define BB_PLT_ENTRY_SIZE 8 88#define CONFIG_PLT_ENTRY_SIZE 8
90#define BB_USE_GOT_ENTRIES 89#define CONFIG_USE_GOT_ENTRIES
91#define BB_GOT_ENTRY_SIZE 8 90#define CONFIG_GOT_ENTRY_SIZE 8
92#endif 91#endif
93 92
94#if defined(__sh__) 93#if defined(__sh__)
95#define BB_USE_GOT_ENTRIES 94#define CONFIG_USE_GOT_ENTRIES
96#define BB_GOT_ENTRY_SIZE 4 95#define CONFIG_GOT_ENTRY_SIZE 4
97#endif 96#endif
98 97
99#if defined(__i386__) 98#if defined(__i386__)
100#define BB_USE_GOT_ENTRIES 99#define CONFIG_USE_GOT_ENTRIES
101#define BB_GOT_ENTRY_SIZE 4 100#define CONFIG_GOT_ENTRY_SIZE 4
102#endif 101#endif
103 102
104#if defined(__mips__) 103#if defined(__mips__)
@@ -134,7 +133,7 @@
134#ifndef MODUTILS_MODULE_H 133#ifndef MODUTILS_MODULE_H
135static const int MODUTILS_MODULE_H = 1; 134static const int MODUTILS_MODULE_H = 1;
136 135
137#ident "$Id: insmod.c,v 1.73 2001/08/22 05:41:57 andersen Exp $" 136#ident "$Id: insmod.c,v 1.74 2001/10/24 04:59:54 andersen Exp $"
138 137
139/* This file contains the structures used by the 2.0 and 2.1 kernels. 138/* This file contains the structures used by the 2.0 and 2.1 kernels.
140 We do not use the kernel headers directly because we do not wish 139 We do not use the kernel headers directly because we do not wish
@@ -267,7 +266,7 @@ struct new_module
267 unsigned tgt_long persist_end; 266 unsigned tgt_long persist_end;
268 unsigned tgt_long can_unload; 267 unsigned tgt_long can_unload;
269 unsigned tgt_long runsize; 268 unsigned tgt_long runsize;
270#ifdef BB_FEATURE_NEW_MODULE_INTERFACE 269#ifdef CONFIG_FEATURE_NEW_MODULE_INTERFACE
271 const char *kallsyms_start; /* All symbols for kernel debugging */ 270 const char *kallsyms_start; /* All symbols for kernel debugging */
272 const char *kallsyms_end; 271 const char *kallsyms_end;
273 const char *archdata_start; /* arch specific data for module */ 272 const char *archdata_start; /* arch specific data for module */
@@ -351,7 +350,7 @@ int delete_module(const char *);
351#ifndef MODUTILS_OBJ_H 350#ifndef MODUTILS_OBJ_H
352static const int MODUTILS_OBJ_H = 1; 351static const int MODUTILS_OBJ_H = 1;
353 352
354#ident "$Id: insmod.c,v 1.73 2001/08/22 05:41:57 andersen Exp $" 353#ident "$Id: insmod.c,v 1.74 2001/10/24 04:59:54 andersen Exp $"
355 354
356/* The relocatable object is manipulated using elfin types. */ 355/* The relocatable object is manipulated using elfin types. */
357 356
@@ -551,7 +550,7 @@ static struct obj_symbol *obj_find_symbol (struct obj_file *f,
551static ElfW(Addr) obj_symbol_final_value(struct obj_file *f, 550static ElfW(Addr) obj_symbol_final_value(struct obj_file *f,
552 struct obj_symbol *sym); 551 struct obj_symbol *sym);
553 552
554#ifdef BB_FEATURE_INSMOD_VERSION_CHECKING 553#ifdef CONFIG_FEATURE_INSMOD_VERSION_CHECKING
555static void obj_set_symbol_compare(struct obj_file *f, 554static void obj_set_symbol_compare(struct obj_file *f,
556 int (*cmp)(const char *, const char *), 555 int (*cmp)(const char *, const char *),
557 unsigned long (*hash)(const char *)); 556 unsigned long (*hash)(const char *));
@@ -643,7 +642,7 @@ static int flag_export = 1;
643 642
644 643
645 644
646#if defined(BB_USE_PLT_ENTRIES) 645#if defined(CONFIG_USE_PLT_ENTRIES)
647struct arch_plt_entry 646struct arch_plt_entry
648{ 647{
649 int offset; 648 int offset;
@@ -652,7 +651,7 @@ struct arch_plt_entry
652}; 651};
653#endif 652#endif
654 653
655#if defined(BB_USE_GOT_ENTRIES) 654#if defined(CONFIG_USE_GOT_ENTRIES)
656struct arch_got_entry { 655struct arch_got_entry {
657 int offset; 656 int offset;
658 unsigned offset_done:1; 657 unsigned offset_done:1;
@@ -671,10 +670,10 @@ struct mips_hi16
671 670
672struct arch_file { 671struct arch_file {
673 struct obj_file root; 672 struct obj_file root;
674#if defined(BB_USE_PLT_ENTRIES) 673#if defined(CONFIG_USE_PLT_ENTRIES)
675 struct obj_section *plt; 674 struct obj_section *plt;
676#endif 675#endif
677#if defined(BB_USE_GOT_ENTRIES) 676#if defined(CONFIG_USE_GOT_ENTRIES)
678 struct obj_section *got; 677 struct obj_section *got;
679#endif 678#endif
680#if defined(__mips__) 679#if defined(__mips__)
@@ -684,10 +683,10 @@ struct arch_file {
684 683
685struct arch_symbol { 684struct arch_symbol {
686 struct obj_symbol root; 685 struct obj_symbol root;
687#if defined(BB_USE_PLT_ENTRIES) 686#if defined(CONFIG_USE_PLT_ENTRIES)
688 struct arch_plt_entry pltent; 687 struct arch_plt_entry pltent;
689#endif 688#endif
690#if defined(BB_USE_GOT_ENTRIES) 689#if defined(CONFIG_USE_GOT_ENTRIES)
691 struct arch_got_entry gotent; 690 struct arch_got_entry gotent;
692#endif 691#endif
693}; 692};
@@ -746,10 +745,10 @@ static struct obj_file *arch_new_file(void)
746 struct arch_file *f; 745 struct arch_file *f;
747 f = xmalloc(sizeof(*f)); 746 f = xmalloc(sizeof(*f));
748 747
749#if defined(BB_USE_PLT_ENTRIES) 748#if defined(CONFIG_USE_PLT_ENTRIES)
750 f->plt = NULL; 749 f->plt = NULL;
751#endif 750#endif
752#if defined(BB_USE_GOT_ENTRIES) 751#if defined(CONFIG_USE_GOT_ENTRIES)
753 f->got = NULL; 752 f->got = NULL;
754#endif 753#endif
755#if defined(__mips__) 754#if defined(__mips__)
@@ -769,10 +768,10 @@ static struct obj_symbol *arch_new_symbol(void)
769 struct arch_symbol *sym; 768 struct arch_symbol *sym;
770 sym = xmalloc(sizeof(*sym)); 769 sym = xmalloc(sizeof(*sym));
771 770
772#if defined(BB_USE_PLT_ENTRIES) 771#if defined(CONFIG_USE_PLT_ENTRIES)
773 memset(&sym->pltent, 0, sizeof(sym->pltent)); 772 memset(&sym->pltent, 0, sizeof(sym->pltent));
774#endif 773#endif
775#if defined(BB_USE_GOT_ENTRIES) 774#if defined(CONFIG_USE_GOT_ENTRIES)
776 memset(&sym->gotent, 0, sizeof(sym->gotent)); 775 memset(&sym->gotent, 0, sizeof(sym->gotent));
777#endif 776#endif
778 777
@@ -793,10 +792,10 @@ arch_apply_relocation(struct obj_file *f,
793 792
794 ElfW(Addr) *loc = (ElfW(Addr) *) (targsec->contents + rel->r_offset); 793 ElfW(Addr) *loc = (ElfW(Addr) *) (targsec->contents + rel->r_offset);
795 ElfW(Addr) dot = targsec->header.sh_addr + rel->r_offset; 794 ElfW(Addr) dot = targsec->header.sh_addr + rel->r_offset;
796#if defined(BB_USE_GOT_ENTRIES) 795#if defined(CONFIG_USE_GOT_ENTRIES)
797 ElfW(Addr) got = ifile->got ? ifile->got->header.sh_addr : 0; 796 ElfW(Addr) got = ifile->got ? ifile->got->header.sh_addr : 0;
798#endif 797#endif
799#if defined(BB_USE_PLT_ENTRIES) 798#if defined(CONFIG_USE_PLT_ENTRIES)
800 ElfW(Addr) plt = ifile->plt ? ifile->plt->header.sh_addr : 0; 799 ElfW(Addr) plt = ifile->plt ? ifile->plt->header.sh_addr : 0;
801 struct arch_plt_entry *pe; 800 struct arch_plt_entry *pe;
802 unsigned long *ip; 801 unsigned long *ip;
@@ -984,7 +983,7 @@ arch_apply_relocation(struct obj_file *f,
984#elif defined(__i386__) 983#elif defined(__i386__)
985#endif 984#endif
986 985
987#if defined(BB_USE_PLT_ENTRIES) 986#if defined(CONFIG_USE_PLT_ENTRIES)
988 987
989#if defined(__arm__) 988#if defined(__arm__)
990 case R_ARM_PC24: 989 case R_ARM_PC24:
@@ -1037,7 +1036,7 @@ arch_apply_relocation(struct obj_file *f,
1037 *loc = (*loc & ~0x03fffffc) | (v & 0x03fffffc); 1036 *loc = (*loc & ~0x03fffffc) | (v & 0x03fffffc);
1038#endif 1037#endif
1039 break; 1038 break;
1040#endif /* BB_USE_PLT_ENTRIES */ 1039#endif /* CONFIG_USE_PLT_ENTRIES */
1041 1040
1042#if defined(__arm__) 1041#if defined(__arm__)
1043#elif defined(__sh__) 1042#elif defined(__sh__)
@@ -1072,7 +1071,7 @@ arch_apply_relocation(struct obj_file *f,
1072 break; 1071 break;
1073#endif 1072#endif
1074 1073
1075#if defined(BB_USE_GOT_ENTRIES) 1074#if defined(CONFIG_USE_GOT_ENTRIES)
1076 1075
1077#if !defined(__68k__) 1076#if !defined(__68k__)
1078#if defined(__sh__) 1077#if defined(__sh__)
@@ -1130,7 +1129,7 @@ arch_apply_relocation(struct obj_file *f,
1130 break; 1129 break;
1131#endif // __mc68000__ 1130#endif // __mc68000__
1132 1131
1133#endif /* BB_USE_GOT_ENTRIES */ 1132#endif /* CONFIG_USE_GOT_ENTRIES */
1134 1133
1135 default: 1134 default:
1136 printf("Warning: unhandled reloc %d\n",(int)ELF32_R_TYPE(rel->r_info)); 1135 printf("Warning: unhandled reloc %d\n",(int)ELF32_R_TYPE(rel->r_info));
@@ -1143,13 +1142,13 @@ arch_apply_relocation(struct obj_file *f,
1143 1142
1144static int arch_create_got(struct obj_file *f) 1143static int arch_create_got(struct obj_file *f)
1145{ 1144{
1146#if defined(BB_USE_GOT_ENTRIES) || defined(BB_USE_PLT_ENTRIES) 1145#if defined(CONFIG_USE_GOT_ENTRIES) || defined(CONFIG_USE_PLT_ENTRIES)
1147 struct arch_file *ifile = (struct arch_file *) f; 1146 struct arch_file *ifile = (struct arch_file *) f;
1148 int i; 1147 int i;
1149#if defined(BB_USE_GOT_ENTRIES) 1148#if defined(CONFIG_USE_GOT_ENTRIES)
1150 int got_offset = 0, gotneeded = 0; 1149 int got_offset = 0, gotneeded = 0;
1151#endif 1150#endif
1152#if defined(BB_USE_PLT_ENTRIES) 1151#if defined(CONFIG_USE_PLT_ENTRIES)
1153 int plt_offset = 0, pltneeded = 0; 1152 int plt_offset = 0, pltneeded = 0;
1154#endif 1153#endif
1155 struct obj_section *relsec, *symsec, *strsec; 1154 struct obj_section *relsec, *symsec, *strsec;
@@ -1226,18 +1225,18 @@ static int arch_create_got(struct obj_file *f)
1226 name = f->sections[extsym->st_shndx]->name; 1225 name = f->sections[extsym->st_shndx]->name;
1227 } 1226 }
1228 intsym = (struct arch_symbol *) obj_find_symbol(f, name); 1227 intsym = (struct arch_symbol *) obj_find_symbol(f, name);
1229#if defined(BB_USE_GOT_ENTRIES) 1228#if defined(CONFIG_USE_GOT_ENTRIES)
1230 if (!intsym->gotent.offset_done) { 1229 if (!intsym->gotent.offset_done) {
1231 intsym->gotent.offset_done = 1; 1230 intsym->gotent.offset_done = 1;
1232 intsym->gotent.offset = got_offset; 1231 intsym->gotent.offset = got_offset;
1233 got_offset += BB_GOT_ENTRY_SIZE; 1232 got_offset += CONFIG_GOT_ENTRY_SIZE;
1234 } 1233 }
1235#endif 1234#endif
1236#if defined(BB_USE_PLT_ENTRIES) 1235#if defined(CONFIG_USE_PLT_ENTRIES)
1237 if (pltneeded && intsym->pltent.allocated == 0) { 1236 if (pltneeded && intsym->pltent.allocated == 0) {
1238 intsym->pltent.allocated = 1; 1237 intsym->pltent.allocated = 1;
1239 intsym->pltent.offset = plt_offset; 1238 intsym->pltent.offset = plt_offset;
1240 plt_offset += BB_PLT_ENTRY_SIZE; 1239 plt_offset += CONFIG_PLT_ENTRY_SIZE;
1241 intsym->pltent.inited = 0; 1240 intsym->pltent.inited = 0;
1242 pltneeded = 0; 1241 pltneeded = 0;
1243 } 1242 }
@@ -1245,7 +1244,7 @@ static int arch_create_got(struct obj_file *f)
1245 } 1244 }
1246 } 1245 }
1247 1246
1248#if defined(BB_USE_GOT_ENTRIES) 1247#if defined(CONFIG_USE_GOT_ENTRIES)
1249 if (got_offset) { 1248 if (got_offset) {
1250 struct obj_section* myrelsec = obj_find_section(f, ".got"); 1249 struct obj_section* myrelsec = obj_find_section(f, ".got");
1251 1250
@@ -1253,7 +1252,7 @@ static int arch_create_got(struct obj_file *f)
1253 obj_extend_section(myrelsec, got_offset); 1252 obj_extend_section(myrelsec, got_offset);
1254 } else { 1253 } else {
1255 myrelsec = obj_create_alloced_section(f, ".got", 1254 myrelsec = obj_create_alloced_section(f, ".got",
1256 BB_GOT_ENTRY_SIZE, 1255 CONFIG_GOT_ENTRY_SIZE,
1257 got_offset); 1256 got_offset);
1258 assert(myrelsec); 1257 assert(myrelsec);
1259 } 1258 }
@@ -1262,10 +1261,10 @@ static int arch_create_got(struct obj_file *f)
1262 } 1261 }
1263#endif 1262#endif
1264 1263
1265#if defined(BB_USE_PLT_ENTRIES) 1264#if defined(CONFIG_USE_PLT_ENTRIES)
1266 if (plt_offset) 1265 if (plt_offset)
1267 ifile->plt = obj_create_alloced_section(f, ".plt", 1266 ifile->plt = obj_create_alloced_section(f, ".plt",
1268 BB_PLT_ENTRY_SIZE, 1267 CONFIG_PLT_ENTRY_SIZE,
1269 plt_offset); 1268 plt_offset);
1270#endif 1269#endif
1271#endif 1270#endif
@@ -1304,7 +1303,7 @@ static unsigned long obj_elf_hash(const char *name)
1304 return obj_elf_hash_n(name, strlen(name)); 1303 return obj_elf_hash_n(name, strlen(name));
1305} 1304}
1306 1305
1307#ifdef BB_FEATURE_INSMOD_VERSION_CHECKING 1306#ifdef CONFIG_FEATURE_INSMOD_VERSION_CHECKING
1308/* String comparison for non-co-versioned kernel and module. */ 1307/* String comparison for non-co-versioned kernel and module. */
1309 1308
1310static int ncv_strcmp(const char *a, const char *b) 1309static int ncv_strcmp(const char *a, const char *b)
@@ -1356,7 +1355,7 @@ obj_set_symbol_compare(struct obj_file *f,
1356 } 1355 }
1357} 1356}
1358 1357
1359#endif /* BB_FEATURE_INSMOD_VERSION_CHECKING */ 1358#endif /* CONFIG_FEATURE_INSMOD_VERSION_CHECKING */
1360 1359
1361static struct obj_symbol * 1360static struct obj_symbol *
1362obj_add_symbol(struct obj_file *f, const char *name, 1361obj_add_symbol(struct obj_file *f, const char *name,
@@ -1787,7 +1786,7 @@ old_process_module_arguments(struct obj_file *f, int argc, char **argv)
1787 return 1; 1786 return 1;
1788} 1787}
1789 1788
1790#ifdef BB_FEATURE_INSMOD_VERSION_CHECKING 1789#ifdef CONFIG_FEATURE_INSMOD_VERSION_CHECKING
1791static int old_is_module_checksummed(struct obj_file *f) 1790static int old_is_module_checksummed(struct obj_file *f)
1792{ 1791{
1793 return obj_find_symbol(f, "Using_Versions") != NULL; 1792 return obj_find_symbol(f, "Using_Versions") != NULL;
@@ -1821,9 +1820,9 @@ old_get_module_version(struct obj_file *f, char str[STRVERSIONLEN])
1821 return a << 16 | b << 8 | c; 1820 return a << 16 | b << 8 | c;
1822} 1821}
1823 1822
1824#endif /* BB_FEATURE_INSMOD_VERSION_CHECKING */ 1823#endif /* CONFIG_FEATURE_INSMOD_VERSION_CHECKING */
1825 1824
1826#ifdef BB_FEATURE_OLD_MODULE_INTERFACE 1825#ifdef CONFIG_FEATURE_OLD_MODULE_INTERFACE
1827 1826
1828/* Fetch all the symbols and divvy them up as appropriate for the modules. */ 1827/* Fetch all the symbols and divvy them up as appropriate for the modules. */
1829 1828
@@ -2033,7 +2032,7 @@ old_init_module(const char *m_name, struct obj_file *f,
2033#define old_create_mod_use_count(x) TRUE 2032#define old_create_mod_use_count(x) TRUE
2034#define old_init_module(x, y, z) TRUE 2033#define old_init_module(x, y, z) TRUE
2035 2034
2036#endif /* BB_FEATURE_OLD_MODULE_INTERFACE */ 2035#endif /* CONFIG_FEATURE_OLD_MODULE_INTERFACE */
2037 2036
2038 2037
2039 2038
@@ -2273,7 +2272,7 @@ new_process_module_arguments(struct obj_file *f, int argc, char **argv)
2273 return 1; 2272 return 1;
2274} 2273}
2275 2274
2276#ifdef BB_FEATURE_INSMOD_VERSION_CHECKING 2275#ifdef CONFIG_FEATURE_INSMOD_VERSION_CHECKING
2277static int new_is_module_checksummed(struct obj_file *f) 2276static int new_is_module_checksummed(struct obj_file *f)
2278{ 2277{
2279 const char *p = get_modinfo_value(f, "using_checksums"); 2278 const char *p = get_modinfo_value(f, "using_checksums");
@@ -2309,10 +2308,10 @@ new_get_module_version(struct obj_file *f, char str[STRVERSIONLEN])
2309 return a << 16 | b << 8 | c; 2308 return a << 16 | b << 8 | c;
2310} 2309}
2311 2310
2312#endif /* BB_FEATURE_INSMOD_VERSION_CHECKING */ 2311#endif /* CONFIG_FEATURE_INSMOD_VERSION_CHECKING */
2313 2312
2314 2313
2315#ifdef BB_FEATURE_NEW_MODULE_INTERFACE 2314#ifdef CONFIG_FEATURE_NEW_MODULE_INTERFACE
2316 2315
2317/* Fetch the loaded modules, and all currently exported symbols. */ 2316/* Fetch the loaded modules, and all currently exported symbols. */
2318 2317
@@ -2601,7 +2600,7 @@ new_init_module(const char *m_name, struct obj_file *f,
2601#define new_create_module_ksymtab(x) 2600#define new_create_module_ksymtab(x)
2602#define query_module(v, w, x, y, z) -1 2601#define query_module(v, w, x, y, z) -1
2603 2602
2604#endif /* BB_FEATURE_NEW_MODULE_INTERFACE */ 2603#endif /* CONFIG_FEATURE_NEW_MODULE_INTERFACE */
2605 2604
2606 2605
2607/*======================================================================*/ 2606/*======================================================================*/
@@ -3155,7 +3154,7 @@ static struct obj_file *obj_load(FILE * fp, int loadprogbits)
3155 return f; 3154 return f;
3156} 3155}
3157 3156
3158#ifdef BB_FEATURE_INSMOD_LOADINKMEM 3157#ifdef CONFIG_FEATURE_INSMOD_LOADINKMEM
3159/* 3158/*
3160 * load the unloaded sections directly into the memory allocated by 3159 * load the unloaded sections directly into the memory allocated by
3161 * kernel for the module 3160 * kernel for the module
@@ -3222,7 +3221,7 @@ extern int insmod_main( int argc, char **argv)
3222 char m_name[FILENAME_MAX + 1] = "\0"; 3221 char m_name[FILENAME_MAX + 1] = "\0";
3223 int exit_status = EXIT_FAILURE; 3222 int exit_status = EXIT_FAILURE;
3224 int m_has_modinfo; 3223 int m_has_modinfo;
3225#ifdef BB_FEATURE_INSMOD_VERSION_CHECKING 3224#ifdef CONFIG_FEATURE_INSMOD_VERSION_CHECKING
3226 struct utsname uts_info; 3225 struct utsname uts_info;
3227 char m_strversion[STRVERSIONLEN]; 3226 char m_strversion[STRVERSIONLEN];
3228 int m_version; 3227 int m_version;
@@ -3335,7 +3334,7 @@ extern int insmod_main( int argc, char **argv)
3335 else 3334 else
3336 m_has_modinfo = 1; 3335 m_has_modinfo = 1;
3337 3336
3338#ifdef BB_FEATURE_INSMOD_VERSION_CHECKING 3337#ifdef CONFIG_FEATURE_INSMOD_VERSION_CHECKING
3339 /* Version correspondence? */ 3338 /* Version correspondence? */
3340 3339
3341 if (uname(&uts_info) < 0) 3340 if (uname(&uts_info) < 0)
@@ -3366,12 +3365,12 @@ extern int insmod_main( int argc, char **argv)
3366 } 3365 }
3367 } 3366 }
3368 k_crcs = 0; 3367 k_crcs = 0;
3369#endif /* BB_FEATURE_INSMOD_VERSION_CHECKING */ 3368#endif /* CONFIG_FEATURE_INSMOD_VERSION_CHECKING */
3370 3369
3371 k_new_syscalls = !query_module(NULL, 0, NULL, 0, NULL); 3370 k_new_syscalls = !query_module(NULL, 0, NULL, 0, NULL);
3372 3371
3373 if (k_new_syscalls) { 3372 if (k_new_syscalls) {
3374#ifdef BB_FEATURE_NEW_MODULE_INTERFACE 3373#ifdef CONFIG_FEATURE_NEW_MODULE_INTERFACE
3375 if (!new_get_kernel_symbols()) 3374 if (!new_get_kernel_symbols())
3376 goto out; 3375 goto out;
3377 k_crcs = new_is_kernel_checksummed(); 3376 k_crcs = new_is_kernel_checksummed();
@@ -3380,7 +3379,7 @@ extern int insmod_main( int argc, char **argv)
3380 goto out; 3379 goto out;
3381#endif 3380#endif
3382 } else { 3381 } else {
3383#ifdef BB_FEATURE_OLD_MODULE_INTERFACE 3382#ifdef CONFIG_FEATURE_OLD_MODULE_INTERFACE
3384 if (!old_get_kernel_symbols(m_name)) 3383 if (!old_get_kernel_symbols(m_name))
3385 goto out; 3384 goto out;
3386 k_crcs = old_is_kernel_checksummed(); 3385 k_crcs = old_is_kernel_checksummed();
@@ -3390,7 +3389,7 @@ extern int insmod_main( int argc, char **argv)
3390#endif 3389#endif
3391 } 3390 }
3392 3391
3393#ifdef BB_FEATURE_INSMOD_VERSION_CHECKING 3392#ifdef CONFIG_FEATURE_INSMOD_VERSION_CHECKING
3394 if (m_has_modinfo) 3393 if (m_has_modinfo)
3395 m_crcs = new_is_module_checksummed(f); 3394 m_crcs = new_is_module_checksummed(f);
3396 else 3395 else
@@ -3398,7 +3397,7 @@ extern int insmod_main( int argc, char **argv)
3398 3397
3399 if (m_crcs != k_crcs) 3398 if (m_crcs != k_crcs)
3400 obj_set_symbol_compare(f, ncv_strcmp, ncv_symbol_hash); 3399 obj_set_symbol_compare(f, ncv_strcmp, ncv_symbol_hash);
3401#endif /* BB_FEATURE_INSMOD_VERSION_CHECKING */ 3400#endif /* CONFIG_FEATURE_INSMOD_VERSION_CHECKING */
3402 3401
3403 /* Let the module know about the kernel symbols. */ 3402 /* Let the module know about the kernel symbols. */
3404 add_kernel_symbols(f); 3403 add_kernel_symbols(f);