[GAS][AARCH64]Add BFD_RELOC_AARCH64_MOVW_GOTOFF_G0_NC Support.
authorRenlin Li <renlin.li@arm.com>
Fri, 2 Oct 2015 14:42:01 +0000 (15:42 +0100)
committerRenlin Li <renlin.li@arm.com>
Fri, 2 Oct 2015 16:56:07 +0000 (17:56 +0100)
bfd/

2015-10-02  Renlin Li <renlin.li@arm.com>

* reloc.c (BFD_RELOC_AARCH64_MOVW_GOTOFF_G0_NC): New.
* elfnn-aarch64.c (elfNN_aarch64_howto_table): New entry
MOVW_GOTOFF_G0_NC.
* libbfd.h: Regnerate.
* bfd-in2.h: Regenerate.

gas/

2015-10-02  Renlin Li <renlin.li@arm.com>

* config/tc-aarch64.c (reloc_table): New relocation modifier
gotoff_g0_nc.
(process_movw_reloc_info): Support gotoff_g0_nc.
(md_apply_fix): Likewise.

gas/testsuite/

2015-10-02  Renlin Li <renlin.li@arm.com>

* gas/aarch64/reloc-gotoff_g0_nc.s: New.
* gas/aarch64/reloc-gotoff_g0_nc.d: New.

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/reloc-gotoff_g0_nc.d [new file with mode: 0644]
gas/testsuite/gas/aarch64/reloc-gotoff_g0_nc.s [new file with mode: 0644]

index f92ef661a7da32f387de1152cb6f6c8262c4cbff..2f7e58428a7f038386a36b1a68a283d1d0cfc54d 100644 (file)
@@ -1,3 +1,11 @@
+2015-10-02  Renlin Li  <renlin.li@arm.com>
+
+       * reloc.c (BFD_RELOC_AARCH64_MOVW_GOTOFF_G0_NC): New.
+       * elfnn-aarch64.c (elfNN_aarch64_howto_table): New entry
+       MOVW_GOTOFF_G0_NC.
+       * libbfd.h: Regnerate.
+       * bfd-in2.h: Regenerate.
+
 2015-10-02  Renlin Li  <renlin.li@arm.com>
 
        * elfnn-aarch64.c (aarch64_reloc_got_type): Add support
index 9c4b34927e2102a29de2b6d0b0fa64d33be84867..6cd47ece13b5e3008c4f2767f466074ef03fdecb 100644 (file)
@@ -5754,6 +5754,10 @@ 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,
 
+/* Unsigned 16 bit byte offset for 64 bit load/store from the GOT entry
+for this symbol.  Valid in LP64 ABI only.  */
+  BFD_RELOC_AARCH64_MOVW_GOTOFF_G0_NC,
+
 /* Unsigned 16 bit byte higher offset for 64 bit load/store from the GOT entry
 for this symbol.  Valid in LP64 ABI only.  */
   BFD_RELOC_AARCH64_MOVW_GOTOFF_G1,
index 715eff62182557f392ee3a3c3c439f90145ba3ee..49d6eeee011a46271c4657fe85fb11d22b691ceb 100644 (file)
@@ -884,6 +884,21 @@ static reloc_howto_type elfNN_aarch64_howto_table[] =
         0xffc,                 /* dst_mask */
         FALSE),                /* pcrel_offset */
 
+  /* Lower 16 bits of GOT offset for the symbol.  */
+  HOWTO64 (AARCH64_R (MOVW_GOTOFF_G0_NC),      /* type */
+        0,                     /* rightshift */
+        2,                     /* size (0 = byte, 1 = short, 2 = long) */
+        16,                    /* bitsize */
+        FALSE,                 /* pc_relative */
+        0,                     /* bitpos */
+        complain_overflow_dont,        /* complain_on_overflow */
+        bfd_elf_generic_reloc, /* special_function */
+        AARCH64_R_STR (MOVW_GOTOFF_G0_NC),     /* name */
+        FALSE,                 /* partial_inplace */
+        0xffff,                /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
   /* Higher 16 bits of GOT offset for the symbol.  */
   HOWTO64 (AARCH64_R (MOVW_GOTOFF_G1), /* type */
         16,                    /* rightshift */
index ae5b2b06ee998af9fc21e2e41d61692c7c5abd28..9483c0a55775fc7ba5f910e2cc958d1633c1b60b 100644 (file)
@@ -2747,6 +2747,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_MOVW_GOTOFF_G0_NC",
   "BFD_RELOC_AARCH64_MOVW_GOTOFF_G1",
   "BFD_RELOC_AARCH64_LD64_GOTOFF_LO15",
   "BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14",
index 750a612368918a31bcd90aa5c3647126a10bb0d9..cec9a1f6d50cdfd0509ffd1fc4270ca5f865543d 100644 (file)
@@ -6789,6 +6789,11 @@ 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_MOVW_GOTOFF_G0_NC
+ENUMDOC
+  Unsigned 16 bit byte offset for 64 bit load/store from the GOT entry
+  for this symbol.  Valid in LP64 ABI only.
 ENUM
   BFD_RELOC_AARCH64_MOVW_GOTOFF_G1
 ENUMDOC
index 04928017a09a9e8afbeb1450c38b285f5b595633..63b9805afb2d65054b4c99b1e2da9ef2ed8a2338 100644 (file)
@@ -1,3 +1,10 @@
+2015-10-02  Renlin Li <renlin.li@arm.com>
+
+       * config/tc-aarch64.c (reloc_table): New relocation modifier
+       gotoff_g0_nc.
+       (process_movw_reloc_info): Support gotoff_g0_nc.
+       (md_apply_fix): Likewise.
+
 2015-10-02  Renlin Li  <renlin.li@arm.com>
 
        * config/tc-aarch64.c (reloc_table): New relocation modifier
index 1b0e69b2f3b3f129ce9366e0f72e958131b424dd..1b62b3996179653ecd84b59a79a166da31b451aa 100644 (file)
@@ -2455,6 +2455,15 @@ static struct reloc_table_entry reloc_table[] = {
    BFD_RELOC_AARCH64_LD_GOT_LO12_NC,
    0},
 
+  /* 0-15 bits of address/value: MOVk, no check.  */
+  {"gotoff_g0_nc", 0,
+   0,                          /* adr_type */
+   0,
+   BFD_RELOC_AARCH64_MOVW_GOTOFF_G0_NC,
+   0,
+   0,
+   0},
+
   /* Most significant bits 16-31 of address/value: MOVZ.  */
   {"gotoff_g1", 0,
    0,                          /* adr_type */
@@ -4676,6 +4685,7 @@ process_movw_reloc_info (void)
     case BFD_RELOC_AARCH64_MOVW_G0:
     case BFD_RELOC_AARCH64_MOVW_G0_NC:
     case BFD_RELOC_AARCH64_MOVW_G0_S:
+    case BFD_RELOC_AARCH64_MOVW_GOTOFF_G0_NC:
     case BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0:
     case BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0_NC:
     case BFD_RELOC_AARCH64_TLSLE_MOVW_TPREL_G0:
@@ -6799,6 +6809,7 @@ md_apply_fix (fixS * fixP, valueT * valP, segT seg)
     case BFD_RELOC_AARCH64_MOVW_G0:
     case BFD_RELOC_AARCH64_MOVW_G0_NC:
     case BFD_RELOC_AARCH64_MOVW_G0_S:
+    case BFD_RELOC_AARCH64_MOVW_GOTOFF_G0_NC:
       scale = 0;
       goto movw_common;
     case BFD_RELOC_AARCH64_MOVW_G1:
index 5f5e35c55da386d3548880aa69b70263e37ac34c..585d3544fd1d8ecb9ecf7f8dc0239c7b67ec8d30 100644 (file)
@@ -1,3 +1,8 @@
+2015-10-02  Renlin Li <renlin.li@arm.com>
+
+       * gas/aarch64/reloc-gotoff_g0_nc.s: New.
+       * gas/aarch64/reloc-gotoff_g0_nc.d: New.
+
 2015-10-02  Renlin Li  <renlin.li@arm.com>
 
        * gas/aarch64/reloc-gotoff_g1.s: New.
diff --git a/gas/testsuite/gas/aarch64/reloc-gotoff_g0_nc.d b/gas/testsuite/gas/aarch64/reloc-gotoff_g0_nc.d
new file mode 100644 (file)
index 0000000..4c0bc60
--- /dev/null
@@ -0,0 +1,9 @@
+#objdump: -dr
+
+.*:     file format .*
+
+Disassembly of section \.text:
+
+0000000000000000 <.*>:
+   0:  f280001c        movk    x28, #0x0
+                       0: R_AARCH64_MOVW_GOTOFF_G0_NC  x
diff --git a/gas/testsuite/gas/aarch64/reloc-gotoff_g0_nc.s b/gas/testsuite/gas/aarch64/reloc-gotoff_g0_nc.s
new file mode 100644 (file)
index 0000000..2affa03
--- /dev/null
@@ -0,0 +1,5 @@
+// Test file for AArch64 GAS -- gotoff_g0_nc
+
+func:
+       // BFD_RELOC_AARCH64_MOVW_GOTOFF_G0_NC
+       movk    x28, #:gotoff_g0_nc:x