History

x86-64: use uplong for symbol values

grischka committed 16 years ago

Commit 52991421 parent 2341ee54 files · +13 −15Browse files

Unified · Split

4 files
  1. libtcc.c +1 −1
  2. libtcc.h +1 −1
  3. tcc.h +1 −1
  4. tccelf.c +10 −12
libtcc.c+1−1
@@ -1213,7 +1213,7 @@ LIBTCCAPI int tcc_add_library(TCCState *s, const char *libraryname) · 1212 unmodified lines
12131213 return -1;
12141214 }
12151215
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)
12171217 {
12181218 #ifdef TCC_TARGET_PE
12191219 pe_putimport(s, 0, name, val);
libtcc.h+1−1
@@ -80,7 +80,7 @@ LIBTCCAPI int tcc_add_library_path(TCCState *s, const char *pathname); · 79 unmodified lines
8080 LIBTCCAPI int tcc_add_library(TCCState *s, const char *libraryname);
8181
8282 /* 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);
8484
8585 /* output an executable, library or object file. DO NOT call
8686 tcc_relocate() before. */
tcc.h+1−1
@@ -1062,7 +1062,7 @@ typedef struct { · 1061 unmodified lines
10621062 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);
10631063
10641064 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);
10661066 ST_FUNC int add_elf_sym(Section *s, uplong value, unsigned long size, int info, int other, int sh_num, const char *name);
10671067 ST_FUNC int find_elf_sym(Section *s, const char *name);
10681068 ST_FUNC void put_elf_reloc(Section *symtab, Section *s, unsigned long offset, int type, int symbol);
tccelf.c+10−12
@@ -97,9 +97,8 @@ static void rebuild_hash(Section *s, unsigned int nb_buckets) · 96 unmodified lines
9797 }
9898
9999 /* return the symbol number */
100−ST_FUNC int put_elf_sym(Section *s,
101− unsigned long value, unsigned long size,
102− int info, int other, int shndx, const char *name)
100+ST_FUNC int put_elf_sym(Section *s, uplong value, unsigned long size,
101+ int info, int other, int shndx, const char *name)
103102 {
104103 int name_offset, sym_index;
105104 int nbuckets, h;
@@ -483,7 +482,7 @@ ST_FUNC void relocate_syms(TCCState *s1, int do_resolve) · 377 unmodified lines
483482 #ifndef TCC_TARGET_PE
484483 #ifdef TCC_TARGET_X86_64
485484 #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)
487486 {
488487 char *p = s1->runtime_plt_and_got + s1->runtime_plt_and_got_offset;
489488 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
491490 p[0] = 0xff;
492491 p[1] = 0x25;
493492 *(int *)(p + 2) = 0;
494− *(unsigned long *)(p + 6) = val;
495− return (unsigned long)p;
493+ *(uplong *)(p + 6) = val;
494+ return (uplong)p;
496495 }
497496
498−static unsigned long add_got_table(TCCState *s1, unsigned long val)
497+static uplong add_got_table(TCCState *s1, uplong val)
499498 {
500− unsigned long *p =(unsigned long *)(s1->runtime_plt_and_got +
501− s1->runtime_plt_and_got_offset);
502− s1->runtime_plt_and_got_offset += sizeof(void *);
499+ uplong *p = (uplong *)(s1->runtime_plt_and_got + s1->runtime_plt_and_got_offset);
500+ s1->runtime_plt_and_got_offset += sizeof(uplong);
503501 *p = val;
504− return (unsigned long)p;
502+ return (uplong)p;
505503 }
506504 #endif
507505 #endif
@@ -514,7 +512,7 @@ ST_FUNC void relocate_section(TCCState *s1, Section *s) · 6 unmodified lines
514512 ElfW(Sym) *sym;
515513 int type, sym_index;
516514 unsigned char *ptr;
517− unsigned long val, addr;
515+ uplong val, addr;
518516 #if defined TCC_TARGET_I386 || defined TCC_TARGET_X86_64
519517 int esym_index;
520518 #endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t