diff options
| author | Daniel Glöckner <daniel-gl@gmx.net> | 2010-05-14 13:07:59 +0200 |
|---|---|---|
| committer | Daniel Glöckner <daniel-gl@gmx.net> | 2010-05-14 13:07:59 +0200 |
| commit | 741841d863be133d4fba91933fdd83dec7a83112 (patch) | |
| tree | ebb74b11be7a4ff68f87e3d73f646522815add02 /tccelf.c | |
| parent | a64727ba7d75e68d4eda5187a1e0fa02c005d70e (diff) | |
| download | tinycc-741841d863be133d4fba91933fdd83dec7a83112.tar.gz tinycc-741841d863be133d4fba91933fdd83dec7a83112.tar.bz2 | |
ARM: allow jumps > 32MB on -run
This is needed to reach tinycc's PLT from the compiled program.
Diffstat (limited to 'tccelf.c')
| -rw-r--r-- | tccelf.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -504,6 +504,17 @@ static uplong add_got_table(TCCState *s1, uplong val) *p = val; return (uplong)p; } +#elif defined TCC_TARGET_ARM +#define JMP_TABLE_ENTRY_SIZE 8 +static int add_jmp_table(TCCState *s1, int val) +{ + uint32_t *p = (uint32_t *)(s1->runtime_plt_and_got + s1->runtime_plt_and_got_offset); + s1->runtime_plt_and_got_offset += JMP_TABLE_ENTRY_SIZE; + /* ldr pc, [pc, #-4] */ + p[0] = 0xE51FF004; + p[1] = val; + return (int)p; +} #endif #endif @@ -611,6 +622,11 @@ ST_FUNC void relocate_section(TCCState *s1, Section *s) x -= 0x1000000; x *= 4; x += val - addr; +#ifndef TCC_TARGET_PE + if((x & 3) != 0 || x >= 0x4000000 || x < -0x4000000) + if (s1->output_type == TCC_OUTPUT_MEMORY) + x += add_jmp_table(s1, val) - val; /* add veneer */ +#endif if((x & 3) != 0 || x >= 0x4000000 || x < -0x4000000) error("can't relocate value at %x",addr); x >>= 2; |
