diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2011-05-02 17:43:32 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2011-05-02 17:43:32 +0000 |
commit | 4cfa7971e98e37387aa219f7565472e52d5fc2b2 (patch) | |
tree | 67ad02401356ef10b2a6f27b4151d04f88ae220b /clang/lib/Driver/Tools.cpp | |
parent | eb39741c0b4ab018d8e416cac82336e7a292e212 (diff) | |
download | bcm5719-llvm-4cfa7971e98e37387aa219f7565472e52d5fc2b2.tar.gz bcm5719-llvm-4cfa7971e98e37387aa219f7565472e52d5fc2b2.zip |
Disable CFI if not using the integrated assembler. We should probably do this only for
OS X, but it is probably not all that important.
llvm-svn: 130697
Diffstat (limited to 'clang/lib/Driver/Tools.cpp')
-rw-r--r-- | clang/lib/Driver/Tools.cpp | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 099a9a1c479..60803ddf93c 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -905,6 +905,25 @@ static void addExceptionArgs(const ArgList &Args, types::ID InputType, CmdArgs.push_back("-fexceptions"); } +static bool ShouldDisableCFI(const ArgList &Args, + const ToolChain &TC) { + + // FIXME: Duplicated code with ToolChains.cpp + // FIXME: This doesn't belong here, but ideally we will support static soon + // anyway. + bool HasStatic = (Args.hasArg(options::OPT_mkernel) || + Args.hasArg(options::OPT_static) || + Args.hasArg(options::OPT_fapple_kext)); + bool IsIADefault = TC.IsIntegratedAssemblerDefault() && !HasStatic; + bool UseIntegratedAs = Args.hasFlag(options::OPT_integrated_as, + options::OPT_no_integrated_as, + IsIADefault); + bool UseCFI = Args.hasFlag(options::OPT_fdwarf2_cfi_asm, + options::OPT_fno_dwarf2_cfi_asm, + UseIntegratedAs); + return !UseCFI; +} + void Clang::ConstructJob(Compilation &C, const JobAction &JA, const InputInfo &Output, const InputInfoList &Inputs, @@ -1375,11 +1394,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back("-fno-gnu-keywords"); } - if (Arg *A = Args.getLastArg(options::OPT_fdwarf2_cfi_asm, - options::OPT_fno_dwarf2_cfi_asm)) { - if (A->getOption().matches(options::OPT_fno_dwarf2_cfi_asm)) - CmdArgs.push_back("-fno-dwarf2-cfi-asm"); - } + if (ShouldDisableCFI(Args, getToolChain())) + CmdArgs.push_back("-fno-dwarf2-cfi-asm"); if (Arg *A = Args.getLastArg(options::OPT_ftemplate_depth_)) { CmdArgs.push_back("-ftemplate-depth"); |