summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Morrow <acm@mongodb.com>2021-04-07 17:23:16 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-04-09 16:40:20 +0000
commitb40f9038d2527cecbc07a4abdf792231b82db244 (patch)
tree6687c647eb70a2ff0b39d2af835dbb75b9d2a208 /src
parent7dffa59ed57ea54863ac4090eac8a0847d808f5c (diff)
downloadmongo-b40f9038d2527cecbc07a4abdf792231b82db244.tar.gz
SERVER-55737 Add an experiment for not requiring -rdynamic
Diffstat (limited to 'src')
-rw-r--r--src/mongo/util/SConscript3
-rw-r--r--src/mongo/util/stacktrace_test.cpp16
2 files changed, 13 insertions, 6 deletions
diff --git a/src/mongo/util/SConscript b/src/mongo/util/SConscript
index 681207594db..ee75e3724f5 100644
--- a/src/mongo/util/SConscript
+++ b/src/mongo/util/SConscript
@@ -761,6 +761,9 @@ stacktraceEnv.CppUnitTest(
'stacktrace_test.cpp',
],
LIBDEPS=stacktrace_test_LIBDEPS,
+ EXPORT_SYMBOLS=[
+ 'mongo_stacktrace_test_detail_testFunctionWithLinkage',
+ ],
)
stacktraceEnv.Benchmark(
diff --git a/src/mongo/util/stacktrace_test.cpp b/src/mongo/util/stacktrace_test.cpp
index feac7aa72aa..2a9ad180c28 100644
--- a/src/mongo/util/stacktrace_test.cpp
+++ b/src/mongo/util/stacktrace_test.cpp
@@ -69,13 +69,17 @@
#include <unistd.h>
#endif // __linux__
+// Needs to have linkage so we can test metadata. Needs to be extern
+// "C" so it doesn't get mangled so we can name it with EXPORT_SYMBOLS
+// in SConscript.
+extern "C" MONGO_COMPILER_NOINLINE MONGO_COMPILER_API_EXPORT void
+mongo_stacktrace_test_detail_testFunctionWithLinkage() {
+ printf("...");
+}
+
namespace mongo {
namespace stack_trace_test_detail {
-/** Needs to have linkage so we can test metadata. */
-MONGO_COMPILER_NOINLINE MONGO_COMPILER_API_EXPORT void testFunctionWithLinkage() {
- printf("...");
-}
struct RecursionParam {
std::uint64_t n;
@@ -320,7 +324,7 @@ TEST(StackTrace, MetadataGenerator) {
std::string symbolSub;
} const tests[] = {
{
- reinterpret_cast<void*>(&stack_trace_test_detail::testFunctionWithLinkage),
+ reinterpret_cast<void*>(&mongo_stacktrace_test_detail_testFunctionWithLinkage),
"stacktrace_test",
"testFunctionWithLinkage",
},
@@ -356,7 +360,7 @@ TEST(StackTrace, MetadataGeneratorFunctionMeasure) {
// Measure the size of a C++ function as a test of metadata retrieval.
// Load increasing addresses until the metadata's symbol name changes.
StackTraceAddressMetadataGenerator gen;
- void* fp = reinterpret_cast<void*>(&stack_trace_test_detail::testFunctionWithLinkage);
+ void* fp = reinterpret_cast<void*>(&mongo_stacktrace_test_detail_testFunctionWithLinkage);
const auto& meta = gen.load(fp);
if (!meta.symbol())
return; // No symbol for `fp`. forget it.