diff --git a/lld/MachO/Arch/ARM64.cpp b/lld/MachO/Arch/ARM64.cpp --- a/lld/MachO/Arch/ARM64.cpp +++ b/lld/MachO/Arch/ARM64.cpp @@ -33,7 +33,7 @@ void relocateOne(uint8_t *loc, const Reloc &, uint64_t va, uint64_t pc) const override; - void writeStub(uint8_t *buf, const macho::Symbol &) const override; + void writeStub(uint8_t *buf, const Symbol &) const override; void writeStubHelperHeader(uint8_t *buf) const override; void writeStubHelperEntry(uint8_t *buf, const DylibSymbol &, uint64_t entryAddr) const override; @@ -217,7 +217,7 @@ 0xd61f0200, // 08: br x16 }; -void ARM64::writeStub(uint8_t *buf8, const macho::Symbol &sym) const { +void ARM64::writeStub(uint8_t *buf8, const Symbol &sym) const { auto *buf32 = reinterpret_cast(buf8); uint64_t pcPageBits = pageBits(in.stubs->addr + sym.stubsIndex * sizeof(stubCode)); diff --git a/lld/MachO/Arch/X86_64.cpp b/lld/MachO/Arch/X86_64.cpp --- a/lld/MachO/Arch/X86_64.cpp +++ b/lld/MachO/Arch/X86_64.cpp @@ -30,7 +30,7 @@ void relocateOne(uint8_t *loc, const Reloc &, uint64_t va, uint64_t relocVA) const override; - void writeStub(uint8_t *buf, const macho::Symbol &) const override; + void writeStub(uint8_t *buf, const Symbol &) const override; void writeStubHelperHeader(uint8_t *buf) const override; void writeStubHelperEntry(uint8_t *buf, const DylibSymbol &, uint64_t entryAddr) const override; @@ -138,7 +138,7 @@ 0xff, 0x25, 0, 0, 0, 0, // jmpq *__la_symbol_ptr(%rip) }; -void X86_64::writeStub(uint8_t *buf, const macho::Symbol &sym) const { +void X86_64::writeStub(uint8_t *buf, const Symbol &sym) const { memcpy(buf, stub, 2); // just copy the two nonzero bytes uint64_t stubAddr = in.stubs->addr + sym.stubsIndex * sizeof(stub); writeRipRelative({&sym, "stub"}, buf, stubAddr, sizeof(stub), diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp --- a/lld/MachO/Driver.cpp +++ b/lld/MachO/Driver.cpp @@ -513,7 +513,7 @@ // any CommonSymbols. static void replaceCommonSymbols() { TimeTraceScope timeScope("Replace common symbols"); - for (macho::Symbol *sym : symtab->getSymbols()) { + for (Symbol *sym : symtab->getSymbols()) { auto *common = dyn_cast(sym); if (common == nullptr) continue; diff --git a/lld/MachO/InputSection.cpp b/lld/MachO/InputSection.cpp --- a/lld/MachO/InputSection.cpp +++ b/lld/MachO/InputSection.cpp @@ -34,8 +34,7 @@ uint64_t InputSection::getVA() const { return parent->addr + outSecOff; } -static uint64_t resolveSymbolVA(uint8_t *loc, const lld::macho::Symbol &sym, - uint8_t type) { +static uint64_t resolveSymbolVA(uint8_t *loc, const Symbol &sym, uint8_t type) { const RelocAttrs &relocAttrs = target->getRelocAttrs(type); if (relocAttrs.hasAttr(RelocAttrBits::BRANCH)) { if (sym.isInStubs()) diff --git a/lld/MachO/MapFile.cpp b/lld/MachO/MapFile.cpp --- a/lld/MachO/MapFile.cpp +++ b/lld/MachO/MapFile.cpp @@ -76,7 +76,7 @@ // Construct a map from symbols to their stringified representations. // Demangling symbols (which is what toString() does) is slow, so // we do that in batch using parallel-for. -static DenseMap +static DenseMap getSymbolStrings(ArrayRef syms) { std::vector str(syms.size()); parallelForEachN(0, syms.size(), [&](size_t i) { @@ -84,7 +84,7 @@ os << toString(*syms[i]); }); - DenseMap ret; + DenseMap ret; for (size_t i = 0, e = syms.size(); i < e; ++i) ret[syms[i]] = std::move(str[i]); return ret; @@ -126,7 +126,7 @@ // Collect symbol info that we want to print out. std::vector syms = getSymbols(); SymbolMapTy sectionSyms = getSectionSyms(syms); - DenseMap symStr = getSymbolStrings(syms); + DenseMap symStr = getSymbolStrings(syms); // Dump table of sections os << "# Sections:\n"; @@ -144,7 +144,7 @@ os << "# Symbols:\n"; os << "# Address\t File Name\n"; for (InputSection *isec : inputSections) { - for (macho::Symbol *sym : sectionSyms[isec]) { + for (Symbol *sym : sectionSyms[isec]) { os << format("0x%08llX\t[%3u] %s\n", sym->getVA(), readerToFileOrdinal[sym->getFile()], symStr[sym].c_str()); } diff --git a/lld/MachO/UnwindInfoSection.cpp b/lld/MachO/UnwindInfoSection.cpp --- a/lld/MachO/UnwindInfoSection.cpp +++ b/lld/MachO/UnwindInfoSection.cpp @@ -100,7 +100,7 @@ return (compactUnwindSection != nullptr); } -SmallDenseMap, macho::Symbol *> +SmallDenseMap, Symbol *> personalityTable; // Compact unwind relocations have different semantics, so we handle them in a @@ -118,7 +118,7 @@ offsetof(struct CompactUnwindEntry64, personality)) continue; - if (auto *s = r.referent.dyn_cast()) { + if (auto *s = r.referent.dyn_cast()) { if (auto *undefined = dyn_cast(s)) { treatUndefinedSymbol(*undefined); // treatUndefinedSymbol() can replace s with a DylibSymbol; re-check. @@ -127,7 +127,7 @@ } if (auto *defined = dyn_cast(s)) { // Check if we have created a synthetic symbol at the same address. - macho::Symbol *&personality = + Symbol *&personality = personalityTable[{defined->isec, defined->value}]; if (personality == nullptr) { personality = defined; @@ -146,7 +146,7 @@ // Personality functions can be referenced via section relocations // if they live in the same object file. Create placeholder synthetic // symbols for them in the GOT. - macho::Symbol *&s = personalityTable[{referentIsec, r.addend}]; + Symbol *&s = personalityTable[{referentIsec, r.addend}]; if (s == nullptr) { s = make("", nullptr, referentIsec, r.addend, false, false, false); @@ -181,7 +181,7 @@ for (const Reloc &r : isec->relocs) { uint64_t referentVA = 0; - if (auto *referentSym = r.referent.dyn_cast()) { + if (auto *referentSym = r.referent.dyn_cast()) { if (!isa(referentSym)) { assert(referentSym->isInGot()); if (auto *defined = dyn_cast(referentSym)) diff --git a/lld/MachO/Writer.cpp b/lld/MachO/Writer.cpp --- a/lld/MachO/Writer.cpp +++ b/lld/MachO/Writer.cpp @@ -484,8 +484,8 @@ return false; } -static void prepareSymbolRelocation(lld::macho::Symbol *sym, - const InputSection *isec, const Reloc &r) { +static void prepareSymbolRelocation(Symbol *sym, const InputSection *isec, + const Reloc &r) { const RelocAttrs &relocAttrs = target->getRelocAttrs(r.type); if (relocAttrs.hasAttr(RelocAttrBits::BRANCH)) { @@ -520,10 +520,10 @@ // minuend, and doesn't have the usual UNSIGNED semantics. We don't want // to emit rebase opcodes for it. it = std::next(it); - assert(isa(it->referent.dyn_cast())); + assert(isa(it->referent.dyn_cast())); continue; } - if (auto *sym = r.referent.dyn_cast()) { + if (auto *sym = r.referent.dyn_cast()) { if (auto *undefined = dyn_cast(sym)) treatUndefinedSymbol(*undefined); // treatUndefinedSymbol() can replace sym with a DylibSymbol; re-check. @@ -540,7 +540,7 @@ void Writer::scanSymbols() { TimeTraceScope timeScope("Scan symbols"); - for (const macho::Symbol *sym : symtab->getSymbols()) { + for (const Symbol *sym : symtab->getSymbols()) { if (const auto *defined = dyn_cast(sym)) { if (defined->overridesWeakDef) in.weakBinding->addNonWeakDefinition(defined); @@ -660,11 +660,12 @@ }; // TODO: Make sure this handles weak symbols correctly. - for (const InputFile *file : inputFiles) + for (const InputFile *file : inputFiles) { if (isa(file)) - for (lld::macho::Symbol *sym : file->symbols) + for (Symbol *sym : file->symbols) if (auto *d = dyn_cast(sym)) addSym(*d); + } return sectionPriorities; }