From 42e599fb3f4321c02cb221c7c90ad91e994aafb6 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Wed, 30 Apr 2014 02:22:09 +0000 Subject: [PATCH] Drop non-cfi assembly support from clang. After this patch clang will ignore -fdwarf2-cfi-asm and -ffno-dwarf2-cfi-asm and always print assembly that uses cfi directives. In llvm, MC itself supports cfi since the end of 2010 (support started in r119972, is reported in the 2.9 release notes). In binutils the support has been around for much longer. It looks like support started to be added in May 2003. It is available in 2.15 (31-Aug-2011, 2.14 is from 12-Jun-2003). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207602 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Driver/Options.td | 4 +-- include/clang/Frontend/CodeGenOptions.def | 1 - lib/CodeGen/BackendUtil.cpp | 2 -- lib/Driver/Tools.cpp | 16 ----------- lib/Frontend/CompilerInvocation.cpp | 1 - test/Driver/cfi.c | 9 ------ test/Driver/dwarf2-cfi-asm.c | 35 ----------------------- 7 files changed, 2 insertions(+), 66 deletions(-) delete mode 100644 test/Driver/cfi.c delete mode 100644 test/Driver/dwarf2-cfi-asm.c diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td index d6b22795e0..8d2e36866b 100644 --- a/include/clang/Driver/Options.td +++ b/include/clang/Driver/Options.td @@ -441,8 +441,8 @@ def fdiagnostics_show_template_tree : Flag<["-"], "fdiagnostics-show-template-tr HelpText<"Print a template comparison tree for differing templates">; def fdollars_in_identifiers : Flag<["-"], "fdollars-in-identifiers">, Group, HelpText<"Allow '$' in identifiers">, Flags<[CC1Option]>; -def fdwarf2_cfi_asm : Flag<["-"], "fdwarf2-cfi-asm">, Group; -def fno_dwarf2_cfi_asm : Flag<["-"], "fno-dwarf2-cfi-asm">, Group, Flags<[CC1Option]>; +def fdwarf2_cfi_asm : Flag<["-"], "fdwarf2-cfi-asm">, Group; +def fno_dwarf2_cfi_asm : Flag<["-"], "fno-dwarf2-cfi-asm">, Group; def fdwarf_directory_asm : Flag<["-"], "fdwarf-directory-asm">, Group; def fno_dwarf_directory_asm : Flag<["-"], "fno-dwarf-directory-asm">, Group, Flags<[CC1Option]>; def felide_constructors : Flag<["-"], "felide-constructors">, Group; diff --git a/include/clang/Frontend/CodeGenOptions.def b/include/clang/Frontend/CodeGenOptions.def index 753b641abf..8959185387 100644 --- a/include/clang/Frontend/CodeGenOptions.def +++ b/include/clang/Frontend/CodeGenOptions.def @@ -68,7 +68,6 @@ CODEGENOPT(LessPreciseFPMAD , 1, 0) ///< Enable less precise MAD instructions t ///< be generated. CODEGENOPT(MergeAllConstants , 1, 1) ///< Merge identical constants. CODEGENOPT(NoCommon , 1, 0) ///< Set when -fno-common or C++ is enabled. -CODEGENOPT(NoDwarf2CFIAsm , 1, 0) ///< Set when -fno-dwarf2-cfi-asm is enabled. CODEGENOPT(NoDwarfDirectoryAsm , 1, 0) ///< Set when -fno-dwarf-directory-asm is ///< enabled. CODEGENOPT(NoExecStack , 1, 0) ///< Set when -Wa,--noexecstack is enabled. diff --git a/lib/CodeGen/BackendUtil.cpp b/lib/CodeGen/BackendUtil.cpp index 2c388ef58e..8d4f69afc3 100644 --- a/lib/CodeGen/BackendUtil.cpp +++ b/lib/CodeGen/BackendUtil.cpp @@ -503,8 +503,6 @@ TargetMachine *EmitAssemblyHelper::CreateTargetMachine(bool MustCreateTM) { TM->setMCRelaxAll(true); if (CodeGenOpts.SaveTempLabels) TM->setMCSaveTempLabels(true); - if (CodeGenOpts.NoDwarf2CFIAsm) - TM->setMCUseCFI(false); if (!CodeGenOpts.NoDwarfDirectoryAsm) TM->setMCUseDwarfDirectory(true); if (CodeGenOpts.NoExecStack) diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 1fbf585d69..04df926e56 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -1733,19 +1733,6 @@ static bool ShouldDisableAutolink(const ArgList &Args, Default); } -static bool ShouldDisableCFI(const ArgList &Args, - const ToolChain &TC) { - bool Default = true; - if (TC.getTriple().isOSDarwin()) { - // The native darwin assembler doesn't support cfi directives, so - // we disable them if we think the .s file will be passed to it. - Default = TC.useIntegratedAs(); - } - return !Args.hasFlag(options::OPT_fdwarf2_cfi_asm, - options::OPT_fno_dwarf2_cfi_asm, - Default); -} - static bool ShouldDisableDwarfDirectory(const ArgList &Args, const ToolChain &TC) { bool UseDwarfDirectory = Args.hasFlag(options::OPT_fdwarf_directory_asm, @@ -3138,9 +3125,6 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back("-fno-gnu-keywords"); } - if (ShouldDisableCFI(Args, getToolChain())) - CmdArgs.push_back("-fno-dwarf2-cfi-asm"); - if (ShouldDisableDwarfDirectory(Args, getToolChain())) CmdArgs.push_back("-fno-dwarf-directory-asm"); diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index 4d0c01def1..9321f89281 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -399,7 +399,6 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK, Opts.RelaxAll = Args.hasArg(OPT_mrelax_all); Opts.OmitLeafFramePointer = Args.hasArg(OPT_momit_leaf_frame_pointer); Opts.SaveTempLabels = Args.hasArg(OPT_msave_temp_labels); - Opts.NoDwarf2CFIAsm = Args.hasArg(OPT_fno_dwarf2_cfi_asm); Opts.NoDwarfDirectoryAsm = Args.hasArg(OPT_fno_dwarf_directory_asm); Opts.SoftFloat = Args.hasArg(OPT_msoft_float); Opts.StrictEnums = Args.hasArg(OPT_fstrict_enums); diff --git a/test/Driver/cfi.c b/test/Driver/cfi.c deleted file mode 100644 index c33d190428..0000000000 --- a/test/Driver/cfi.c +++ /dev/null @@ -1,9 +0,0 @@ -// RUN: %clang -target i386-apple-darwin10 \ -// RUN: -no-integrated-as -### %s 2>&1 | \ -// RUN: FileCheck --check-prefix=CHECK-DARWIN %s - -// RUN: %clang -target i386-pc-linux-gnu -static -### %s 2>&1 | \ -// RUN: FileCheck --check-prefix=CHECK-LINUX %s - -// CHECK-DARWIN: -fno-dwarf2-cfi-asm -// CHECK-LINUX-NOT: -fno-dwarf2-cfi-asm diff --git a/test/Driver/dwarf2-cfi-asm.c b/test/Driver/dwarf2-cfi-asm.c deleted file mode 100644 index a5c4878703..0000000000 --- a/test/Driver/dwarf2-cfi-asm.c +++ /dev/null @@ -1,35 +0,0 @@ -// RUN: %clang -target x86_64-apple-darwin -### -S -integrated-as %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK-DARWIN-MC-DEFAULT %s -// RUN: %clang -target x86_64-apple-darwin -### -S -integrated-as -fdwarf2-cfi-asm %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK-DARWIN-MC-CFI %s -// RUN: %clang -target x86_64-apple-darwin -### -S -integrated-as -fno-dwarf2-cfi-asm %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK-DARWIN-MC-NOCFI %s - -// RUN: %clang -target x86_64-apple-darwin -### -S -no-integrated-as %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK-DARWIN-AS-DEFAULT %s -// RUN: %clang -target x86_64-apple-darwin -### -S -no-integrated-as -fdwarf2-cfi-asm %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK-DARWIN-AS-CFI %s -// RUN: %clang -target x86_64-apple-darwin -### -S -no-integrated-as -fno-dwarf2-cfi-asm %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK-DARWIN-AS-NOCFI %s - - -// RUN: %clang -target x86_64-pc-linux -### -S -integrated-as %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK-LINUX-MC-DEFAULT %s -// RUN: %clang -target x86_64-pc-linux -### -S -integrated-as -fdwarf2-cfi-asm %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK-LINUX-MC-CFI %s -// RUN: %clang -target x86_64-pc-linux -### -S -integrated-as -fno-dwarf2-cfi-asm %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK-LINUX-MC-NOCFI %s - -// RUN: %clang -target x86_64-pc-linux -### -S -no-integrated-as %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK-LINUX-AS-DEFAULT %s -// RUN: %clang -target x86_64-pc-linux -### -S -no-integrated-as -fdwarf2-cfi-asm %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK-LINUX-AS-CFI %s -// RUN: %clang -target x86_64-pc-linux -### -S -no-integrated-as -fno-dwarf2-cfi-asm %s -o %t.s 2>&1 | FileCheck -check-prefix=CHECK-LINUX-AS-NOCFI %s - - - -// CHECK-DARWIN-MC-DEFAULT-NOT: -fno-dwarf2-cfi-asm -// CHECK-DARWIN-MC-CFI-NOT: -fno-dwarf2-cfi-asm -// CHECK-DARWIN-MC-NOCFI: -fno-dwarf2-cfi-asm - -// CHECK-DARWIN-AS-DEFAULT: -fno-dwarf2-cfi-asm -// CHECK-DARWIN-AS-CFI-NOT: -fno-dwarf2-cfi-asm -// CHECK-DARWIN-AS-NOCFI: -fno-dwarf2-cfi-asm - - -// CHECK-LINUX-MC-DEFAULT-NOT: -fno-dwarf2-cfi-asmx -// CHECK-LINUX-MC-CFI-NOT: -fno-dwarf2-cfi-asm -// CHECK-LINUX-MC-NOCFI: -fno-dwarf2-cfi-asm - -// CHECK-LINUX-AS-DEFAULT-NOT: -fno-dwarf2-cfi-asm -// CHECK-LINUX-AS-CFI-NOT: -fno-dwarf2-cfi-asm -// CHECK-LINUX-AS-NOCFI: -fno-dwarf2-cfi-asm -- 2.40.0