forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathio_opentracing_cpp.patch
132 lines (129 loc) · 4.14 KB
/
io_opentracing_cpp.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
diff --git a/mocktracer/BUILD b/mocktracer/BUILD
index 3b22bab..d425e2e 100644
--- a/mocktracer/BUILD
+++ b/mocktracer/BUILD
@@ -7,11 +7,13 @@ cc_library(
deps = [
"//:opentracing",
],
+ alwayslink = 1,
)
cc_binary(
name = "libmocktracer_plugin.so",
linkshared = 1,
+ linkstatic = 1,
visibility = ["//visibility:public"],
deps = [
"//mocktracer:mocktracer"
diff --git a/src/dynamic_load_unix.cpp b/src/dynamic_load_unix.cpp
index 17e08fd..7e8ac02 100644
--- a/src/dynamic_load_unix.cpp
+++ b/src/dynamic_load_unix.cpp
@@ -35,7 +35,13 @@ DynamicallyLoadTracingLibrary(const char* shared_library,
std::string& error_message) noexcept try {
dlerror(); // Clear any existing error.
- const auto handle = dlopen(shared_library, RTLD_NOW | RTLD_LOCAL);
+ const auto handle = dlopen(shared_library, RTLD_NOW | RTLD_LOCAL
+#if defined(__has_feature)
+#if __has_feature(address_sanitizer)
+ | RTLD_NODELETE
+#endif
+#endif
+ );
if (handle == nullptr) {
error_message = dlerror();
return make_unexpected(dynamic_load_failure_error);
# commit 3a6f049c123a1906c7381e824292c18fd8698293
# Author: Christian Neumüller <[email protected]>
# Date: Wed Feb 27 01:48:17 2019 +0100
#
# Fix MSVC compiler flags. (#104)
#
# * All debug specific flags would be replaced by release specific on MSVC.
# * The OPENTRACING_STATIC flag would be missing from OpenTracingConfig.cmake when linking against OpenTracing::opentracing-static
#
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1721fb3..3873b3a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -52,7 +52,7 @@ if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
- set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_RELEASE} -D_SCL_SECURE_NO_WARNINGS")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_SCL_SECURE_NO_WARNINGS")
endif()
# ==============================================================================
diff --git a/include/opentracing/config.h b/include/opentracing/config.h
new file mode 100755
index 0000000..cae3e61
--- /dev/null
+++ b/include/opentracing/config.h
@@ -0,0 +1,3 @@
+#pragma once
+
+#define OPENTRACING_BUILD_DYNAMIC_LOADING
diff --git a/include/opentracing/version.h b/include/opentracing/version.h
new file mode 100755
index 0000000..25b9945
--- /dev/null
+++ b/include/opentracing/version.h
@@ -0,0 +1,14 @@
+#ifndef OPENTRACING_VERSION_H
+#define OPENTRACING_VERSION_H
+
+#define OPENTRACING_VERSION "1.5.1"
+#define OPENTRACING_ABI_VERSION "2"
+
+// clang-format off
+#define BEGIN_OPENTRACING_ABI_NAMESPACE \
+ inline namespace v2 {
+#define END_OPENTRACING_ABI_NAMESPACE \
+ } // namespace v2
+// clang-format on
+
+#endif // OPENTRACING_VERSION_H
diff --git a/BUILD.bazel b/BUILD.bazel
index c57dc9f..587bf0e 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -1,10 +1,7 @@
cc_library(
name = "opentracing",
srcs = glob(["src/**/*.cpp"], exclude=["src/dynamic_load_unsupported.cpp", "src/dynamic_load_windows.cpp"]),
- hdrs = glob(["include/opentracing/**/*.h"]) + [
- ":include/opentracing/config.h",
- ":include/opentracing/version.h",
- ],
+ hdrs = glob(["include/opentracing/**/*.h"]),
strip_include_prefix = "include",
visibility = ["//visibility:public"],
deps = [
@@ -15,27 +12,3 @@ cc_library(
"-ldl",
],
)
-
-genrule(
- name = "generate_version_h",
- srcs = glob([
- "*",
- "cmake/*",
- "src/**/*.cpp",
- ]),
- outs = [
- "include/opentracing/config.h",
- "include/opentracing/version.h"
- ],
- cmd = """
- TEMP_DIR=$$(mktemp -d)
- CONFIG_H_OUT=$${PWD}/$(location :include/opentracing/config.h)
- VERSION_H_OUT=$${PWD}/$(location :include/opentracing/version.h)
- OPENTRACING_ROOT=$$(dirname $${PWD}/$(location :CMakeLists.txt))
- cd $$TEMP_DIR
- cmake -DBUILD_TESTING=OFF -DBUILD_MOCKTRACER=OFF -L $$OPENTRACING_ROOT
- mv include/opentracing/config.h $$CONFIG_H_OUT
- mv include/opentracing/version.h $$VERSION_H_OUT
- rm -rf $$TEMP_DIR
- """,
-)