diff options
| author | Eric Andersen <andersen@codepoet.org> | 2001-07-17 01:12:36 +0000 |
|---|---|---|
| committer | Eric Andersen <andersen@codepoet.org> | 2001-07-17 01:12:36 +0000 |
| commit | 044228d5ecb9b79397f9fc915d046cf4538281e2 (patch) | |
| tree | 4c43e4947b0196d807249f8f6e1c9c679b6bbcde /modutils | |
| parent | 51ded05b3bf4df6f126420d39a40d27ea0728aa9 (diff) | |
| download | busybox-w32-044228d5ecb9b79397f9fc915d046cf4538281e2.tar.gz busybox-w32-044228d5ecb9b79397f9fc915d046cf4538281e2.tar.bz2 busybox-w32-044228d5ecb9b79397f9fc915d046cf4538281e2.zip | |
This is vodz' latest patch. Sorry it took so long...
1) ping cleanup (compile fix from this patch already applied).
2) traceroute call not spare ntohl() now (and reduce size);
3) Fix for functions not declared static in insmod, ash, vi and mount.
4) a more simple API cmdedit :))
5) adds "stopped jobs" warning to ash on Ctrl-D and fixes "ignoreeof" option
6) reduce exporting library function index->strchr (traceroute), bzero->memset (syslogd)
Diffstat (limited to 'modutils')
| -rw-r--r-- | modutils/insmod.c | 147 |
1 files changed, 66 insertions, 81 deletions
diff --git a/modutils/insmod.c b/modutils/insmod.c index 4b0051594..b457fa81c 100644 --- a/modutils/insmod.c +++ b/modutils/insmod.c | |||
| @@ -130,7 +130,7 @@ | |||
| 130 | #ifndef MODUTILS_MODULE_H | 130 | #ifndef MODUTILS_MODULE_H |
| 131 | static const int MODUTILS_MODULE_H = 1; | 131 | static const int MODUTILS_MODULE_H = 1; |
| 132 | 132 | ||
| 133 | #ident "$Id: insmod.c,v 1.67 2001/06/28 21:36:06 andersen Exp $" | 133 | #ident "$Id: insmod.c,v 1.68 2001/07/17 01:12:36 andersen Exp $" |
| 134 | 134 | ||
| 135 | /* This file contains the structures used by the 2.0 and 2.1 kernels. | 135 | /* This file contains the structures used by the 2.0 and 2.1 kernels. |
| 136 | We do not use the kernel headers directly because we do not wish | 136 | We do not use the kernel headers directly because we do not wish |
| @@ -347,7 +347,7 @@ int delete_module(const char *); | |||
| 347 | #ifndef MODUTILS_OBJ_H | 347 | #ifndef MODUTILS_OBJ_H |
| 348 | static const int MODUTILS_OBJ_H = 1; | 348 | static const int MODUTILS_OBJ_H = 1; |
| 349 | 349 | ||
| 350 | #ident "$Id: insmod.c,v 1.67 2001/06/28 21:36:06 andersen Exp $" | 350 | #ident "$Id: insmod.c,v 1.68 2001/07/17 01:12:36 andersen Exp $" |
| 351 | 351 | ||
| 352 | /* The relocatable object is manipulated using elfin types. */ | 352 | /* The relocatable object is manipulated using elfin types. */ |
| 353 | 353 | ||
| @@ -537,78 +537,73 @@ struct obj_symbol_patch | |||
| 537 | 537 | ||
| 538 | /* Generic object manipulation routines. */ | 538 | /* Generic object manipulation routines. */ |
| 539 | 539 | ||
| 540 | unsigned long obj_elf_hash(const char *); | 540 | static unsigned long obj_elf_hash(const char *); |
| 541 | 541 | ||
| 542 | unsigned long obj_elf_hash_n(const char *, unsigned long len); | 542 | static unsigned long obj_elf_hash_n(const char *, unsigned long len); |
| 543 | 543 | ||
| 544 | struct obj_symbol *obj_add_symbol (struct obj_file *f, const char *name, | 544 | static struct obj_symbol *obj_find_symbol (struct obj_file *f, |
| 545 | unsigned long symidx, int info, int secidx, | ||
| 546 | ElfW(Addr) value, unsigned long size); | ||
| 547 | |||
| 548 | struct obj_symbol *obj_find_symbol (struct obj_file *f, | ||
| 549 | const char *name); | 545 | const char *name); |
| 550 | 546 | ||
| 551 | ElfW(Addr) obj_symbol_final_value(struct obj_file *f, | 547 | static ElfW(Addr) obj_symbol_final_value(struct obj_file *f, |
| 552 | struct obj_symbol *sym); | 548 | struct obj_symbol *sym); |
| 553 | 549 | ||
| 554 | void obj_set_symbol_compare(struct obj_file *f, | 550 | static void obj_set_symbol_compare(struct obj_file *f, |
| 555 | int (*cmp)(const char *, const char *), | 551 | int (*cmp)(const char *, const char *), |
| 556 | unsigned long (*hash)(const char *)); | 552 | unsigned long (*hash)(const char *)); |
| 557 | 553 | ||
| 558 | struct obj_section *obj_find_section (struct obj_file *f, | 554 | static struct obj_section *obj_find_section (struct obj_file *f, |
| 559 | const char *name); | 555 | const char *name); |
| 560 | 556 | ||
| 561 | void obj_insert_section_load_order (struct obj_file *f, | 557 | static void obj_insert_section_load_order (struct obj_file *f, |
| 562 | struct obj_section *sec); | 558 | struct obj_section *sec); |
| 563 | 559 | ||
| 564 | struct obj_section *obj_create_alloced_section (struct obj_file *f, | 560 | static struct obj_section *obj_create_alloced_section (struct obj_file *f, |
| 565 | const char *name, | 561 | const char *name, |
| 566 | unsigned long align, | 562 | unsigned long align, |
| 567 | unsigned long size); | 563 | unsigned long size); |
| 568 | 564 | ||
| 569 | struct obj_section *obj_create_alloced_section_first (struct obj_file *f, | 565 | static struct obj_section *obj_create_alloced_section_first (struct obj_file *f, |
| 570 | const char *name, | 566 | const char *name, |
| 571 | unsigned long align, | 567 | unsigned long align, |
| 572 | unsigned long size); | 568 | unsigned long size); |
| 573 | 569 | ||
| 574 | void *obj_extend_section (struct obj_section *sec, unsigned long more); | 570 | static void *obj_extend_section (struct obj_section *sec, unsigned long more); |
| 575 | 571 | ||
| 576 | int obj_string_patch(struct obj_file *f, int secidx, ElfW(Addr) offset, | 572 | static int obj_string_patch(struct obj_file *f, int secidx, ElfW(Addr) offset, |
| 577 | const char *string); | 573 | const char *string); |
| 578 | 574 | ||
| 579 | int obj_symbol_patch(struct obj_file *f, int secidx, ElfW(Addr) offset, | 575 | static int obj_symbol_patch(struct obj_file *f, int secidx, ElfW(Addr) offset, |
| 580 | struct obj_symbol *sym); | 576 | struct obj_symbol *sym); |
| 581 | 577 | ||
| 582 | int obj_check_undefineds(struct obj_file *f); | 578 | static int obj_check_undefineds(struct obj_file *f); |
| 583 | 579 | ||
| 584 | void obj_allocate_commons(struct obj_file *f); | 580 | static void obj_allocate_commons(struct obj_file *f); |
| 585 | 581 | ||
| 586 | unsigned long obj_load_size (struct obj_file *f); | 582 | static unsigned long obj_load_size (struct obj_file *f); |
| 587 | 583 | ||
| 588 | int obj_relocate (struct obj_file *f, ElfW(Addr) base); | 584 | static int obj_relocate (struct obj_file *f, ElfW(Addr) base); |
| 589 | 585 | ||
| 590 | struct obj_file *obj_load(FILE *f, int loadprogbits); | 586 | static struct obj_file *obj_load(FILE *f, int loadprogbits); |
| 591 | 587 | ||
| 592 | int obj_create_image (struct obj_file *f, char *image); | 588 | static int obj_create_image (struct obj_file *f, char *image); |
| 593 | 589 | ||
| 594 | /* Architecture specific manipulation routines. */ | 590 | /* Architecture specific manipulation routines. */ |
| 595 | 591 | ||
| 596 | struct obj_file *arch_new_file (void); | 592 | static struct obj_file *arch_new_file (void); |
| 597 | 593 | ||
| 598 | struct obj_section *arch_new_section (void); | 594 | static struct obj_section *arch_new_section (void); |
| 599 | 595 | ||
| 600 | struct obj_symbol *arch_new_symbol (void); | 596 | static struct obj_symbol *arch_new_symbol (void); |
| 601 | 597 | ||
| 602 | enum obj_reloc arch_apply_relocation (struct obj_file *f, | 598 | static enum obj_reloc arch_apply_relocation (struct obj_file *f, |
| 603 | struct obj_section *targsec, | 599 | struct obj_section *targsec, |
| 604 | struct obj_section *symsec, | 600 | struct obj_section *symsec, |
| 605 | struct obj_symbol *sym, | 601 | struct obj_symbol *sym, |
| 606 | ElfW(RelM) *rel, ElfW(Addr) value); | 602 | ElfW(RelM) *rel, ElfW(Addr) value); |
| 607 | 603 | ||
| 608 | int arch_create_got (struct obj_file *f); | 604 | static int arch_create_got (struct obj_file *f); |
| 609 | 605 | ||
| 610 | struct new_module; | 606 | static int arch_init_module (struct obj_file *f, struct new_module *); |
| 611 | int arch_init_module (struct obj_file *f, struct new_module *); | ||
| 612 | 607 | ||
| 613 | #endif /* obj.h */ | 608 | #endif /* obj.h */ |
| 614 | //---------------------------------------------------------------------------- | 609 | //---------------------------------------------------------------------------- |
| @@ -624,10 +619,10 @@ static const int STRVERSIONLEN = 32; | |||
| 624 | 619 | ||
| 625 | /*======================================================================*/ | 620 | /*======================================================================*/ |
| 626 | 621 | ||
| 627 | int flag_force_load = 0; | 622 | static int flag_force_load = 0; |
| 628 | int flag_autoclean = 0; | 623 | static int flag_autoclean = 0; |
| 629 | int flag_verbose = 0; | 624 | static int flag_verbose = 0; |
| 630 | int flag_export = 1; | 625 | static int flag_export = 1; |
| 631 | 626 | ||
| 632 | 627 | ||
| 633 | /*======================================================================*/ | 628 | /*======================================================================*/ |
| @@ -700,12 +695,12 @@ struct external_module { | |||
| 700 | struct new_module_symbol *syms; | 695 | struct new_module_symbol *syms; |
| 701 | }; | 696 | }; |
| 702 | 697 | ||
| 703 | struct new_module_symbol *ksyms; | 698 | static struct new_module_symbol *ksyms; |
| 704 | size_t nksyms; | 699 | static size_t nksyms; |
| 705 | 700 | ||
| 706 | struct external_module *ext_modules; | 701 | static struct external_module *ext_modules; |
| 707 | int n_ext_modules; | 702 | static int n_ext_modules; |
| 708 | int n_ext_modules_used; | 703 | static int n_ext_modules_used; |
| 709 | extern int delete_module(const char *); | 704 | extern int delete_module(const char *); |
| 710 | 705 | ||
| 711 | static char m_filename[FILENAME_MAX + 1]; | 706 | static char m_filename[FILENAME_MAX + 1]; |
| @@ -740,7 +735,7 @@ static int check_module_name_match(const char *filename, struct stat *statbuf, | |||
| 740 | 735 | ||
| 741 | /*======================================================================*/ | 736 | /*======================================================================*/ |
| 742 | 737 | ||
| 743 | struct obj_file *arch_new_file(void) | 738 | static struct obj_file *arch_new_file(void) |
| 744 | { | 739 | { |
| 745 | struct arch_file *f; | 740 | struct arch_file *f; |
| 746 | f = xmalloc(sizeof(*f)); | 741 | f = xmalloc(sizeof(*f)); |
| @@ -758,12 +753,12 @@ struct obj_file *arch_new_file(void) | |||
| 758 | return &f->root; | 753 | return &f->root; |
| 759 | } | 754 | } |
| 760 | 755 | ||
| 761 | struct obj_section *arch_new_section(void) | 756 | static struct obj_section *arch_new_section(void) |
| 762 | { | 757 | { |
| 763 | return xmalloc(sizeof(struct obj_section)); | 758 | return xmalloc(sizeof(struct obj_section)); |
| 764 | } | 759 | } |
| 765 | 760 | ||
| 766 | struct obj_symbol *arch_new_symbol(void) | 761 | static struct obj_symbol *arch_new_symbol(void) |
| 767 | { | 762 | { |
| 768 | struct arch_symbol *sym; | 763 | struct arch_symbol *sym; |
| 769 | sym = xmalloc(sizeof(*sym)); | 764 | sym = xmalloc(sizeof(*sym)); |
| @@ -778,7 +773,7 @@ struct obj_symbol *arch_new_symbol(void) | |||
| 778 | return &sym->root; | 773 | return &sym->root; |
| 779 | } | 774 | } |
| 780 | 775 | ||
| 781 | enum obj_reloc | 776 | static enum obj_reloc |
| 782 | arch_apply_relocation(struct obj_file *f, | 777 | arch_apply_relocation(struct obj_file *f, |
| 783 | struct obj_section *targsec, | 778 | struct obj_section *targsec, |
| 784 | struct obj_section *symsec, | 779 | struct obj_section *symsec, |
| @@ -1140,7 +1135,7 @@ arch_apply_relocation(struct obj_file *f, | |||
| 1140 | return ret; | 1135 | return ret; |
| 1141 | } | 1136 | } |
| 1142 | 1137 | ||
| 1143 | int arch_create_got(struct obj_file *f) | 1138 | static int arch_create_got(struct obj_file *f) |
| 1144 | { | 1139 | { |
| 1145 | #if defined(BB_USE_GOT_ENTRIES) || defined(BB_USE_PLT_ENTRIES) | 1140 | #if defined(BB_USE_GOT_ENTRIES) || defined(BB_USE_PLT_ENTRIES) |
| 1146 | struct arch_file *ifile = (struct arch_file *) f; | 1141 | struct arch_file *ifile = (struct arch_file *) f; |
| @@ -1271,7 +1266,7 @@ int arch_create_got(struct obj_file *f) | |||
| 1271 | return 1; | 1266 | return 1; |
| 1272 | } | 1267 | } |
| 1273 | 1268 | ||
| 1274 | int arch_init_module(struct obj_file *f, struct new_module *mod) | 1269 | static int arch_init_module(struct obj_file *f, struct new_module *mod) |
| 1275 | { | 1270 | { |
| 1276 | return 1; | 1271 | return 1; |
| 1277 | } | 1272 | } |
| @@ -1280,7 +1275,7 @@ int arch_init_module(struct obj_file *f, struct new_module *mod) | |||
| 1280 | /*======================================================================*/ | 1275 | /*======================================================================*/ |
| 1281 | 1276 | ||
| 1282 | /* Standard ELF hash function. */ | 1277 | /* Standard ELF hash function. */ |
| 1283 | inline unsigned long obj_elf_hash_n(const char *name, unsigned long n) | 1278 | static inline unsigned long obj_elf_hash_n(const char *name, unsigned long n) |
| 1284 | { | 1279 | { |
| 1285 | unsigned long h = 0; | 1280 | unsigned long h = 0; |
| 1286 | unsigned long g; | 1281 | unsigned long g; |
| @@ -1298,7 +1293,7 @@ inline unsigned long obj_elf_hash_n(const char *name, unsigned long n) | |||
| 1298 | return h; | 1293 | return h; |
| 1299 | } | 1294 | } |
| 1300 | 1295 | ||
| 1301 | unsigned long obj_elf_hash(const char *name) | 1296 | static unsigned long obj_elf_hash(const char *name) |
| 1302 | { | 1297 | { |
| 1303 | return obj_elf_hash_n(name, strlen(name)); | 1298 | return obj_elf_hash_n(name, strlen(name)); |
| 1304 | } | 1299 | } |
| @@ -1309,25 +1304,15 @@ unsigned long obj_elf_hash(const char *name) | |||
| 1309 | static int get_kernel_version(char str[STRVERSIONLEN]) | 1304 | static int get_kernel_version(char str[STRVERSIONLEN]) |
| 1310 | { | 1305 | { |
| 1311 | struct utsname uts_info; | 1306 | struct utsname uts_info; |
| 1312 | char *p, *q; | 1307 | int kv; |
| 1313 | int a, b, c; | ||
| 1314 | 1308 | ||
| 1315 | if (uname(&uts_info) < 0) | 1309 | if (uname(&uts_info) < 0) |
| 1316 | return -1; | 1310 | return -1; |
| 1317 | strncpy(str, uts_info.release, STRVERSIONLEN); | 1311 | strncpy(str, uts_info.release, STRVERSIONLEN); |
| 1318 | p = uts_info.release; | ||
| 1319 | 1312 | ||
| 1320 | a = strtoul(p, &p, 10); | 1313 | kv = get_kernel_revision(); |
| 1321 | if (*p != '.') | 1314 | if(kv==0) |
| 1322 | return -1; | ||
| 1323 | b = strtoul(p + 1, &p, 10); | ||
| 1324 | if (*p != '.') | ||
| 1325 | return -1; | 1315 | return -1; |
| 1326 | c = strtoul(p + 1, &q, 10); | ||
| 1327 | if (p + 1 == q) | ||
| 1328 | return -1; | ||
| 1329 | |||
| 1330 | return a << 16 | b << 8 | c; | ||
| 1331 | } | 1316 | } |
| 1332 | 1317 | ||
| 1333 | /* String comparison for non-co-versioned kernel and module. */ | 1318 | /* String comparison for non-co-versioned kernel and module. */ |
| @@ -1355,7 +1340,7 @@ static unsigned long ncv_symbol_hash(const char *str) | |||
| 1355 | return obj_elf_hash_n(str, len); | 1340 | return obj_elf_hash_n(str, len); |
| 1356 | } | 1341 | } |
| 1357 | 1342 | ||
| 1358 | void | 1343 | static void |
| 1359 | obj_set_symbol_compare(struct obj_file *f, | 1344 | obj_set_symbol_compare(struct obj_file *f, |
| 1360 | int (*cmp) (const char *, const char *), | 1345 | int (*cmp) (const char *, const char *), |
| 1361 | unsigned long (*hash) (const char *)) | 1346 | unsigned long (*hash) (const char *)) |
| @@ -1383,8 +1368,8 @@ obj_set_symbol_compare(struct obj_file *f, | |||
| 1383 | 1368 | ||
| 1384 | #endif /* BB_FEATURE_INSMOD_VERSION_CHECKING */ | 1369 | #endif /* BB_FEATURE_INSMOD_VERSION_CHECKING */ |
| 1385 | 1370 | ||
| 1386 | 1371 | static struct obj_symbol * | |
| 1387 | struct obj_symbol *obj_add_symbol(struct obj_file *f, const char *name, | 1372 | obj_add_symbol(struct obj_file *f, const char *name, |
| 1388 | unsigned long symidx, int info, | 1373 | unsigned long symidx, int info, |
| 1389 | int secidx, ElfW(Addr) value, | 1374 | int secidx, ElfW(Addr) value, |
| 1390 | unsigned long size) | 1375 | unsigned long size) |
| @@ -1478,7 +1463,8 @@ struct obj_symbol *obj_add_symbol(struct obj_file *f, const char *name, | |||
| 1478 | return sym; | 1463 | return sym; |
| 1479 | } | 1464 | } |
| 1480 | 1465 | ||
| 1481 | struct obj_symbol *obj_find_symbol(struct obj_file *f, const char *name) | 1466 | static struct obj_symbol * |
| 1467 | obj_find_symbol(struct obj_file *f, const char *name) | ||
| 1482 | { | 1468 | { |
| 1483 | struct obj_symbol *sym; | 1469 | struct obj_symbol *sym; |
| 1484 | unsigned long hash = f->symbol_hash(name) % HASH_BUCKETS; | 1470 | unsigned long hash = f->symbol_hash(name) % HASH_BUCKETS; |
| @@ -1490,7 +1476,7 @@ struct obj_symbol *obj_find_symbol(struct obj_file *f, const char *name) | |||
| 1490 | return NULL; | 1476 | return NULL; |
| 1491 | } | 1477 | } |
| 1492 | 1478 | ||
| 1493 | ElfW(Addr) | 1479 | static ElfW(Addr) |
| 1494 | obj_symbol_final_value(struct obj_file * f, struct obj_symbol * sym) | 1480 | obj_symbol_final_value(struct obj_file * f, struct obj_symbol * sym) |
| 1495 | { | 1481 | { |
| 1496 | if (sym) { | 1482 | if (sym) { |
| @@ -1504,7 +1490,7 @@ ElfW(Addr) | |||
| 1504 | } | 1490 | } |
| 1505 | } | 1491 | } |
| 1506 | 1492 | ||
| 1507 | struct obj_section *obj_find_section(struct obj_file *f, const char *name) | 1493 | static struct obj_section *obj_find_section(struct obj_file *f, const char *name) |
| 1508 | { | 1494 | { |
| 1509 | int i, n = f->header.e_shnum; | 1495 | int i, n = f->header.e_shnum; |
| 1510 | 1496 | ||
| @@ -1537,7 +1523,7 @@ static int obj_load_order_prio(struct obj_section *a) | |||
| 1537 | return ac; | 1523 | return ac; |
| 1538 | } | 1524 | } |
| 1539 | 1525 | ||
| 1540 | void | 1526 | static void |
| 1541 | obj_insert_section_load_order(struct obj_file *f, struct obj_section *sec) | 1527 | obj_insert_section_load_order(struct obj_file *f, struct obj_section *sec) |
| 1542 | { | 1528 | { |
| 1543 | struct obj_section **p; | 1529 | struct obj_section **p; |
| @@ -1549,7 +1535,7 @@ obj_insert_section_load_order(struct obj_file *f, struct obj_section *sec) | |||
| 1549 | *p = sec; | 1535 | *p = sec; |
| 1550 | } | 1536 | } |
| 1551 | 1537 | ||
| 1552 | struct obj_section *obj_create_alloced_section(struct obj_file *f, | 1538 | static struct obj_section *obj_create_alloced_section(struct obj_file *f, |
| 1553 | const char *name, | 1539 | const char *name, |
| 1554 | unsigned long align, | 1540 | unsigned long align, |
| 1555 | unsigned long size) | 1541 | unsigned long size) |
| @@ -1575,7 +1561,7 @@ struct obj_section *obj_create_alloced_section(struct obj_file *f, | |||
| 1575 | return sec; | 1561 | return sec; |
| 1576 | } | 1562 | } |
| 1577 | 1563 | ||
| 1578 | struct obj_section *obj_create_alloced_section_first(struct obj_file *f, | 1564 | static struct obj_section *obj_create_alloced_section_first(struct obj_file *f, |
| 1579 | const char *name, | 1565 | const char *name, |
| 1580 | unsigned long align, | 1566 | unsigned long align, |
| 1581 | unsigned long size) | 1567 | unsigned long size) |
| @@ -1604,7 +1590,7 @@ struct obj_section *obj_create_alloced_section_first(struct obj_file *f, | |||
| 1604 | return sec; | 1590 | return sec; |
| 1605 | } | 1591 | } |
| 1606 | 1592 | ||
| 1607 | void *obj_extend_section(struct obj_section *sec, unsigned long more) | 1593 | static void *obj_extend_section(struct obj_section *sec, unsigned long more) |
| 1608 | { | 1594 | { |
| 1609 | unsigned long oldsize = sec->header.sh_size; | 1595 | unsigned long oldsize = sec->header.sh_size; |
| 1610 | if (more) { | 1596 | if (more) { |
| @@ -1614,7 +1600,6 @@ void *obj_extend_section(struct obj_section *sec, unsigned long more) | |||
| 1614 | } | 1600 | } |
| 1615 | 1601 | ||
| 1616 | 1602 | ||
| 1617 | |||
| 1618 | /* Conditionally add the symbols from the given symbol set to the | 1603 | /* Conditionally add the symbols from the given symbol set to the |
| 1619 | new module. */ | 1604 | new module. */ |
| 1620 | 1605 | ||
| @@ -2631,7 +2616,7 @@ new_init_module(const char *m_name, struct obj_file *f, | |||
| 2631 | 2616 | ||
| 2632 | /*======================================================================*/ | 2617 | /*======================================================================*/ |
| 2633 | 2618 | ||
| 2634 | int | 2619 | static int |
| 2635 | obj_string_patch(struct obj_file *f, int secidx, ElfW(Addr) offset, | 2620 | obj_string_patch(struct obj_file *f, int secidx, ElfW(Addr) offset, |
| 2636 | const char *string) | 2621 | const char *string) |
| 2637 | { | 2622 | { |
| @@ -2660,7 +2645,7 @@ obj_string_patch(struct obj_file *f, int secidx, ElfW(Addr) offset, | |||
| 2660 | return 1; | 2645 | return 1; |
| 2661 | } | 2646 | } |
| 2662 | 2647 | ||
| 2663 | int | 2648 | static int |
| 2664 | obj_symbol_patch(struct obj_file *f, int secidx, ElfW(Addr) offset, | 2649 | obj_symbol_patch(struct obj_file *f, int secidx, ElfW(Addr) offset, |
| 2665 | struct obj_symbol *sym) | 2650 | struct obj_symbol *sym) |
| 2666 | { | 2651 | { |
| @@ -2676,7 +2661,7 @@ obj_symbol_patch(struct obj_file *f, int secidx, ElfW(Addr) offset, | |||
| 2676 | return 1; | 2661 | return 1; |
| 2677 | } | 2662 | } |
| 2678 | 2663 | ||
| 2679 | int obj_check_undefineds(struct obj_file *f) | 2664 | static int obj_check_undefineds(struct obj_file *f) |
| 2680 | { | 2665 | { |
| 2681 | unsigned long i; | 2666 | unsigned long i; |
| 2682 | int ret = 1; | 2667 | int ret = 1; |
| @@ -2698,7 +2683,7 @@ int obj_check_undefineds(struct obj_file *f) | |||
| 2698 | return ret; | 2683 | return ret; |
| 2699 | } | 2684 | } |
| 2700 | 2685 | ||
| 2701 | void obj_allocate_commons(struct obj_file *f) | 2686 | static void obj_allocate_commons(struct obj_file *f) |
| 2702 | { | 2687 | { |
| 2703 | struct common_entry { | 2688 | struct common_entry { |
| 2704 | struct common_entry *next; | 2689 | struct common_entry *next; |
| @@ -2807,7 +2792,7 @@ void obj_allocate_commons(struct obj_file *f) | |||
| 2807 | } | 2792 | } |
| 2808 | } | 2793 | } |
| 2809 | 2794 | ||
| 2810 | unsigned long obj_load_size(struct obj_file *f) | 2795 | static unsigned long obj_load_size(struct obj_file *f) |
| 2811 | { | 2796 | { |
| 2812 | unsigned long dot = 0; | 2797 | unsigned long dot = 0; |
| 2813 | struct obj_section *sec; | 2798 | struct obj_section *sec; |
| @@ -2828,7 +2813,7 @@ unsigned long obj_load_size(struct obj_file *f) | |||
| 2828 | return dot; | 2813 | return dot; |
| 2829 | } | 2814 | } |
| 2830 | 2815 | ||
| 2831 | int obj_relocate(struct obj_file *f, ElfW(Addr) base) | 2816 | static int obj_relocate(struct obj_file *f, ElfW(Addr) base) |
| 2832 | { | 2817 | { |
| 2833 | int i, n = f->header.e_shnum; | 2818 | int i, n = f->header.e_shnum; |
| 2834 | int ret = 1; | 2819 | int ret = 1; |
| @@ -2958,7 +2943,7 @@ int obj_relocate(struct obj_file *f, ElfW(Addr) base) | |||
| 2958 | return ret; | 2943 | return ret; |
| 2959 | } | 2944 | } |
| 2960 | 2945 | ||
| 2961 | int obj_create_image(struct obj_file *f, char *image) | 2946 | static int obj_create_image(struct obj_file *f, char *image) |
| 2962 | { | 2947 | { |
| 2963 | struct obj_section *sec; | 2948 | struct obj_section *sec; |
| 2964 | ElfW(Addr) base = f->baseaddr; | 2949 | ElfW(Addr) base = f->baseaddr; |
| @@ -2980,7 +2965,7 @@ int obj_create_image(struct obj_file *f, char *image) | |||
| 2980 | 2965 | ||
| 2981 | /*======================================================================*/ | 2966 | /*======================================================================*/ |
| 2982 | 2967 | ||
| 2983 | struct obj_file *obj_load(FILE * fp, int loadprogbits) | 2968 | static struct obj_file *obj_load(FILE * fp, int loadprogbits) |
| 2984 | { | 2969 | { |
| 2985 | struct obj_file *f; | 2970 | struct obj_file *f; |
| 2986 | ElfW(Shdr) * section_headers; | 2971 | ElfW(Shdr) * section_headers; |
| @@ -3186,7 +3171,7 @@ struct obj_file *obj_load(FILE * fp, int loadprogbits) | |||
| 3186 | * kernel for the module | 3171 | * kernel for the module |
| 3187 | */ | 3172 | */ |
| 3188 | 3173 | ||
| 3189 | int obj_load_progbits(FILE * fp, struct obj_file* f) | 3174 | static int obj_load_progbits(FILE * fp, struct obj_file* f) |
| 3190 | { | 3175 | { |
| 3191 | char* imagebase = (char*) f->imagebase; | 3176 | char* imagebase = (char*) f->imagebase; |
| 3192 | ElfW(Addr) base = f->baseaddr; | 3177 | ElfW(Addr) base = f->baseaddr; |
