[llvm] r315034 - Revert "[llvm-dsymutil] Add support for __swift_ast MachO DWARF section"

Francis Ricci via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 5 16:09:17 PDT 2017


Author: fjricci
Date: Thu Oct  5 16:09:17 2017
New Revision: 315034

URL: http://llvm.org/viewvc/llvm-project?rev=315034&view=rev
Log:
Revert "[llvm-dsymutil] Add support for __swift_ast MachO DWARF section"

Breaks aarch64 builders

This reverts commit r315014.

Removed:
    llvm/trunk/test/tools/dsymutil/Inputs/swift-ast.macho.x86_64
    llvm/trunk/test/tools/dsymutil/Inputs/swift-ast.swiftmodule
    llvm/trunk/test/tools/dsymutil/swift-ast.test
Modified:
    llvm/trunk/include/llvm/MC/MCObjectFileInfo.h
    llvm/trunk/lib/MC/MCObjectFileInfo.cpp
    llvm/trunk/tools/dsymutil/BinaryHolder.h
    llvm/trunk/tools/dsymutil/DebugMap.cpp
    llvm/trunk/tools/dsymutil/DebugMap.h
    llvm/trunk/tools/dsymutil/DwarfLinker.cpp
    llvm/trunk/tools/dsymutil/MachODebugMapParser.cpp

Modified: llvm/trunk/include/llvm/MC/MCObjectFileInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCObjectFileInfo.h?rev=315034&r1=315033&r2=315034&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCObjectFileInfo.h (original)
+++ llvm/trunk/include/llvm/MC/MCObjectFileInfo.h Thu Oct  5 16:09:17 2017
@@ -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;

Modified: llvm/trunk/lib/MC/MCObjectFileInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCObjectFileInfo.cpp?rev=315034&r1=315033&r2=315034&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCObjectFileInfo.cpp (original)
+++ llvm/trunk/lib/MC/MCObjectFileInfo.cpp Thu Oct  5 16:09:17 2017
@@ -214,10 +214,6 @@ void MCObjectFileInfo::initMachOMCObject
       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");

Removed: llvm/trunk/test/tools/dsymutil/Inputs/swift-ast.macho.x86_64
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/Inputs/swift-ast.macho.x86_64?rev=315033&view=auto
==============================================================================
Binary files llvm/trunk/test/tools/dsymutil/Inputs/swift-ast.macho.x86_64 (original) and llvm/trunk/test/tools/dsymutil/Inputs/swift-ast.macho.x86_64 (removed) differ

Removed: llvm/trunk/test/tools/dsymutil/Inputs/swift-ast.swiftmodule
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/Inputs/swift-ast.swiftmodule?rev=315033&view=auto
==============================================================================
--- llvm/trunk/test/tools/dsymutil/Inputs/swift-ast.swiftmodule (original)
+++ llvm/trunk/test/tools/dsymutil/Inputs/swift-ast.swiftmodule (removed)
@@ -1 +0,0 @@
-SWIFTMODULE DATA

Removed: llvm/trunk/test/tools/dsymutil/swift-ast.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/swift-ast.test?rev=315033&view=auto
==============================================================================
--- llvm/trunk/test/tools/dsymutil/swift-ast.test (original)
+++ llvm/trunk/test/tools/dsymutil/swift-ast.test (removed)
@@ -1,14 +0,0 @@
-RUN: llvm-dsymutil -oso-prepend-path %p %p/Inputs/swift-ast.macho.x86_64 -o %T/swift-ast.dSYM -verbose | FileCheck %s --check-prefix=DSYMUTIL
-RUN: llvm-readobj -sections -section-data %T/swift-ast.dSYM/Contents/Resources/DWARF/swift-ast.macho.x86_64 | FileCheck %s --check-prefix=READOBJ
-
-The tested object file has been created by the dummy Swift code:
-let x = 1
-
-Compiled with: swiftc /tmp/test.swift -Onone -target x86_64-apple-macosx10.9 -c
-Linked with: ld swift-ast.o -add_ast_path Inputs/swift-ast.swiftmodule -arch x86_64 -lSystem -macosx_version_min 10.9.0
-
-DSYMUTIL: filename:{{.*}}swift-ast.swiftmodule
-DSYMUTIL: DEBUG MAP OBJECT:{{.*}}swift-ast.swiftmodule
-
-READOBJ: Name:{{.*}}__swift_ast
-READOBJ: |SWIFTMODULE DATA|

Modified: llvm/trunk/tools/dsymutil/BinaryHolder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/BinaryHolder.h?rev=315034&r1=315033&r2=315034&view=diff
==============================================================================
--- llvm/trunk/tools/dsymutil/BinaryHolder.h (original)
+++ llvm/trunk/tools/dsymutil/BinaryHolder.h Thu Oct  5 16:09:17 2017
@@ -66,12 +66,6 @@ class BinaryHolder {
   MapArchiveAndGetMemberBuffers(StringRef Filename,
                                 sys::TimePoint<std::chrono::seconds> Timestamp);
 
-  void changeBackingMemoryBuffer(std::unique_ptr<MemoryBuffer> &&MemBuf);
-  ErrorOr<const object::ObjectFile &> 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<std::chrono::seconds> Timestamp);
 
+  void changeBackingMemoryBuffer(std::unique_ptr<MemoryBuffer> &&MemBuf);
+  ErrorOr<const object::ObjectFile &> 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).

Modified: llvm/trunk/tools/dsymutil/DebugMap.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/DebugMap.cpp?rev=315034&r1=315033&r2=315034&view=diff
==============================================================================
--- llvm/trunk/tools/dsymutil/DebugMap.cpp (original)
+++ llvm/trunk/tools/dsymutil/DebugMap.cpp Thu Oct  5 16:09:17 2017
@@ -21,9 +21,8 @@ namespace dsymutil {
 using namespace llvm::object;
 
 DebugMapObject::DebugMapObject(StringRef ObjectFilename,
-                               sys::TimePoint<std::chrono::seconds> Timestamp,
-                               uint8_t Type)
-    : Filename(ObjectFilename), Timestamp(Timestamp), Type(Type) {}
+                               sys::TimePoint<std::chrono::seconds> Timestamp)
+    : Filename(ObjectFilename), Timestamp(Timestamp) {}
 
 bool DebugMapObject::addSymbol(StringRef Name, Optional<uint64_t> ObjectAddress,
                                uint64_t LinkedAddress, uint32_t Size) {
@@ -65,9 +64,8 @@ void DebugMapObject::dump() const { prin
 
 DebugMapObject &
 DebugMap::addDebugMapObject(StringRef ObjectFilePath,
-                            sys::TimePoint<std::chrono::seconds> Timestamp,
-                            uint8_t Type) {
-  Objects.emplace_back(new DebugMapObject(ObjectFilePath, Timestamp, Type));
+                            sys::TimePoint<std::chrono::seconds> Timestamp) {
+  Objects.emplace_back(new DebugMapObject(ObjectFilePath, Timestamp));
   return *Objects.back();
 }
 
@@ -243,7 +241,7 @@ MappingTraits<dsymutil::DebugMapObject>:
     }
   }
 
-  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<uint64_t> ObjAddress;

Modified: llvm/trunk/tools/dsymutil/DebugMap.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/DebugMap.h?rev=315034&r1=315033&r2=315034&view=diff
==============================================================================
--- llvm/trunk/tools/dsymutil/DebugMap.h (original)
+++ llvm/trunk/tools/dsymutil/DebugMap.h Thu Oct  5 16:09:17 2017
@@ -94,8 +94,7 @@ public:
   /// debug map.
   DebugMapObject &
   addDebugMapObject(StringRef ObjectFilePath,
-                    sys::TimePoint<std::chrono::seconds> Timestamp,
-                    uint8_t Type);
+                    sys::TimePoint<std::chrono::seconds> Timestamp);
 
   const Triple &getTriple() const { return BinaryTriple; }
 
@@ -155,8 +154,6 @@ public:
     return Timestamp;
   }
 
-  uint8_t getType() const { return Type; }
-
   iterator_range<StringMap<SymbolMapping>::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<std::chrono::seconds> Timestamp, uint8_t Type);
+                 sys::TimePoint<std::chrono::seconds> Timestamp);
 
   std::string Filename;
   sys::TimePoint<std::chrono::seconds> Timestamp;
   StringMap<SymbolMapping> Symbols;
   DenseMap<uint64_t, DebugMapEntry *> AddressToMapping;
-  uint8_t Type;
 
   /// For YAMLIO support.
   ///@{

Modified: llvm/trunk/tools/dsymutil/DwarfLinker.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/DwarfLinker.cpp?rev=315034&r1=315033&r2=315034&view=diff
==============================================================================
--- llvm/trunk/tools/dsymutil/DwarfLinker.cpp (original)
+++ llvm/trunk/tools/dsymutil/DwarfLinker.cpp Thu Oct  5 16:09:17 2017
@@ -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<MemoryBufferRef> &Buffers);
-
   /// Emit debug_ranges for \p FuncRange by translating the
   /// original \p Entries.
   void emitRangesEntries(
@@ -711,15 +708,6 @@ void DwarfStreamer::emitStrings(const No
         StringRef(Entry->getKey().data(), Entry->getKey().size() + 1));
 }
 
-/// Emit the swift_ast section stored in \p Buffers.
-void DwarfStreamer::emitSwiftAST(const std::vector<MemoryBufferRef> &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(String
   else
     sys::path::append(Path, Filename);
   BinaryHolder ObjHolder(Options.Verbose);
-  auto &Obj = ModuleMap.addDebugMapObject(
-      Path, sys::TimePoint<std::chrono::seconds>(), MachO::N_OSO);
+  auto &Obj =
+      ModuleMap.addDebugMapObject(Path, sys::TimePoint<std::chrono::seconds>());
   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 &M
 
     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;

Modified: llvm/trunk/tools/dsymutil/MachODebugMapParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/MachODebugMapParser.cpp?rev=315034&r1=315033&r2=315034&view=diff
==============================================================================
--- llvm/trunk/tools/dsymutil/MachODebugMapParser.cpp (original)
+++ llvm/trunk/tools/dsymutil/MachODebugMapParser.cpp Thu Oct  5 16:09:17 2017
@@ -135,8 +135,7 @@ void MachODebugMapParser::switchToNewDeb
                    Err.message() + "\n");
   }
 
-  CurrentDebugMapObject =
-      &Result->addDebugMapObject(Path, Timestamp, MachO::N_OSO);
+  CurrentDebugMapObject = &Result->addDebugMapObject(Path, Timestamp);
   loadCurrentObjectFileSymbols(*ErrOrAchObj);
 }
 
@@ -350,13 +349,6 @@ void MachODebugMapParser::handleStabSymb
   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.




More information about the llvm-commits mailing list