Skip to content

Commit ef2627e

Browse files
committed
[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
1 parent c6d03b5 commit ef2627e

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

compiler-rt/lib/profile/InstrProfilingFile.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -594,9 +594,15 @@ intptr_t INSTR_PROF_PROFILE_COUNTER_BIAS_DEFAULT_VAR = 0;
594594
* whether or not the compiler defined this symbol. */
595595
#if defined(_WIN32)
596596
COMPILER_RT_VISIBILITY extern intptr_t INSTR_PROF_PROFILE_COUNTER_BIAS_VAR;
597-
#pragma comment(linker, "/alternatename:" \
598-
INSTR_PROF_QUOTE(INSTR_PROF_PROFILE_COUNTER_BIAS_VAR) "=" \
599-
INSTR_PROF_QUOTE(INSTR_PROF_PROFILE_COUNTER_BIAS_DEFAULT_VAR))
597+
#if defined(_M_IX86) || defined(__i386__)
598+
#define WIN_SYM_PREFIX "_"
599+
#else
600+
#define WIN_SYM_PREFIX
601+
#endif
602+
#pragma comment( \
603+
linker, "/alternatename:" WIN_SYM_PREFIX INSTR_PROF_QUOTE( \
604+
INSTR_PROF_PROFILE_COUNTER_BIAS_VAR) "=" WIN_SYM_PREFIX \
605+
INSTR_PROF_QUOTE(INSTR_PROF_PROFILE_COUNTER_BIAS_DEFAULT_VAR))
600606
#else
601607
COMPILER_RT_VISIBILITY extern intptr_t INSTR_PROF_PROFILE_COUNTER_BIAS_VAR
602608
__attribute__((weak, alias(INSTR_PROF_QUOTE(

0 commit comments

Comments
 (0)