Skip to content

Commit 1136fec

Browse files
author
Martin Belanger
committed
libnvme: annotate public API symbols with __public
Add compiler_attributes.h defining two GCC visibility macros: __public (__attribute__((visibility("default")))) __weak (__attribute__((weak))) Annotate all functions exported via libnvme.ld, libnvmf.ld, and accessors.ld with __public. This prepares libnvme for builds with -fvisibility=hidden, ensuring internal symbols are hidden by default and only explicitly annotated functions form the public ABI. Each affected .c file now includes compiler_attributes.h and marks the relevant function definitions with __public. The accessor generator has also been updated to emit __public, so future regenerations remain consistent. As a small related cleanup, __weak was introduced in compiler_attributes.h and applied where needed. While not strictly part of the main change, it naturally fits alongside the new attribute definitions and keeps related compiler annotations consolidated. Signed-off-by: Martin Belanger <martin.belanger@dell.com>
1 parent a19cf14 commit 1136fec

18 files changed

Lines changed: 629 additions & 408 deletions

libnvme/src/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ libnvme = library(
9696
'nvme', # produces libnvme.so
9797
sources,
9898
version: libnvme_so_version,
99+
c_args: ['-fvisibility=hidden'],
99100
link_args: link_args,
100101
dependencies: deps,
101102
install: true,

0 commit comments

Comments
 (0)