| @@ -56,7 +56,7 @@ static void rebuild_hash(Section *s, unsigned int nb_buckets) · 55 unmodified lines |
| 56 | 56 | { |
| 57 | 57 | ElfW(Sym) *sym; |
| 58 | 58 | int *ptr, *hash, nb_syms, sym_index, h; |
| 59 | | − char *strtab; |
| 59 | + unsigned char *strtab; |
| 60 | 60 | |
| 61 | 61 | strtab = s->link->data; |
| 62 | 62 | nb_syms = s->data_offset / sizeof(ElfW(Sym)); |
| @@ -115,7 +115,7 @@ ST_FUNC int put_elf_sym(Section *s, addr_t value, unsigned long size, · 52 unmodified lines |
| 115 | 115 | if (ELFW(ST_BIND)(info) != STB_LOCAL) { |
| 116 | 116 | /* add another hashing entry */ |
| 117 | 117 | nbuckets = base[0]; |
| 118 | | − h = elf_hash(name) % nbuckets; |
| 118 | + h = elf_hash((unsigned char *) name) % nbuckets; |
| 119 | 119 | *ptr = base[2 + h]; |
| 120 | 120 | base[2 + h] = sym_index; |
| 121 | 121 | base[1]++; |
| @@ -145,11 +145,11 @@ ST_FUNC int find_elf_sym(Section *s, const char *name) · 23 unmodified lines |
| 145 | 145 | if (!hs) |
| 146 | 146 | return 0; |
| 147 | 147 | nbuckets = ((int *)hs->data)[0]; |
| 148 | | − h = elf_hash(name) % nbuckets; |
| 148 | + h = elf_hash((unsigned char *) name) % nbuckets; |
| 149 | 149 | sym_index = ((int *)hs->data)[2 + h]; |
| 150 | 150 | while (sym_index != 0) { |
| 151 | 151 | sym = &((ElfW(Sym) *)s->data)[sym_index]; |
| 152 | | − name1 = s->link->data + sym->st_name; |
| 152 | + name1 = (char *) s->link->data + sym->st_name; |
| 153 | 153 | if (!strcmp(name, name1)) |
| 154 | 154 | return sym_index; |
| 155 | 155 | sym_index = ((int *)hs->data)[2 + nbuckets + sym_index]; |
| @@ -429,12 +429,12 @@ ST_FUNC void relocate_syms(TCCState *s1, int do_resolve) · 273 unmodified lines |
| 429 | 429 | for_each_elem(symtab_section, 1, sym, ElfW(Sym)) { |
| 430 | 430 | sh_num = sym->st_shndx; |
| 431 | 431 | if (sh_num == SHN_UNDEF) { |
| 432 | | − name = strtab_section->data + sym->st_name; |
| 432 | + name = (char *) strtab_section->data + sym->st_name; |
| 433 | 433 | /* Use ld.so to resolve symbol for us (for tcc -run) */ |
| 434 | 434 | if (do_resolve) { |
| 435 | 435 | #if defined TCC_IS_NATIVE && !defined _WIN32 |
| 436 | 436 | void *addr; |
| 437 | | − name = symtab_section->link->data + sym->st_name; |
| 437 | + name = (char *) symtab_section->link->data + sym->st_name; |
| 438 | 438 | addr = resolve_sym(s1, name); |
| 439 | 439 | if (addr) { |
| 440 | 440 | sym->st_value = (addr_t)addr; |
| @@ -1026,7 +1026,7 @@ static void put_got_entry(TCCState *s1, · 585 unmodified lines |
| 1026 | 1026 | |
| 1027 | 1027 | if (s1->dynsym) { |
| 1028 | 1028 | sym = &((ElfW(Sym) *)symtab_section->data)[sym_index]; |
| 1029 | | − name = symtab_section->link->data + sym->st_name; |
| 1029 | + name = (char *) symtab_section->link->data + sym->st_name; |
| 1030 | 1030 | offset = sym->st_value; |
| 1031 | 1031 | #if defined(TCC_TARGET_I386) || defined(TCC_TARGET_X86_64) |
| 1032 | 1032 | if (reloc_type == |
| @@ -1198,7 +1198,7 @@ ST_FUNC void build_got_entries(TCCState *s1) · 165 unmodified lines |
| 1198 | 1198 | char *name, buf[1024]; |
| 1199 | 1199 | Section *text_section; |
| 1200 | 1200 | |
| 1201 | | − name = symtab_section->link->data + sym->st_name; |
| 1201 | + name = (char *) symtab_section->link->data + sym->st_name; |
| 1202 | 1202 | text_section = s1->sections[sym->st_shndx]; |
| 1203 | 1203 | /* Modify reloc to target a thumb stub to switch to ARM */ |
| 1204 | 1204 | snprintf(buf, sizeof(buf), "%s_from_thumb", name); |
| @@ -1566,7 +1566,7 @@ static void bind_exe_dynsyms(TCCState *s1) · 361 unmodified lines |
| 1566 | 1566 | - if STT_OBJECT symbol -> add it in .bss section with suitable reloc */ |
| 1567 | 1567 | for_each_elem(symtab_section, 1, sym, ElfW(Sym)) { |
| 1568 | 1568 | if (sym->st_shndx == SHN_UNDEF) { |
| 1569 | | − name = symtab_section->link->data + sym->st_name; |
| 1569 | + name = (char *) symtab_section->link->data + sym->st_name; |
| 1570 | 1570 | sym_index = find_elf_sym(s1->dynsymtab_section, name); |
| 1571 | 1571 | if (sym_index) { |
| 1572 | 1572 | esym = &((ElfW(Sym) *)s1->dynsymtab_section->data)[sym_index]; |
| @@ -1596,7 +1596,7 @@ static void bind_exe_dynsyms(TCCState *s1) · 23 unmodified lines |
| 1596 | 1596 | for_each_elem(s1->dynsymtab_section, 1, dynsym, ElfW(Sym)) { |
| 1597 | 1597 | if ((dynsym->st_value == esym->st_value) |
| 1598 | 1598 | && (ELFW(ST_BIND)(dynsym->st_info) == STB_GLOBAL)) { |
| 1599 | | − char *dynname = s1->dynsymtab_section->link->data |
| 1599 | + char *dynname = (char *) s1->dynsymtab_section->link->data |
| 1600 | 1600 | + dynsym->st_name; |
| 1601 | 1601 | put_elf_sym(s1->dynsym, offset, dynsym->st_size, |
| 1602 | 1602 | dynsym->st_info, 0, |
| @@ -1621,7 +1621,7 @@ static void bind_exe_dynsyms(TCCState *s1) · 18 unmodified lines |
| 1621 | 1621 | } |
| 1622 | 1622 | } else if (s1->rdynamic && ELFW(ST_BIND)(sym->st_info) != STB_LOCAL) { |
| 1623 | 1623 | /* if -rdynamic option, then export all non local symbols */ |
| 1624 | | − name = symtab_section->link->data + sym->st_name; |
| 1624 | + name = (char *) symtab_section->link->data + sym->st_name; |
| 1625 | 1625 | put_elf_sym(s1->dynsym, sym->st_value, sym->st_size, sym->st_info, |
| 1626 | 1626 | 0, sym->st_shndx, name); |
| 1627 | 1627 | } |
| @@ -1640,7 +1640,7 @@ static void bind_libs_dynsyms(TCCState *s1) · 12 unmodified lines |
| 1640 | 1640 | corresponding symbol */ |
| 1641 | 1641 | for_each_elem(s1->dynsymtab_section, 1, esym, ElfW(Sym)) { |
| 1642 | 1642 | if (esym->st_shndx == SHN_UNDEF) { |
| 1643 | | − name = s1->dynsymtab_section->link->data + esym->st_name; |
| 1643 | + name = (char *) s1->dynsymtab_section->link->data + esym->st_name; |
| 1644 | 1644 | sym_index = find_elf_sym(symtab_section, name); |
| 1645 | 1645 | if (sym_index) { |
| 1646 | 1646 | /* XXX: avoid adding a symbol if already present because of |
| @@ -1682,7 +1682,7 @@ static void export_global_syms(TCCState *s1) · 35 unmodified lines |
| 1682 | 1682 | } else |
| 1683 | 1683 | #endif |
| 1684 | 1684 | { |
| 1685 | | − name = symtab_section->link->data + sym->st_name; |
| 1685 | + name = (char *) symtab_section->link->data + sym->st_name; |
| 1686 | 1686 | dynindex = put_elf_sym(s1->dynsym, sym->st_value, sym->st_size, |
| 1687 | 1687 | sym->st_info, 0, sym->st_shndx, name); |
| 1688 | 1688 | index = sym - (ElfW(Sym) *) symtab_section->data; |
| @@ -2527,7 +2527,7 @@ ST_FUNC int tcc_load_object_file(TCCState *s1, · 838 unmodified lines |
| 2527 | 2527 | if (i == ehdr.e_shstrndx) |
| 2528 | 2528 | continue; |
| 2529 | 2529 | sh = &shdr[i]; |
| 2530 | | − sh_name = strsec + sh->sh_name; |
| 2530 | + sh_name = (char *) strsec + sh->sh_name; |
| 2531 | 2531 | /* ignore sections types we do not handle */ |
| 2532 | 2532 | if (sh->sh_type != SHT_PROGBITS && |
| 2533 | 2533 | sh->sh_type != SHT_RELX && |
| @@ -2648,7 +2648,7 @@ ST_FUNC int tcc_load_object_file(TCCState *s1, · 114 unmodified lines |
| 2648 | 2648 | already defined symbol. It is very important to get |
| 2649 | 2649 | correct relocations */ |
| 2650 | 2650 | if (ELFW(ST_BIND)(sym->st_info) != STB_LOCAL) { |
| 2651 | | − name = strtab + sym->st_name; |
| 2651 | + name = (char *) strtab + sym->st_name; |
| 2652 | 2652 | sym_index = find_elf_sym(symtab_section, name); |
| 2653 | 2653 | if (sym_index) |
| 2654 | 2654 | old_to_new_syms[i] = sym_index; |
| @@ -2664,7 +2664,7 @@ ST_FUNC int tcc_load_object_file(TCCState *s1, · 9 unmodified lines |
| 2664 | 2664 | sym->st_value += sm->offset; |
| 2665 | 2665 | } |
| 2666 | 2666 | /* add symbol */ |
| 2667 | | − name = strtab + sym->st_name; |
| 2667 | + name = (char *) strtab + sym->st_name; |
| 2668 | 2668 | sym_index = add_elf_sym(symtab_section, sym->st_value, sym->st_size, |
| 2669 | 2669 | sym->st_info, sym->st_other, |
| 2670 | 2670 | sym->st_shndx, name); |
| @@ -2765,7 +2765,7 @@ static int tcc_load_alacarte(TCCState *s1, int fd, int size) · 94 unmodified lines |
| 2765 | 2765 | goto fail; |
| 2766 | 2766 | nsyms = get_be32(data); |
| 2767 | 2767 | ar_index = data + 4; |
| 2768 | | − ar_names = ar_index + nsyms * 4; |
| 2768 | + ar_names = (char *) ar_index + nsyms * 4; |
| 2769 | 2769 | |
| 2770 | 2770 | do { |
| 2771 | 2771 | bound = 0; |
| @@ -2898,7 +2898,7 @@ ST_FUNC int tcc_load_dll(TCCState *s1, int fd, const char *filename, int level) · 126 unmodified lines |
| 2898 | 2898 | |
| 2899 | 2899 | for(i = 0, dt = dynamic; i < nb_dts; i++, dt++) { |
| 2900 | 2900 | if (dt->d_tag == DT_SONAME) { |
| 2901 | | − soname = dynstr + dt->d_un.d_val; |
| 2901 | + soname = (char *) dynstr + dt->d_un.d_val; |
| 2902 | 2902 | } |
| 2903 | 2903 | } |
| 2904 | 2904 | |
| @@ -2925,7 +2925,7 @@ ST_FUNC int tcc_load_dll(TCCState *s1, int fd, const char *filename, int level) · 20 unmodified lines |
| 2925 | 2925 | sym_bind = ELFW(ST_BIND)(sym->st_info); |
| 2926 | 2926 | if (sym_bind == STB_LOCAL) |
| 2927 | 2927 | continue; |
| 2928 | | − name = dynstr + sym->st_name; |
| 2928 | + name = (char *) dynstr + sym->st_name; |
| 2929 | 2929 | add_elf_sym(s1->dynsymtab_section, sym->st_value, sym->st_size, |
| 2930 | 2930 | sym->st_info, sym->st_other, sym->st_shndx, name); |
| 2931 | 2931 | } |
| @@ -2934,7 +2934,7 @@ ST_FUNC int tcc_load_dll(TCCState *s1, int fd, const char *filename, int level) · 2 unmodified lines |
| 2934 | 2934 | for(i = 0, dt = dynamic; i < nb_dts; i++, dt++) { |
| 2935 | 2935 | switch(dt->d_tag) { |
| 2936 | 2936 | case DT_NEEDED: |
| 2937 | | − name = dynstr + dt->d_un.d_val; |
| 2937 | + name = (char *) dynstr + dt->d_un.d_val; |
| 2938 | 2938 | for(j = 0; j < s1->nb_loaded_dlls; j++) { |
| 2939 | 2939 | dllref = s1->loaded_dlls[j]; |
| 2940 | 2940 | if (!strcmp(name, dllref->name)) |