[PATCH] D53782: [llvm-objcopy] Don't apply --localize flags to common symbols
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 26 16:34:03 PDT 2018
MaskRay added inline comments.
================
Comment at: tools/llvm-objcopy/llvm-objcopy.cpp:259
Obj.SymbolTable->updateSymbols([&](Symbol &Sym) {
- if ((Config.LocalizeHidden &&
- (Sym.Visibility == STV_HIDDEN || Sym.Visibility == STV_INTERNAL)) ||
- (!Config.SymbolsToLocalize.empty() &&
- is_contained(Config.SymbolsToLocalize, Sym.Name)))
+ if (Sym.getShndx() != SHN_COMMON &&
+ ((Config.LocalizeHidden &&
----------------
MaskRay wrote:
> GNU objcopy -L does not apply on `SHN_UNDEF` symbols.
if (Sym.getShndx() != SHN_UNDEF && Sym.getShndx() != SHN_COMMON &&
(Sym.Binding == STB_GLOBAL || Sym.Binding == STB_WEAK) &&
(is_contained(Config.SymbolsToLocalize, Sym.Name) ||
(Config.LocalizeHidden &&
(Sym.Visibility == STV_HIDDEN || Sym.Visibility == STV_INTERNAL))))
May be a better emulation of GNU objcopy's behavior. But I don't know how much compatibility we want to achieve...
Repository:
rL LLVM
https://reviews.llvm.org/D53782
More information about the llvm-commits
mailing list