diff options
| author | Michael Matz <matz@suse.de> | 2016-10-14 17:32:10 +0200 |
|---|---|---|
| committer | Michael Matz <matz@suse.de> | 2016-10-14 17:32:10 +0200 |
| commit | 682ecc1745123d8c8cb324cce151accff2a311ed (patch) | |
| tree | b0fa785b6280608d3304504f2c1e86ce7f6589e1 /arm64-gen.c | |
| parent | 7600b03f35a0178978e864c17abac9a5f3a24032 (diff) | |
| download | tinycc-682ecc1745123d8c8cb324cce151accff2a311ed.tar.gz tinycc-682ecc1745123d8c8cb324cce151accff2a311ed.tar.bz2 | |
arm64: Fix -run
With -run the call instruction and a defined function can be
far away, if the function is defined in the executable itself,
not in the to be compiled code. So we always need PLT slots
for -run, not just for undefined symbols.
Diffstat (limited to 'arm64-gen.c')
| -rw-r--r-- | arm64-gen.c | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/arm64-gen.c b/arm64-gen.c index 5f52e1f..cd6faac 100644 --- a/arm64-gen.c +++ b/arm64-gen.c @@ -592,22 +592,10 @@ ST_FUNC void store(int r, SValue *sv) static void arm64_gen_bl_or_b(int b) { - // Currently TCC's linker does not generate a PLT when TCC is invoked - // with "-run". This means functions can be out of range if we try to - // call them in the usual way. Until the linker is fixed, work around - // this by using R_AARCH64_MOVW_UABS_G* relocations; see arm64_sym. - int avoid_call26 = 1; - if ((vtop->r & (VT_VALMASK | VT_LVAL)) == VT_CONST) { assert(!b && (vtop->r & VT_SYM)); - if (avoid_call26) { - arm64_sym(30, vtop->sym, 0); - o(0xd63f03c0); // blr x30 - } - else { - greloc(cur_text_section, vtop->sym, ind, R_AARCH64_CALL26); - o(0x94000000); // bl . - } + greloc(cur_text_section, vtop->sym, ind, R_AARCH64_CALL26); + o(0x94000000); // bl . } else o(0xd61f0000 | (uint32_t)!b << 21 | intr(gv(RC_R30)) << 5); // br/blr |
