40 lines
1.2 KiB
C++
Raw Permalink Normal View History

2014-03-18 09:06:04 +01:00
//------------------------------------------------------------------------------
// 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: clang -shared %fPIC -DCLING_EXPORT=%dllexport -DBUILD_SHARED %s -o%T/libSymbols%shlibext
2014-03-18 09:06:04 +01:00
// RUN: %cling --nologo -L%T -lSymbols %s | FileCheck %s
// Check that weak symbols do not get re-emitted (ROOT-6124)
extern "C" int printf(const char*,...);
template <class T>
2016-09-20 19:59:19 -04:00
struct CLING_EXPORT StaticStuff {
2014-03-18 09:06:04 +01:00
static T s_data;
};
template <class T>
T StaticStuff<T>::s_data = 42;
2016-09-20 19:59:19 -04:00
CLING_EXPORT int compareAddr(int* interp);
2014-03-18 09:06:04 +01:00
#ifdef BUILD_SHARED
2015-01-12 14:33:07 +01:00
int compareAddr(int* interp) {
if (interp != &StaticStuff<int>::s_data) {
printf("Wrong address, %ld in shared lib, %ld in interpreter!\n",
2014-03-18 09:06:04 +01:00
(long)&StaticStuff<int>::s_data,
2015-01-12 14:33:07 +01:00
(long)interp);
2014-03-18 09:06:04 +01:00
// CHECK-NOT: Wrong address
return 1;
}
return 0;
}
#else
int Symbols() {
return compareAddr(&StaticStuff<int>::s_data);
}
#endif