[llvm] [llvm-objcopy] Add llvm-objcopy option --set-symbol-visibility (PR #80872)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 23 11:10:11 PST 2024
================
@@ -298,6 +298,10 @@ static Error updateAndRemoveSymbols(const CommonConfig &Config,
Config.SymbolsToLocalize.matches(Sym.Name)))
Sym.Binding = STB_LOCAL;
+ for (auto &[Matcher, VisibilityType] : ELFConfig.SymbolsToSetVisibility)
+ if (Matcher.matches(Sym.Name) && Sym.getShndx() != SHN_UNDEF)
----------------
MaskRay wrote:
Why is there a special case for undefined symbol? A protected/hidden undefined should be allowed.
The following code generates a hidden undefined symbol.
```
#pragma GCC visibility push(hidden)
void bar();
void foo() {
bar();
}
```
https://github.com/llvm/llvm-project/pull/80872
More information about the llvm-commits
mailing list