Unified · Split
| @@ -1213,7 +1213,7 @@ LIBTCCAPI int tcc_add_library(TCCState *s, const char *libraryname) · 1212 unmodified lines | |||
| 1213 | return -1; | 1213 | return -1; |
| 1214 | } | 1214 | } |
| 1215 | 1215 | ||
| 1216 | LIBTCCAPI int tcc_add_symbol(TCCState *s, const char *name, void *val) | 1216 | LIBTCCAPI int tcc_add_symbol(TCCState *s, const char *name, const void *val) |
| 1217 | { | 1217 | { |
| 1218 | #ifdef TCC_TARGET_PE | 1218 | #ifdef TCC_TARGET_PE |
| 1219 | pe_putimport(s, 0, name, val); | 1219 | pe_putimport(s, 0, name, val); |
| @@ -80,7 +80,7 @@ LIBTCCAPI int tcc_add_library_path(TCCState *s, const char *pathname); · 79 unmodified lines | |||
| 80 | LIBTCCAPI int tcc_add_library(TCCState *s, const char *libraryname); | 80 | LIBTCCAPI int tcc_add_library(TCCState *s, const char *libraryname); |
| 81 | 81 | ||
| 82 | /* add a symbol to the compiled program */ | 82 | /* add a symbol to the compiled program */ |
| 83 | LIBTCCAPI int tcc_add_symbol(TCCState *s, const char *name, void *val); | 83 | LIBTCCAPI int tcc_add_symbol(TCCState *s, const char *name, const void *val); |
| 84 | 84 | ||
| 85 | /* output an executable, library or object file. DO NOT call | 85 | /* output an executable, library or object file. DO NOT call |
| 86 | tcc_relocate() before. */ | 86 | tcc_relocate() before. */ |
| @@ -1062,7 +1062,7 @@ typedef struct { · 1061 unmodified lines | |||
| 1062 | ST_FUNC Section *new_symtab(TCCState *s1, const char *symtab_name, int sh_type, int sh_flags, const char *strtab_name, const char *hash_name, int hash_sh_flags); | 1062 | ST_FUNC Section *new_symtab(TCCState *s1, const char *symtab_name, int sh_type, int sh_flags, const char *strtab_name, const char *hash_name, int hash_sh_flags); |
| 1063 | 1063 | ||
| 1064 | ST_FUNC int put_elf_str(Section *s, const char *sym); | 1064 | ST_FUNC int put_elf_str(Section *s, const char *sym); |
| 1065 | ST_FUNC int put_elf_sym(Section *s, unsigned long value, unsigned long size, int info, int other, int shndx, const char *name); | 1065 | ST_FUNC int put_elf_sym(Section *s, uplong value, unsigned long size, int info, int other, int shndx, const char *name); |
| 1066 | ST_FUNC int add_elf_sym(Section *s, uplong value, unsigned long size, int info, int other, int sh_num, const char *name); | 1066 | ST_FUNC int add_elf_sym(Section *s, uplong value, unsigned long size, int info, int other, int sh_num, const char *name); |
| 1067 | ST_FUNC int find_elf_sym(Section *s, const char *name); | 1067 | ST_FUNC int find_elf_sym(Section *s, const char *name); |
| 1068 | ST_FUNC void put_elf_reloc(Section *symtab, Section *s, unsigned long offset, int type, int symbol); | 1068 | ST_FUNC void put_elf_reloc(Section *symtab, Section *s, unsigned long offset, int type, int symbol); |
| @@ -97,9 +97,8 @@ static void rebuild_hash(Section *s, unsigned int nb_buckets) · 96 unmodified lines | |||
| 97 | } | 97 | } |
| 98 | 98 | ||
| 99 | /* return the symbol number */ | 99 | /* return the symbol number */ |
| 100 | ST_FUNC int put_elf_sym(Section *s, | 100 | ST_FUNC int put_elf_sym(Section *s, uplong value, unsigned long size, |
| 101 | unsigned long value, unsigned long size, | 101 | int info, int other, int shndx, const char *name) |
| 102 | int info, int other, int shndx, const char *name) | ||
| 103 | { | 102 | { |
| 104 | int name_offset, sym_index; | 103 | int name_offset, sym_index; |
| 105 | int nbuckets, h; | 104 | int nbuckets, h; |
| @@ -483,7 +482,7 @@ ST_FUNC void relocate_syms(TCCState *s1, int do_resolve) · 377 unmodified lines | |||
| 483 | #ifndef TCC_TARGET_PE | 482 | #ifndef TCC_TARGET_PE |
| 484 | #ifdef TCC_TARGET_X86_64 | 483 | #ifdef TCC_TARGET_X86_64 |
| 485 | #define JMP_TABLE_ENTRY_SIZE 14 | 484 | #define JMP_TABLE_ENTRY_SIZE 14 |
| 486 | static unsigned long add_jmp_table(TCCState *s1, unsigned long val) | 485 | static uplong add_jmp_table(TCCState *s1, uplong val) |
| 487 | { | 486 | { |
| 488 | char *p = s1->runtime_plt_and_got + s1->runtime_plt_and_got_offset; | 487 | char *p = s1->runtime_plt_and_got + s1->runtime_plt_and_got_offset; |
| 489 | s1->runtime_plt_and_got_offset += JMP_TABLE_ENTRY_SIZE; | 488 | s1->runtime_plt_and_got_offset += JMP_TABLE_ENTRY_SIZE; |
| @@ -491,17 +490,16 @@ static unsigned long add_jmp_table(TCCState *s1, unsigned long val) · 1 unmodified line | |||
| 491 | p[0] = 0xff; | 490 | p[0] = 0xff; |
| 492 | p[1] = 0x25; | 491 | p[1] = 0x25; |
| 493 | *(int *)(p + 2) = 0; | 492 | *(int *)(p + 2) = 0; |
| 494 | *(unsigned long *)(p + 6) = val; | 493 | *(uplong *)(p + 6) = val; |
| 495 | return (unsigned long)p; | 494 | return (uplong)p; |
| 496 | } | 495 | } |
| 497 | 496 | ||
| 498 | static unsigned long add_got_table(TCCState *s1, unsigned long val) | 497 | static uplong add_got_table(TCCState *s1, uplong val) |
| 499 | { | 498 | { |
| 500 | unsigned long *p =(unsigned long *)(s1->runtime_plt_and_got + | 499 | uplong *p = (uplong *)(s1->runtime_plt_and_got + s1->runtime_plt_and_got_offset); |
| 501 | s1->runtime_plt_and_got_offset); | 500 | s1->runtime_plt_and_got_offset += sizeof(uplong); |
| 502 | s1->runtime_plt_and_got_offset += sizeof(void *); | ||
| 503 | *p = val; | 501 | *p = val; |
| 504 | return (unsigned long)p; | 502 | return (uplong)p; |
| 505 | } | 503 | } |
| 506 | #endif | 504 | #endif |
| 507 | #endif | 505 | #endif |
| @@ -514,7 +512,7 @@ ST_FUNC void relocate_section(TCCState *s1, Section *s) · 6 unmodified lines | |||
| 514 | ElfW(Sym) *sym; | 512 | ElfW(Sym) *sym; |
| 515 | int type, sym_index; | 513 | int type, sym_index; |
| 516 | unsigned char *ptr; | 514 | unsigned char *ptr; |
| 517 | unsigned long val, addr; | 515 | uplong val, addr; |
| 518 | #if defined TCC_TARGET_I386 || defined TCC_TARGET_X86_64 | 516 | #if defined TCC_TARGET_I386 || defined TCC_TARGET_X86_64 |
| 519 | int esym_index; | 517 | int esym_index; |
| 520 | #endif | 518 | #endif |