Skip to content

Commit 4cfb047

Browse files
committed
[profile] Don't use pragma comment linker on mingw
At least when compiling with gcc, this is not supported and will result in errors when linking against the profiler runtime. Only use the pragma comment linker based code with MSVC, but not with a mingw toolchain. This also undoes D107620, which shouldn't be relevant anymore. Differential Revision: https://reviews.llvm.org/D108095
1 parent 94b4598 commit 4cfb047

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

compiler-rt/lib/profile/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,6 @@ endif()
114114
append_list_if(COMPILER_RT_HAS_NOSTDINCXX_FLAG -nostdinc++ EXTRA_FLAGS)
115115
# XRay uses C++ standard library headers.
116116
string(REGEX REPLACE "-stdlib=[a-zA-Z+]*" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
117-
# The Windows specific code uses a #pragma comment(linker, ...) which requires
118-
# -fms-extensions on MinGW targets.
119-
append_list_if(MINGW -fms-extensions EXTRA_FLAGS)
120117

121118
# This appears to be a C-only warning banning the use of locals in aggregate
122119
# initializers. All other compilers accept this, though.

compiler-rt/lib/profile/InstrProfilingFile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ intptr_t INSTR_PROF_PROFILE_COUNTER_BIAS_DEFAULT_VAR = 0;
109109

110110
/* This variable is a weak external reference which could be used to detect
111111
* whether or not the compiler defined this symbol. */
112-
#if defined(_WIN32)
112+
#if defined(_MSC_VER)
113113
COMPILER_RT_VISIBILITY extern intptr_t INSTR_PROF_PROFILE_COUNTER_BIAS_VAR;
114114
#if defined(_M_IX86) || defined(__i386__)
115115
#define WIN_SYM_PREFIX "_"

0 commit comments

Comments
 (0)