2 trivial patches for libc++

Hi

Does anyone object to these trivial patches? (If not someone please push)

#1

FreeBSD has a local patch that for some stupid reason they have’t pushed upstream. We recently added a commit that without the libc++ fix causes multiple symbols for us and a build regression.

Here’s the patch
https://svnweb.freebsd.org/base/head/contrib/libc%2B%2B/src/new.cpp?r1=261283&r2=273434

commit message - “libcxxrt now implements bad_array_new_length and need to guard against multiple defines”

#2 The attached patch allows libc++ to use libcxxrt on OSX.

Thanks

libcxx.patch (1.09 KB)

FWIW, your description doesn't seem bad, but we can't commit a patch to
libc++ without the author of the patch contributing it by posting it to the
list... Hopefully whomever wrote this is willing to upstream it?

The CMake part has a bug:

diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index cd8553c..d489c90 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -53,7 +53,7 @@ target_link_libraries(cxx ${libraries})
append_if(compile_flags LIBCXX_HAS_FPIC_FLAG -fPIC)
append_if(link_flags LIBCXX_HAS_NODEFAULTLIBS_FLAG -nodefaultlibs)

-if ( APPLE )
+if ( APPLE AND "${LIBCXX_CXX_ABI}" STREQUAL "libcxxaib" )

This should be "libcxxabi"

Other than that (and needing to test this on OS X with libc++abi to make
sure the typo fix works) the CMake side looks fine. Sadly, the
exception.cpp code is stuff I have never rightly understood well enough to
help with. Hopefully Marshall or someone can help there.

-Chandler

The patch is too trivial to be covered by copyright (it moves an #endif down a few lines). Baptiste committed it to the FreeBSD repo, but on my advice so I can count as the person who wrote it if that's really a problem.

David

I'd much rather have someone just post a patch they authored than think
about the details of such things.... Much simpler....

I agree. Doesn't cost anything, and makes things a lot clearer.

--renato

We're talking about moving a #if a couple lines down. I'd agree there's a
line nobody wants to cross, but it's unrealistic to think this could be
done another way. The time taken for 3 people to write emails was longer
than the commit message.

(Now I guess I understand why FreeBSD has local changes that aren't
upstream..)

UGH

I’ve reached out to the author of the patch to get his permission. I’ll review and test the CMake patch tonight and then commit it.

/Eric