2008-08-14 Cary Coutant <ccoutant@google.com>
authorCary Coutant <ccoutant@google.com>
Fri, 15 Aug 2008 04:57:46 +0000 (04:57 +0000)
committerCary Coutant <ccoutant@google.com>
Fri, 15 Aug 2008 04:57:46 +0000 (04:57 +0000)
* x86_64.cc (Target_x86_64::Relocate::relocat_tls):
Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
* testsuite/tls_test.cc (struct int128): 128-bit struct
for testing TLS relocs with non-zero addend.
(v12): New TLS variable.
(t12): New test.
(t_last): Add check for v12.
* testsuite/tls_test.h (t12): New function.
* testsuite/tls_test_main.cc (thread_routine): Call new test.

gold/ChangeLog
gold/testsuite/tls_test.cc
gold/testsuite/tls_test.h
gold/testsuite/tls_test_main.cc
gold/x86_64.cc

index aec50a59f01fbc758ec4684ae2ccd00b572a4b1e..21867d21979aa67a0b010d8a869e634272a7189d 100644 (file)
@@ -1,3 +1,15 @@
+2008-08-14  Cary Coutant  <ccoutant@google.com>
+
+       * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
+       Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
+       * testsuite/tls_test.cc (struct int128): 128-bit struct
+       for testing TLS relocs with non-zero addend.
+       (v12): New TLS variable.
+       (t12): New test.
+       (t_last): Add check for v12.
+       * testsuite/tls_test.h (t12): New function.
+       * testsuite/tls_test_main.cc (thread_routine): Call new test.
+
 2008-08-13  Ian Lance Taylor  <iant@google.com>
 
        * layout.cc (Layout::attach_allocated_section_to_segment): Don't
index e859f8c45cf6783e0cc1a2c6927c27ae0fe533c2..880bf238309875f7fc545a40c203c5d54bdd6651 100644 (file)
@@ -73,6 +73,14 @@ static __thread int v4 = 4;
 __thread int v5;
 static __thread int v6;
 
+struct int128
+{
+  long long hi;
+  long long lo;
+};
+
+static __thread struct int128 v12 = { 115, 125 };
+
 bool
 t1()
 {
@@ -186,6 +194,16 @@ t10()
   return true;
 }
 
+bool
+t12()
+{
+  struct int128 newval = { 335, 345 };
+  CHECK_EQ_OR_RETURN((int) v12.hi, 115);
+  CHECK_EQ_OR_RETURN((int) v12.lo, 125);
+  v12 = newval;
+  return true;
+}
+
 bool
 t_last()
 {
@@ -195,6 +213,8 @@ t_last()
   CHECK_EQ_OR_RETURN(v4, 40);
   CHECK_EQ_OR_RETURN(v5, 50);
   CHECK_EQ_OR_RETURN(v6, 60);
+  CHECK_EQ_OR_RETURN((int) v12.hi, 335);
+  CHECK_EQ_OR_RETURN((int) v12.lo, 345);
   CHECK_EQ_OR_RETURN(o1, -10);
   CHECK_EQ_OR_RETURN(o2, -20);
   CHECK_EQ_OR_RETURN(o3, -30);
index 0aaec73c3238a66c98d918a2704cf6d8969868cf..1c98b176d091b2d980708222074333e7de4c03f4 100644 (file)
@@ -46,6 +46,8 @@ extern bool t10();
 extern "C" int t11();
 extern "C" int t11_last();
 
+extern bool t12();
+
 extern bool t_last();
 
 // These variables are defined in tls_test_file2.cc
index 993cc7e9ba474cc5a71bc77740b5f7882a68635e..0ff02c6bc10413d8fbaa8e1edf8de7d5bab43d21 100644 (file)
@@ -100,6 +100,7 @@ thread_routine(void* arg)
   f10b(f10a());
   check("t10", t10());
   check("t11", t11() != 0);
+  check("t12", t12());
   check("t_last", t_last());
 
   // Unlock the second mutex.
index cbbd5ccf368d972eb017e0d8aa834dffd335364f..2daa9bf44c59ea71443842df1230d6ee1f39f936 100644 (file)
@@ -2054,7 +2054,7 @@ Target_x86_64::Relocate::relocate_tls(const Relocate_info<64, false>* relinfo,
           if (this->saw_tls_block_reloc_)
             value -= tls_segment->memsz();
         }
-      Relocate_functions<64, false>::rela32(view, value, 0);
+      Relocate_functions<64, false>::rela32(view, value, addend);
       break;
 
     case elfcpp::R_X86_64_DTPOFF64:
@@ -2065,7 +2065,7 @@ Target_x86_64::Relocate::relocate_tls(const Relocate_info<64, false>* relinfo,
           if (this->saw_tls_block_reloc_)
             value -= tls_segment->memsz();
         }
-      Relocate_functions<64, false>::rela64(view, value, 0);
+      Relocate_functions<64, false>::rela64(view, value, addend);
       break;
 
     case elfcpp::R_X86_64_GOTTPOFF:         // Initial-exec
@@ -2107,7 +2107,7 @@ Target_x86_64::Relocate::relocate_tls(const Relocate_info<64, false>* relinfo,
 
     case elfcpp::R_X86_64_TPOFF32:          // Local-exec
       value -= tls_segment->memsz();
-      Relocate_functions<64, false>::rela32(view, value, 0);
+      Relocate_functions<64, false>::rela32(view, value, addend);
       break;
     }
 }
This page took 0.033248 seconds and 4 git commands to generate.