This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Introduce _LIBCPP_EXTERN_VIS to fix __libcpp_debug_function link errors
ClosedPublic

Authored by EricWF on Jan 14 2017, 3:04 AM.

Details

Summary

On Windows tests that use _LIBCPP_ASSERT fail to link because the assertion handler function isn't correctly exported from the libc++ dylib. This patch fixes the dll import/export issues by introducing a new visibility macro _LIBCPP_EXTERN_VIS for use on external variables.

Diff Detail

Event Timeline

EricWF updated this revision to Diff 84444.Jan 14 2017, 3:04 AM
EricWF retitled this revision from to [libc++] Introduce _LIBCPP_EXTERN_VIS to fix __libcpp_debug_function link errors.
EricWF updated this object.
EricWF added reviewers: smeenai, compnerd.
EricWF added a subscriber: cfe-commits.
smeenai edited edge metadata.Jan 14 2017, 11:16 AM

This will need to be exported on other platforms too when hidden visibility happens :)

Is it okay for these to be exported unconditionally, or should their exporting be determined by _LIBCPP_DEBUG? This LGTM if it's the former.

EricWF accepted this revision.Jan 16 2017, 1:11 PM

This will need to be exported on other platforms too when hidden visibility happens :)

Are you sure?I don't think "extern" variables are subject to visibility rules in GCC or Clang. At least I haven't
been able to generate a test case or even different assembly.

Is it okay for these to be exported unconditionally, or should their exporting be determined by _LIBCPP_DEBUG? This LGTM if it's the former.

Unconditionally. The declaration should already be #ifdef'ed out when libc++'s debug mode is not enabled.

I'm going to commit this as-is, and will address visibility issues on other platforms if needed.

This revision is now accepted and ready to land.Jan 16 2017, 1:11 PM
EricWF closed this revision.Jan 16 2017, 1:11 PM