From e8dd848664b01d7a45c01a15991586b24e95b8e1 Mon Sep 17 00:00:00 2001 From: Robert Neale Date: Fri, 22 Jan 2021 11:13:51 -0800 Subject: [PATCH] Fix issues with TypeIndex on Windows, i.e. hash on the type name where available since this otherwise causes problems when loading different shared libraries with RTLD_LOCAL. PiperOrigin-RevId: 353279508 Change-Id: I7e5aeb5d043efddf924228517dd9ec93eaaf6c6c --- tensorflow/core/framework/type_index.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tensorflow/core/framework/type_index.h b/tensorflow/core/framework/type_index.h index 7986904dd7a..444429abcc5 100644 --- a/tensorflow/core/framework/type_index.h +++ b/tensorflow/core/framework/type_index.h @@ -24,9 +24,9 @@ limitations under the License. #include "tensorflow/core/platform/types.h" -#if defined(MACOS) || defined(TARGET_OS_MAC) +#if defined(MACOS) || defined(TARGET_OS_MAC) || defined(PLATFORM_WINDOWS) #include "tensorflow/core/platform/hash.h" -#endif // defined(MACOS) || defined(TARGET_OS_MAC) +#endif // defined(MACOS) || defined(TARGET_OS_MAC) || defined(PLATFORM_WINDOWS) namespace tensorflow { @@ -62,7 +62,7 @@ class TypeIndex { #if defined(__GXX_RTTI) || defined(_CPPRTTI) -#if defined(MACOS) || defined(TARGET_OS_MAC) +#if defined(MACOS) || defined(TARGET_OS_MAC) || defined(PLATFORM_WINDOWS) // Use a hash based on the type name to avoid issues due to RTLD_LOCAL on // MacOS (b/156979412). return TypeIndex(Hash64(typeid(T).name()), typeid(T).name()); @@ -70,7 +70,7 @@ class TypeIndex { // Use the real type name if we have RTTI. return TypeIndex(static_cast(reinterpret_cast(hash_bit)), typeid(T).name()); -#endif // defined(MACOS) || defined(TARGET_OS_MAC) +#endif // defined(MACOS) || defined(TARGET_OS_MAC) || defined(PLATFORM_WINDOWS) #else #if TARGET_OS_OSX