aboutsummaryrefslogtreecommitdiff
path: root/tccelf.c
diff options
context:
space:
mode:
authorShinichiro Hamaji <shinichiro.hamaji _at_ gmail.com>2009-04-17 10:17:14 +0900
committergrischka <grischka>2009-04-18 15:08:02 +0200
commit9a7173bf69cc1e620f33e2d08550a70d31674a0f (patch)
tree493f0209507800ea5daaeb6644932854dc57caa3 /tccelf.c
parente6ba81b012b1ce6d7c451ef25d21330c638e1320 (diff)
downloadtinycc-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.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/tccelf.c b/tccelf.c
index 6a26831..11bb82c 100644
--- a/tccelf.c
+++ b/tccelf.c
@@ -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;
}