Correct GOLD PowerPC64 local-dynamic TLS linker optimization
authorAlan Modra <amodra@gmail.com>
Thu, 29 Jan 2015 10:03:26 +0000 (20:33 +1030)
committerAlan Modra <amodra@gmail.com>
Thu, 29 Jan 2015 10:04:45 +0000 (20:34 +1030)
Similar to b86ac8e3

* powerpc.cc (Target_powerpc::Relocate::relocate): Correct GOT_TLSLD
and GOT_TLSGD to LE optimization.

gold/ChangeLog
gold/powerpc.cc

index 2944b51e7cde204cf29b9db4fdd7d9db8a683f01..8803028f121badea942a40048ca2f943002df1b0 100644 (file)
@@ -1,3 +1,8 @@
+2015-01-29  Alan Modra  <amodra@gmail.com>
+
+       * powerpc.cc (Target_powerpc::Relocate::relocate): Correct GOT_TLSLD
+       and GOT_TLSGD to LE optimization.
+
 2015-01-28  Cary Coutant  <ccoutant@google.com>
 
        * x86_64.cc (Target_x86_64::Scan::global): Allow IE-to-LE optimization
index 2eae938ca6ebe0857b95bb9b92119223d9d2e9e3..ac8d05b0a5b57785cfeaf18c5e1edf2b42d95ad1 100644 (file)
@@ -3178,8 +3178,6 @@ static const uint32_t addi_11_11  = 0x396b0000;
 static const uint32_t addi_12_12       = 0x398c0000;
 static const uint32_t addis_0_2                = 0x3c020000;
 static const uint32_t addis_0_13       = 0x3c0d0000;
-static const uint32_t addis_3_2                = 0x3c620000;
-static const uint32_t addis_3_13       = 0x3c6d0000;
 static const uint32_t addis_11_2       = 0x3d620000;
 static const uint32_t addis_11_11      = 0x3d6b0000;
 static const uint32_t addis_11_30      = 0x3d7e0000;
@@ -7008,9 +7006,12 @@ Target_powerpc<size, big_endian>::Relocate::relocate(
              || r_type == elfcpp::R_POWERPC_GOT_TLSGD16_LO)
            {
              Insn* iview = reinterpret_cast<Insn*>(view - 2 * big_endian);
-             Insn insn = addis_3_13;
+             Insn insn = elfcpp::Swap<32, big_endian>::readval(iview);
+             insn &= (1 << 26) - (1 << 21); // extract rt
              if (size == 32)
-               insn = addis_3_2;
+               insn |= addis_0_2;
+             else
+               insn |= addis_0_13;
              elfcpp::Swap<32, big_endian>::writeval(iview, insn);
              r_type = elfcpp::R_POWERPC_TPREL16_HA;
              value = psymval->value(object, rela.get_r_addend());
@@ -7043,9 +7044,12 @@ Target_powerpc<size, big_endian>::Relocate::relocate(
              || r_type == elfcpp::R_POWERPC_GOT_TLSLD16_LO)
            {
              Insn* iview = reinterpret_cast<Insn*>(view - 2 * big_endian);
-             Insn insn = addis_3_13;
+             Insn insn = elfcpp::Swap<32, big_endian>::readval(iview);
+             insn &= (1 << 26) - (1 << 21); // extract rt
              if (size == 32)
-               insn = addis_3_2;
+               insn |= addis_0_2;
+             else
+               insn |= addis_0_13;
              elfcpp::Swap<32, big_endian>::writeval(iview, insn);
              r_type = elfcpp::R_POWERPC_TPREL16_HA;
              value = dtp_offset;
This page took 0.037397 seconds and 4 git commands to generate.