summaryrefslogtreecommitdiffstats
path: root/compiler-rt
diff options
context:
space:
mode:
authorXinliang David Li <davidxl@google.com>2015-12-15 22:38:18 +0000
committerXinliang David Li <davidxl@google.com>2015-12-15 22:38:18 +0000
commit1fbae3b76a3dbb463d37953140b02efa6f94d93c (patch)
treed3975ff5855cbc5ce1671ceb11ee7df881e66660 /compiler-rt
parentf85b008de82f501491bd159a61875df63ddb1e8d (diff)
downloadbcm5719-llvm-1fbae3b76a3dbb463d37953140b02efa6f94d93c.tar.gz
bcm5719-llvm-1fbae3b76a3dbb463d37953140b02efa6f94d93c.zip
[PGO] Improve prof library portability
Patch by: Johan Engelen Introduce LLVM_LIBRARY_WEAK macro. Define LLVM_LIBRARY_WEAK and LLVM_LIBRARY_VISIBIITY for MSVC llvm-svn: 255688
Diffstat (limited to 'compiler-rt')
-rw-r--r--compiler-rt/lib/profile/InstrProfilingFile.c4
-rw-r--r--compiler-rt/lib/profile/InstrProfilingPort.h7
-rw-r--r--compiler-rt/lib/profile/InstrProfilingRuntime.cc3
3 files changed, 8 insertions, 6 deletions
diff --git a/compiler-rt/lib/profile/InstrProfilingFile.c b/compiler-rt/lib/profile/InstrProfilingFile.c
index 4fc7693345b..ac0eeff6bda 100644
--- a/compiler-rt/lib/profile/InstrProfilingFile.c
+++ b/compiler-rt/lib/profile/InstrProfilingFile.c
@@ -56,8 +56,8 @@ static int writeFileWithName(const char *OutputName) {
return RetVal;
}
-__attribute__((weak)) int __llvm_profile_OwnsFilename = 0;
-__attribute__((weak)) const char *__llvm_profile_CurrentFilename = NULL;
+LLVM_LIBRARY_WEAK int __llvm_profile_OwnsFilename = 0;
+LLVM_LIBRARY_WEAK const char *__llvm_profile_CurrentFilename = NULL;
static void truncateCurrentFile(void) {
const char *Filename;
diff --git a/compiler-rt/lib/profile/InstrProfilingPort.h b/compiler-rt/lib/profile/InstrProfilingPort.h
index 977dc63f747..12f5ca78e83 100644
--- a/compiler-rt/lib/profile/InstrProfilingPort.h
+++ b/compiler-rt/lib/profile/InstrProfilingPort.h
@@ -11,12 +11,15 @@
#define PROFILE_INSTRPROFILING_PORT_H_
#ifdef _MSC_VER
-# define LLVM_ALIGNAS(x) __declspec(align(x))
+#define LLVM_ALIGNAS(x) __declspec(align(x))
+#define LLVM_LIBRARY_VISIBILITY
+#define LLVM_LIBRARY_WEAK __declspec(selectany)
#elif __GNUC__
#define LLVM_ALIGNAS(x) __attribute__((aligned(x)))
+#define LLVM_LIBRARY_VISIBILITY __attribute__((visibility("hidden")))
+#define LLVM_LIBRARY_WEAK __attribute__((weak))
#endif
-#define LLVM_LIBRARY_VISIBILITY __attribute__((visibility("hidden")))
#define LLVM_SECTION(Sect) __attribute__((section(Sect)))
#define PROF_ERR(Format, ...) \
diff --git a/compiler-rt/lib/profile/InstrProfilingRuntime.cc b/compiler-rt/lib/profile/InstrProfilingRuntime.cc
index 081ecb29e98..77fca472a62 100644
--- a/compiler-rt/lib/profile/InstrProfilingRuntime.cc
+++ b/compiler-rt/lib/profile/InstrProfilingRuntime.cc
@@ -11,8 +11,7 @@ extern "C" {
#include "InstrProfiling.h"
-__attribute__((visibility("hidden"))) int __llvm_profile_runtime;
-
+LLVM_LIBRARY_VISIBILITY int __llvm_profile_runtime;
}
namespace {
OpenPOWER on IntegriCloud