This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] Reexport std::bad_array_length symbols from libc++abi on OS X.
ClosedPublic

Authored by EricWF on Oct 5 2015, 11:54 AM.

Details

Summary

On OS X libc++ needs to reexport libc++abi's symbols in order for them to be provided. We explicitly list the symbols to reexport it libcxx/lib/libc++abi2.exp. This patch adds the symbols required by std::bad_array_length which have been missing for some time.

However there is a problem. std::bad_array_length was add to libc++abi in September of 2013 by commit r190479, about a year after everything else. Therefore I think older OS X version have libc++abi versions without std::bad_array_length. On those systems
libc++ won't build with this change because we will try and export undefined symbols.

The workaround I would write to support older systems depends on the amount of people who would need it. If only a small number of developers are affected it might be sufficient to provide a CMake switch like LIBCPP_LIBCPPABI_HAS_BAD_ARRAY_LENGTH which is
ON by default and can be disabled by those who need it. Otherwise I think we should try to automatically detect if the symbols are present in /usr/lib/libc++abi.dylib and configure accordingly. I would prefer the first solution because writing CMake sucks.

Diff Detail

Repository
rL LLVM

Event Timeline

EricWF updated this revision to Diff 36536.Oct 5 2015, 11:54 AM
EricWF retitled this revision from to [libcxx] Reexport std::bad_array_length symbols from libc++abi on OS X..
EricWF updated this object.
EricWF added a reviewer: mclow.lists.
EricWF added a subscriber: cfe-commits.
aprantl accepted this revision.Oct 5 2015, 12:23 PM
aprantl added a reviewer: aprantl.

Grepping through the nm output of libc++abi it looks like bad_array_length is included in Xcode 7 and Xcode 6.4, which is also what is installed on the lab.llvm.org:8080 machines and going further back it looks like it is even included in MacOSX10.9.sdk in Xcode 5.1.1.

I don't think there are any expectation that LLVM trunk can be built with older versions.

Thanks for investigating this!

This revision is now accepted and ready to land.Oct 5 2015, 12:23 PM
EricWF updated this revision to Diff 36540.Oct 5 2015, 12:29 PM
EricWF edited edge metadata.

I moved the symbols into lib/libc++abi2.exp since we didn't anticipate the need to exclude them.

This revision was automatically updated to reflect the committed changes.