mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-21 18:22:53 +01:00
Revert "[JITLink][MachO] Treat linker private symbols as hidden rather than private."
This reverts commit b64afadf306f284a684ee656c6eefbd43c192c8d. Reverting while I investigate bot failures.
This commit is contained in:
parent
fa8604e589
commit
80d993d0f0
@ -64,7 +64,9 @@ Linkage MachOLinkGraphBuilder::getLinkage(uint16_t Desc) {
|
||||
}
|
||||
|
||||
Scope MachOLinkGraphBuilder::getScope(StringRef Name, uint8_t Type) {
|
||||
if (Name.startswith("l") || (Type & MachO::N_PEXT))
|
||||
if (Name.startswith("l"))
|
||||
return Scope::Local;
|
||||
if (Type & MachO::N_PEXT)
|
||||
return Scope::Hidden;
|
||||
if (Type & MachO::N_EXT)
|
||||
return Scope::Default;
|
||||
|
@ -89,25 +89,14 @@ getObjectSymbolInfo(ExecutionSession &ES, MemoryBufferRef ObjBuffer) {
|
||||
if (!Obj)
|
||||
return Obj.takeError();
|
||||
|
||||
bool IsMachO = isa<object::MachOObjectFile>(Obj->get());
|
||||
|
||||
SymbolFlagsMap SymbolFlags;
|
||||
for (auto &Sym : (*Obj)->symbols()) {
|
||||
// Skip symbols not defined in this object file.
|
||||
if (Sym.getFlags() & object::BasicSymbolRef::SF_Undefined)
|
||||
continue;
|
||||
|
||||
// Get the symbol name.
|
||||
auto Name = Sym.getName();
|
||||
if (!Name)
|
||||
return Name.takeError();
|
||||
|
||||
bool IsLinkerPrivate = IsMachO && Name->startswith("l");
|
||||
|
||||
// Skip symbols that are not global. Treat linker private symbols as global
|
||||
// hidden.
|
||||
if (!(Sym.getFlags() & object::BasicSymbolRef::SF_Global) &&
|
||||
!IsLinkerPrivate)
|
||||
// Skip symbols that are not global.
|
||||
if (!(Sym.getFlags() & object::BasicSymbolRef::SF_Global))
|
||||
continue;
|
||||
|
||||
// Skip symbols that have type SF_File.
|
||||
@ -117,6 +106,9 @@ getObjectSymbolInfo(ExecutionSession &ES, MemoryBufferRef ObjBuffer) {
|
||||
} else
|
||||
return SymType.takeError();
|
||||
|
||||
auto Name = Sym.getName();
|
||||
if (!Name)
|
||||
return Name.takeError();
|
||||
auto InternedName = ES.intern(*Name);
|
||||
auto SymFlags = JITSymbolFlags::fromObjectSymbol(Sym);
|
||||
if (!SymFlags)
|
||||
@ -126,10 +118,9 @@ getObjectSymbolInfo(ExecutionSession &ES, MemoryBufferRef ObjBuffer) {
|
||||
|
||||
SymbolStringPtr InitSymbol;
|
||||
|
||||
if (IsMachO) {
|
||||
auto &MachOObj = cast<object::MachOObjectFile>(*Obj->get());
|
||||
for (auto &Sec : MachOObj.sections()) {
|
||||
auto SecType = MachOObj.getSectionType(Sec);
|
||||
if (auto *MachOObj = dyn_cast<object::MachOObjectFile>(Obj->get())) {
|
||||
for (auto &Sec : MachOObj->sections()) {
|
||||
auto SecType = MachOObj->getSectionType(Sec);
|
||||
if ((SecType & MachO::SECTION_TYPE) == MachO::S_MOD_INIT_FUNC_POINTERS) {
|
||||
std::string InitSymString;
|
||||
raw_string_ostream(InitSymString)
|
||||
|
@ -1,10 +0,0 @@
|
||||
# Supplies a linker private definition, "l_foo".
|
||||
|
||||
.section __TEXT,__text,regular,pure_instructions
|
||||
.macosx_version_min 10, 14
|
||||
.p2align 4, 0x90
|
||||
l_foo:
|
||||
xorl %eax, %eax
|
||||
retq
|
||||
|
||||
.subsections_via_symbols
|
@ -1,19 +0,0 @@
|
||||
# RUN: rm -rf %t && mkdir -p %t
|
||||
# RUN: llvm-mc -triple=x86_64-apple-macosx10.9 -filetype=obj \
|
||||
# RUN: -o %t/MachO_linker_private_def.o %S/Inputs/MachO_linker_private_def.s
|
||||
# RUN: llvm-mc -triple=x86_64-apple-macosx10.9 -filetype=obj \
|
||||
# RUN: -o %t/MachO_linker_private_symbols.o %s
|
||||
# RUN: llvm-jitlink -noexec %t/MachO_linker_private_def.o \
|
||||
# RUN: %t/MachO_linker_private_symbols.o
|
||||
#
|
||||
# Check that we can resolve linker-private symbol definitions across object
|
||||
# boundaries.
|
||||
|
||||
.section __TEXT,__text,regular,pure_instructions
|
||||
.macosx_version_min 10, 14
|
||||
.globl _main
|
||||
.p2align 4, 0x90
|
||||
_main:
|
||||
jmp l_foo
|
||||
|
||||
.subsections_via_symbols
|
Loading…
Reference in New Issue
Block a user