Page MenuHomePhabricator

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

Authored by Fabien on Sep 25 2019, 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
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

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.Sep 26 2019, 13:45
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.