From c7bb34f6ec9714ee717ca2166e06aae2c34e9041 Mon Sep 17 00:00:00 2001 From: Greg Clayton Date: Fri, 1 Jul 2016 21:25:20 +0000 Subject: [PATCH] Thread local storage was already broken on Linux and the tests were passing because there was a dectorator: @unittest2.expectedFailure("rdar://7796742") Which was covering up the fact this was failing on linux and hexagon. I added back a decorator so we don't break any build bots. llvm-svn: 274388 --- .../lldbsuite/test/lang/c/tls_globals/TestTlsGlobals.py | 1 + .../DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp | 5 ++++- .../DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp | 5 ++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lldb/packages/Python/lldbsuite/test/lang/c/tls_globals/TestTlsGlobals.py b/lldb/packages/Python/lldbsuite/test/lang/c/tls_globals/TestTlsGlobals.py index 8e4f17ab39d2..9a5ff555c1dc 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/c/tls_globals/TestTlsGlobals.py +++ b/lldb/packages/Python/lldbsuite/test/lang/c/tls_globals/TestTlsGlobals.py @@ -27,6 +27,7 @@ class TlsGlobalTestCase(TestBase): self.addTearDownHook(lambda: self.runCmd("settings remove target.env-vars " + self.dylibPath)) @skipIfWindows # TLS works differently on Windows, this would need to be implemented separately. + @unittest2.expectedFailure("now works on Darwin, but not linux") def test(self): """Test thread-local storage.""" self.build() diff --git a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp index 0f7c64868868..1f77539ca8df 100644 --- a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp @@ -688,5 +688,8 @@ DynamicLoaderHexagonDYLD::GetThreadLocalData(const lldb::ModuleSP module, const "module=%s, link_map=0x%" PRIx64 ", tp=0x%" PRIx64 ", modid=%i, tls_block=0x%" PRIx64, mod->GetObjectName().AsCString(""), link_map, tp, modid, tls_block); - return tls_block + tls_file_addr; + if (tls_block == LLDB_INVALID_ADDRESS) + return LLDB_INVALID_ADDRESS; + else + return tls_block + tls_file_addr; } diff --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp index 73f0ff612ce2..6515c02f37e0 100644 --- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp @@ -641,7 +641,10 @@ DynamicLoaderPOSIXDYLD::GetThreadLocalData(const lldb::ModuleSP module_sp, const "module=%s, link_map=0x%" PRIx64 ", tp=0x%" PRIx64 ", modid=%" PRId64 ", tls_block=0x%" PRIx64 "\n", module_sp->GetObjectName().AsCString(""), link_map, tp, (int64_t)modid, tls_block); - return tls_block + tls_file_addr; + if (tls_block == LLDB_INVALID_ADDRESS) + return LLDB_INVALID_ADDRESS; + else + return tls_block + tls_file_addr; } void