[llvm-branch-commits] [compiler-rt] 4f857ea - [profile] Add underscore to /alternatename for Win/x86

Tom Stellard via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Aug 23 13:45:00 PDT 2021


Author: Arthur Eubanks
Date: 2021-08-23T13:44:26-07:00
New Revision: 4f857ea56b4fb45f7c9c380a0ab18d9e1296e25e

URL: https://github.com/llvm/llvm-project/commit/4f857ea56b4fb45f7c9c380a0ab18d9e1296e25e
DIFF: https://github.com/llvm/llvm-project/commit/4f857ea56b4fb45f7c9c380a0ab18d9e1296e25e.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

(cherry picked from commit ef2627e1fa7c5009aae8b0bbfdec7ff4419ee5d3)

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-branch-commits mailing list