From e82e6b2b19eb796fed161b1658de6d5f763c18de Mon Sep 17 00:00:00 2001 From: Cary Coutant Date: Tue, 27 Mar 2018 18:24:48 -0700 Subject: [PATCH] Add support for R_AARCH64_TLSLE_LDST8_TPREL_LO12, etc. elfcpp/ PR gold/22969 * aarch64.h: Fix spelling of R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC. gold/ PR gold/22969 * aarch64-reloc.def: Add TLSLE_LDST* relocations. * aarch64.cc (Target_aarch64::optimize_tls_reloc): Likewise. (Target_aarch64::Scan::local): Likewise. (Target_aarch64::Scan::global): Likewise. (Target_aarch64::Relocate::relocate): Likewise. (Target_aarch64::Relocate::relocate_tls): Likewise. --- elfcpp/ChangeLog | 5 +++++ elfcpp/aarch64.h | 2 +- gold/ChangeLog | 11 ++++++++++- gold/aarch64-reloc.def | 8 ++++++++ gold/aarch64.cc | 42 +++++++++++++++++++++++++++++++++++++++++- 5 files changed, 65 insertions(+), 3 deletions(-) diff --git a/elfcpp/ChangeLog b/elfcpp/ChangeLog index 0c25304..776908f 100644 --- a/elfcpp/ChangeLog +++ b/elfcpp/ChangeLog @@ -1,3 +1,8 @@ +2018-03-28 Cary Coutant + + PR gold/22969 + * aarch64.h: Fix spelling of R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC. + 2018-01-13 Nick Clifton 2.30 branch created. diff --git a/elfcpp/aarch64.h b/elfcpp/aarch64.h index 935a4d7..eb1ce6a 100644 --- a/elfcpp/aarch64.h +++ b/elfcpp/aarch64.h @@ -146,7 +146,7 @@ enum R_AARCH64_TLSLE_LDST8_TPREL_LO12 = 552, // TPREL(S+A) R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC = 553, // TPREL(S+A) R_AARCH64_TLSLE_LDST16_TPREL_LO12 = 554, // TPREL(S+A) - R_AARCH64_TLSLE_LSDT16_TPREL_LO12_NC = 555, // TPREL(S+A) + R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC = 555, // TPREL(S+A) R_AARCH64_TLSLE_LDST32_TPREL_LO12 = 556, // TPREL(S+A) R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC = 557, // TPREL(S+A) R_AARCH64_TLSLE_LDST64_TPREL_LO12 = 558, // TPREL(S+A) diff --git a/gold/ChangeLog b/gold/ChangeLog index 38a2ecf..1ba3414 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,10 +1,19 @@ +2018-03-28 Cary Coutant + + PR gold/22969 + * aarch64-reloc.def: Add TLSLE_LDST* relocations. + * aarch64.cc (Target_aarch64::optimize_tls_reloc): Likewise. + (Target_aarch64::Scan::local): Likewise. + (Target_aarch64::Scan::global): Likewise. + (Target_aarch64::Relocate::relocate): Likewise. + (Target_aarch64::Relocate::relocate_tls): Likewise. + 2018-03-27 Roland McGrath * testsuite/split_x86_64.sh: Fix bad regexp. 2018-03-26 Cary Coutant -gold/ PR gold/22868 * plugin.cc (Sized_pluginobj::do_add_symbols): Use a real section index instead of SHN_ABS for defined symbols. diff --git a/gold/aarch64-reloc.def b/gold/aarch64-reloc.def index 2fc0059..b8528e4 100644 --- a/gold/aarch64-reloc.def +++ b/gold/aarch64-reloc.def @@ -108,6 +108,14 @@ ARD(TLSLE_MOVW_TPREL_G0_NC , STATIC , AARCH64 , Y, 0, 0,0 ARD(TLSLE_ADD_TPREL_HI12 , STATIC , AARCH64 , Y, -1, 0,24 , 12,23 , Symbol::TLS_REF , ADD ) ARD(TLSLE_ADD_TPREL_LO12 , STATIC , AARCH64 , Y, -1, 0,12 , 0,11 , Symbol::TLS_REF , ADD ) ARD(TLSLE_ADD_TPREL_LO12_NC , STATIC , AARCH64 , Y, -1, 0,0 , 0,11 , Symbol::TLS_REF , ADD ) +ARD(TLSLE_LDST8_TPREL_LO12 , STATIC , AARCH64 , Y, -1, 0,12 , 0,11 , Symbol::TLS_REF , LDST ) +ARD(TLSLE_LDST8_TPREL_LO12_NC , STATIC , AARCH64 , Y, -1, 0,0 , 0,11 , Symbol::TLS_REF , LDST ) +ARD(TLSLE_LDST16_TPREL_LO12 , STATIC , AARCH64 , Y, -1, 0,12 , 1,11 , Symbol::TLS_REF , LDST ) +ARD(TLSLE_LDST16_TPREL_LO12_NC , STATIC , AARCH64 , Y, -1, 0,0 , 1,11 , Symbol::TLS_REF , LDST ) +ARD(TLSLE_LDST32_TPREL_LO12 , STATIC , AARCH64 , Y, -1, 0,12 , 2,11 , Symbol::TLS_REF , LDST ) +ARD(TLSLE_LDST32_TPREL_LO12_NC , STATIC , AARCH64 , Y, -1, 0,0 , 2,11 , Symbol::TLS_REF , LDST ) +ARD(TLSLE_LDST64_TPREL_LO12 , STATIC , AARCH64 , Y, -1, 0,12 , 3,11 , Symbol::TLS_REF , LDST ) +ARD(TLSLE_LDST64_TPREL_LO12_NC , STATIC , AARCH64 , Y, -1, 0,0 , 3,11 , Symbol::TLS_REF , LDST ) // Above is from Table 4-18, Local Exec TLS relocations, 544-571. ARD(TLSDESC_ADR_PAGE21 , STATIC , AARCH64 , Y, -1, 32,32 , 12,32 , Symbol::TLS_REF , ADRP ) diff --git a/gold/aarch64.cc b/gold/aarch64.cc index 1abdb27..ecb400b 100644 --- a/gold/aarch64.cc +++ b/gold/aarch64.cc @@ -5916,6 +5916,14 @@ Target_aarch64::optimize_tls_reloc(bool is_final, 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: + case elfcpp::R_AARCH64_TLSLE_LDST8_TPREL_LO12: + case elfcpp::R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC: + case elfcpp::R_AARCH64_TLSLE_LDST16_TPREL_LO12: + case elfcpp::R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC: + case elfcpp::R_AARCH64_TLSLE_LDST32_TPREL_LO12: + case elfcpp::R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC: + case elfcpp::R_AARCH64_TLSLE_LDST64_TPREL_LO12: + case elfcpp::R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC: // When we already have Local-Exec, there is nothing further we // can do. return tls::TLSOPT_NONE; @@ -6262,6 +6270,14 @@ Target_aarch64::Scan::local( 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: + case elfcpp::R_AARCH64_TLSLE_LDST8_TPREL_LO12: + case elfcpp::R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC: + case elfcpp::R_AARCH64_TLSLE_LDST16_TPREL_LO12: + case elfcpp::R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC: + case elfcpp::R_AARCH64_TLSLE_LDST32_TPREL_LO12: + case elfcpp::R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC: + case elfcpp::R_AARCH64_TLSLE_LDST64_TPREL_LO12: + case elfcpp::R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC: { layout->set_has_static_tls(); bool output_is_shared = parameters->options().shared(); @@ -6679,7 +6695,15 @@ Target_aarch64::Scan::global( 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: // Local executable + case elfcpp::R_AARCH64_TLSLE_ADD_TPREL_LO12_NC: + case elfcpp::R_AARCH64_TLSLE_LDST8_TPREL_LO12: + case elfcpp::R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC: + case elfcpp::R_AARCH64_TLSLE_LDST16_TPREL_LO12: + case elfcpp::R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC: + case elfcpp::R_AARCH64_TLSLE_LDST32_TPREL_LO12: + case elfcpp::R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC: + case elfcpp::R_AARCH64_TLSLE_LDST64_TPREL_LO12: + case elfcpp::R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC: // Local executable layout->set_has_static_tls(); if (parameters->options().shared()) gold_error(_("%s: unsupported TLSLE reloc type %u in shared objects."), @@ -7276,6 +7300,14 @@ Target_aarch64::Relocate::relocate( 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: + case elfcpp::R_AARCH64_TLSLE_LDST8_TPREL_LO12: + case elfcpp::R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC: + case elfcpp::R_AARCH64_TLSLE_LDST16_TPREL_LO12: + case elfcpp::R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC: + case elfcpp::R_AARCH64_TLSLE_LDST32_TPREL_LO12: + case elfcpp::R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC: + case elfcpp::R_AARCH64_TLSLE_LDST64_TPREL_LO12: + case elfcpp::R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC: case elfcpp::R_AARCH64_TLSDESC_ADR_PAGE21: case elfcpp::R_AARCH64_TLSDESC_LD64_LO12: case elfcpp::R_AARCH64_TLSDESC_ADD_LO12: @@ -7555,6 +7587,14 @@ Target_aarch64::Relocate::relocate_tls( 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: + case elfcpp::R_AARCH64_TLSLE_LDST8_TPREL_LO12: + case elfcpp::R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC: + case elfcpp::R_AARCH64_TLSLE_LDST16_TPREL_LO12: + case elfcpp::R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC: + case elfcpp::R_AARCH64_TLSLE_LDST32_TPREL_LO12: + case elfcpp::R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC: + case elfcpp::R_AARCH64_TLSLE_LDST64_TPREL_LO12: + case elfcpp::R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC: { gold_assert(tls_segment != NULL); AArch64_address value = psymval->value(object, 0); -- 2.7.4