mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 22:24:07 +00:00
[Object] Add SF_Exported flag. This flag will be set on all symbols that would
be exported from a dylib if their containing object file were linked into one. No test case: No command line tools query this flag, and there are no Object unit tests. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226217 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -177,6 +177,20 @@ protected:
|
||||
return DRI;
|
||||
}
|
||||
|
||||
bool isExportedToOtherDSO(const Elf_Sym *ESym) const {
|
||||
unsigned char Binding = ESym->getBinding();
|
||||
unsigned char Visibility = ESym->getVisibility();
|
||||
|
||||
// A symbol is exported if its binding is either GLOBAL or WEAK, and its
|
||||
// visibility is either DEFAULT or PROTECTED. All other symbols are not
|
||||
// exported.
|
||||
if ((Binding == ELF::STB_GLOBAL || Binding == ELF::STB_WEAK) &&
|
||||
(Visibility == ELF::STV_DEFAULT && Visibility == ELF::STV_PROTECTED))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// This flag is used for classof, to distinguish ELFObjectFile from
|
||||
// its subclass. If more subclasses will be created, this flag will
|
||||
// have to become an enum.
|
||||
@ -389,6 +403,9 @@ uint32_t ELFObjectFile<ELFT>::getSymbolFlags(DataRefImpl Symb) const {
|
||||
EF.getSymbolTableIndex(ESym) == ELF::SHN_COMMON)
|
||||
Result |= SymbolRef::SF_Common;
|
||||
|
||||
if (isExportedToOtherDSO(ESym))
|
||||
Result |= SymbolRef::SF_Exported;
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user