Skip to content

Commit

Permalink
Merge pull request #32284 from vespa-engine/toregge/use-shared-defini…
Browse files Browse the repository at this point in the history
…tion-of-tls-linkage-macro

Use shared definition of TLS_LINKAGE macro.
  • Loading branch information
baldersheim authored Aug 27, 2024
2 parents 5f73a17 + 040d7ca commit 39fe20f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,19 @@
#include "handlerecorder.h"
#include <vespa/searchlib/fef/matchdata.h>
#include <vespa/vespalib/stllike/asciistream.h>
#include <algorithm>
#include <cassert>
#include <vespa/vespalib/stllike/hash_map.hpp>
#include <vespa/vespalib/stllike/hash_map_equal.hpp>
#include <vespa/vespalib/util/array_equal.hpp>
#include <vespa/vespalib/util/tls_linkage.h>
#include <algorithm>
#include <cassert>

using search::fef::MatchData;
using search::fef::MatchDataDetails;
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <vespa/vespalib/util/sequencedtaskexecutor.h>
#include <vespa/vespalib/util/string_escape.h>
#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/vespalib/util/tls_linkage.h>
#include <vespa/config-stor-filestor.h>
#include <vespa/config/helper/configfetcher.hpp>
#include <thread>
Expand Down Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions vespalib/src/vespa/vespalib/util/tls_linkage.h
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 39fe20f

Please sign in to comment.