[gold patch] PR 22969: Add support for R_AARCH64_TLSLE_LDST8_TPREL_LO12, etc.

Cary Coutant ccoutant@gmail.com
Wed Mar 28 01:23:00 GMT 2018


> Can you please look over this patch and give it a test? Let me know if
> it's OK to check in.

While I was looking in relocate_tls(), I found the following, which
looks suspicious to me:

    case elfcpp::R_AARCH64_TLSLE_MOVW_TPREL_G2:
    case elfcpp::R_AARCH64_TLSLE_MOVW_TPREL_G1:
    case elfcpp::R_AARCH64_TLSLE_MOVW_TPREL_G1_NC:
    case elfcpp::R_AARCH64_TLSLE_MOVW_TPREL_G0:
    case elfcpp::R_AARCH64_TLSLE_MOVW_TPREL_G0_NC:
    case elfcpp::R_AARCH64_TLSLE_ADD_TPREL_HI12:
    case elfcpp::R_AARCH64_TLSLE_ADD_TPREL_LO12:
    case elfcpp::R_AARCH64_TLSLE_ADD_TPREL_LO12_NC:
      {
        gold_assert(tls_segment != NULL);
        AArch64_address value = psymval->value(object, 0);

        if (!parameters->options().shared())
          {
            AArch64_address aligned_tcb_size =
                align_address(target->tcb_size(),
                              tls_segment->maximum_alignment());
            value += aligned_tcb_size;
            switch (r_type)
              {
              case elfcpp::R_AARCH64_TLSLE_MOVW_TPREL_G2:
              case elfcpp::R_AARCH64_TLSLE_MOVW_TPREL_G1:
              case elfcpp::R_AARCH64_TLSLE_MOVW_TPREL_G0:
                return aarch64_reloc_funcs::movnz(view, value + addend,
                                                  reloc_property);
              default:
                return aarch64_reloc_funcs::template
                  rela_general<32>(view,
                                   value,
                                   addend,
                                   reloc_property);
              }
          }

For TLSLE_MOVW_TPREL_G1_NC and TLSLE_MOVW_TPREL_G0_NC, shouldn't we
also use movnz instead of the default rela_general?

-cary



More information about the Binutils mailing list