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
Branch
cmake_check_function_attributes
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 7586
Build 13212: Bitcoin ABC Buildbot (legacy)
Build 13211: arc lint + arc unit

Event Timeline

deadalnix added inline comments.
src/config/bitcoin-config.h.cmake.in
55

WAT ?

This revision is now accepted and ready to land.Sep 26 2019, 13:45
src/config/bitcoin-config.h.cmake.in
55

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