From bb46295e2f8860860f7eb83cff702e89037436ed Mon Sep 17 00:00:00 2001 From: Francis Ricci Date: Thu, 5 Oct 2017 23:09:17 +0000 Subject: [PATCH] Revert "[llvm-dsymutil] Add support for __swift_ast MachO DWARF section" Breaks aarch64 builders This reverts commit r315014. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315034 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/MC/MCObjectFileInfo.h | 4 --- lib/MC/MCObjectFileInfo.cpp | 4 --- .../dsymutil/Inputs/swift-ast.macho.x86_64 | Bin 8464 -> 0 bytes .../dsymutil/Inputs/swift-ast.swiftmodule | 1 - test/tools/dsymutil/swift-ast.test | 14 --------- tools/dsymutil/BinaryHolder.h | 12 ++++---- tools/dsymutil/DebugMap.cpp | 12 +++----- tools/dsymutil/DebugMap.h | 8 ++--- tools/dsymutil/DwarfLinker.cpp | 29 ++---------------- tools/dsymutil/MachODebugMapParser.cpp | 10 +----- 10 files changed, 16 insertions(+), 78 deletions(-) delete mode 100755 test/tools/dsymutil/Inputs/swift-ast.macho.x86_64 delete mode 100644 test/tools/dsymutil/Inputs/swift-ast.swiftmodule delete mode 100644 test/tools/dsymutil/swift-ast.test diff --git a/include/llvm/MC/MCObjectFileInfo.h b/include/llvm/MC/MCObjectFileInfo.h index d95f84d1d81..b03fd099c1d 100644 --- a/include/llvm/MC/MCObjectFileInfo.h +++ b/include/llvm/MC/MCObjectFileInfo.h @@ -123,9 +123,6 @@ protected: /// Section for newer gnu pubtypes. MCSection *DwarfGnuPubTypesSection; - // Section for Swift AST - MCSection *DwarfSwiftASTSection; - MCSection *COFFDebugSymbolsSection; MCSection *COFFDebugTypesSection; @@ -270,7 +267,6 @@ public: MCSection *getDwarfAddrSection() const { return DwarfAddrSection; } MCSection *getDwarfCUIndexSection() const { return DwarfCUIndexSection; } MCSection *getDwarfTUIndexSection() const { return DwarfTUIndexSection; } - MCSection *getDwarfSwiftASTSection() const { return DwarfSwiftASTSection; } MCSection *getCOFFDebugSymbolsSection() const { return COFFDebugSymbolsSection; diff --git a/lib/MC/MCObjectFileInfo.cpp b/lib/MC/MCObjectFileInfo.cpp index e162e954687..c6c5cb31690 100644 --- a/lib/MC/MCObjectFileInfo.cpp +++ b/lib/MC/MCObjectFileInfo.cpp @@ -214,10 +214,6 @@ void MCObjectFileInfo::initMachOMCObjectFileInfo(const Triple &T) { Ctx->getMachOSection("__DWARF", "__apple_types", MachO::S_ATTR_DEBUG, SectionKind::getMetadata(), "types_begin"); - DwarfSwiftASTSection = - Ctx->getMachOSection("__DWARF", "__swift_ast", MachO::S_ATTR_DEBUG, - SectionKind::getMetadata()); - DwarfAbbrevSection = Ctx->getMachOSection("__DWARF", "__debug_abbrev", MachO::S_ATTR_DEBUG, SectionKind::getMetadata(), "section_abbrev"); diff --git a/test/tools/dsymutil/Inputs/swift-ast.macho.x86_64 b/test/tools/dsymutil/Inputs/swift-ast.macho.x86_64 deleted file mode 100755 index f82d811409bef3d9be47460302950c849b2c7bef..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8464 zcmeHM&ubGw6n;rtt+kk(#9wF>6&0GaQX~ftMjA}~QHzZrf{gjGX;!iu&F;1-BIM#B zw;nwBH>iJsC&7c>y!jspy$E`hB7SeO(`?d;9z4l=@b=9&JM+z(ZzqtM`Sj!K&%H#k zF`{mqh!XJRIMH)Tp+s~TUVtmLl)IL{pTBdPYlkg140lD$lSMC&a=4B{ zjNE7fj{LMKg`!y_ zsgZdCvn4|UULR4eQ&`8dy2T$JDI#vib36pk0`Eb5iP%Bh4_|__ao$EtUW?K3`2FA5 z0W?a%r{S5vYiF8vB~x2()_~cL!a0xcAKx}^J-xKqdy#&)nAm!98g-D8Xx|h%PtgT~ zxej&?^W}cL&ZEZTWa0dd=NP~I89#&AU~G)PyzcpylfIfp9(DzdU}xbx-fW79zuox| zvp!;?fG8jehytR3C?E=m0-}H@@NX5kTj+h6dsp}{u>xM+X!M?K6?(z92k&DV9t($y zM*e@#|NrL^*) z_v3ZOxGXjIz)X{f>6=V_5^+%D{<#GobMScvA{Vu#aO1r*C#7@ZYg6U Timestamp); - void changeBackingMemoryBuffer(std::unique_ptr &&MemBuf); - ErrorOr getObjfileForArch(const Triple &T); - -public: - BinaryHolder(bool Verbose) : Verbose(Verbose) {} - /// Return the MemoryBufferRef that holds the memory mapping for the /// given \p Filename. This function will try to parse archive /// member specifications of the form /path/to/archive.a(member.o). @@ -85,6 +79,12 @@ public: GetMemoryBuffersForFile(StringRef Filename, sys::TimePoint Timestamp); + void changeBackingMemoryBuffer(std::unique_ptr &&MemBuf); + ErrorOr getObjfileForArch(const Triple &T); + +public: + BinaryHolder(bool Verbose) : Verbose(Verbose) {} + /// Get the ObjectFiles designated by the \p Filename. This /// might be an archive member specification of the form /// /path/to/archive.a(member.o). diff --git a/tools/dsymutil/DebugMap.cpp b/tools/dsymutil/DebugMap.cpp index 7f205767461..636d65836c6 100644 --- a/tools/dsymutil/DebugMap.cpp +++ b/tools/dsymutil/DebugMap.cpp @@ -21,9 +21,8 @@ namespace dsymutil { using namespace llvm::object; DebugMapObject::DebugMapObject(StringRef ObjectFilename, - sys::TimePoint Timestamp, - uint8_t Type) - : Filename(ObjectFilename), Timestamp(Timestamp), Type(Type) {} + sys::TimePoint Timestamp) + : Filename(ObjectFilename), Timestamp(Timestamp) {} bool DebugMapObject::addSymbol(StringRef Name, Optional ObjectAddress, uint64_t LinkedAddress, uint32_t Size) { @@ -65,9 +64,8 @@ void DebugMapObject::dump() const { print(errs()); } DebugMapObject & DebugMap::addDebugMapObject(StringRef ObjectFilePath, - sys::TimePoint Timestamp, - uint8_t Type) { - Objects.emplace_back(new DebugMapObject(ObjectFilePath, Timestamp, Type)); + sys::TimePoint Timestamp) { + Objects.emplace_back(new DebugMapObject(ObjectFilePath, Timestamp)); return *Objects.back(); } @@ -243,7 +241,7 @@ MappingTraits::YamlDMO::denormalize(IO &IO) { } } - dsymutil::DebugMapObject Res(Path, sys::toTimePoint(Timestamp), MachO::N_OSO); + dsymutil::DebugMapObject Res(Path, sys::toTimePoint(Timestamp)); for (auto &Entry : Entries) { auto &Mapping = Entry.second; Optional ObjAddress; diff --git a/tools/dsymutil/DebugMap.h b/tools/dsymutil/DebugMap.h index 0b564149488..eab0cb0a800 100644 --- a/tools/dsymutil/DebugMap.h +++ b/tools/dsymutil/DebugMap.h @@ -94,8 +94,7 @@ public: /// debug map. DebugMapObject & addDebugMapObject(StringRef ObjectFilePath, - sys::TimePoint Timestamp, - uint8_t Type); + sys::TimePoint Timestamp); const Triple &getTriple() const { return BinaryTriple; } @@ -155,8 +154,6 @@ public: return Timestamp; } - uint8_t getType() const { return Type; } - iterator_range::const_iterator> symbols() const { return make_range(Symbols.begin(), Symbols.end()); } @@ -169,13 +166,12 @@ private: friend class DebugMap; /// DebugMapObjects can only be constructed by the owning DebugMap. DebugMapObject(StringRef ObjectFilename, - sys::TimePoint Timestamp, uint8_t Type); + sys::TimePoint Timestamp); std::string Filename; sys::TimePoint Timestamp; StringMap Symbols; DenseMap AddressToMapping; - uint8_t Type; /// For YAMLIO support. ///@{ diff --git a/tools/dsymutil/DwarfLinker.cpp b/tools/dsymutil/DwarfLinker.cpp index be662f49e1a..fba23b6517d 100644 --- a/tools/dsymutil/DwarfLinker.cpp +++ b/tools/dsymutil/DwarfLinker.cpp @@ -525,9 +525,6 @@ public: /// Emit the string table described by \p Pool. void emitStrings(const NonRelocatableStringpool &Pool); - /// Emit the swift_ast section stored in \p Buffers. - void emitSwiftAST(const std::vector &Buffers); - /// Emit debug_ranges for \p FuncRange by translating the /// original \p Entries. void emitRangesEntries( @@ -711,15 +708,6 @@ void DwarfStreamer::emitStrings(const NonRelocatableStringpool &Pool) { StringRef(Entry->getKey().data(), Entry->getKey().size() + 1)); } -/// Emit the swift_ast section stored in \p Buffers. -void DwarfStreamer::emitSwiftAST(const std::vector &Buffers) { - MCSection *SwiftASTSection = MOFI->getDwarfSwiftASTSection(); - SwiftASTSection->setAlignment(1 << 5); - MS->SwitchSection(SwiftASTSection); - for (auto Buf : Buffers) - MS->EmitBytes(Buf.getBuffer()); -} - /// Emit the debug_range section contents for \p FuncRange by /// translating the original \p Entries. The debug_range section /// format is totally trivial, consisting just of pairs of address @@ -3341,8 +3329,8 @@ void DwarfLinker::loadClangModule(StringRef Filename, StringRef ModulePath, else sys::path::append(Path, Filename); BinaryHolder ObjHolder(Options.Verbose); - auto &Obj = ModuleMap.addDebugMapObject( - Path, sys::TimePoint(), MachO::N_OSO); + auto &Obj = + ModuleMap.addDebugMapObject(Path, sys::TimePoint()); auto ErrOrObj = loadObject(ObjHolder, Obj, ModuleMap); if (!ErrOrObj) { // Try and emit more helpful warnings by applying some heuristics. @@ -3487,19 +3475,6 @@ bool DwarfLinker::link(const DebugMap &Map) { if (Options.Verbose) outs() << "DEBUG MAP OBJECT: " << Obj->getObjectFilename() << "\n"; - - // N_AST objects (swiftmodule files) should get dumped directly into the - // appropriate DWARF section. - if (Obj->getType() == MachO::N_AST) { - auto ErrOrMemBufferRefs = BinHolder.GetMemoryBuffersForFile( - Obj->getObjectFilename(), Obj->getTimestamp()); - if (ErrOrMemBufferRefs.getError()) - continue; - if (!Options.NoOutput) - Streamer->emitSwiftAST(ErrOrMemBufferRefs.get()); - continue; - } - auto ErrOrObj = loadObject(BinHolder, *Obj, Map); if (!ErrOrObj) continue; diff --git a/tools/dsymutil/MachODebugMapParser.cpp b/tools/dsymutil/MachODebugMapParser.cpp index 79b19137119..866196fb27e 100644 --- a/tools/dsymutil/MachODebugMapParser.cpp +++ b/tools/dsymutil/MachODebugMapParser.cpp @@ -135,8 +135,7 @@ void MachODebugMapParser::switchToNewDebugMapObject( Err.message() + "\n"); } - CurrentDebugMapObject = - &Result->addDebugMapObject(Path, Timestamp, MachO::N_OSO); + CurrentDebugMapObject = &Result->addDebugMapObject(Path, Timestamp); loadCurrentObjectFileSymbols(*ErrOrAchObj); } @@ -350,13 +349,6 @@ void MachODebugMapParser::handleStabSymbolTableEntry(uint32_t StringIndex, if (Type == MachO::N_OSO) return switchToNewDebugMapObject(Name, sys::toTimePoint(Value)); - if (Type == MachO::N_AST) { - SmallString<80> Path(PathPrefix); - sys::path::append(Path, Name); - Result->addDebugMapObject(Path, sys::toTimePoint(Value), Type); - return; - } - // If the last N_OSO object file wasn't found, // CurrentDebugMapObject will be null. Do not update anything // until we find the next valid N_OSO entry. -- 2.50.1