[Openmp-commits] [PATCH] D68051: [OpenMP] Don't link libm with -Wl, --as-needed on FreeBSD

Jan Beich via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed Sep 25 14:24:22 PDT 2019


jbeich created this revision.
jbeich added a reviewer: OpenMP.
Herald added subscribers: openmp-commits, guansong, kristof.beyls, mgorny, emaste.
Herald added a reviewer: jdoerfert.
Herald added a project: OpenMP.

`-Wl,--as-needed` omits libm when building with BFD linker (e.g., from GNU binutils 2.32). Affects FreeBSD 11.* amd64/armv6/i386, 12.0 armv6/i386 (where LLD is not default yet).

Fixes https://bugs.llvm.org/show_bug.cgi?id=32279

  $ LDFLAGS=-fuse-ld=bfd cmake .
  $ make libomp-micro-tests
  [...]
  ld: error: runtime/src/libomp.so: undefined reference to scalbnl
  ld: error: runtime/src/libomp.so: undefined reference to fmaxl
  ld: error: runtime/src/libomp.so: undefined reference to logbl
  ld: error: runtime/src/libomp.so: undefined reference to scalbnf
  ld: error: runtime/src/libomp.so: undefined reference to scalbn


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D68051

Files:
  openmp/runtime/cmake/LibompHandleFlags.cmake


Index: openmp/runtime/cmake/LibompHandleFlags.cmake
===================================================================
--- openmp/runtime/cmake/LibompHandleFlags.cmake
+++ openmp/runtime/cmake/LibompHandleFlags.cmake
@@ -126,11 +126,11 @@
   if(${IA32})
     libomp_append(libflags_local -lirc_pic LIBOMP_HAVE_IRC_PIC_LIBRARY)
   endif()
-  if(${CMAKE_SYSTEM_NAME} MATCHES "DragonFly")
+  if(${CMAKE_SYSTEM_NAME} MATCHES "DragonFly|FreeBSD")
     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 "(Free|Net)BSD")
+  elseif(${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
     libomp_append(libflags_local -lm)
   endif()
   set(libflags_local ${libflags_local} ${LIBOMP_LIBFLAGS})


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68051.221834.patch
Type: text/x-patch
Size: 862 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20190925/7afcb175/attachment.bin>


More information about the Openmp-commits mailing list