[PATCH] D24083: [CMake] Fix libc++abi __aeabi_idiv() link error.

2016-12-15 Thread Logan Chien via Phabricator via cfe-commits
logan added a comment.

Sorry, I don't have time to work on this recently.  Here's the plan:

1. Add another flag to specify the path to `libclang_rt-builtin.a`.

2. If that flag was not specified and the compiler is `clang`, then run `clang 
-###` to extract for `-L` option and `-l` option for `libclang_rt-builtin.a`.

3. If neither (1) nor (2) are available, then report an error.

I hope I can get back to this next week.


https://reviews.llvm.org/D24083



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D24083: [CMake] Fix libc++abi __aeabi_idiv() link error.

2016-12-12 Thread Renato Golin via Phabricator via cfe-commits
rengolin added a comment.

Was this abandoned? Merged?


https://reviews.llvm.org/D24083



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D24083: [CMake] Fix libc++abi __aeabi_idiv() link error.

2016-10-04 Thread Renato Golin via cfe-commits
rengolin added a comment.

In https://reviews.llvm.org/D24083#534464, @EricWF wrote:

> In https://reviews.llvm.org/D24083#534459, @logan wrote:
>
> > One solution might be adding the `libclang_rt.builtins.${arch}.a` detection 
> > rules[1] to CMakeLists.txt, and manually specify 
> > `-lclang_rt.builtins-${arch}.a` when `LIBCXXABI_USE_COMPILER_RT` is 
> > enabled.  How do you think about this solution?
>
>
> That SGTM. There's a similar workaround in libc++ to link the sanitizer 
> run-times on OS X (found here 
> ).


+1


https://reviews.llvm.org/D24083



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24083: [CMake] Fix libc++abi __aeabi_idiv() link error.

2016-09-06 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

In https://reviews.llvm.org/D24083#534459, @logan wrote:

> One solution might be adding the `libclang_rt.builtins.${arch}.a` detection 
> rules[1] to CMakeLists.txt, and manually specify 
> `-lclang_rt.builtins-${arch}.a` when `LIBCXXABI_USE_COMPILER_RT` is enabled.  
> How do you think about this solution?


That SGTM. There's a similar workaround in libc++ to link the sanitizer 
run-times on OS X (found here 
).


https://reviews.llvm.org/D24083



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24083: [CMake] Fix libc++abi __aeabi_idiv() link error.

2016-09-06 Thread Logan Chien via cfe-commits
logan added a comment.

Hi @rengolin and @EricWF,

After tracing the commit log of clang, it seems that `--rtlib=` is ignored 
intentionally when `-nodefaultlibs` is present.  (see also: 
https://reviews.llvm.org/rL254535)

And, unfortunately, we don't have a command line option to ask clang to link 
compiler-rt built-in library along (regardless the `-nodefaultlibs` option.)

One solution might be adding the `libclang_rt.builtins.${arch}.a` detection 
rules[1] to CMakeLists.txt, and manually specify 
`-lclang_rt.builtins-${arch}.a` when `LIBCXXABI_USE_COMPILER_RT` is enabled.  
How do you think about this solution?

[1] There is a function named `ToolChain::getCompilerRT()` in 
`${clang}/lib/Driver/ToolChain.cpp` which is responsible to detect and pick the 
correct compiler-rt library.


https://reviews.llvm.org/D24083



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24083: [CMake] Fix libc++abi __aeabi_idiv() link error.

2016-09-03 Thread Eric Fiselier via cfe-commits
EricWF added a comment.

This is not correct. We need the `-nodefaultlibs` on most platforms to prevent 
libstdc++ from being linked. I think the correct fix is to change 
`--rtlib=`


https://reviews.llvm.org/D24083



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D24083: [CMake] Fix libc++abi __aeabi_idiv() link error.

2016-08-31 Thread Renato Golin via cfe-commits
rengolin added a comment.

This looks like a work around the fact that --rtlib is being ignored with 
--nodefaultlibs. I'm not sure that's a sane behaviour, if you explicitly 
specify --rtlib.


https://reviews.llvm.org/D24083



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D24083: [CMake] Fix libc++abi __aeabi_idiv() link error.

2016-08-31 Thread Logan Chien via cfe-commits
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