[llvm] r347481 - [Object] Also treat STB_GNU_UNIQUE symbols as exported to other DSO
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 22 17:33:19 PST 2018
Author: maskray
Date: Thu Nov 22 17:33:19 2018
New Revision: 347481
URL: http://llvm.org/viewvc/llvm-project?rev=347481&view=rev
Log:
[Object] Also treat STB_GNU_UNIQUE symbols as exported to other DSO
All of STB_GLOBAL/STB_WEAK/STB_GNU_UNIQUE are treated as export symbols, see:
glibc/elf/dl-lookup.c:do_lookup_x
musl/ldso/dynlink.c OK_BINDS
Though ld.so does not read binding, the currently used STV_DEFAULT or STV_PROTECTED is a good emulation of linker behavior.
Modified:
llvm/trunk/include/llvm/Object/ELFObjectFile.h
Modified: llvm/trunk/include/llvm/Object/ELFObjectFile.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/ELFObjectFile.h?rev=347481&r1=347480&r2=347481&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/ELFObjectFile.h (original)
+++ llvm/trunk/include/llvm/Object/ELFObjectFile.h Thu Nov 22 17:33:19 2018
@@ -333,9 +333,10 @@ protected:
// 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.
- return ((Binding == ELF::STB_GLOBAL || Binding == ELF::STB_WEAK) &&
- (Visibility == ELF::STV_DEFAULT ||
- Visibility == ELF::STV_PROTECTED));
+ return (
+ (Binding == ELF::STB_GLOBAL || Binding == ELF::STB_WEAK ||
+ Binding == ELF::STB_GNU_UNIQUE) &&
+ (Visibility == ELF::STV_DEFAULT || Visibility == ELF::STV_PROTECTED));
}
// This flag is used for classof, to distinguish ELFObjectFile from
More information about the llvm-commits
mailing list