From aea65e9b130c059ab8aad04029324249287487f0 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Sat, 7 Jun 2014 19:32:38 +0000 Subject: Driver: add -m{,no-}long-calls support This mirrors the GCC option for the ARM backend. This option enables the backend option "-enable-arm-long-calls". The default behaviour is that this is disabled due to the slight overhead of the generated calls. If the target of jumps are greater than 64M range of offset-based jumps, then the target address must be loaded into a register to make an indirect jump. The backend support for this has been present, but was not previously controllable by the proper flag. llvm-svn: 210398 --- clang/lib/Driver/Tools.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'clang/lib/Driver/Tools.cpp') diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 0316357bd16..dfbc280c55c 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -3469,6 +3469,17 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back("-arm-restrict-it"); } + if (TT.getArch() == llvm::Triple::arm || + TT.getArch() == llvm::Triple::thumb) { + if (Arg *A = Args.getLastArg(options::OPT_mlong_calls, + options::OPT_mno_long_calls)) { + if (A->getOption().matches(options::OPT_mlong_calls)) { + CmdArgs.push_back("-backend-option"); + CmdArgs.push_back("-enable-arm-long-calls"); + } + } + } + // Forward -f options with positive and negative forms; we translate // these by hand. if (Arg *A = Args.getLastArg(options::OPT_fprofile_sample_use_EQ)) { -- cgit v1.2.3