From 040d7caf9e0df3fa2134965ae394d06ff4f91c04 Mon Sep 17 00:00:00 2001 From: Tor Egge Date: Tue, 27 Aug 2024 15:12:01 +0200 Subject: [PATCH] Use shared definition of TLS_LINKAGE macro. --- .../searchcore/proton/matching/handlerecorder.cpp | 11 +++-------- .../persistence/filestorage/filestormanager.cpp | 7 +------ vespalib/src/vespa/vespalib/util/tls_linkage.h | 9 +++++++++ 3 files changed, 13 insertions(+), 14 deletions(-) create mode 100644 vespalib/src/vespa/vespalib/util/tls_linkage.h diff --git a/searchcore/src/vespa/searchcore/proton/matching/handlerecorder.cpp b/searchcore/src/vespa/searchcore/proton/matching/handlerecorder.cpp index 573340196622..cdb53867966c 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/handlerecorder.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/handlerecorder.cpp @@ -3,11 +3,12 @@ #include "handlerecorder.h" #include #include -#include -#include #include #include #include +#include +#include +#include using search::fef::MatchData; using search::fef::MatchDataDetails; @@ -15,12 +16,6 @@ using search::fef::TermFieldHandle; namespace proton::matching { -#ifdef __PIC__ - #define TLS_LINKAGE __attribute__((visibility("hidden"), tls_model("initial-exec"))) -#else - #define TLS_LINKAGE __attribute__((visibility("hidden"), tls_model("local-exec"))) -#endif - namespace { __thread HandleRecorder * _T_recorder TLS_LINKAGE = nullptr; __thread bool _T_assert_all_handles_are_registered = false; diff --git a/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp b/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp index dbab8ec071f5..f8fa817782c7 100644 --- a/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp +++ b/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -164,12 +165,6 @@ dynamic_throttle_params_from_config(const StorFilestorConfig& config, uint32_t n return params; } -#ifdef __PIC__ -#define TLS_LINKAGE __attribute__((visibility("hidden"), tls_model("initial-exec"))) -#else -#define TLS_LINKAGE __attribute__((visibility("hidden"), tls_model("local-exec"))) -#endif - thread_local PersistenceHandler * _g_threadLocalHandler TLS_LINKAGE = nullptr; size_t diff --git a/vespalib/src/vespa/vespalib/util/tls_linkage.h b/vespalib/src/vespa/vespalib/util/tls_linkage.h new file mode 100644 index 000000000000..a5436945890f --- /dev/null +++ b/vespalib/src/vespa/vespalib/util/tls_linkage.h @@ -0,0 +1,9 @@ +// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#pragma once + +#ifdef __PIC__ +#define TLS_LINKAGE __attribute__((visibility("hidden"), tls_model("initial-exec"))) +#else +#define TLS_LINKAGE __attribute__((visibility("hidden"), tls_model("local-exec"))) +#endif