diff options
Diffstat (limited to 'modutils')
| -rw-r--r-- | modutils/insmod.c | 100 |
1 files changed, 53 insertions, 47 deletions
diff --git a/modutils/insmod.c b/modutils/insmod.c index 38bddbb6f..2560aee25 100644 --- a/modutils/insmod.c +++ b/modutils/insmod.c | |||
| @@ -528,6 +528,12 @@ static const int MODUTILS_OBJ_H = 1; | |||
| 528 | # define ELF64_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf)) | 528 | # define ELF64_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf)) |
| 529 | #endif | 529 | #endif |
| 530 | 530 | ||
| 531 | #define ELF_ST_BIND(info) ELFW(ST_BIND)(info) | ||
| 532 | #define ELF_ST_TYPE(info) ELFW(ST_TYPE)(info) | ||
| 533 | #define ELF_ST_INFO(bind, type) ELFW(ST_INFO)(bind, type) | ||
| 534 | #define ELF_R_TYPE(val) ELFW(R_TYPE)(val) | ||
| 535 | #define ELF_R_SYM(val) ELFW(R_SYM)(val) | ||
| 536 | |||
| 531 | struct obj_string_patch; | 537 | struct obj_string_patch; |
| 532 | struct obj_symbol_patch; | 538 | struct obj_symbol_patch; |
| 533 | 539 | ||
| @@ -726,8 +732,8 @@ struct arch_single_entry | |||
| 726 | struct mips_hi16 | 732 | struct mips_hi16 |
| 727 | { | 733 | { |
| 728 | struct mips_hi16 *next; | 734 | struct mips_hi16 *next; |
| 729 | Elf32_Addr *addr; | 735 | ElfW(Addr) *addr; |
| 730 | Elf32_Addr value; | 736 | ElfW(Addr) value; |
| 731 | }; | 737 | }; |
| 732 | #endif | 738 | #endif |
| 733 | 739 | ||
| @@ -859,7 +865,7 @@ arch_apply_relocation(struct obj_file *f, | |||
| 859 | #endif | 865 | #endif |
| 860 | #endif | 866 | #endif |
| 861 | 867 | ||
| 862 | switch (ELF32_R_TYPE(rel->r_info)) { | 868 | switch (ELF_R_TYPE(rel->r_info)) { |
| 863 | 869 | ||
| 864 | #if defined(__arm__) | 870 | #if defined(__arm__) |
| 865 | case R_ARM_NONE: | 871 | case R_ARM_NONE: |
| @@ -921,7 +927,7 @@ arch_apply_relocation(struct obj_file *f, | |||
| 921 | ip = (unsigned long *)(ifile->plt->contents + pe->offset); | 927 | ip = (unsigned long *)(ifile->plt->contents + pe->offset); |
| 922 | ip[0] = 0x0d105810; /* basr 1,0; lg 1,10(1); br 1 */ | 928 | ip[0] = 0x0d105810; /* basr 1,0; lg 1,10(1); br 1 */ |
| 923 | ip[1] = 0x100607f1; | 929 | ip[1] = 0x100607f1; |
| 924 | if (ELF32_R_TYPE(rel->r_info) == R_390_PLT16DBL) | 930 | if (ELF_R_TYPE(rel->r_info) == R_390_PLT16DBL) |
| 925 | ip[2] = v - 2; | 931 | ip[2] = v - 2; |
| 926 | else | 932 | else |
| 927 | ip[2] = v; | 933 | ip[2] = v; |
| @@ -930,9 +936,9 @@ arch_apply_relocation(struct obj_file *f, | |||
| 930 | 936 | ||
| 931 | /* Insert relative distance to target. */ | 937 | /* Insert relative distance to target. */ |
| 932 | v = plt + pe->offset - dot; | 938 | v = plt + pe->offset - dot; |
| 933 | if (ELF32_R_TYPE(rel->r_info) == R_390_PLT32) | 939 | if (ELF_R_TYPE(rel->r_info) == R_390_PLT32) |
| 934 | *(unsigned int *) loc = (unsigned int) v; | 940 | *(unsigned int *) loc = (unsigned int) v; |
| 935 | else if (ELF32_R_TYPE(rel->r_info) == R_390_PLT16DBL) | 941 | else if (ELF_R_TYPE(rel->r_info) == R_390_PLT16DBL) |
| 936 | *(unsigned short *) loc = (unsigned short) ((v + 2) >> 1); | 942 | *(unsigned short *) loc = (unsigned short) ((v + 2) >> 1); |
| 937 | break; | 943 | break; |
| 938 | 944 | ||
| @@ -958,13 +964,13 @@ arch_apply_relocation(struct obj_file *f, | |||
| 958 | if (!isym->gotent.inited) | 964 | if (!isym->gotent.inited) |
| 959 | { | 965 | { |
| 960 | isym->gotent.inited = 1; | 966 | isym->gotent.inited = 1; |
| 961 | *(Elf32_Addr *)(ifile->got->contents + isym->gotent.offset) = v; | 967 | *(ElfW(Addr) *)(ifile->got->contents + isym->gotent.offset) = v; |
| 962 | } | 968 | } |
| 963 | if (ELF32_R_TYPE(rel->r_info) == R_390_GOT12) | 969 | if (ELF_R_TYPE(rel->r_info) == R_390_GOT12) |
| 964 | *(unsigned short *) loc |= (*(unsigned short *) loc + isym->gotent.offset) & 0xfff; | 970 | *(unsigned short *) loc |= (*(unsigned short *) loc + isym->gotent.offset) & 0xfff; |
| 965 | else if (ELF32_R_TYPE(rel->r_info) == R_390_GOT16) | 971 | else if (ELF_R_TYPE(rel->r_info) == R_390_GOT16) |
| 966 | *(unsigned short *) loc += isym->gotent.offset; | 972 | *(unsigned short *) loc += isym->gotent.offset; |
| 967 | else if (ELF32_R_TYPE(rel->r_info) == R_390_GOT32) | 973 | else if (ELF_R_TYPE(rel->r_info) == R_390_GOT32) |
| 968 | *(unsigned int *) loc += isym->gotent.offset; | 974 | *(unsigned int *) loc += isym->gotent.offset; |
| 969 | break; | 975 | break; |
| 970 | 976 | ||
| @@ -1106,8 +1112,8 @@ arch_apply_relocation(struct obj_file *f, | |||
| 1106 | 1112 | ||
| 1107 | case R_68K_PC8: | 1113 | case R_68K_PC8: |
| 1108 | v -= dot; | 1114 | v -= dot; |
| 1109 | if ((Elf32_Sword)v > 0x7f || | 1115 | if ((ElfW(Sword))v > 0x7f || |
| 1110 | (Elf32_Sword)v < -(Elf32_Sword)0x80) { | 1116 | (ElfW(Sword))v < -(ElfW(Sword))0x80) { |
| 1111 | ret = obj_reloc_overflow; | 1117 | ret = obj_reloc_overflow; |
| 1112 | } | 1118 | } |
| 1113 | *(char *)loc = v; | 1119 | *(char *)loc = v; |
| @@ -1115,8 +1121,8 @@ arch_apply_relocation(struct obj_file *f, | |||
| 1115 | 1121 | ||
| 1116 | case R_68K_PC16: | 1122 | case R_68K_PC16: |
| 1117 | v -= dot; | 1123 | v -= dot; |
| 1118 | if ((Elf32_Sword)v > 0x7fff || | 1124 | if ((ElfW(Sword))v > 0x7fff || |
| 1119 | (Elf32_Sword)v < -(Elf32_Sword)0x8000) { | 1125 | (ElfW(Sword))v < -(ElfW(Sword))0x8000) { |
| 1120 | ret = obj_reloc_overflow; | 1126 | ret = obj_reloc_overflow; |
| 1121 | } | 1127 | } |
| 1122 | *(short *)loc = v; | 1128 | *(short *)loc = v; |
| @@ -1182,7 +1188,7 @@ arch_apply_relocation(struct obj_file *f, | |||
| 1182 | case R_MIPS_LO16: | 1188 | case R_MIPS_LO16: |
| 1183 | { | 1189 | { |
| 1184 | unsigned long insnlo = *loc; | 1190 | unsigned long insnlo = *loc; |
| 1185 | Elf32_Addr val, vallo; | 1191 | ElfW(Addr) val, vallo; |
| 1186 | 1192 | ||
| 1187 | /* Sign extend the addend we extract from the lo insn. */ | 1193 | /* Sign extend the addend we extract from the lo insn. */ |
| 1188 | vallo = ((insnlo & 0xffff) ^ 0x8000) - 0x8000; | 1194 | vallo = ((insnlo & 0xffff) ^ 0x8000) - 0x8000; |
| @@ -1300,9 +1306,9 @@ arch_apply_relocation(struct obj_file *f, | |||
| 1300 | case R_SH_IMM_MEDLOW16: | 1306 | case R_SH_IMM_MEDLOW16: |
| 1301 | case R_SH_IMM_LOW16: | 1307 | case R_SH_IMM_LOW16: |
| 1302 | { | 1308 | { |
| 1303 | Elf32_Addr word; | 1309 | ElfW(Addr) word; |
| 1304 | 1310 | ||
| 1305 | if (ELF32_R_TYPE(rel->r_info) == R_SH_IMM_MEDLOW16) | 1311 | if (ELF_R_TYPE(rel->r_info) == R_SH_IMM_MEDLOW16) |
| 1306 | v >>= 16; | 1312 | v >>= 16; |
| 1307 | 1313 | ||
| 1308 | /* | 1314 | /* |
| @@ -1324,13 +1330,13 @@ arch_apply_relocation(struct obj_file *f, | |||
| 1324 | case R_SH_IMM_MEDLOW16_PCREL: | 1330 | case R_SH_IMM_MEDLOW16_PCREL: |
| 1325 | case R_SH_IMM_LOW16_PCREL: | 1331 | case R_SH_IMM_LOW16_PCREL: |
| 1326 | { | 1332 | { |
| 1327 | Elf32_Addr word; | 1333 | ElfW(Addr) word; |
| 1328 | 1334 | ||
| 1329 | word = *loc & ~0x3fffc00; | 1335 | word = *loc & ~0x3fffc00; |
| 1330 | 1336 | ||
| 1331 | v -= dot; | 1337 | v -= dot; |
| 1332 | 1338 | ||
| 1333 | if (ELF32_R_TYPE(rel->r_info) == R_SH_IMM_MEDLOW16_PCREL) | 1339 | if (ELF_R_TYPE(rel->r_info) == R_SH_IMM_MEDLOW16_PCREL) |
| 1334 | v >>= 16; | 1340 | v >>= 16; |
| 1335 | 1341 | ||
| 1336 | word |= (v & 0xffff) << 10; | 1342 | word |= (v & 0xffff) << 10; |
| @@ -1343,7 +1349,7 @@ arch_apply_relocation(struct obj_file *f, | |||
| 1343 | #endif /* __sh__ */ | 1349 | #endif /* __sh__ */ |
| 1344 | 1350 | ||
| 1345 | default: | 1351 | default: |
| 1346 | printf("Warning: unhandled reloc %d\n",(int)ELF32_R_TYPE(rel->r_info)); | 1352 | printf("Warning: unhandled reloc %d\n",(int)ELF_R_TYPE(rel->r_info)); |
| 1347 | ret = obj_reloc_unhandled; | 1353 | ret = obj_reloc_unhandled; |
| 1348 | break; | 1354 | break; |
| 1349 | 1355 | ||
| @@ -1391,16 +1397,16 @@ arch_apply_relocation(struct obj_file *f, | |||
| 1391 | break; | 1397 | break; |
| 1392 | case R_H8_PCREL16: | 1398 | case R_H8_PCREL16: |
| 1393 | v -= dot + 2; | 1399 | v -= dot + 2; |
| 1394 | if ((Elf32_Sword)v > 0x7fff || | 1400 | if ((ElfW(Sword))v > 0x7fff || |
| 1395 | (Elf32_Sword)v < -(Elf32_Sword)0x8000) | 1401 | (ElfW(Sword))v < -(ElfW(Sword))0x8000) |
| 1396 | ret = obj_reloc_overflow; | 1402 | ret = obj_reloc_overflow; |
| 1397 | else | 1403 | else |
| 1398 | *(unsigned short *)loc = v; | 1404 | *(unsigned short *)loc = v; |
| 1399 | break; | 1405 | break; |
| 1400 | case R_H8_PCREL8: | 1406 | case R_H8_PCREL8: |
| 1401 | v -= dot + 1; | 1407 | v -= dot + 1; |
| 1402 | if ((Elf32_Sword)v > 0x7f || | 1408 | if ((ElfW(Sword))v > 0x7f || |
| 1403 | (Elf32_Sword)v < -(Elf32_Sword)0x80) | 1409 | (ElfW(Sword))v < -(ElfW(Sword))0x80) |
| 1404 | ret = obj_reloc_overflow; | 1410 | ret = obj_reloc_overflow; |
| 1405 | else | 1411 | else |
| 1406 | *(unsigned char *)loc = v; | 1412 | *(unsigned char *)loc = v; |
| @@ -1453,7 +1459,7 @@ bb_use_plt: | |||
| 1453 | #if defined (__arm__) || defined (__powerpc__) | 1459 | #if defined (__arm__) || defined (__powerpc__) |
| 1454 | if ((int)v < -0x02000000 || (int)v >= 0x02000000) | 1460 | if ((int)v < -0x02000000 || (int)v >= 0x02000000) |
| 1455 | #elif defined (__v850e__) | 1461 | #elif defined (__v850e__) |
| 1456 | if ((Elf32_Sword)v > 0x1fffff || (Elf32_Sword)v < (Elf32_Sword)-0x200000) | 1462 | if ((ElfW(Sword))v > 0x1fffff || (ElfW(Sword))v < (ElfW(Sword))-0x200000) |
| 1457 | #endif | 1463 | #endif |
| 1458 | /* go via the plt */ | 1464 | /* go via the plt */ |
| 1459 | v = plt + pe->offset - dot; | 1465 | v = plt + pe->offset - dot; |
| @@ -1610,7 +1616,7 @@ static void arch_create_got(struct obj_file *f) | |||
| 1610 | strtab = (const char *) strsec->contents; | 1616 | strtab = (const char *) strsec->contents; |
| 1611 | 1617 | ||
| 1612 | for (; rel < relend; ++rel) { | 1618 | for (; rel < relend; ++rel) { |
| 1613 | extsym = &symtab[ELF32_R_SYM(rel->r_info)]; | 1619 | extsym = &symtab[ELF_R_SYM(rel->r_info)]; |
| 1614 | 1620 | ||
| 1615 | #if defined(CONFIG_USE_GOT_ENTRIES) | 1621 | #if defined(CONFIG_USE_GOT_ENTRIES) |
| 1616 | got_allocate = 0; | 1622 | got_allocate = 0; |
| @@ -1619,7 +1625,7 @@ static void arch_create_got(struct obj_file *f) | |||
| 1619 | plt_allocate = 0; | 1625 | plt_allocate = 0; |
| 1620 | #endif | 1626 | #endif |
| 1621 | 1627 | ||
| 1622 | switch (ELF32_R_TYPE(rel->r_info)) { | 1628 | switch (ELF_R_TYPE(rel->r_info)) { |
| 1623 | #if defined(__arm__) | 1629 | #if defined(__arm__) |
| 1624 | case R_ARM_PC24: | 1630 | case R_ARM_PC24: |
| 1625 | case R_ARM_PLT32: | 1631 | case R_ARM_PLT32: |
| @@ -1818,15 +1824,15 @@ obj_add_symbol(struct obj_file *f, const char *name, | |||
| 1818 | { | 1824 | { |
| 1819 | struct obj_symbol *sym; | 1825 | struct obj_symbol *sym; |
| 1820 | unsigned long hash = f->symbol_hash(name) % HASH_BUCKETS; | 1826 | unsigned long hash = f->symbol_hash(name) % HASH_BUCKETS; |
| 1821 | int n_type = ELFW(ST_TYPE) (info); | 1827 | int n_type = ELF_ST_TYPE(info); |
| 1822 | int n_binding = ELFW(ST_BIND) (info); | 1828 | int n_binding = ELF_ST_BIND(info); |
| 1823 | 1829 | ||
| 1824 | for (sym = f->symtab[hash]; sym; sym = sym->next) | 1830 | for (sym = f->symtab[hash]; sym; sym = sym->next) |
| 1825 | if (f->symbol_cmp(sym->name, name) == 0) { | 1831 | if (f->symbol_cmp(sym->name, name) == 0) { |
| 1826 | int o_secidx = sym->secidx; | 1832 | int o_secidx = sym->secidx; |
| 1827 | int o_info = sym->info; | 1833 | int o_info = sym->info; |
| 1828 | int o_type = ELFW(ST_TYPE) (o_info); | 1834 | int o_type = ELF_ST_TYPE(o_info); |
| 1829 | int o_binding = ELFW(ST_BIND) (o_info); | 1835 | int o_binding = ELF_ST_BIND(o_info); |
| 1830 | 1836 | ||
| 1831 | /* A redefinition! Is it legal? */ | 1837 | /* A redefinition! Is it legal? */ |
| 1832 | 1838 | ||
| @@ -1887,7 +1893,7 @@ obj_add_symbol(struct obj_file *f, const char *name, | |||
| 1887 | f->symtab[hash] = sym; | 1893 | f->symtab[hash] = sym; |
| 1888 | sym->ksymidx = -1; | 1894 | sym->ksymidx = -1; |
| 1889 | 1895 | ||
| 1890 | if (ELFW(ST_BIND)(info) == STB_LOCAL && symidx != -1) { | 1896 | if (ELF_ST_BIND(info) == STB_LOCAL && symidx != -1) { |
| 1891 | if (symidx >= f->local_symtab_size) | 1897 | if (symidx >= f->local_symtab_size) |
| 1892 | bb_error_msg("local symbol %s with index %ld exceeds local_symtab_size %ld", | 1898 | bb_error_msg("local symbol %s with index %ld exceeds local_symtab_size %ld", |
| 1893 | name, (long) symidx, (long) f->local_symtab_size); | 1899 | name, (long) symidx, (long) f->local_symtab_size); |
| @@ -2101,14 +2107,14 @@ add_symbols_from( struct obj_file *f, | |||
| 2101 | #endif /* SYMBOL_PREFIX */ | 2107 | #endif /* SYMBOL_PREFIX */ |
| 2102 | 2108 | ||
| 2103 | sym = obj_find_symbol(f, name); | 2109 | sym = obj_find_symbol(f, name); |
| 2104 | if (sym && !(ELFW(ST_BIND) (sym->info) == STB_LOCAL)) { | 2110 | if (sym && !(ELF_ST_BIND(sym->info) == STB_LOCAL)) { |
| 2105 | #ifdef SYMBOL_PREFIX | 2111 | #ifdef SYMBOL_PREFIX |
| 2106 | /* Put NAME_BUF into more permanent storage. */ | 2112 | /* Put NAME_BUF into more permanent storage. */ |
| 2107 | name = xmalloc (name_size); | 2113 | name = xmalloc (name_size); |
| 2108 | strcpy (name, name_buf); | 2114 | strcpy (name, name_buf); |
| 2109 | #endif | 2115 | #endif |
| 2110 | sym = obj_add_symbol(f, name, -1, | 2116 | sym = obj_add_symbol(f, name, -1, |
| 2111 | ELFW(ST_INFO) (STB_GLOBAL, | 2117 | ELF_ST_INFO(STB_GLOBAL, |
| 2112 | STT_NOTYPE), | 2118 | STT_NOTYPE), |
| 2113 | idx, s->value, 0); | 2119 | idx, s->value, 0); |
| 2114 | /* Did our symbol just get installed? If so, mark the | 2120 | /* Did our symbol just get installed? If so, mark the |
| @@ -2569,7 +2575,7 @@ static int new_create_this_module(struct obj_file *f, const char *m_name) | |||
| 2569 | memset(sec->contents, 0, sizeof(struct new_module)); | 2575 | memset(sec->contents, 0, sizeof(struct new_module)); |
| 2570 | 2576 | ||
| 2571 | obj_add_symbol(f, SPFX "__this_module", -1, | 2577 | obj_add_symbol(f, SPFX "__this_module", -1, |
| 2572 | ELFW(ST_INFO) (STB_LOCAL, STT_OBJECT), sec->idx, 0, | 2578 | ELF_ST_INFO(STB_LOCAL, STT_OBJECT), sec->idx, 0, |
| 2573 | sizeof(struct new_module)); | 2579 | sizeof(struct new_module)); |
| 2574 | 2580 | ||
| 2575 | obj_string_patch(f, sec->idx, offsetof(struct new_module, name), | 2581 | obj_string_patch(f, sec->idx, offsetof(struct new_module, name), |
| @@ -2658,7 +2664,7 @@ static int new_create_module_ksymtab(struct obj_file *f) | |||
| 2658 | for (nsyms = i = 0; i < HASH_BUCKETS; ++i) { | 2664 | for (nsyms = i = 0; i < HASH_BUCKETS; ++i) { |
| 2659 | struct obj_symbol *sym; | 2665 | struct obj_symbol *sym; |
| 2660 | for (sym = f->symtab[i]; sym; sym = sym->next) | 2666 | for (sym = f->symtab[i]; sym; sym = sym->next) |
| 2661 | if (ELFW(ST_BIND) (sym->info) != STB_LOCAL | 2667 | if (ELF_ST_BIND(sym->info) != STB_LOCAL |
| 2662 | && sym->secidx <= SHN_HIRESERVE | 2668 | && sym->secidx <= SHN_HIRESERVE |
| 2663 | && (sym->secidx >= SHN_LORESERVE | 2669 | && (sym->secidx >= SHN_LORESERVE |
| 2664 | || loaded[sym->secidx])) { | 2670 | || loaded[sym->secidx])) { |
| @@ -2815,7 +2821,7 @@ static int obj_check_undefineds(struct obj_file *f) | |||
| 2815 | struct obj_symbol *sym; | 2821 | struct obj_symbol *sym; |
| 2816 | for (sym = f->symtab[i]; sym; sym = sym->next) | 2822 | for (sym = f->symtab[i]; sym; sym = sym->next) |
| 2817 | if (sym->secidx == SHN_UNDEF) { | 2823 | if (sym->secidx == SHN_UNDEF) { |
| 2818 | if (ELFW(ST_BIND) (sym->info) == STB_WEAK) { | 2824 | if (ELF_ST_BIND(sym->info) == STB_WEAK) { |
| 2819 | sym->secidx = SHN_ABS; | 2825 | sym->secidx = SHN_ABS; |
| 2820 | sym->value = 0; | 2826 | sym->value = 0; |
| 2821 | } else { | 2827 | } else { |
| @@ -3001,12 +3007,12 @@ static int obj_relocate(struct obj_file *f, ElfW(Addr) base) | |||
| 3001 | 3007 | ||
| 3002 | /* Attempt to find a value to use for this relocation. */ | 3008 | /* Attempt to find a value to use for this relocation. */ |
| 3003 | 3009 | ||
| 3004 | symndx = ELFW(R_SYM) (rel->r_info); | 3010 | symndx = ELF_R_SYM(rel->r_info); |
| 3005 | if (symndx) { | 3011 | if (symndx) { |
| 3006 | /* Note we've already checked for undefined symbols. */ | 3012 | /* Note we've already checked for undefined symbols. */ |
| 3007 | 3013 | ||
| 3008 | extsym = &symtab[symndx]; | 3014 | extsym = &symtab[symndx]; |
| 3009 | if (ELFW(ST_BIND) (extsym->st_info) == STB_LOCAL) { | 3015 | if (ELF_ST_BIND(extsym->st_info) == STB_LOCAL) { |
| 3010 | /* Local symbols we look up in the local table to be sure | 3016 | /* Local symbols we look up in the local table to be sure |
| 3011 | we get the one that is really intended. */ | 3017 | we get the one that is really intended. */ |
| 3012 | intsym = f->local_symtab[symndx]; | 3018 | intsym = f->local_symtab[symndx]; |
| @@ -3027,7 +3033,7 @@ static int obj_relocate(struct obj_file *f, ElfW(Addr) base) | |||
| 3027 | #if defined(__alpha__) && defined(AXP_BROKEN_GAS) | 3033 | #if defined(__alpha__) && defined(AXP_BROKEN_GAS) |
| 3028 | /* Work around a nasty GAS bug, that is fixed as of 2.7.0.9. */ | 3034 | /* Work around a nasty GAS bug, that is fixed as of 2.7.0.9. */ |
| 3029 | if (!extsym || !extsym->st_name || | 3035 | if (!extsym || !extsym->st_name || |
| 3030 | ELFW(ST_BIND) (extsym->st_info) != STB_LOCAL) | 3036 | ELF_ST_BIND(extsym->st_info) != STB_LOCAL) |
| 3031 | #endif | 3037 | #endif |
| 3032 | value += rel->r_addend; | 3038 | value += rel->r_addend; |
| 3033 | #endif | 3039 | #endif |
| @@ -3049,11 +3055,11 @@ static int obj_relocate(struct obj_file *f, ElfW(Addr) base) | |||
| 3049 | bad_reloc: | 3055 | bad_reloc: |
| 3050 | if (extsym) { | 3056 | if (extsym) { |
| 3051 | bb_error_msg("%s of type %ld for %s", errmsg, | 3057 | bb_error_msg("%s of type %ld for %s", errmsg, |
| 3052 | (long) ELFW(R_TYPE) (rel->r_info), | 3058 | (long) ELF_R_TYPE(rel->r_info), |
| 3053 | strtab + extsym->st_name); | 3059 | strtab + extsym->st_name); |
| 3054 | } else { | 3060 | } else { |
| 3055 | bb_error_msg("%s of type %ld", errmsg, | 3061 | bb_error_msg("%s of type %ld", errmsg, |
| 3056 | (long) ELFW(R_TYPE) (rel->r_info)); | 3062 | (long) ELF_R_TYPE(rel->r_info)); |
| 3057 | } | 3063 | } |
| 3058 | ret = 0; | 3064 | ret = 0; |
| 3059 | break; | 3065 | break; |
| @@ -3373,7 +3379,7 @@ static void hide_special_symbols(struct obj_file *f) | |||
| 3373 | for (p = specials; *p; ++p) | 3379 | for (p = specials; *p; ++p) |
| 3374 | if ((sym = obj_find_symbol(f, *p)) != NULL) | 3380 | if ((sym = obj_find_symbol(f, *p)) != NULL) |
| 3375 | sym->info = | 3381 | sym->info = |
| 3376 | ELFW(ST_INFO) (STB_LOCAL, ELFW(ST_TYPE) (sym->info)); | 3382 | ELF_ST_INFO(STB_LOCAL, ELF_ST_TYPE(sym->info)); |
| 3377 | } | 3383 | } |
| 3378 | 3384 | ||
| 3379 | 3385 | ||
| @@ -3577,7 +3583,7 @@ add_ksymoops_symbols(struct obj_file *f, const char *filename, | |||
| 3577 | (int)(2*sizeof(statbuf.st_mtime)), statbuf.st_mtime, | 3583 | (int)(2*sizeof(statbuf.st_mtime)), statbuf.st_mtime, |
| 3578 | version); | 3584 | version); |
| 3579 | sym = obj_add_symbol(f, name, -1, | 3585 | sym = obj_add_symbol(f, name, -1, |
| 3580 | ELFW(ST_INFO) (STB_GLOBAL, STT_NOTYPE), | 3586 | ELF_ST_INFO(STB_GLOBAL, STT_NOTYPE), |
| 3581 | sec->idx, sec->header.sh_addr, 0); | 3587 | sec->idx, sec->header.sh_addr, 0); |
| 3582 | if (use_ksymtab) | 3588 | if (use_ksymtab) |
| 3583 | new_add_ksymtab(f, sym); | 3589 | new_add_ksymtab(f, sym); |
| @@ -3595,7 +3601,7 @@ add_ksymoops_symbols(struct obj_file *f, const char *filename, | |||
| 3595 | name = xmalloc(l); | 3601 | name = xmalloc(l); |
| 3596 | snprintf(name, l, "%s%s_P%s", | 3602 | snprintf(name, l, "%s%s_P%s", |
| 3597 | symprefix, m_name, f->persist); | 3603 | symprefix, m_name, f->persist); |
| 3598 | sym = obj_add_symbol(f, name, -1, ELFW(ST_INFO) (STB_GLOBAL, STT_NOTYPE), | 3604 | sym = obj_add_symbol(f, name, -1, ELF_ST_INFO(STB_GLOBAL, STT_NOTYPE), |
| 3599 | sec->idx, sec->header.sh_addr, 0); | 3605 | sec->idx, sec->header.sh_addr, 0); |
| 3600 | if (use_ksymtab) | 3606 | if (use_ksymtab) |
| 3601 | new_add_ksymtab(f, sym); | 3607 | new_add_ksymtab(f, sym); |
| @@ -3617,7 +3623,7 @@ add_ksymoops_symbols(struct obj_file *f, const char *filename, | |||
| 3617 | snprintf(name, l, "%s%s_S%s_L%ld", | 3623 | snprintf(name, l, "%s%s_S%s_L%ld", |
| 3618 | symprefix, m_name, sec->name, | 3624 | symprefix, m_name, sec->name, |
| 3619 | (long)sec->header.sh_size); | 3625 | (long)sec->header.sh_size); |
| 3620 | sym = obj_add_symbol(f, name, -1, ELFW(ST_INFO) (STB_GLOBAL, STT_NOTYPE), | 3626 | sym = obj_add_symbol(f, name, -1, ELF_ST_INFO(STB_GLOBAL, STT_NOTYPE), |
| 3621 | sec->idx, sec->header.sh_addr, 0); | 3627 | sec->idx, sec->header.sh_addr, 0); |
| 3622 | if (use_ksymtab) | 3628 | if (use_ksymtab) |
| 3623 | new_add_ksymtab(f, sym); | 3629 | new_add_ksymtab(f, sym); |
| @@ -3707,7 +3713,7 @@ static void print_load_map(struct obj_file *f) | |||
| 3707 | value = sym->value + sec->header.sh_addr; | 3713 | value = sym->value + sec->header.sh_addr; |
| 3708 | } | 3714 | } |
| 3709 | 3715 | ||
| 3710 | if (ELFW(ST_BIND) (sym->info) == STB_LOCAL) | 3716 | if (ELF_ST_BIND(sym->info) == STB_LOCAL) |
| 3711 | type = tolower(type); | 3717 | type = tolower(type); |
| 3712 | 3718 | ||
| 3713 | printf("%0*lx %c %s\n", (int) (2 * sizeof(void *)), value, | 3719 | printf("%0*lx %c %s\n", (int) (2 * sizeof(void *)), value, |
