[Openmp-commits] [openmp] 2d0c9b6 - [OpenMP][CMake] Ensure linking against libm for Linux

Fangrui Song via Openmp-commits openmp-commits at lists.llvm.org
Sat Mar 5 20:20:33 PST 2022


Author: James Beddek
Date: 2022-03-05T20:20:28-08:00
New Revision: 2d0c9b64a07c6c430ccfe11ea4c767d788d20461

URL: https://github.com/llvm/llvm-project/commit/2d0c9b64a07c6c430ccfe11ea4c767d788d20461
DIFF: https://github.com/llvm/llvm-project/commit/2d0c9b64a07c6c430ccfe11ea4c767d788d20461.diff

LOG: [OpenMP][CMake] Ensure linking against libm for Linux

Do the same as is done for NetBSD. Some compiler-rt/lib/builtins files call
libm functions (e.g. fmaxl, fabs). Linking libomp with --rtlib=compiler-rt
references these functions.
Downstream report: https://bugs.gentoo.org/816831

Fixes: https://github.com/llvm/llvm-project/issues/51457

Added: 
    

Modified: 
    openmp/runtime/cmake/LibompHandleFlags.cmake

Removed: 
    


################################################################################
diff  --git a/openmp/runtime/cmake/LibompHandleFlags.cmake b/openmp/runtime/cmake/LibompHandleFlags.cmake
index 9e19e59ba17de..d725ece02be42 100644
--- a/openmp/runtime/cmake/LibompHandleFlags.cmake
+++ b/openmp/runtime/cmake/LibompHandleFlags.cmake
@@ -139,7 +139,7 @@ function(libomp_get_libflags libflags)
     libomp_append(libflags_local "-Wl,--no-as-needed" LIBOMP_HAVE_AS_NEEDED_FLAG)
     libomp_append(libflags_local "-lm")
     libomp_append(libflags_local "-Wl,--as-needed" LIBOMP_HAVE_AS_NEEDED_FLAG)
-  elseif(${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
+  elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux|NetBSD")
     libomp_append(libflags_local -lm)
   endif()
   set(libflags_local ${libflags_local} ${LIBOMP_LIBFLAGS})


        


More information about the Openmp-commits mailing list