This is an archive of the discontinued LLVM Phabricator instance.

[clang-repl] Fix REPL_EXTERNAL_VISIBILITY and building libclang-cpp.dll for MinGW configurations
ClosedPublic

Authored by mstorsjo on May 27 2023, 3:02 PM.

Details

Summary

This fixes two issues that are observed after
5111286f06e1e10f24745007a45a830760f1790c:

For builds with GCC with LLVM_LINK_LLVM_DYLIB=ON, we previously got
build errors, as libclang-cpp.dll suddenly only contained the
functions that were marked dllexport via REPL_EXTERNAL_VISIBILITY,
instead of all symbols as expected.

For MinGW builds with Clang, building previously succeeded (as it
used either the attribute((visibility("default"))) annotation or
nothing at all), and the functions were exported from libclang-cpp.dll
if that was built, but the unit test failed (as neither of those cases
made the functions exported from an EXE).

Don't use the visibility attributes on MinGW targets for these purposes;
setting default visibility only makes a difference if building with
e.g. -fvisibility=hidden, but it doesn't make the symbols exported
from an EXE.

Diff Detail

Event Timeline

mstorsjo created this revision.May 27 2023, 3:02 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 27 2023, 3:02 PM
mstorsjo requested review of this revision.May 27 2023, 3:02 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 27 2023, 3:02 PM
Herald added a subscriber: bd1976llvm. · View Herald Transcript
junaire accepted this revision.May 28 2023, 1:09 AM

Thanks.

This revision is now accepted and ready to land.May 28 2023, 1:09 AM