[AArch64] -mcmodel=tiny -fPIC GOT support.

From-SVN: r200956
This commit is contained in:
Marcus Shawcroft 2013-07-15 11:27:39 +00:00 committed by Marcus Shawcroft
parent abc2d8074a
commit 87dd8ab0f2
4 changed files with 49 additions and 1 deletions

View File

@ -1,3 +1,15 @@
2013-07-15 Marcus Shawcroft <marcus.shawcroft@arm.com>
* config/aarch64/aarch64-protos.h (aarch64_symbol_type):
Define SYMBOL_TINY_GOT, update comment.
* config/aarch64/aarch64.c
(aarch64_load_symref_appropriately): Handle SYMBOL_TINY_GOT.
(aarch64_expand_mov_immediate): Likewise.
(aarch64_print_operand): Likewise.
(aarch64_classify_symbol): Likewise.
* config/aarch64/aarch64.md (UNSPEC_GOTTINYPIC): Define.
(ldr_got_tiny): Define.
2013-07-13 Tobias Grosser <tobias@grosser.es>
PR tree-optimization/54094

View File

@ -75,6 +75,17 @@ enum aarch64_symbol_context
ADR x0, foo
SYMBOL_TINY_GOT
Generate symbol accesses via the GOT using a single PC relative
instruction. To compute the address of symbol foo, we generate:
ldr t0, :got:foo
The value of foo can subsequently read using:
ldrb t0, [t0]
SYMBOL_FORCE_TO_MEM : Global variables are addressed using
constant pool. All variable addresses are spilled into constant
pools. The constant pools themselves are addressed using PC
@ -89,6 +100,7 @@ enum aarch64_symbol_type
SYMBOL_SMALL_GOTTPREL,
SYMBOL_SMALL_TPREL,
SYMBOL_TINY_ABSOLUTE,
SYMBOL_TINY_GOT,
SYMBOL_FORCE_TO_MEM
};

View File

@ -613,6 +613,10 @@ aarch64_load_symref_appropriately (rtx dest, rtx imm,
return;
}
case SYMBOL_TINY_GOT:
emit_insn (gen_ldr_got_tiny (dest, imm));
return;
default:
gcc_unreachable ();
}
@ -890,6 +894,7 @@ aarch64_expand_mov_immediate (rtx dest, rtx imm)
case SYMBOL_SMALL_TLSDESC:
case SYMBOL_SMALL_GOTTPREL:
case SYMBOL_SMALL_GOT:
case SYMBOL_TINY_GOT:
if (offset != const0_rtx)
{
gcc_assert(can_create_pseudo_p ());
@ -3646,6 +3651,10 @@ aarch64_print_operand (FILE *f, rtx x, char code)
asm_fprintf (asm_out_file, ":tprel:");
break;
case SYMBOL_TINY_GOT:
gcc_unreachable ();
break;
default:
break;
}
@ -3675,6 +3684,10 @@ aarch64_print_operand (FILE *f, rtx x, char code)
asm_fprintf (asm_out_file, ":tprel_lo12_nc:");
break;
case SYMBOL_TINY_GOT:
asm_fprintf (asm_out_file, ":got:");
break;
default:
break;
}
@ -5241,7 +5254,7 @@ aarch64_classify_symbol (rtx x,
case AARCH64_CMODEL_TINY_PIC:
if (!aarch64_symbol_binds_local_p (x))
return SYMBOL_SMALL_GOT;
return SYMBOL_TINY_GOT;
return SYMBOL_TINY_ABSOLUTE;
case AARCH64_CMODEL_SMALL_PIC:

View File

@ -80,6 +80,7 @@
UNSPEC_FRINTZ
UNSPEC_GOTSMALLPIC
UNSPEC_GOTSMALLTLS
UNSPEC_GOTTINYPIC
UNSPEC_LD2
UNSPEC_LD3
UNSPEC_LD4
@ -3751,6 +3752,16 @@
(set_attr "mode" "DI")]
)
(define_insn "ldr_got_tiny"
[(set (match_operand:DI 0 "register_operand" "=r")
(unspec:DI [(match_operand:DI 1 "aarch64_valid_symref" "S")]
UNSPEC_GOTTINYPIC))]
""
"ldr\\t%0, %L1"
[(set_attr "v8type" "load1")
(set_attr "mode" "DI")]
)
(define_insn "aarch64_load_tp_hard"
[(set (match_operand:DI 0 "register_operand" "=r")
(unspec:DI [(const_int 0)] UNSPEC_TLS))]