1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00

[dsymutil] Don't emit N_AST symbol entries in the Mach-O companion file

Treat N_AST symbol table entries like other debug entries and don't emit
them in the linked binary.

Differential revision: https://reviews.llvm.org/D81205
This commit is contained in:
Jonas Devlieghere 2020-06-05 08:39:02 -07:00
parent e56242dfcc
commit b33381e799
2 changed files with 11 additions and 0 deletions

View File

@ -18,3 +18,6 @@ READOBJ-NEXT: |.|
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
RUN: dsymutil -s %T/swift-ast.dSYM/Contents/Resources/DWARF/swift-ast.macho.x86_64 | FileCheck %s --check-prefix=NAST
NAST-NOT: N_AST

View File

@ -163,7 +163,15 @@ static bool transferSymbol(NListTy NList, bool IsLittleEndian,
if ((NList.n_type & MachO::N_TYPE) == MachO::N_UNDF)
return false;
// Do not transfer N_AST symbols as their content is copied into a section of
// the Mach-O companion file.
if (NList.n_type == MachO::N_AST)
return false;
StringRef Name = StringRef(Strings.begin() + NList.n_strx);
// An N_SO with a filename opens a debugging scope and another one without a
// name closes it. Don't transfer anything in the debugging scope.
if (InDebugNote) {
InDebugNote =
(NList.n_type != MachO::N_SO) || (!Name.empty() && Name[0] != '\0');