Page MenuHomePhabricator

[CMAKE] Detect if the compiler supports visibility function attribute

Authored by Fabien on Sep 25 2019, 18:45.



This diff adds detection for the
__attribute__((visibility("default"))) and
__attribute__((visibility("default"))) visibility function attributes.

This allow to export the expected symbols when building a shared library
while using fvisibility=hidden.

Test Plan
mkdir buildcmake && cd buildcmake
cmake -GNinja ..
grep HAVE_FUNC_ATTRIBUTE src/config/bitcoin-config.h

Should be defined to 1 for HAVE_FUNC_ATTRIBUTE_VISIBILITY and
undefined for HAVE_FUNC_ATTRIBUTE_DLLEXPORT when using Clang, and
should be both defined to 1 when using GCC.

Diff Detail

rABC Bitcoin ABC
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Fabien created this revision.Sep 25 2019, 18:45
Herald added a reviewer: Restricted Project. · View Herald TranscriptSep 25 2019, 18:45
deadalnix accepted this revision.Sep 26 2019, 13:45
deadalnix added inline comments.
55 ↗(On Diff #13137)


This revision is now accepted and ready to land.Sep 26 2019, 13:45
Fabien added inline comments.Sep 26 2019, 14:29
55 ↗(On Diff #13137)

It's from a backport that fixes an issue with serialization on OpenSolaris OS and derived.