summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
diff options
context:
space:
mode:
authorNick Kledzik <kledzik@apple.com>2014-09-09 23:52:59 +0000
committerNick Kledzik <kledzik@apple.com>2014-09-09 23:52:59 +0000
commit1bebb2832ee312d3b0316dacff457a7a29435edb (patch)
tree8e60f41a6649fd60850d101306b98b039857f97f /lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
parentd0f103775a66232fae4a54fc29fdc031f3436d38 (diff)
downloadbcm5719-llvm-1bebb2832ee312d3b0316dacff457a7a29435edb.tar.gz
bcm5719-llvm-1bebb2832ee312d3b0316dacff457a7a29435edb.zip
[mach-o] Add support for arm64 (AAarch64)
Most of the changes are in the new file ArchHandler_arm64.cpp. But a few things had to be fixed to support 16KB pages (instead of 4KB) which iOS arm64 requires. In addition the StubInfo struct had to be expanded because arm64 uses two instruction (ADRP/LDR) to load a global which requires two relocations. The other mach-o arches just needed one relocation. llvm-svn: 217469
Diffstat (limited to 'lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp')
-rw-r--r--lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp b/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
index 7fc6fa95a8f..7a5c3c31235 100644
--- a/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
+++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
@@ -285,6 +285,12 @@ std::error_code processSymboledSection(DefinedAtom::ContentType atomType,
Atom::Scope rScope = atomScope(rhs->scope);
if (lScope != rScope)
return lScope < rScope;
+ // If same address and scope, see if one might be better as
+ // the alias.
+ bool lPrivate = (lhs->name.front() == 'l');
+ bool rPrivate = (rhs->name.front() == 'l');
+ if (lPrivate != rPrivate)
+ return lPrivate;
// If same address and scope, sort by name.
return lhs->name < rhs->name;
});
@@ -315,8 +321,15 @@ std::error_code processSymboledSection(DefinedAtom::ContentType atomType,
const Symbol *lastSym = nullptr;
for (const Symbol *sym : symbols) {
if (lastSym != nullptr) {
- atomFromSymbol(atomType, section, file, lastSym->value, lastSym->name,
- lastSym->desc, atomScope(lastSym->scope), sym->value, copyRefs);
+ // Ignore any assembler added "ltmpNNN" symbol at start of section
+ // if there is another symbol at the start.
+ if ((lastSym->value != sym->value)
+ || lastSym->value != section.address
+ || !lastSym->name.startswith("ltmp")) {
+ atomFromSymbol(atomType, section, file, lastSym->value, lastSym->name,
+ lastSym->desc, atomScope(lastSym->scope), sym->value,
+ copyRefs);
+ }
}
lastSym = sym;
}
OpenPOWER on IntegriCloud