[compiler-rt] 4cfb047 - [profile] Don't use pragma comment linker on mingw

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 16 09:21:34 PDT 2021


Author: Nikita Popov
Date: 2021-08-16T18:20:32+02:00
New Revision: 4cfb047d6ab3259c20059e8ed4c15ece3d6eb723

URL: https://github.com/llvm/llvm-project/commit/4cfb047d6ab3259c20059e8ed4c15ece3d6eb723
DIFF: https://github.com/llvm/llvm-project/commit/4cfb047d6ab3259c20059e8ed4c15ece3d6eb723.diff

LOG: [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

Added: 
    

Modified: 
    compiler-rt/lib/profile/CMakeLists.txt
    compiler-rt/lib/profile/InstrProfilingFile.c

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/profile/CMakeLists.txt b/compiler-rt/lib/profile/CMakeLists.txt
index 9688236c52ea8..f5e13574b7ce8 100644
--- a/compiler-rt/lib/profile/CMakeLists.txt
+++ b/compiler-rt/lib/profile/CMakeLists.txt
@@ -114,9 +114,6 @@ endif()
 append_list_if(COMPILER_RT_HAS_NOSTDINCXX_FLAG -nostdinc++ EXTRA_FLAGS)
 # XRay uses C++ standard library headers.
 string(REGEX REPLACE "-stdlib=[a-zA-Z+]*" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
-# The Windows specific code uses a #pragma comment(linker, ...) which requires
-# -fms-extensions on MinGW targets.
-append_list_if(MINGW -fms-extensions EXTRA_FLAGS)
 
 # This appears to be a C-only warning banning the use of locals in aggregate
 # initializers. All other compilers accept this, though.

diff  --git a/compiler-rt/lib/profile/InstrProfilingFile.c b/compiler-rt/lib/profile/InstrProfilingFile.c
index b99db321b4e60..fb4c2fecefacb 100644
--- a/compiler-rt/lib/profile/InstrProfilingFile.c
+++ b/compiler-rt/lib/profile/InstrProfilingFile.c
@@ -109,7 +109,7 @@ intptr_t INSTR_PROF_PROFILE_COUNTER_BIAS_DEFAULT_VAR = 0;
 
 /* This variable is a weak external reference which could be used to detect
  * whether or not the compiler defined this symbol. */
-#if defined(_WIN32)
+#if defined(_MSC_VER)
 COMPILER_RT_VISIBILITY extern intptr_t INSTR_PROF_PROFILE_COUNTER_BIAS_VAR;
 #if defined(_M_IX86) || defined(__i386__)
 #define WIN_SYM_PREFIX "_"


        


More information about the llvm-commits mailing list