[GAS][AARCH64]Add BFD_RELOC_AARCH64_TLSGD_MOVW_G0_NC support.
authorRenlin Li <renlin.li@arm.com>
Fri, 2 Oct 2015 15:28:49 +0000 (16:28 +0100)
committerRenlin Li <renlin.li@arm.com>
Fri, 2 Oct 2015 16:56:08 +0000 (17:56 +0100)
bfd/

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

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

gas/

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

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

gas/testsuite/

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

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

index 6fabefa1886f45b71abf0653f1c67bd271a2c7e1..1b56c3d74c78dcd52ae378415d8d937d68adf5ad 100644 (file)
@@ -1,3 +1,11 @@
+2015-10-02  Renlin Li  <renlin.li@arm.com>
+
+       * reloc.c (BFD_RELOC_AARCH64_TLSGD_MOVW_G0_NC): New entry.
+       * elfnn-aarch64.c (elfNN_aarch64_howto_table): New entry for
+       BFD_RELOC_AARCH64_TLSGD_MOVW_G0_NC.
+       * libbfd.h: Regenerate.
+       * bfd-in2.h: Likewise
+
 2015-10-02  Renlin Li  <renlin.li@arm.com>
 
        * elfnn-aarch64.c (aarch64_reloc_got_type): Add
index 39c1af2a89b509b7a0ff8365d198b3d131aca541..036bbbbbf998eb22636b6e0249fab4d40f35ff25 100644 (file)
@@ -5786,6 +5786,9 @@ tls_index structure.  Used in conjunction with
 BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21.  */
   BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC,
 
+/* AArch64 TLS General Dynamic relocation.  */
+  BFD_RELOC_AARCH64_TLSGD_MOVW_G0_NC,
+
 /* AArch64 TLS General Dynamic relocation.  */
   BFD_RELOC_AARCH64_TLSGD_MOVW_G1,
 
index 7977588295c0ef567d5601d3b7da3feaf83d536a..519aa51be5888c6b552287a49e59453ac9f9d4a8 100644 (file)
   ((R_TYPE) == BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC             \
    || (R_TYPE) == BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21           \
    || (R_TYPE) == BFD_RELOC_AARCH64_TLSGD_ADR_PREL21           \
+   || (R_TYPE) == BFD_RELOC_AARCH64_TLSGD_MOVW_G0_NC           \
    || (R_TYPE) == BFD_RELOC_AARCH64_TLSGD_MOVW_G1              \
    || (R_TYPE) == BFD_RELOC_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21  \
    || (R_TYPE) == BFD_RELOC_AARCH64_TLSIE_LD32_GOTTPREL_LO12_NC        \
@@ -1007,6 +1008,21 @@ static reloc_howto_type elfNN_aarch64_howto_table[] =
         0xfff,                 /* dst_mask */
         FALSE),                /* pcrel_offset */
 
+  /* Lower 16 bits of GOT offset to tls_index.  */
+  HOWTO64 (AARCH64_R (TLSGD_MOVW_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 (TLSGD_MOVW_G0_NC),      /* name */
+        FALSE,                 /* partial_inplace */
+        0xffff,                /* src_mask */
+        0xffff,                /* dst_mask */
+        FALSE),                /* pcrel_offset */
+
   /* Higher 16 bits of GOT offset to tls_index.  */
   HOWTO64 (AARCH64_R (TLSGD_MOVW_G1),  /* type */
         16,                    /* rightshift */
index 93bdc5d5e14642a13b31ad6218f670c9267ad4ef..3d3d586c12d67f1915f587f54583a782ea03f40a 100644 (file)
@@ -2755,6 +2755,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
   "BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21",
   "BFD_RELOC_AARCH64_TLSGD_ADR_PREL21",
   "BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC",
+  "BFD_RELOC_AARCH64_TLSGD_MOVW_G0_NC",
   "BFD_RELOC_AARCH64_TLSGD_MOVW_G1",
   "BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G1",
   "BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC",
index b32a2e26b2a8f2c695bd6695487140e62abfcb5b..a08019169d9782a45f6003acca60b7a63bacc2b3 100644 (file)
@@ -6829,6 +6829,10 @@ ENUMDOC
   Unsigned 12 bit byte offset to global offset table entry for a symbols
   tls_index structure.  Used in conjunction with
   BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21.
+ENUM
+  BFD_RELOC_AARCH64_TLSGD_MOVW_G0_NC
+ENUMDOC
+  AArch64 TLS General Dynamic relocation.
 ENUM
   BFD_RELOC_AARCH64_TLSGD_MOVW_G1
 ENUMDOC
index 8d0908f660480caa135c970a4c9a01aae9c78c46..5fc9cae3cc8ce873ab6af8343f62a07fef60ee4e 100644 (file)
@@ -1,3 +1,10 @@
+2015-10-02  Renlin Li <renlin.li@arm.com>
+
+       * config/tc-aarch64.c (reloc_table): New relocation modifier tlsgd_g0_nc.
+       (process_movw_reloc_info): Support BFD_RELOC_AARCH64_TLSGD_MOVW_G1.
+       (md_apply_fix): Likewise.
+       (aarch64_force_relocation): Likewise.
+
 2015-10-02  Renlin Li <renlin.li@arm.com>
 
        * config/tc-aarch64.c (reloc_table): New relocation modifier tlsgd_g1.
index 5716ef07eb44d936aa68a5b56c67da041367cb08..a13ba55c1ae55bc9805787a2a945347ea300fd14 100644 (file)
@@ -2500,6 +2500,15 @@ static struct reloc_table_entry reloc_table[] = {
    0,
    0},
 
+  /* Lower 16 bits address/value: MOVk.  */
+  {"tlsgd_g0_nc", 0,
+   0,                          /* adr_type */
+   0,
+   BFD_RELOC_AARCH64_TLSGD_MOVW_G0_NC,
+   0,
+   0,
+   0},
+
   /* Most significant bits 16-31 of address/value: MOVZ.  */
   {"tlsgd_g1", 0,
    0,                          /* adr_type */
@@ -4696,6 +4705,7 @@ process_movw_reloc_info (void)
     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_TLSGD_MOVW_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:
@@ -6926,6 +6936,7 @@ md_apply_fix (fixS * fixP, valueT * valP, segT seg)
     case BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC:
     case BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21:
     case BFD_RELOC_AARCH64_TLSGD_ADR_PREL21:
+    case BFD_RELOC_AARCH64_TLSGD_MOVW_G0_NC:
     case BFD_RELOC_AARCH64_TLSGD_MOVW_G1:
     case BFD_RELOC_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21:
     case BFD_RELOC_AARCH64_TLSIE_LD32_GOTTPREL_LO12_NC:
@@ -7155,6 +7166,7 @@ aarch64_force_relocation (struct fix *fixp)
     case BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC:
     case BFD_RELOC_AARCH64_TLSGD_ADR_PAGE21:
     case BFD_RELOC_AARCH64_TLSGD_ADR_PREL21:
+    case BFD_RELOC_AARCH64_TLSGD_MOVW_G0_NC:
     case BFD_RELOC_AARCH64_TLSGD_MOVW_G1:
     case BFD_RELOC_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21:
     case BFD_RELOC_AARCH64_TLSIE_LD32_GOTTPREL_LO12_NC:
index cf9e0dab893f704aea2e7c01a9682b572bc9a3ca..cbc37a86ebdb78612858c5569e96d61a4f14d8ee 100644 (file)
@@ -1,3 +1,8 @@
+2015-10-02  Renlin Li <renlin.li@arm.com>
+
+    * gas/aarch64/reloc-tlsgd_g0_nc.d: New.
+    * gas/aarch64/reloc-tlsgd_g0_nc.s: New.
+
 2015-10-02  Renlin Li <renlin.li@arm.com>
 
        * gas/aarch64/reloc-tlsgd_g1.s: New.
diff --git a/gas/testsuite/gas/aarch64/reloc-tlsgd_g0_nc.d b/gas/testsuite/gas/aarch64/reloc-tlsgd_g0_nc.d
new file mode 100644 (file)
index 0000000..157c5fd
--- /dev/null
@@ -0,0 +1,9 @@
+#objdump: -dr
+
+.*:     file format .*
+
+Disassembly of section \.text:
+
+0000000000000000 <.*>:
+   0:  f280001c        movk    x28, #0x0
+                       0: R_AARCH64_TLSGD_MOVW_G0_NC   var
diff --git a/gas/testsuite/gas/aarch64/reloc-tlsgd_g0_nc.s b/gas/testsuite/gas/aarch64/reloc-tlsgd_g0_nc.s
new file mode 100644 (file)
index 0000000..bb253fa
--- /dev/null
@@ -0,0 +1,4 @@
+func:
+
+       // R_AARCH64_TLSGD_MOVW_G0_NC var
+       movk x28, #:tlsgd_g0_nc:var