Page MenuHomePhabricator

[CMAKE] Detect if the compiler supports visibility function attribute
ClosedPublic

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

Details

Summary

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

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

Event Timeline

Fabien created this revision.Wed, Sep 25, 18:45
Herald added a reviewer: Restricted Project. · View Herald TranscriptWed, Sep 25, 18:45
deadalnix accepted this revision.Thu, Sep 26, 13:45
deadalnix added inline comments.
src/config/bitcoin-config.h.cmake.in
55 ↗(On Diff #13137)

WAT ?

This revision is now accepted and ready to land.Thu, Sep 26, 13:45
Fabien added inline comments.Thu, Sep 26, 14:29
src/config/bitcoin-config.h.cmake.in
55 ↗(On Diff #13137)

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