Fix handling of relocations against TLS section symbols.
authorCary Coutant <ccoutant@google.com>
Fri, 26 Sep 2014 20:34:27 +0000 (13:34 -0700)
committerCary Coutant <ccoutant@google.com>
Fri, 26 Sep 2014 20:34:27 +0000 (13:34 -0700)
Gold doesn't handle relocations against the section symbol for a TLS
section correctly. Instead of using the offset of the section relative
to the TLS segment, it uses the address of the actual section.  This
patch checks for section symbols for TLS sections, and treats them
the same as TLS symbols.

gold/
PR gold/16773
* object.cc (Sized_relobj_file): Compute value of section symbols
for TLS sections the same as TLS symbols.

gold/ChangeLog
gold/object.cc

index 4b39c3fe0f82d8879a6e6f91cb79cddbe53de1b7..f71db091ff4366f12de8915cec86c11d211365bc 100644 (file)
@@ -1,3 +1,9 @@
+2014-09-26  Cary Coutant  <ccoutant@google.com>
+
+       PR gold/16773
+       * object.cc (Sized_relobj_file): Compute value of section symbols
+       for TLS sections the same as TLS symbols.
+
 2014-09-25  Cary Coutant  <ccoutant@google.com>
 
        PR gold/17432
index 03239d8443fe6111416ac0325232c0c7182a175f..6ab84cef70f7aa8d85c635b4f36f994faadb7404 100644 (file)
@@ -2359,7 +2359,9 @@ Sized_relobj_file<size, big_endian>::compute_final_local_value_internal(
              lv_out->set_merged_symbol_value(msv);
            }
        }
-      else if (lv_in->is_tls_symbol())
+      else if (lv_in->is_tls_symbol()
+               || (lv_in->is_section_symbol()
+                   && (os->flags() & elfcpp::SHF_TLS)))
        lv_out->set_output_value(os->tls_offset()
                                 + secoffset
                                 + lv_in->input_value());