This is an archive of the discontinued LLVM Phabricator instance.

Re-apply "Only define LLVM_EXTERNAL_VISIBILITY when building libLLVM dylib"
ClosedPublic

Authored by benlangmuir on Dec 15 2021, 12:51 PM.

Details

Summary

With a fix for the MLIR test failure with BUILD_SHARED_LIBS.

Original commit message:

When building LLVM static libraries, we should not make symbols more
visible than CMAKE_CXX_VISIBILITY_PRESET, since the goal may be to have
a purely hidden llvm embedded in another library. Instead, we only
define LLVM_EXTERNAL_VISIBILITY for the dynamic library build (when
LLVM_BUILD_LLVM_DYLIB=YES).

Diff Detail

Event Timeline

benlangmuir created this revision.Dec 15 2021, 12:51 PM
benlangmuir requested review of this revision.Dec 15 2021, 12:51 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptDec 15 2021, 12:51 PM
benlangmuir added inline comments.Dec 15 2021, 12:57 PM
mlir/include/mlir/Support/TypeID.h
118 ↗(On Diff #394643)

I'm not sure if matching the CAPI visibility is precisely what you want here, but it seems like a strict improvement over matching the LLVM visibility, which should be mostly orthogonal from what you do here.

mehdi_amini added inline comments.Dec 15 2021, 1:01 PM
mlir/include/mlir/Support/TypeID.h
118 ↗(On Diff #394643)

Not really: if you look into mlir/tools/mlir-shlib/CMakeLists.txt we're creating libMLIR.dylib hand-in-hand with libLLVM.dylib ; this is what this mechanism is covering here.

(I need to go back to the original revision, I haven't followed exactly what the change is so far)

mehdi_amini added inline comments.Dec 15 2021, 1:10 PM
mlir/include/mlir/Support/TypeID.h
118 ↗(On Diff #394643)

Updated to enable the visibility macro when using BUILD_SHARED_LIBS and remove the MLIR-specific change, per review.

mehdi_amini accepted this revision.Dec 16 2021, 8:59 AM
This revision is now accepted and ready to land.Dec 16 2021, 8:59 AM
This revision was landed with ongoing or failed builds.Dec 16 2021, 9:25 AM
This revision was automatically updated to reflect the committed changes.