From 644dc69f5d1e6ac289f16991006819645eae54ff Mon Sep 17 00:00:00 2001 From: Leonard Chan Date: Thu, 13 Jun 2019 17:40:03 +0000 Subject: [PATCH] [clang][NewPM] Fix split debug test This contains the part of D62225 which fixes CodeGen/split-debug-single-file.c by not placing .dwo sections when using -enable-split-dwarf=split. Differential Revision: https://reviews.llvm.org/D63168 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@363281 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/BackendUtil.cpp | 3 ++- test/CodeGen/split-debug-single-file.c | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/CodeGen/BackendUtil.cpp b/lib/CodeGen/BackendUtil.cpp index ff4d3599fe..53292bec5e 100644 --- a/lib/CodeGen/BackendUtil.cpp +++ b/lib/CodeGen/BackendUtil.cpp @@ -1275,7 +1275,8 @@ void EmitAssemblyHelper::EmitAssemblyWithNewPassManager( NeedCodeGen = true; CodeGenPasses.add( createTargetTransformInfoWrapperPass(getTargetIRAnalysis())); - if (!CodeGenOpts.SplitDwarfFile.empty()) { + if (!CodeGenOpts.SplitDwarfFile.empty() && + CodeGenOpts.getSplitDwarfMode() == CodeGenOptions::SplitFileFission) { DwoOS = openOutputFile(CodeGenOpts.SplitDwarfFile); if (!DwoOS) return; diff --git a/test/CodeGen/split-debug-single-file.c b/test/CodeGen/split-debug-single-file.c index 5987dc07ab..1c775d0941 100644 --- a/test/CodeGen/split-debug-single-file.c +++ b/test/CodeGen/split-debug-single-file.c @@ -2,13 +2,19 @@ // Testing to ensure -enable-split-dwarf=single allows to place .dwo sections into regular output object. // RUN: %clang_cc1 -debug-info-kind=limited -triple x86_64-unknown-linux \ -// RUN: -enable-split-dwarf=single -split-dwarf-file %t.o -emit-obj -o %t.o %s +// RUN: -enable-split-dwarf=single -split-dwarf-file %t.o -emit-obj -o %t.o %s -fno-experimental-new-pass-manager +// RUN: llvm-readobj -S %t.o | FileCheck --check-prefix=MODE-SINGLE %s +// RUN: %clang_cc1 -debug-info-kind=limited -triple x86_64-unknown-linux \ +// RUN: -enable-split-dwarf=single -split-dwarf-file %t.o -emit-obj -o %t.o %s -fexperimental-new-pass-manager // RUN: llvm-readobj -S %t.o | FileCheck --check-prefix=MODE-SINGLE %s // MODE-SINGLE: .dwo // Testing to ensure -enable-split-dwarf=split does not place .dwo sections into regular output object. // RUN: %clang_cc1 -debug-info-kind=limited -triple x86_64-unknown-linux \ -// RUN: -enable-split-dwarf=split -split-dwarf-file %t.o -emit-obj -o %t.o %s +// RUN: -enable-split-dwarf=split -split-dwarf-file %t.o -emit-obj -o %t.o %s -fno-experimental-new-pass-manager +// RUN: llvm-readobj -S %t.o | FileCheck --check-prefix=MODE-SPLIT %s +// RUN: %clang_cc1 -debug-info-kind=limited -triple x86_64-unknown-linux \ +// RUN: -enable-split-dwarf=split -split-dwarf-file %t.o -emit-obj -o %t.o %s -fexperimental-new-pass-manager // RUN: llvm-readobj -S %t.o | FileCheck --check-prefix=MODE-SPLIT %s // MODE-SPLIT-NOT: .dwo -- 2.40.0