[llvm] r217666 - Add CMake check for libatomic.

İsmail Dönmez ismail at donmez.ws
Sun Sep 14 10:20:18 PDT 2014


On Sep 14, 2014 7:55 PM, "Evgeniy Stepanov" <eugeni.stepanov at gmail.com>
wrote:
>
> I understand that since gcc-4.8 they've moved atomics implementation
> to libatomic.a, and it's supposed to be linked whenever atomics are
> used. It's definitely needed on ARM in general, not just on Android.
>
> Does this change break anything?
>

Nope, I was just being pedantic. Thanks for the explanation!

> On Sun, Sep 14, 2014 at 6:33 PM, İsmail Dönmez <ismail at donmez.ws> wrote:
> > Hi,
> >
> > On Fri, Sep 12, 2014 at 2:09 PM, Evgeniy Stepanov
> > <eugeni.stepanov at gmail.com> wrote:
> >> Author: eugenis
> >> Date: Fri Sep 12 06:08:59 2014
> >> New Revision: 217666
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=217666&view=rev
> >> Log:
> >> Add CMake check for libatomic.
> >>
> >>
> >> Modified:
> >>     llvm/trunk/cmake/modules/CheckAtomic.cmake
> >>     llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
> >>     llvm/trunk/lib/Support/CMakeLists.txt
> >>
> >> Modified: llvm/trunk/cmake/modules/CheckAtomic.cmake
> >> URL:
http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/CheckAtomic.cmake?rev=217666&r1=217665&r2=217666&view=diff
> >>
==============================================================================
> >> --- llvm/trunk/cmake/modules/CheckAtomic.cmake (original)
> >> +++ llvm/trunk/cmake/modules/CheckAtomic.cmake Fri Sep 12 06:08:59 2014
> >> @@ -2,6 +2,11 @@
> >>
> >>  INCLUDE(CheckCXXSourceCompiles)
> >>
> >> +check_library_exists(atomic __atomic_fetch_add_4 "" HAVE_LIBATOMIC)
> >> +if (HAVE_LIBATOMIC)
> >> +  list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic")
> >> +endif()
> >> +
> >>  CHECK_CXX_SOURCE_COMPILES("
> >>  #ifdef _MSC_VER
> >>  #include <windows.h>
> >>
> >> Modified: llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
> >> URL:
http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/HandleLLVMOptions.cmake?rev=217666&r1=217665&r2=217666&view=diff
> >>
==============================================================================
> >> --- llvm/trunk/cmake/modules/HandleLLVMOptions.cmake (original)
> >> +++ llvm/trunk/cmake/modules/HandleLLVMOptions.cmake Fri Sep 12
06:08:59 2014
> >> @@ -25,9 +25,6 @@ if(NOT LLVM_FORCE_USE_OLD_TOOLCHAIN)
> >>        set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
> >>        set(OLD_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
> >>        set(CMAKE_REQUIRED_FLAGS "-std=c++0x")
> >> -      if (ANDROID)
> >> -        set(CMAKE_REQUIRED_LIBRARIES "atomic")
> >> -      endif()
> >>        check_cxx_source_compiles("
> >>  #include <atomic>
> >>  std::atomic<float> x(0.0f);
> >
> > This used to be an Android only link library.
> >
> >> Modified: llvm/trunk/lib/Support/CMakeLists.txt
> >> URL:
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CMakeLists.txt?rev=217666&r1=217665&r2=217666&view=diff
> >>
==============================================================================
> >> --- llvm/trunk/lib/Support/CMakeLists.txt (original)
> >> +++ llvm/trunk/lib/Support/CMakeLists.txt Fri Sep 12 06:08:59 2014
> >> @@ -132,6 +132,9 @@ if( NOT MSVC )
> >>          set(system_libs ${system_libs} ${TERMINFO_LIBS})
> >>        endif()
> >>      endif()
> >> +    if( LLVM_ENABLE_THREADS AND HAVE_LIBATOMIC )
> >> +      set(system_libs ${system_libs} atomic)
> >> +    endif()
> >>      if( LLVM_ENABLE_THREADS AND HAVE_LIBPTHREAD )
> >>        set(system_libs ${system_libs} pthread)
> >>      endif()
> >
> > Now everyone links to it if available, that looks wrong.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140914/ecd2d50f/attachment.html>


More information about the llvm-commits mailing list