aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Driver/Tools.cpp
AgeCommit message (Collapse)AuthorFilesLines
2015-01-02Driver: honour the clang-cl behaviour on ARM as wellSaleem Abdulrasool1-3/+4
Unfortunately, MSVC does not indicate to the driver what target is being used. This means that we cannot correctly select the target architecture for the clang_rt component. This breaks down when targeting windows with the clang driver as opposed to the clang-cl driver. This should fix the native ARM buildbot tests. llvm-svn: 225089
2015-01-02Driver: reuse getCompilerRT in place of addSanitizerRTWindowsSaleem Abdulrasool1-16/+16
The logic for addSanitizerRTWindows was performing the same logical operation as getCompilerRT, which was previously fully generalised for Linux and Windows. This avoids having a duplication of the logic for building up the name of a clang_rt component. This change does move the current limitation for Windows into getArchNameForCompilerRTLib, where it is assumed that the architecture for Windows is always i386. llvm-svn: 225087
2014-12-30Driver: unify compiler-rt component selectionSaleem Abdulrasool1-37/+28
Unify the component handling for compiler-rt. The components are regularly named, built up from: ${LIBRARY_PREFIX}clang_rt.${component}-${arch}[-${environment}]${LIBRARY_SUFFIX} Unify the handling for all the various components, into a single path to link against the various components in a number of places. This reduces duplication of the clang_rt library name construction logic. llvm-svn: 225013
2014-12-30Driver: whitespaceSaleem Abdulrasool1-9/+7
Fixup some whitespace/style issues. NFC. llvm-svn: 225012
2014-12-30Driver: use the canonical library prefix on WindowsSaleem Abdulrasool1-1/+2
Unlike Unices, Windows does not use a library prefix. Use the traditional naming scheme even for Windows itanium environments. This makes the builtins behave more like the sanitisers as well. llvm-svn: 224996
2014-12-30Driver: unify addClangRT{Linux,Windows}Saleem Abdulrasool1-20/+16
The differences are pretty superficial: - .lib vs .a extensions - whether or not to link (potentially) incorrectly against libgcc_s llvm-svn: 224975
2014-12-23Add driver flags -ftrigraphs, -fno-trigraphs.Nico Weber1-2/+5
-trigraphs is now an alias for -ftrigraphs. -fno-trigraphs makes it possible to explicitly disable trigraphs, which couldn't be done before. clang -std=c++11 -fno-trigraphs now builds without GNU extensions, but with trigraphs disabled. Previously, trigraphs were only disabled in GNU modes or with -std=c++1z. Make the new -f flags the cc1 interface too. This requires changing -trigraphs to -ftrigraphs in a few cc1 tests. Related to PR21974. llvm-svn: 224790
2014-12-21Reapply "Change -save-temps to emit unoptimized bitcode files."Bob Wilson1-6/+17
This reapplies r224503 along with a fix for compiling Fortran by having the clang driver invoke gcc (see r224546, where it was reverted). I have added a testcase for that as well. Original commit message: It is often convenient to use -save-temps to collect the intermediate results of a compilation, e.g., when triaging a bug report. Besides the temporary files for preprocessed source and assembly code, this adds the unoptimized bitcode files as well. This adds a new BackendJobAction, which is mostly mechanical, to run after the CompileJobAction. When not using -save-temps, the BackendJobAction is combined into one job with the CompileJobAction, similar to the way the integrated assembler is handled. I've implemented this entirely as a driver change, so under the hood, it is just using -disable-llvm-optzns to get the unoptimized bitcode. Based in part on a patch by Steven Wu. rdar://problem/18909437 llvm-svn: 224688
2014-12-19Driver: hoist an assertionSaleem Abdulrasool1-10/+4
Remove an unnecessary conditional, hoisting the assertion. Minor style tweaks/reflowing. NFC. llvm-svn: 224654
2014-12-19Driver: refactor a local variableSaleem Abdulrasool1-10/+10
Pull out a getToolChain() into a local variable to share the call across to all the uses. NFC. llvm-svn: 224653
2014-12-18Revert "Change -save-temps to emit unoptimized bitcode files."Reid Kleckner1-17/+6
This reverts commit r224503. It broke compilation of fortran through the Clang driver. Previously `clang -c t.f` would invoke `gcc t.f` and `clang -cc1as`, but now it tries to call `clang -cc1 t.f` which fails for obvious reasons. llvm-svn: 224546
2014-12-18Correction to -mfu=neon-vfpv4 to pass the correct backend feature nameRichard Barton1-2/+2
Change-Id: I4dbfe1d97670fc4e626368ef1f91fc008778dfca llvm-svn: 224523
2014-12-18Change -save-temps to emit unoptimized bitcode files.Bob Wilson1-6/+17
It is often convenient to use -save-temps to collect the intermediate results of a compilation, e.g., when triaging a bug report. Besides the temporary files for preprocessed source and assembly code, this adds the unoptimized bitcode files as well. This adds a new BackendJobAction, which is mostly mechanical, to run after the CompileJobAction. When not using -save-temps, the BackendJobAction is combined into one job with the CompileJobAction, similar to the way the integrated assembler is handled. I've implemented this entirely as a driver change, so under the hood, it is just using -disable-llvm-optzns to get the unoptimized bitcode. Based in part on a patch by Steven Wu. rdar://problem/18909437 llvm-svn: 224503
2014-12-18Reinstate aapcs as the default arm abi.Eric Christopher1-3/+4
llvm-svn: 224490
2014-12-16Add a new flag, -fspell-checking-limit=<number> to control how many times ↵Nick Lewycky1-1/+5
we'll do spell checking. Note that spell checking will change the produced AST, so we don't automatically change this value when someone sets -ferror-limit=. With this, merge test typo-correction-pt2.cpp into typo-correction.cpp. Remove Sema::UnqualifiedTyposCorrected, a cache of corrected typos. It would only cache typo corrections that didn't provide ValidateCandidate of which there were few left, and it had a bug when we had the same identifier spelled wrong twice. See the last two tests in typo-correction.cpp for cases this fires. llvm-svn: 224375
2014-12-10Add a FIXME for unifying ARM target abi handling.Eric Christopher1-0/+1
llvm-svn: 223977
2014-12-10Revert the default changing behavior part of r216662 until weEric Christopher1-4/+3
can change the backend to be the same default. Leave the modified/new testcases with the exception of the default behavior since it increases our testing footprint. llvm-svn: 223976
2014-12-09Revert "Driver: Objective-C should respect -fno-exceptions"David Majnemer1-14/+25
This reverts commit r223455. It's been succesfully argued that -fexceptions (at the driver level) is a misnomer and has little to do with -fobjc-exceptions. llvm-svn: 223723
2014-12-05Driver: Objective-C should respect -fno-exceptionsDavid Majnemer1-25/+14
Clang attempted to replicate a GCC bug: -fobjc-exceptions forces -fexceptions to be enabled. However, this has unintended effects and other awkard side effects that Clang doesn't "correctly" ape (e.g. it's impossible to turn off C++ exceptions in ObjC++ mode). Instead, -f[no]objc-exceptions and -f[no]cxx-exceptions now have an identical relationship with -f[no]exceptions. llvm-svn: 223455
2014-12-05Driver: Cleanup -fexceptions behaviorDavid Majnemer1-48/+15
No functionality change is intended, just a cleanup of the logic clang uses to determine what -fexceptions/-fno-exceptions ends up doing. llvm-svn: 223453
2014-12-05Use isOSBinFormatMachO() instead of comparing the object formatEric Christopher1-2/+1
against an enum. llvm-svn: 223422
2014-12-02Remove special case for aarch64 static vs. PIC code in iOS kernel code.Bob Wilson1-2/+1
I added this check a while back but then made a note to myself that it should be completely unnecessary since iOS always uses PIC code-gen for aarch64. Since I could never come up with any reason why it would be necessary, I'm just going to remove it and we'll see if anything breaks. rdar://problem/13627985 llvm-svn: 223097
2014-12-01Make -fuse-ld=lld work properly on Windows.Zachary Turner1-4/+20
Using lld on Windows requires calling link-lld.exe instead of lld.exe. This patch puts this knowledge into clang so that when using the GCC style clang driver, it can properly delegate to lld. Differential Revision: http://reviews.llvm.org/D6428 Reviewed by: Reid Kleckner, Rui Ueyama llvm-svn: 223086
2014-11-28Add additional arguments for -mfpu optionsRichard Barton1-0/+3
Add neon-vfpv3 to allow specifying both at the same time. This is not an option that GCC supports, but follows the same track and should be non-controversial. Change-Id: Id9ec157c835937d7d11ad0f49dbe5171fac17658 llvm-svn: 222933
2014-11-28Add -mfpu=neon-vfpv4Richard Barton1-0/+3
This enables user to architecturally specify ARMv7A + VFPv4 + NEON. Change-Id: I779b01fef5c47e5e4ac702ae24ed2f76a0e4c63f llvm-svn: 222932
2014-11-16[Sanitizer] Parse and produce all sanitizer-relevant arguments in SanitizerArgs.Alexey Samsonov1-9/+0
In particular, make SanitizerArgs responsible for parsing and passing down to frontend -fsanitize-recover and -fsanitize-undefined-trap-on-error flags. Simplify parsing -f(no-)sanitize= flags parsing: get rid of too complex filterUnsupportedKinds function. No functionality change. llvm-svn: 222105
2014-11-14Remove -fseh-exceptions in favor of checking the tripleReid Kleckner1-2/+0
This option was misleading because it looked like it enabled the language feature of SEH (__try / __except), when this option was really controlling which EH personality function to use. Mingw only supports SEH and SjLj EH on x86_64, so we can simply do away with this flag. llvm-svn: 221963
2014-11-14[Profile] Always build profile runtime library with -fPIC.Alexey Samsonov1-9/+3
This change removes libclang_rt.profile-pic-<arch>.a version of profile runtime. Instead, it's sufficient to always build libclang_rt.profile-<arch>.a with -fPIC, as it can be linked into both executables and shared objects. llvm-svn: 221952
2014-11-10AArch64: set all processor features from -arch if nothing else presentTim Northover1-0/+6
Darwin's "-arch arm64" option implies full Cyclone CPU, for both architectural and tuning purposes. So if neither of the explicit options have been given, forward that on to the proper invocation. rdar://problem/18906227 llvm-svn: 221631
2014-11-07Fix clash of gcc toolchains in hexagon driver regression tests.Samuel Antao1-2/+2
If clang was configured with a custom gcc toolchain (either by using GCC_INSTALL_PREFIX in cmake or the equivalent configure command), the path to the custom gcc toolchain path takes precedence to the one specified by -ccc-install-dir. This causes several regression tests to fail as they will be using an unexpected path. Adding the switch --gcc-toolchain="" in each test command is not enough as the hexagon toolchain implementation in the driver is not evaluating this argument. This commit modifies the hexagon toolchain to take the --gcc-toolchain="" argument into account when deciding the toolchain path, similarly to what is already done for other targets toolchains. Additionally, the faulty regression tests are modified in order to --gcc-toolchain="" be passed to the commands. llvm-svn: 221535
2014-11-06Remove references to the cortex-a9-mp CPU.Charlie Turner1-1/+1
This CPU definition is redundant. The Cortex-A9 is defined as supporting multiprocessing extensions. Remove references to this CPU. This CPU was recently removed from LLVM. See http://reviews.llvm.org/D6057 Change-Id: I62ae7cc656fcae54fbaefc4b6976e77e694a8678 llvm-svn: 221458
2014-11-04Use backslashes to escape spaces and other backslashes in -dwarf-debug-flags.Bob Wilson1-2/+23
The command line options are specified in a space-separated list that is an argument to -dwarf-debug-flags, so that breaks if there are spaces in the options. This feature came from Apple's internal version of GCC, so I went back to check how llvm-gcc handled this and matched that behavior. rdar://problem/18775420 llvm-svn: 221309
2014-10-28Driver: remove a stray s that propagated in cross-windowsSaleem Abdulrasool1-1/+1
The option is '--allow-multiple-definition' not '--allow-multiple-definitions'. llvm-svn: 220760
2014-10-24[Thumb] Clang thinks "char" is signed when using a thumb tripleOliver Stannard1-0/+2
'char' is unsigned on all ARM and Thumb architectures. Clang gets this right for ARM, and for thumb when using and arm triple and the -mthumb option, but gets it wrong for thumb triples. This fixes that. llvm-svn: 220555
2014-10-24Driver: add CrossWindowsToolChainSaleem Abdulrasool1-1/+195
This is a very basic toolchain. It supports cross-compiling Windows (primarily inspired by the WoA target). It is meant to use clang with the LLVM IAS and a binutils ld-compatible interface for the linker (eventually to be lld). It does not perform any "standard" GCC lookup, nor does it perform any special adjustments given that it is expected to be used in an environment where the user is using MSVCRT (and as such Visual Studio headers) and the Windows SDK. The primary runtime library is expected to be compiler-rt and the C++ implementation to be libc++. It also expects that a sysroot has been setup given the usual Unix semantics (standard C headers in /usr/include, all the import libraries available in /usr/lib). It also expects that an entry point stub is present in /usr/lib (crtbegin.obj for executables, crtbeginS.obj for shared libraries). The entry point stub is responsible for running any GNU constructors. llvm-svn: 220546
2014-10-23Revert r218541 - Don't link in sanitizer runtimes if ↵Alexey Samsonov1-4/+0
-nostdlib/-nodefaultlibs is provided. This is a sad thing to do, but all the alternatives look ugly. Looks like there are legitimate cases when users may want to link with sanitizer runtimes *and* -nodefaultlibs (and ensure they provide replacements for system libraries). For example, this happens in libc++ test suite. "-nodefaultlibs" is told to link only the libraries explicitly provided by the user, and providing "-fsanitize=address" is a clear indication of intention to link with ASan runtime. We can't easily introduce analogue of "-print-libgcc-name": linking with sanitizers runtimes is not trivial: some runtimes are split into several archive libraries, which are required to be wrapped in -whole-archive/-no-whole-archive. If "-fsanitize=whatever" and "-nodefaultlibs" are provided, system library dependencies of sanitizer runtimes (-lc/-ldl/-lpthread/-lrt) will *not* be linked, and user would have to link them in manually. Note that this can cause problems, as failing to provide "-lrt" might lead to crashes in runtime during ASan initialization. But looks like we should bite this bullet. See r218541 review thread for the discussion. llvm-svn: 220455
2014-10-22Make a good guess about where MSVC and Windows SDK libraries are for linking.Zachary Turner1-0/+33
When a user has not configured a standard Visual Studio environment by running vcvarsall, clang tries its best to find Visual Studio include files and executables anyway. This patch makes clang also try to find system and Windows SDK libraries for linking against, as well. Reviewed by: Hans Wennborg Differential Revision: http://reviews.llvm.org/D5873 llvm-svn: 220425
2014-10-22Resubmit "Improve Windows toolchain support for non-standard environments."Zachary Turner1-32/+27
This resubmits change r220226. That change broke the chromium build bots because chromium it ships an hermetic MSVC toolchain that it expects clang to fallback to by finding it on the path. This patch fixes the issue by bumping up the prioritization of PATH when looking for MSVC binaries. Reviewed by: Hans Wennborg, Reid Kleckner Differential Revision: http://reviews.llvm.org/D5892 llvm-svn: 220424
2014-10-22[modules] Initial support for explicitly loading .pcm files.Richard Smith1-1/+5
Implicit module builds are not well-suited to a lot of build systems. In particular, they fare badly in distributed build systems, and they lead to build artifacts that are not tracked as part of the usual dependency management process. This change allows explicitly-built module files (which are already supported through the -emit-module flag) to be explicitly loaded into a build, allowing build systems to opt to manage module builds and dependencies themselves. This is only the first step in supporting such configurations, and it should be considered experimental and subject to change or removal for now. llvm-svn: 220359
2014-10-21Treat -g1 as -gline-tables-onlyHal Finkel1-1/+2
-g1 on gcc (and also IBM's xlc) are documented to be very similar to -gline-tables-only. Our -gline-tables-only might still be more verbose than -g1 on other compilers, but currently we treat -g1 as -g, and so we're producing much more debug info at -g1 than everybody else. Treating -g1 as -gline-tables-only brings us much closer to what everyone else is doing. For more information, see the discussion on http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-October/039649.html llvm-svn: 220311
2014-10-20Revert "Improve Windows toolchain support for non-standard environments." ↵Hans Wennborg1-51/+32
(r220226) In environments where PATH was set to point to the VS installation, Clang would override that by looking in the registry and finding the latest VS installation. If the environment is set up to point to a VS installation, that should take precedence. Reverting this until we can fix it. llvm-svn: 220243
2014-10-20Driver: Consolidate the logic for naming the module crashdump cacheJustin Bogner1-0/+3
List the module cache we use for crashdumps as a tempfile. This simplifies how we pick up this directory when generating the actual crash diagnostic and removes some duplicate logic. llvm-svn: 220241
2014-10-20Improve Windows toolchain support for non-standard environments.Zachary Turner1-32/+51
Typically clang finds Visual Studio by the user explicitly setting up a Visual Studio environment via vcvarsall. But we still try to behave intelligently and fallback to different methods of finding Visual Studio when this is not done. This patch improves various fallback codepaths to make Visual Studio locating more robust. Specifically, this patch: * Adds support for searching environment variables for VS 12.0 * Correctly locates include folders for Windows SDK 8.x (this was previously broken, and would cause clang to error) * Prefers locating link.exe in the same location as cl.exe. This is helpful in case another link.exe is in the path earlier than Visual Studio (e.g. GnuWin32) * Minor cleanup in the registry reading code to make it more robust in the presence of long pathnames. llvm-svn: 220226
2014-10-17PR21215: Support -fmodule-map-file being specified multiple times. SupportRichard Smith1-8/+5
loading multiple module map files from the same directory. llvm-svn: 220020
2014-10-16[AArch64] Enable A53 erratum workaround (835769) by default for Android targetsBradley Smith1-0/+4
llvm-svn: 219933
2014-10-16specify dwarf version for SolarisAlexander Eremin1-4/+6
llvm-svn: 219901
2014-10-13Adds support for the Cortex-A17 processor to ClangRenato Golin1-1/+1
Patch by Matthew Wahab. llvm-svn: 219607
2014-10-13[AArch64] Add workaround for Cortex-A53 erratum (835769)Bradley Smith1-0/+9
Some early revisions of the Cortex-A53 have an erratum (835769) whereby it is possible for a 64-bit multiply-accumulate instruction in AArch64 state to generate an incorrect result. The details are quite complex and hard to determine statically, since branches in the code may exist in some circumstances, but all cases end with a memory (load, store, or prefetch) instruction followed immediately by the multiply-accumulate operation. The safest work-around for this issue is to make the compiler avoid emitting multiply-accumulate instructions immediately after memory instructions and the simplest way to do this is to insert a NOP. This patch implements clang options to enable this workaround in the backend. The work-around code generation is not enabled by default. llvm-svn: 219604
2014-10-10Hopefully fixes test failures for msvc.Dan Albert1-2/+1
Looks like llvm::sys::path::filename() was canonicalizing my paths before emitting them for FileCheck to stumble over. Fix a style nit with r219460 while I'm at it. llvm-svn: 219464
2014-10-10PR21195: Emit .gcno files to the proper location.Dan Albert1-1/+7
When building with coverage, -no-integrated-as, and -c, the driver was emitting -cc1 -coverage-file pointing at a file in /tmp. Ensure the coverage file is emitted in the same directory as the output file. llvm-svn: 219460