[gold patch] PR 22969: Add support for R_AARCH64_TLSLE_LDST8_TPREL_LO12, etc.
Renlin Li
renlin.li@foss.arm.com
Wed Mar 28 13:40:00 GMT 2018
Hi Cary,
On 28/03/18 02:23, Cary Coutant wrote:
>> 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?
This is correct as far as I know.
TLSLE_MOVW_TPREL_G1_NC, TLSLE_MOVW_TPREL_G0_NC are relocations used with MOVK instruction.
while
TLSLE_MOVW_TPREL_G2, TLSLE_MOVW_TPREL_G1, TLSLE_MOVW_TPREL_G0 are used with MOV[NZ] instruction.
Regards,
Renlin
>
> -cary
>
More information about the Binutils
mailing list