Skip to content

libnvme: annotate public API symbols with __public#3199

Open
martin-belanger wants to merge 1 commit intolinux-nvme:masterfrom
martin-belanger:libnvme-public-visibility-v3
Open

libnvme: annotate public API symbols with __public#3199
martin-belanger wants to merge 1 commit intolinux-nvme:masterfrom
martin-belanger:libnvme-public-visibility-v3

Conversation

@martin-belanger
Copy link

@martin-belanger martin-belanger commented Mar 18, 2026

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.

@martin-belanger martin-belanger force-pushed the libnvme-public-visibility-v3 branch from 1136fec to 99d0290 Compare March 18, 2026 18:51
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>
@martin-belanger martin-belanger force-pushed the libnvme-public-visibility-v3 branch from 99d0290 to 5884293 Compare March 18, 2026 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant