diff options
| author | Shinichiro Hamaji <shinichiro.hamaji _at_ gmail.com> | 2009-04-17 10:17:14 +0900 |
|---|---|---|
| committer | grischka <grischka> | 2009-04-18 15:08:02 +0200 |
| commit | 9a7173bf69cc1e620f33e2d08550a70d31674a0f (patch) | |
| tree | 493f0209507800ea5daaeb6644932854dc57caa3 /tccelf.c | |
| parent | e6ba81b012b1ce6d7c451ef25d21330c638e1320 (diff) | |
| download | tinycc-9a7173bf69cc1e620f33e2d08550a70d31674a0f.tar.gz tinycc-9a7173bf69cc1e620f33e2d08550a70d31674a0f.tar.bz2 | |
x86-64: Fix tcc -run. We need extra memory for PLT and GOT.
Size of the extra buffer is too large for now.
Diffstat (limited to 'tccelf.c')
| -rw-r--r-- | tccelf.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -480,7 +480,8 @@ static void relocate_syms(TCCState *s1, int do_resolve) #define JMP_TABLE_ENTRY_SIZE 14 static unsigned long add_jmp_table(TCCState *s1, unsigned long val) { - char *p = (char *)section_ptr_add(text_section, JMP_TABLE_ENTRY_SIZE); + char *p = s1->runtime_plt_and_got + s1->runtime_plt_and_got_offset; + s1->runtime_plt_and_got_offset += JMP_TABLE_ENTRY_SIZE; /* jmp *0x0(%rip) */ p[0] = 0xff; p[1] = 0x25; @@ -491,8 +492,9 @@ static unsigned long add_jmp_table(TCCState *s1, unsigned long val) static unsigned long add_got_table(TCCState *s1, unsigned long val) { - unsigned long *p = - (unsigned long *)section_ptr_add(text_section, sizeof(void *)); + unsigned long *p =(unsigned long *)(s1->runtime_plt_and_got + + s1->runtime_plt_and_got_offset); + s1->runtime_plt_and_got_offset += sizeof(void *); *p = val; return (unsigned long)p; } |
