[AArch64][6/8] LD support BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC
authorJiong Wang <jiong.wang@arm.com>
Tue, 11 Aug 2015 16:20:17 +0000 (17:20 +0100)
committerJiong Wang <jiong.wang@arm.com>
Tue, 11 Aug 2015 20:26:13 +0000 (21:26 +0100)
2015-08-11  Jiong Wang  <jiong.wang@arm.com>

bfd/
  * elfnn-aarch64.c (IS_AARCH64_TLS_RELOC): Recognize
  BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC.
  (aarch64_reloc_got_type): Likewise.
  (elfNN_aarch64_final_link_relocate): Likewise.
  (elfNN_aarch64_relocate_section): Likewise.
  (elfNN_aarch64_gc_sweep_hook): Likewise.
  (elfNN_aarch64_check_relocs): Likewise.
  * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
  (_bfd_aarch64_elf_resolve_relocation): Likewise.

ld/testsuite/
  * ld-aarch64/tls-small-ld.s: Update testcase.

bfd/ChangeLog
bfd/elfnn-aarch64.c
bfd/elfxx-aarch64.c
ld/testsuite/ChangeLog
ld/testsuite/ld-aarch64/tls-small-ld.s

index 6e12da30ef0dbe0290f15e39880f79f05cf0830d..8c6de6f961e58afde44e465905d87f8ae8eabd47 100644 (file)
@@ -1,3 +1,15 @@
+2015-08-11  Jiong Wang  <jiong.wang@arm.com>
+
+       * elfnn-aarch64.c (IS_AARCH64_TLS_RELOC): Recognize
+       BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC.
+       (aarch64_reloc_got_type): Likewise.
+       (elfNN_aarch64_final_link_relocate): Likewise.
+       (elfNN_aarch64_relocate_section): Likewise.
+       (elfNN_aarch64_gc_sweep_hook): Likewise.
+       (elfNN_aarch64_check_relocs): Likewise.
+       * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
+       (_bfd_aarch64_elf_resolve_relocation): Likewise.
+
 2015-08-11  Jiong Wang  <jiong.wang@arm.com>
 
        * reloc.c (BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC): New entry.
index 12c1220fb9901ca0e0d4598fd0e80fde3ff1eea6..72d64fe70405c85bf28d8da84605640d33e4adc9 100644 (file)
    || (R_TYPE) == BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19   \
    || (R_TYPE) == BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC  \
    || (R_TYPE) == BFD_RELOC_AARCH64_TLSIE_MOVW_GOTTPREL_G1     \
+   || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC          \
    || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21           \
    || (R_TYPE) == BFD_RELOC_AARCH64_TLSLD_ADR_PREL21           \
    || (R_TYPE) == BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_HI12       \
@@ -4138,6 +4139,7 @@ aarch64_reloc_got_type (bfd_reloc_code_real_type r_type)
     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_TLSLD_ADD_LO12_NC:
     case BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21:
     case BFD_RELOC_AARCH64_TLSLD_ADR_PREL21:
       return GOT_TLS_GD;
@@ -5046,6 +5048,7 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto,
     case BFD_RELOC_AARCH64_TLSIE_LD32_GOTTPREL_LO12_NC:
     case BFD_RELOC_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC:
     case BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19:
+    case BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC:
     case BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21:
     case BFD_RELOC_AARCH64_TLSLD_ADR_PREL21:
       if (globals->root.sgot == NULL)
@@ -5532,6 +5535,7 @@ elfNN_aarch64_relocate_section (bfd *output_bfd,
        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_TLSLD_ADD_LO12_NC:
        case BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21:
        case BFD_RELOC_AARCH64_TLSLD_ADR_PREL21:
          if (! symbol_got_offset_mark_p (input_bfd, h, r_symndx))
@@ -5570,7 +5574,8 @@ elfNN_aarch64_relocate_section (bfd *output_bfd,
                    elfNN_aarch64_bfd_reloc_from_type (r_type);
 
                  if (real_type == BFD_RELOC_AARCH64_TLSLD_ADR_PREL21
-                     || real_type == BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21)
+                     || real_type == BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21
+                     || real_type == BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC)
                    {
                      /* For local dynamic, don't generate DTPREL in any case.
                         Initialize the DTPREL slot into zero, so we get module
@@ -6063,6 +6068,7 @@ elfNN_aarch64_gc_sweep_hook (bfd *abfd,
        case BFD_RELOC_AARCH64_TLSIE_LD32_GOTTPREL_LO12_NC:
        case BFD_RELOC_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC:
        case BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19:
+       case BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC:
        case BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21:
        case BFD_RELOC_AARCH64_TLSLD_ADR_PREL21:
        case BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_HI12:
@@ -6537,6 +6543,7 @@ elfNN_aarch64_check_relocs (bfd *abfd, struct bfd_link_info *info,
        case BFD_RELOC_AARCH64_TLSIE_LD32_GOTTPREL_LO12_NC:
        case BFD_RELOC_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC:
        case BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19:
+       case BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC:
        case BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21:
        case BFD_RELOC_AARCH64_TLSLD_ADR_PREL21:
        case BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_HI12:
index 3186d8ed71419204fb9f1627aa7e422d17309d51..75f518d09d8b87215eb84f57f3932524c38ebf32 100644 (file)
@@ -249,6 +249,7 @@ _bfd_aarch64_elf_put_addend (bfd *abfd,
     case BFD_RELOC_AARCH64_ADD_LO12:
     case BFD_RELOC_AARCH64_TLSDESC_ADD_LO12_NC:
     case BFD_RELOC_AARCH64_TLSGD_ADD_LO12_NC:
+    case BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC:
     case BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_HI12:
     case BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_LO12:
     case BFD_RELOC_AARCH64_TLSLE_ADD_TPREL_LO12_NC:
index 99e87f7df43c3d78c32a103dd8975584c7472d66..d6188663eb9e074b95fc5f64f43903c7a79d5b10 100644 (file)
@@ -1,3 +1,7 @@
+2015-08-11  Jiong Wang  <jiong.wang@arm.com>
+
+       * ld-aarch64/tls-small-ld.s: Update testcase.
+
 2015-08-11  Jiong Wang  <jiong.wang@arm.com>
 
        * ld-aarch64/tls-small-ld.s: New file.
index 0a8b6b972fc3379051f76b53f94d5d19a4fa1de0..ed0668664f78e2a6e93f72f2db4145700da00bc5 100644 (file)
@@ -2,6 +2,7 @@
 
        .text
 func:
-       add     x1, x2, x3
+       // BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC
+       add     x1, x2, #:tlsldm_lo12_nc:dummy
        // BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21
        adrp    x0, :tlsldm:dummy