forked from root-project/root
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSymbols.C
More file actions
40 lines (35 loc) · 1.23 KB
/
Copy pathSymbols.C
File metadata and controls
40 lines (35 loc) · 1.23 KB
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
//------------------------------------------------------------------------------
// CLING - the C++ LLVM-based InterpreterG :)
//
// This file is dual-licensed: you can choose to license it under the University
// of Illinois Open Source License or the GNU Lesser General Public License. See
// LICENSE.TXT for details.
//------------------------------------------------------------------------------
// RUN: rm -rf %t.dir && mkdir -p %t.dir
// RUN: clang -shared %fPIC -DCLING_EXPORT=%dllexport -DBUILD_SHARED %s -o%t.dir/libSymbols%shlibext
// RUN: %cling --nologo -L%t.dir -lSymbols %s | FileCheck %s
// Check that weak symbols do not get re-emitted (ROOT-6124)
extern "C" int printf(const char*,...);
template <class T>
struct CLING_EXPORT StaticStuff {
static T s_data;
};
template <class T>
T StaticStuff<T>::s_data = 42;
CLING_EXPORT int compareAddr(int* interp);
#ifdef BUILD_SHARED
int compareAddr(int* interp) {
if (interp != &StaticStuff<int>::s_data) {
printf("Wrong address, %ld in shared lib, %ld in interpreter!\n",
(long)&StaticStuff<int>::s_data,
(long)interp);
// CHECK-NOT: Wrong address
return 1;
}
return 0;
}
#else
int Symbols() {
return compareAddr(&StaticStuff<int>::s_data);
}
#endif