[compiler-rt] ef2627e - [profile] Add underscore to /alternatename for Win/x86
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 28 14:59:17 PDT 2021
Author: Arthur Eubanks
Date: 2021-07-28T14:58:35-07:00
New Revision: ef2627e1fa7c5009aae8b0bbfdec7ff4419ee5d3
URL: https://github.com/llvm/llvm-project/commit/ef2627e1fa7c5009aae8b0bbfdec7ff4419ee5d3
DIFF: https://github.com/llvm/llvm-project/commit/ef2627e1fa7c5009aae8b0bbfdec7ff4419ee5d3.diff
LOG: [profile] Add underscore to /alternatename for Win/x86
/alternatename should use the mangled name. On x86 we need an extra
underscore.
Copied from sanitizer_win_defs.h
Fixes https://crbug.com/1233589.
Reviewed By: phosek
Differential Revision: https://reviews.llvm.org/D107000
Added:
Modified:
compiler-rt/lib/profile/InstrProfilingFile.c
Removed:
################################################################################
diff --git a/compiler-rt/lib/profile/InstrProfilingFile.c b/compiler-rt/lib/profile/InstrProfilingFile.c
index 518447e3e422a..9f25af0f94449 100644
--- a/compiler-rt/lib/profile/InstrProfilingFile.c
+++ b/compiler-rt/lib/profile/InstrProfilingFile.c
@@ -594,9 +594,15 @@ intptr_t INSTR_PROF_PROFILE_COUNTER_BIAS_DEFAULT_VAR = 0;
* whether or not the compiler defined this symbol. */
#if defined(_WIN32)
COMPILER_RT_VISIBILITY extern intptr_t INSTR_PROF_PROFILE_COUNTER_BIAS_VAR;
-#pragma comment(linker, "/alternatename:" \
- INSTR_PROF_QUOTE(INSTR_PROF_PROFILE_COUNTER_BIAS_VAR) "=" \
- INSTR_PROF_QUOTE(INSTR_PROF_PROFILE_COUNTER_BIAS_DEFAULT_VAR))
+#if defined(_M_IX86) || defined(__i386__)
+#define WIN_SYM_PREFIX "_"
+#else
+#define WIN_SYM_PREFIX
+#endif
+#pragma comment( \
+ linker, "/alternatename:" WIN_SYM_PREFIX INSTR_PROF_QUOTE( \
+ INSTR_PROF_PROFILE_COUNTER_BIAS_VAR) "=" WIN_SYM_PREFIX \
+ INSTR_PROF_QUOTE(INSTR_PROF_PROFILE_COUNTER_BIAS_DEFAULT_VAR))
#else
COMPILER_RT_VISIBILITY extern intptr_t INSTR_PROF_PROFILE_COUNTER_BIAS_VAR
__attribute__((weak, alias(INSTR_PROF_QUOTE(
More information about the llvm-commits
mailing list