logan created this revision.
logan added reviewers: mclow.lists, rengolin, EricWF.
logan added a subscriber: cfe-commits.
Herald added a subscriber: aemerson.

This commit fixes __aeabi_idiv() link error when we are building
libc++abi with compiler-rt.

When compiler-rt is enabled, the option `--rtlib=compiler-rt` will be
added to link flags.  However, if `-nodefaultlibs` is specified
simultaneously, `--rtlib` will be ignored and compiler-rt libraries will
not be linked.  Consequently, several ARM built-in functions, e.g.
__aeabi_idiv(), will not be available.

https://reviews.llvm.org/D24083

Files:
  src/CMakeLists.txt

Index: src/CMakeLists.txt
===================================================================
--- src/CMakeLists.txt
+++ src/CMakeLists.txt
@@ -70,7 +70,9 @@
 
 # Setup flags.
 append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_HAS_FPIC_FLAG -fPIC)
-append_if(LIBCXXABI_LINK_FLAGS LIBCXXABI_HAS_NODEFAULTLIBS_FLAG -nodefaultlibs)
+if (NOT LIBCXXABI_USE_COMPILER_RT)
+  append_if(LIBCXXABI_LINK_FLAGS LIBCXXABI_HAS_NODEFAULTLIBS_FLAG 
-nodefaultlibs)
+endif()
 
 set(LIBCXXABI_SHARED_LINK_FLAGS)
 


Index: src/CMakeLists.txt
===================================================================
--- src/CMakeLists.txt
+++ src/CMakeLists.txt
@@ -70,7 +70,9 @@
 
 # Setup flags.
 append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_HAS_FPIC_FLAG -fPIC)
-append_if(LIBCXXABI_LINK_FLAGS LIBCXXABI_HAS_NODEFAULTLIBS_FLAG -nodefaultlibs)
+if (NOT LIBCXXABI_USE_COMPILER_RT)
+  append_if(LIBCXXABI_LINK_FLAGS LIBCXXABI_HAS_NODEFAULTLIBS_FLAG -nodefaultlibs)
+endif()
 
 set(LIBCXXABI_SHARED_LINK_FLAGS)
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to