This is an archive of the discontinued LLVM Phabricator instance.

[CMake] Get rid of LLVM_DYLIB_EXPORT_ALL, and make it the default, add libLLVM-C on darwin to cover the C API needs.
ClosedPublic

Authored by beanz on Oct 16 2015, 8:13 PM.

Details

Summary

We've had a lot of discussion in the past about the meaningful and useful default behaviors for the llvm-shlib tool. The original implementation was heavily geared toward Apple's use, and I think that was wrong. This patch seeks to correct that.

I've removed the LLVM_DYLIB_EXPORT_ALL variable and made libLLVM export everything by default.

I've also added a new target that is only built on Darwin for libLLVM-C as a library that re-exports the LLVM-C API. This library is not built on Linux because ELF doesn't support re-export libraries in the same way MachO does.

Diff Detail

Repository
rL LLVM

Event Timeline

beanz updated this revision to Diff 37669.Oct 16 2015, 8:13 PM
beanz retitled this revision from to [CMake] Get rid of LLVM_DYLIB_EXPORT_ALL, and make it the default, add libLLVM-C on darwin to cover the C API needs..
beanz updated this object.
beanz added reviewers: axw, chapuni, resistor.
beanz added a subscriber: llvm-commits.
axw edited edge metadata.Oct 17 2015, 7:45 AM

Thanks, just a few small things. I'm not qualified to review the Apple-specific bits.

CMakeLists.txt
376 ↗(On Diff #37669)

Did you mean to make this change? It's a pretty big change, and probably warrants some discussion on llvm-dev.

378 ↗(On Diff #37669)

nit, differentiate description from option above?

tools/llvm-shlib/CMakeLists.txt
15 ↗(On Diff #37669)

s/LLVM_DYLIB_EXPORT_ALL/LLVM_LINK_LLVM_DYLIB/
?

80 ↗(On Diff #37669)

nit, I think "_LLVM || LLVM" is only necessary if targeting Darwin (with a _ prefix) as well as other platforms (with no _ prefix).

beanz added a comment.Oct 17 2015, 8:23 AM

Thanks for the feedback. Updated patches incoming.

CMakeLists.txt
376 ↗(On Diff #37669)

That was unintentional, but I do actually need to clean up how we set some of the defaults here. I think the default value for LLVM_BUILD_LLVM_DYLIB should effectively be LLVM_LINK_LLVM_DYLIB OR LLVM_BUILD_LLVM_C_DYLIB.

beanz updated this revision to Diff 37683.Oct 17 2015, 8:25 AM
beanz edited edge metadata.

Updates based on feedback from Andrew.

axw accepted this revision.Oct 27 2015, 2:16 AM
axw edited edge metadata.

LGTM

This revision is now accepted and ready to land.Oct 27 2015, 2:16 AM
This revision was automatically updated to reflect the committed changes.