[llvm] c938b4a - [MachO] Also recongize __swift_ast as a debug info section

Jonas Devlieghere via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 2 14:50:04 PST 2020


Author: Jonas Devlieghere
Date: 2020-11-02T14:49:57-08:00
New Revision: c938b4a1ed43f3075155e16a7c2792ca8c122258

URL: https://github.com/llvm/llvm-project/commit/c938b4a1ed43f3075155e16a7c2792ca8c122258
DIFF: https://github.com/llvm/llvm-project/commit/c938b4a1ed43f3075155e16a7c2792ca8c122258.diff

LOG: [MachO] Also recongize __swift_ast as a debug info section

Address post-commit review from Adrian.

Added: 
    

Modified: 
    llvm/lib/Object/MachOObjectFile.cpp
    llvm/test/tools/dsymutil/X86/swift-ast-x86_64.test

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp
index 2f4548cc0563..9d3c30608895 100644
--- a/llvm/lib/Object/MachOObjectFile.cpp
+++ b/llvm/lib/Object/MachOObjectFile.cpp
@@ -2033,7 +2033,8 @@ bool MachOObjectFile::isSectionBSS(DataRefImpl Sec) const {
 bool MachOObjectFile::isDebugSection(StringRef SectionName) const {
   return SectionName.startswith("__debug") ||
          SectionName.startswith("__zdebug") ||
-         SectionName.startswith("__apple") || SectionName == "__gdb_index";
+         SectionName.startswith("__apple") || SectionName == "__gdb_index" ||
+         SectionName == "__swift_ast";
 }
 
 unsigned MachOObjectFile::getSectionID(SectionRef Sec) const {

diff  --git a/llvm/test/tools/dsymutil/X86/swift-ast-x86_64.test b/llvm/test/tools/dsymutil/X86/swift-ast-x86_64.test
index 0ba86800f7bd..626208ff3496 100644
--- a/llvm/test/tools/dsymutil/X86/swift-ast-x86_64.test
+++ b/llvm/test/tools/dsymutil/X86/swift-ast-x86_64.test
@@ -1,5 +1,6 @@
 RUN: dsymutil -oso-prepend-path %p/.. %p/../Inputs/swift-ast.macho.x86_64 -o %T/swift-ast.dSYM -verbose -no-swiftmodule-timestamp | 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
+RUN: llvm-dwarfdump --show-section-sizes %T/swift-ast.dSYM/Contents/Resources/DWARF/swift-ast.macho.x86_64 | FileCheck %s --check-prefix=DWARFDUMP
 
 The tested object file has been created by the dummy Swift code:
 let x = 1
@@ -16,6 +17,8 @@ READOBJ: Name:{{.*}}__swift_ast
 READOBJ: |SWIFTMODULE DATA|
 READOBJ-NEXT: |.|
 
+DWARFDUMP: __swift_ast
+
 RUN: dsymutil -oso-prepend-path %p/.. %p/../Inputs/swift-ast.macho.x86_64 -no-output -verbose 2>&1 | FileCheck %s --check-prefix=TIMESTAMP
 TIMESTAMP: warning: Timestamp mismatch
 


        


More information about the llvm-commits mailing list