This is an archive of the discontinued LLVM Phabricator instance.

[MinGW] Don't currently set visibility=hidden when building for MinGW
ClosedPublic

Authored by mstorsjo on Jul 20 2022, 1:38 PM.

Details

Summary

If we build the Target libraries with -fvisibility=hidden, then
LLVM_EXTERNAL_VISIBILITY must also be able to override it back
to default visibility.

Currently, the LLVM_EXTERNAL_VISIBILITY define is a no-op for
mingw targets, thus set CMAKE_CXX_VISIBILITY_PRESET correspondingly.

This unbreaks the mingw dylib build, if the compiler actually
takes hidden visiblity into account (e.g. after D130121).

(Later, once hidden visiblity can be used for MinGW targets, we
can make LLVM_EXTERNAL_VISIBILITY and LLVM_LIBRARY_VISIBILITY expand
to actual attributes, and reverse this commit.)

Diff Detail

Event Timeline

mstorsjo created this revision.Jul 20 2022, 1:38 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 20 2022, 1:38 PM
mstorsjo requested review of this revision.Jul 20 2022, 1:38 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 20 2022, 1:38 PM
rnk accepted this revision.Jul 20 2022, 2:00 PM
rnk added a subscriber: tstellar.

Tom added hidden Target symbol visibility originally, right, can he review? +@tstellar

This seems reasonable to me.

This revision is now accepted and ready to land.Jul 20 2022, 2:00 PM
tstellar accepted this revision.Jul 21 2022, 8:31 AM
This revision was landed with ongoing or failed builds.Jul 21 2022, 1:17 PM
This revision was automatically updated to reflect the committed changes.