[AArch64] GAS support BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14
authorJiong Wang <jiong.wang@arm.com>
Mon, 1 Jun 2015 14:41:54 +0000 (15:41 +0100)
committerJiong Wang <jiong.wang@arm.com>
Mon, 1 Jun 2015 14:41:54 +0000 (15:41 +0100)
This patch add BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14 support in Gas.

The relocation modifier
===
  :gotpage_lo14:symbol

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

bfd/
  * reloc.c (BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14): New entry.
  * bfd-in2.h: Regenerate.
  * libbfd.h: Regenerate.
  * elfnn-aarch64.c (elfNN_aarch64_howto_table): New entry for
  BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14.

gas/
  * config/tc-aarch64.c (reloc_table): New relocation modifiers.
  (md_apply_fix): Support BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14.
  (aarch64_force_relocation): Ditto.

gas/testsuite/
  * gas/aarch64/ilp32-basic.s: New testcase.
  * gas/aarch64/ilp32-basic.d: Ditto.

bfd/ChangeLog
bfd/bfd-in2.h
bfd/elfnn-aarch64.c
bfd/libbfd.h
bfd/reloc.c
gas/ChangeLog
gas/config/tc-aarch64.c
gas/testsuite/ChangeLog
gas/testsuite/gas/aarch64/ilp32-basic.d
gas/testsuite/gas/aarch64/ilp32-basic.s

index 678f0cc4e9f069eaf186dc5c9cc7e25be721e549..e1ce3819f919c7ba72cdfcaedc4abf8e08af313b 100644 (file)
@@ -1,3 +1,11 @@
+2015-06-01  Jiong Wang  <jiong.wang@arm.com>
+
+       * reloc.c (BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14): New entry.
+       * bfd-in2.h: Regenerate.
+       * libbfd.h: Regenerate.
+       * elfnn-aarch64.c (elfNN_aarch64_howto_table): New entry for
+       BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14.
+
 2015-06-01  Jiong Wang  <jiong.wang@arm.com>
 
        * elfnn-aarch64.c (elfNN_aarch64_howto_table): Set overflow type to
index 804820ee05180a33283677ff634cad23a04858e4..09331bded3945763fb3df1414529d9d5954fad46 100644 (file)
@@ -5737,6 +5737,9 @@ the GOT entry for this symbol.  Used in conjunction with
 BFD_RELOC_AARCH64_ADR_GOTPAGE.  Valid in ILP32 ABI only.  */
   BFD_RELOC_AARCH64_LD32_GOT_LO12_NC,
 
+/* Scaled 14 bit byte offset to the page base of the global offset table.  */
+  BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14,
+
 /* Scaled 15 bit byte offset to the page base of the global offset table.  */
   BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15,
 
index 26f20c587b5b7efaa5daf5f1a18d9d42b9f4bfaf..3104de78388cddca01622a450ab1e8757cbdf6d7 100644 (file)
@@ -848,6 +848,22 @@ static reloc_howto_type elfNN_aarch64_howto_table[] =
         0xffc,                 /* dst_mask */
         FALSE),                /* pcrel_offset */
 
+  /* LD32: GOT offset to the page address of GOT table.
+     (G(S) - PAGE (_GLOBAL_OFFSET_TABLE_)) & 0x5ffc.  */
+  HOWTO32 (AARCH64_R (LD32_GOTPAGE_LO14),      /* type */
+        2,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        12,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_unsigned,    /* complain_on_overflow */
+        bfd_elf_generic_reloc, /* special_function */
+        AARCH64_R_STR (LD32_GOTPAGE_LO14),     /* name */
+        FALSE,                 /* partial_inplace */
+        0x5ffc,                /* src_mask */
+        0x5ffc,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
   /* LD64: GOT offset to the page address of GOT table.
      (G(S) - PAGE (_GLOBAL_OFFSET_TABLE_)) & 0x7ff8.  */
   HOWTO64 (AARCH64_R (LD64_GOTPAGE_LO15),      /* type */
index 73a580320d8f961c2234f44c5a01ef818e978920..b2a09791cc9ca6029d0bbacdaade2ac108637694 100644 (file)
@@ -2733,6 +2733,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
   "BFD_RELOC_AARCH64_ADR_GOT_PAGE",
   "BFD_RELOC_AARCH64_LD64_GOT_LO12_NC",
   "BFD_RELOC_AARCH64_LD32_GOT_LO12_NC",
+  "BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14",
   "BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15",
   "BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21",
   "BFD_RELOC_AARCH64_TLSGD_ADR_PREL21",
index 4ee384fae79312f6d1ac096e9ebe87978b4727c6..7f2b31e35c59641fd97d316e4c2dc70b697ca838 100644 (file)
@@ -6761,6 +6761,10 @@ ENUMDOC
   Unsigned 12 bit byte offset for 32 bit load/store from the page of
   the GOT entry for this symbol.  Used in conjunction with
   BFD_RELOC_AARCH64_ADR_GOTPAGE.  Valid in ILP32 ABI only.
+ENUM
+  BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14
+ENUMDOC
+  Scaled 14 bit byte offset to the page base of the global offset table.
 ENUM
   BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15
 ENUMDOC
index 4d06707ddde85a185b6e054f09597c2ceade4b0f..3b606eaa4bbec2778c5daf514438f0b63cd428f8 100644 (file)
@@ -1,3 +1,9 @@
+2015-06-01  Jiong Wang  <jiong.wang@arm.com>
+
+       * config/tc-aarch64.c (reloc_table): New relocation modifiers.
+       (md_apply_fix): Support BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14.
+       (aarch64_force_relocation): Ditto.
+
 2015-06-01  Jiong Wang  <jiong.wang@arm.com>
 
        * config/tc-aarch64.c (reloc_table): New relocation modifiers.
index 2139f9d69989496864ce245a17547533a6056491..2782a2a9a926d250a93c4a3ca32bf99c6a81256e 100644 (file)
@@ -2598,6 +2598,15 @@ static struct reloc_table_entry reloc_table[] = {
    0,
    BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15,
    0},
+
+  /* 14bit offset from got entry to base address of GOT table.  */
+  {"gotpage_lo14", 0,
+   0,
+   0,
+   0,
+   0,
+   BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14,
+   0},
 };
 
 /* Given the address of a pointer pointing to the textual name of a
@@ -6767,6 +6776,7 @@ md_apply_fix (fixS * fixP, valueT * valP, segT seg)
     case BFD_RELOC_AARCH64_ADR_HI21_PCREL:
     case BFD_RELOC_AARCH64_GOT_LD_PREL19:
     case BFD_RELOC_AARCH64_LD32_GOT_LO12_NC:
+    case BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14:
     case BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15:
     case BFD_RELOC_AARCH64_LD64_GOT_LO12_NC:
     case BFD_RELOC_AARCH64_LDST128_LO12:
@@ -6921,6 +6931,7 @@ aarch64_force_relocation (struct fix *fixp)
     case BFD_RELOC_AARCH64_ADR_HI21_PCREL:
     case BFD_RELOC_AARCH64_GOT_LD_PREL19:
     case BFD_RELOC_AARCH64_LD32_GOT_LO12_NC:
+    case BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14:
     case BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15:
     case BFD_RELOC_AARCH64_LD64_GOT_LO12_NC:
     case BFD_RELOC_AARCH64_LDST128_LO12:
index 83a73d10a397f318ce448d026a190c69791c2cca..38751eb2642a877608a06b20bb48f3ef70065074 100644 (file)
@@ -1,3 +1,8 @@
+2015-06-01  Jiong Wang  <jiong.wang@arm.com>
+
+       * gas/aarch64/ilp32-basic.s: New testcase.
+       * gas/aarch64/ilp32-basic.d: Ditto.
+
 2015-06-01  Jiong Wang  <jiong.wang@arm.com>
 
        * gas/aarch64/reloc-insn.s: New testcase.
index 2e5146a88077fc1103973cfc5b3dad189b4b24ca..3caef3e040a97b2cd3137418782be8484c44250a 100644 (file)
@@ -21,3 +21,5 @@ Disassembly of section \.text:
                        18: R_AARCH64_P32_LD32_GOT_LO12_NC      ptrs
   1c:  2a0403e0        mov     w0, w4
   20:  d65f03c0        ret
+  24:  f9400083        ldr     x3, \[x4\]
+                       24: R_AARCH64_P32_LD32_GOTPAGE_LO14     ptrs
index 790dcdf65c06e9ddca8888a8d22808602e5cdf51..ab11ea8aa1e2253d619c55ef70a4d790f77dcd5f 100644 (file)
@@ -13,5 +13,6 @@ foo:
        ldr     x3, [x4,#:got_lo12:ptrs]
        mov     w0, w4
        ret
+       ldr     x3, [x4,#:gotpage_lo14:ptrs]
        .size   foo, .-foo
        .comm   ptrs,12,8
This page took 0.040086 seconds and 4 git commands to generate.