diff mbox

[AArch64,1/2] Rename SYMBOL_SMALL_GOT to SYMBOL_SMALL_GOT_4G

Message ID n99fv5e24uc.fsf@arm.com
State New
Headers show

Commit Message

Jiong Wang June 26, 2015, 9:23 a.m. UTC
Marcus Shawcroft writes:

> On 23 June 2015 at 14:02, Jiong Wang <jiong.wang@arm.com> wrote:
>>
>> Marcus Shawcroft writes:
>>
>>> On 20 May 2015 at 11:21, Jiong Wang <jiong.wang@arm.com> wrote:
>>>
>>>> gcc/
>>>>   * config/aarch64/aarch64.md: (ldr_got_small_<mode>): Support new GOT relocation
>>>>   modifiers.
>>>>   (ldr_got_small_sidi): Ditto.
>>>>   * config/aarch64/iterators.md (got_modifier): New mode iterator.
>>>>   * config/aarch64/aarch64-otps.h (aarch64_code_model): New model.
>>>>   * config/aarch64/aarch64.c (aarch64_load_symref_appropriately): Support -fpic.
>>>>   (aarch64_rtx_costs): Add costs for new instruction sequences.
>>>>   (initialize_aarch64_code_model): Initialize new model.
>>>>   (aarch64_classify_symbol): Recognize new model.
>>>>   (aarch64_asm_preferred_eh_data_format): Support new model.
>>>>   (aarch64_load_symref_appropriately): Generate new instruction sequences for -fpic.
>>>>   (TARGET_USE_PSEUDO_PIC_REG): New definition.
>>>>   (aarch64_use_pseudo_pic_reg): New function.
>>>>
>>>> gcc/testsuite/
>>>>   * gcc.target/aarch64/pic-small.c: New testcase.
>>>
>>>
>>> Rather than thread tests against aarch64_cmodel throughout the
>>> existing code can we instead extend classify_symbol with a new symbol
>>> classification?
>>
>> Yes, we can. As -fPIC/-fpic allow 4G/32K GOT table size, we may name
>> corresponding symbol classification as "SYMBOL_GOT_4G",
>> "SYMBOL_GOT_32K".
>>
>> But can we let this patch go in and create a another patch to improve
>> this? there are several other TLS patches may needs rebase if we change
>> this immedaitely.
>
> We can wait for a proper solution that fits with the code already in place.

OK. Reworked this patch. Removed those redundant memory model check by
adding new symbol classification. Patch splitted into two:

  * [1/2] Rename SYMBOL_SMALL_GOT to SYMBOL_SMALL_GOT_4G
  * [2/2] Implement -fpic for -mcmodel=small

This is the first patch which only renmae SYMBOL_SMALL_GOT into
SYMBOL_SMALL_GOT_4G. Please review, Thanks.

2015-06-26  Jiong Wang  <jiong.wang@arm.com>

gcc/
  * config/aarch64/aarch64-protos.h (aarch64_symbol_type): Rename
  SYMBOL_SMALL_GOT to SYMBOL_SMALL_GOT_4G.
  * config/aarch64/aarch64.c (aarch64_load_symref_appropriately): Ditto.
  (aarch64_expand_mov_immediate): Ditto.
  (aarch64_print_operand): Ditto.
  (aarch64_classify_symbol): Ditto.

Comments

Marcus Shawcroft June 26, 2015, 12:53 p.m. UTC | #1
On 26 June 2015 at 10:23, Jiong Wang <jiong.wang@arm.com> wrote:

> OK. Reworked this patch. Removed those redundant memory model check by
> adding new symbol classification. Patch splitted into two:
>
>   * [1/2] Rename SYMBOL_SMALL_GOT to SYMBOL_SMALL_GOT_4G
>   * [2/2] Implement -fpic for -mcmodel=small
>
> This is the first patch which only renmae SYMBOL_SMALL_GOT into
> SYMBOL_SMALL_GOT_4G. Please review, Thanks.
>
> 2015-06-26  Jiong Wang  <jiong.wang@arm.com>
>
> gcc/
>   * config/aarch64/aarch64-protos.h (aarch64_symbol_type): Rename
>   SYMBOL_SMALL_GOT to SYMBOL_SMALL_GOT_4G.
>   * config/aarch64/aarch64.c (aarch64_load_symref_appropriately): Ditto.
>   (aarch64_expand_mov_immediate): Ditto.
>   (aarch64_print_operand): Ditto.
>   (aarch64_classify_symbol): Ditto.
>

OK, thanks Jiong.  /Marcus
diff mbox

Patch

---
 gcc/config/aarch64/aarch64-protos.h |  7 ++++---
 gcc/config/aarch64/aarch64.c        | 10 +++++-----
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h
index 965a11b..36bd051 100644
--- a/gcc/config/aarch64/aarch64-protos.h
+++ b/gcc/config/aarch64/aarch64-protos.h
@@ -49,12 +49,13 @@  enum aarch64_symbol_context
 
    This corresponds to the small code model of the compiler.
 
-   SYMBOL_SMALL_GOT: Similar to the one above but this
+   SYMBOL_SMALL_GOT_4G: Similar to the one above but this
    gives us the GOT entry of the symbol being referred to :
    Thus calculating the GOT entry for foo is done using the
    following sequence of instructions.  The ADRP instruction
    gets us to the page containing the GOT entry of the symbol
-   and the got_lo12 gets us the actual offset in it.
+   and the got_lo12 gets us the actual offset in it, together
+   the base and offset, we can address 4G size GOT table.
 
    adrp  x0, :got:foo
    ldr   x0, [x0, :gotoff_lo12:foo]
@@ -94,7 +95,7 @@  enum aarch64_symbol_context
 enum aarch64_symbol_type
 {
   SYMBOL_SMALL_ABSOLUTE,
-  SYMBOL_SMALL_GOT,
+  SYMBOL_SMALL_GOT_4G,
   SYMBOL_SMALL_TLSGD,
   SYMBOL_SMALL_TLSDESC,
   SYMBOL_SMALL_GOTTPREL,
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 17bae08..776600f 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -814,7 +814,7 @@  aarch64_load_symref_appropriately (rtx dest, rtx imm,
       emit_insn (gen_rtx_SET (dest, imm));
       return;
 
-    case SYMBOL_SMALL_GOT:
+    case SYMBOL_SMALL_GOT_4G:
       {
 	/* In ILP32, the mode of dest can be either SImode or DImode,
 	   while the got entry is always of SImode size.  The mode of
@@ -1466,7 +1466,7 @@  aarch64_expand_mov_immediate (rtx dest, rtx imm)
         case SYMBOL_SMALL_TLSGD:
         case SYMBOL_SMALL_TLSDESC:
         case SYMBOL_SMALL_GOTTPREL:
-	case SYMBOL_SMALL_GOT:
+	case SYMBOL_SMALL_GOT_4G:
 	case SYMBOL_TINY_GOT:
 	  if (offset != const0_rtx)
 	    {
@@ -4333,7 +4333,7 @@  aarch64_print_operand (FILE *f, rtx x, char code)
 
       switch (aarch64_classify_symbolic_expression (x, SYMBOL_CONTEXT_ADR))
 	{
-	case SYMBOL_SMALL_GOT:
+	case SYMBOL_SMALL_GOT_4G:
 	  asm_fprintf (asm_out_file, ":got:");
 	  break;
 
@@ -4366,7 +4366,7 @@  aarch64_print_operand (FILE *f, rtx x, char code)
     case 'L':
       switch (aarch64_classify_symbolic_expression (x, SYMBOL_CONTEXT_ADR))
 	{
-	case SYMBOL_SMALL_GOT:
+	case SYMBOL_SMALL_GOT_4G:
 	  asm_fprintf (asm_out_file, ":lo12:");
 	  break;
 
@@ -7377,7 +7377,7 @@  aarch64_classify_symbol (rtx x, rtx offset,
 
 	case AARCH64_CMODEL_SMALL_PIC:
 	  if (!aarch64_symbol_binds_local_p (x))
-	    return SYMBOL_SMALL_GOT;
+	    return SYMBOL_SMALL_GOT_4G;
 	  return SYMBOL_SMALL_ABSOLUTE;
 
 	default:
-- 
2.1.0