[llvm-branch-commits] [compiler-rt] e8ce80e - [profile] Don't use pragma comment linker on mingw

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


Author: Nikita Popov
Date: 2021-08-23T13:44:26-07:00
New Revision: e8ce80e31d93019aa9a6b952cf2b21fc3232462c

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

(cherry picked from commit 4cfb047d6ab3259c20059e8ed4c15ece3d6eb723)

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 9f25af0f94449..32def21eec7f2 100644
--- a/compiler-rt/lib/profile/InstrProfilingFile.c
+++ b/compiler-rt/lib/profile/InstrProfilingFile.c
@@ -592,7 +592,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-branch-commits mailing list