Issue |
134151
|
Summary |
Adding `availability` attribute overrides visibility of symbols
|
Labels |
new issue
|
Assignees |
|
Reporter |
var-const
|
Symbols annotated with `__attribute__((availability))` always have default visibility, even if marked with `__attribute__((__visibility__("hidden")))` and compiled with `-fvisibility=hidden`. Self-contained repro (courtesy of @ldionne):
```cpp
// Compile with: clang++ -xc++ - -shared -o a.out -fvisibility=hidden -fvisibility-inlines-hidden
// Check symbols with: nm -omg a.out | c++filt | grep value
template <class T>
struct foo {
__attribute__((__visibility__("hidden")))
__attribute__((availability(macos,strict,introduced=10.13)))
T value() const { return 0; }
};
int f(foo<int> x) {
return x.value();
}
```
Running `nm` on the resulting binary shows it contains
```
a.out: 0000000000000408 (__TEXT,__text) weak external foo<int>::value() const
```
Annotating a symbol with availability should not affect its visibility.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs