[Openmp-commits] [openmp] 4b7beab - [OpenMP] Add back implicit flags manually

Joseph Huber via Openmp-commits openmp-commits at lists.llvm.org
Mon Nov 27 12:51:56 PST 2023


Author: Joseph Huber
Date: 2023-11-27T14:51:48-06:00
New Revision: 4b7beab4187ab0766c3d7b272511d5751431a8da

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

LOG: [OpenMP] Add back implicit flags manually

Summary:
We used to inherit these flags from the LLVM options in a runtimes
build. This patch adds them back in manually as they are helpful for
diagnostics and optimizing the created binary.

Added: 
    

Modified: 
    openmp/cmake/HandleOpenMPOptions.cmake
    openmp/cmake/config-ix.cmake

Removed: 
    


################################################################################
diff  --git a/openmp/cmake/HandleOpenMPOptions.cmake b/openmp/cmake/HandleOpenMPOptions.cmake
index a79b04e005756e9..b0fd0b7de4bf7c5 100644
--- a/openmp/cmake/HandleOpenMPOptions.cmake
+++ b/openmp/cmake/HandleOpenMPOptions.cmake
@@ -18,6 +18,8 @@ if (OPENMP_ENABLE_WERROR)
   append_if(OPENMP_HAVE_WERROR_FLAG "-Werror" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
 endif()
 
+append_if(OPENMP_HAVE_COLOR_DIAGNOSTICS "-fcolor-diagnostics" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
+
 # Additional warnings that are not enabled by -Wall.
 append_if(OPENMP_HAVE_WCAST_QUAL_FLAG "-Wcast-qual" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
 append_if(OPENMP_HAVE_WFORMAT_PEDANTIC_FLAG "-Wformat-pedantic" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
@@ -35,3 +37,7 @@ append_if(OPENMP_HAVE_WENUM_CONSTEXPR_CONVERSION_FLAG "-Wno-enum-constexpr-conve
 append_if(OPENMP_HAVE_WEXTRA_FLAG "-Wno-extra" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
 append_if(OPENMP_HAVE_WPEDANTIC_FLAG "-Wno-pedantic" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
 append_if(OPENMP_HAVE_WMAYBE_UNINITIALIZED_FLAG "-Wno-maybe-uninitialized" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
+
+append_if(OPENMP_HAVE_NO_SEMANTIC_INTERPOSITION "-fno-semantic-interposition" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
+append_if(OPENMP_HAVE_FUNCTION_SECTIONS "-ffunction-section" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
+append_if(OPENMP_HAVE_DATA_SECTIONS "-fdata-sections" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)

diff  --git a/openmp/cmake/config-ix.cmake b/openmp/cmake/config-ix.cmake
index 49e374286ac78cf..a1e1b61d374b816 100644
--- a/openmp/cmake/config-ix.cmake
+++ b/openmp/cmake/config-ix.cmake
@@ -18,6 +18,7 @@ endif()
 
 check_cxx_compiler_flag(-Wall OPENMP_HAVE_WALL_FLAG)
 check_cxx_compiler_flag(-Werror OPENMP_HAVE_WERROR_FLAG)
+check_cxx_compiler_flag(-fcolor-diagnostics OPENMP_HAVE_COLOR_DIAGNOSTICS)
 
 # Additional warnings that are not enabled by -Wall.
 check_cxx_compiler_flag(-Wcast-qual OPENMP_HAVE_WCAST_QUAL_FLAG)
@@ -36,3 +37,9 @@ check_cxx_compiler_flag(-Wenum-constexpr-conversion OPENMP_HAVE_WENUM_CONSTEXPR_
 check_cxx_compiler_flag(-Wextra OPENMP_HAVE_WEXTRA_FLAG)
 check_cxx_compiler_flag(-Wpedantic OPENMP_HAVE_WPEDANTIC_FLAG)
 check_cxx_compiler_flag(-Wmaybe-uninitialized OPENMP_HAVE_WMAYBE_UNINITIALIZED_FLAG)
+
+# Additional flags for optimizing created libraries.
+
+check_cxx_compiler_flag(-fno-semantic-interposition OPENMP_HAVE_NO_SEMANTIC_INTERPOSITION)
+check_cxx_compiler_flag(-ffunction-section OPENMP_HAVE_FUNCTION_SECTIONS)
+check_cxx_compiler_flag(-fdata-sections OPENMP_HAVE_DATA_SECTIONS)


        


More information about the Openmp-commits mailing list