Commit 198598f
Martin Belanger
libnvme: enforce ABI boundary with -fvisibility=hidden
Add -fvisibility=hidden to the libnvme library build and introduce a
LIBNVME_PUBLIC macro (defined as __attribute__((visibility("default")))
in lib-types.h) to explicitly mark each exported function definition.
With this change the compiler enforces the ABI boundary rather than
relying solely on the linker version scripts (libnvme.ld, libnvmf.ld,
accessors.ld). The immediate benefits are:
- Any function accidentally omitted from the version script but lacking
LIBNVME_PUBLIC will be hidden at compile time, making the omission
visible as a link error rather than a silent symbol leak.
- nm -D on the installed .so gives an authoritative, minimal symbol
list suitable for CI checks and abidiff.
The annotation is placed on function *definitions* in the .c files only.
Installed public headers are left unannotated so that third-party code
that includes them is not exposed to a build-internal attribute.
The generate-accessors tool is updated to emit LIBNVME_PUBLIC on the
generated function definitions in accessors.c.
While auditing the version scripts, 34 stale symbol entries that had no
corresponding definition in the source tree were removed from libnvme.ld
and libnvmf.ld.
Signed-off-by: Martin Belanger <[email protected]>1 parent cd3c691 commit 198598f
23 files changed
Lines changed: 962 additions & 548 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
60 | 59 | | |
61 | 60 | | |
62 | 61 | | |
| |||
89 | 88 | | |
90 | 89 | | |
91 | 90 | | |
92 | | - | |
93 | 91 | | |
94 | 92 | | |
95 | 93 | | |
96 | 94 | | |
97 | 95 | | |
98 | | - | |
99 | 96 | | |
100 | 97 | | |
101 | 98 | | |
| |||
106 | 103 | | |
107 | 104 | | |
108 | 105 | | |
109 | | - | |
110 | 106 | | |
111 | 107 | | |
112 | 108 | | |
| |||
115 | 111 | | |
116 | 112 | | |
117 | 113 | | |
118 | | - | |
119 | | - | |
120 | 114 | | |
121 | 115 | | |
122 | 116 | | |
123 | 117 | | |
124 | 118 | | |
125 | 119 | | |
126 | 120 | | |
127 | | - | |
128 | 121 | | |
129 | 122 | | |
130 | 123 | | |
| |||
153 | 146 | | |
154 | 147 | | |
155 | 148 | | |
156 | | - | |
157 | 149 | | |
158 | 150 | | |
159 | 151 | | |
| |||
171 | 163 | | |
172 | 164 | | |
173 | 165 | | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | 166 | | |
178 | 167 | | |
179 | 168 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | 25 | | |
52 | 26 | | |
53 | 27 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| 99 | + | |
99 | 100 | | |
100 | 101 | | |
101 | 102 | | |
| |||
0 commit comments