summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/ToolChain.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [CUDA] added include paths for both sides of CUDA compilation.Artem Belevich2015-11-171-0/+3
| | | | | | | | | | | | | | | | | | | | | In order to compile a CUDA file clang must be able to find include files for both both host and device. This patch passes AuxToolchain to AddPreprocessingOptions and uses it to add include paths for the opposite side of compilation. We also must be able to find CUDA include files. If the driver found CUDA installation, it adds appropriate include path to CUDA headers. This can be disabled with '-nocudainc'. - Added include paths for the opposite side of compilation. - Added include paths to detected CUDA installation. - Added -nocudainc to prevent adding CUDA include path. - Added test cases to verify new functionality. Differential Revision: http://reviews.llvm.org/D13170 llvm-svn: 253386
* Add trivial utility to append -L arguments to linker step. NFCDouglas Katzman2015-11-171-0/+6
| | | | llvm-svn: 253350
* Re-recommit: Add support for the new mips-mti-linux toolchain.Vasileios Kalintiris2015-11-121-1/+0
| | | | | | | | Last time, this caused two Windows buildbots and a single ARM buildbot to fail. I XFAIL'd the failing test on win32,win64 machines in order to see if the ARM buildbot complains again. llvm-svn: 252901
* [ARM] Clang gives unintended warning message for 'mthumb' + M-profiles:Alexandros Lamprineas2015-11-051-3/+2
| | | | | | | | | $ clang --target=armv7m-none-eabi -mthumb -march=armv7-m -c test.c clang-3.8: warning: argument unused during compilation: '-mthumb' Differential Revision: http://reviews.llvm.org/D14384 llvm-svn: 252175
* Revert "[mips] Add support for the new mips-mti-linux toolchain."Vasileios Kalintiris2015-10-301-0/+1
| | | | | | | This reverts commits r251633. I'll investigate the test failure off trunk in order to keep the buildbots clean. llvm-svn: 251698
* [mips] Add support for the new mips-mti-linux toolchain.Vasileios Kalintiris2015-10-291-1/+0
| | | | | | | | | | The original commit in r249137 added the mips-mti-linux toolchain. However, the newly added tests of that commit failed in few buildbots. This commit re-applies the original changes but XFAILs the test file which caused the buildbot failures. This will allow us to examine what's going wrong without having to commit/revert large changes. llvm-svn: 251633
* When running clang with an arm triple such as '--target=thumbv7m-none-eabi'Alexandros Lamprineas2015-10-281-6/+8
| | | | | | | | | | | | that has a thumb only CPU by default (cortex-m3), and when using the assembler, the default thumb state of the CPU does not get passed via the triple to LLVM: $ clang -target thumbv7m-none-eabi -c -v test.s clang -cc1as ... -triple armv7m-none--eabi ... test.s Differential Revision: http://reviews.llvm.org/D14121 llvm-svn: 251507
* clang driver toolchain refactoringXinliang David Li2015-10-221-4/+30
| | | | | | | | | | | | | | In this patch, the file static method addProfileRT is moved to be a virtual member function of base ToolChain class. This allows derived toolchain to override the default behavior easily and make it consistent with Darwin toolchain (a TODO was added for this refactoring - now removed). A new helper method is also introduced to test if instrumentation profile option is turned on or not. Differential Revision: http://reviews.llvm.org/D13326 llvm-svn: 250994
* Roll-back r250822.Angel Garcia Gomez2015-10-201-1/+2
| | | | | | | | | | Summary: It breaks the build for the ASTMatchers Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D13893 llvm-svn: 250827
* Apply modernize-use-default to clang.Angel Garcia Gomez2015-10-201-2/+1
| | | | | | | | | | | | Summary: Replace empty bodies of default constructors and destructors with '= default'. Reviewers: bkramer, klimek Subscribers: klimek, alexfh, cfe-commits Differential Revision: http://reviews.llvm.org/D13890 llvm-svn: 250822
* Use Triple.isAndroid() where possible.Evgeniy Stepanov2015-10-081-2/+1
| | | | llvm-svn: 249751
* [VFS] Port driver tool chains to VFS.Benjamin Kramer2015-10-071-3/+1
| | | | | | | There are still some loose ends here but it's sufficient so we can detect GCC headers that are inside of a VFS. llvm-svn: 249556
* Remove support for the mips-mti-linux toolchain.Vasileios Kalintiris2015-10-051-0/+1
| | | | | | | There are two remaining buildbot failures that we'll have to investigate before submitting this again. llvm-svn: 249298
* Re-commit "Add support for the new mips-mti-linux toolchain."Vasileios Kalintiris2015-10-051-1/+0
| | | | | | | | | | | r249137 added support for the new mips-mti-linux toolchain. However, the new tests of that commit, broke some buildbots because they didn't use the correct regular expressions to capture the filename of Clang & LLD. This commit re-applies the changes of r249137 and fixes the tests in r249137 in order to match the filenames of the Clang and LLD executable. llvm-svn: 249294
* Revert "Add support for the new mips-mti-linux toolchain."Vasileios Kalintiris2015-10-021-0/+1
| | | | | | | This reverts commit r249137 because it broke the Windows buildbots and a Linux buildbot for LLD. llvm-svn: 249141
* Add support for the new mips-mti-linux toolchain.Vasileios Kalintiris2015-10-021-1/+0
| | | | | | | | | | | | | | | | | | | | Summary: This new toolchain uses primarily LLVM-based tools, eg. compiler-rt, lld, libcxx, etc. Because of this, it doesn't require neither an existing GCC installation nor a GNU environment. Ideally, in a follow-up patch we would like to add a new --{llvm|clang}-toolchain option (similar to --gcc-toolchain) in order to allow the use of this toolchain with independent Clang builds. For the time being, we use the --sysroot option just to test the correctness of the paths generated by the driver. Reviewers: atanasyan, dsanders, rsmith Subscribers: jfb, tberghammer, danalbert, srhines, dschuff, cfe-commits Differential Revision: http://reviews.llvm.org/D13340 llvm-svn: 249137
* Allow a ToolChain to compute the path of a compiler-rt's component.Vasileios Kalintiris2015-10-011-1/+39
| | | | | | | | | | | | | | | | Summary: This patch moves getCompilerRT() from the clang::driver::tools namespace to the ToolChain class. This is needed for multilib toolchains that need to place their libraries in Clang's resource directory with a layout that is different from the default one. Reviewers: atanasyan, rsmith Subscribers: tberghammer, danalbert, srhines, cfe-commits Differential Revision: http://reviews.llvm.org/D13339 llvm-svn: 249030
* The Clang gcc-compatible driver (clang/tools/driver/driver.cpp) has someEric Christopher2015-09-251-0/+94
| | | | | | | | | | | | | | | | | | | | | | | logic to select an alternate target based on the executable it was called as. For instance, if you symlink i686-linux-android-gcc to clang and invoke it, the driver will act as though it were called with another argument ("-target i686-linux-android"). This leads to visible effects even in syntax-only compilations (like the ANDROID preprocessor symbol being defined). This behavior is not replicated for tool invocations--for instance, clang::createInvocationFromCommandLine will not choose an alternate target based on ArgList[0]. This means that configurations stored in compilation databases aren't accurately replayed. This patch separates the logic for selecting a mode flag and target from the executable name into a new member function on ToolChain. It should have no functional effects (but will allow other code to reuse the target/mode selection logic). Patch by Luke Zarko! llvm-svn: 248592
* [ARM] Fix crash "-target arm -mcpu=generic", without "-march="Vladimir Sukharev2015-09-231-2/+1
| | | | | | | | | | | | | | | | An assertion hit has been fixed for cmdlines like $ clang --target=arm-linux-gnueabi -mcpu=generic hello.c Related to: http://reviews.llvm.org/rL245445 Reviewers: rengolin Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D13013 llvm-svn: 248370
* Driver: Support cfi-icall on all OSs when targeting x86/x86_64.Peter Collingbourne2015-09-101-3/+7
| | | | llvm-svn: 247324
* CFI: Introduce -fsanitize=cfi-icall flag.Peter Collingbourne2015-09-101-1/+1
| | | | | | | | | | This flag causes the compiler to emit bit set entries for functions as well as runtime bitset checks at indirect call sites. Depends on the new function bitset mechanism. Differential Revision: http://reviews.llvm.org/D11857 llvm-svn: 247238
* [WebAssembly] Initial WebAssembly support in clangDan Gohman2015-09-031-2/+4
| | | | | | | | | | This implements basic support for compiling (though not yet assembling or linking) for a WebAssembly target. Note that ABI details are not yet finalized, and may change. Differential Revision: http://reviews.llvm.org/D12002 llvm-svn: 246814
* Update for several APIs in LLVM that now use StringRefs rather thanChandler Carruth2015-08-301-3/+4
| | | | | | | | const char pointers. In turn, push this through Clang APIs as well, simplifying a number of bits of code that was handling the oddities of nullptrs. llvm-svn: 246375
* Range-forify a loop, delete trailing whitespace. NFCDouglas Katzman2015-08-061-6/+4
| | | | llvm-svn: 244290
* [ARM] Changes to Arch/CPU handling to help with -Wa,-mfpu etc. (nfc)Renato Golin2015-07-271-3/+8
| | | | | | | | | | | | To be able to handle -Wa, options in the assembler (ClangAs), we need to make the handling of options based on the value of the options, not direct Arguments from the list, since the list is immutable. No functional change in this patch, but this allows validating of -Wa,-mfpu and friends in the same way we validate -mfpu and friends, *just* for the assembler. llvm-svn: 243352
* [cuda] Driver changes to compile and stitch together host and device-side ↵Artem Belevich2015-07-131-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | CUDA code. NOTE: reverts r242077 to reinstate r242058, r242065, 242067 and includes fix for OS X test failures. - Changed driver pipeline to compile host and device side of CUDA files and incorporate results of device-side compilation into host object file. - Added a test for cuda pipeline creation in clang driver. New clang options: --cuda-host-only - Do host-side compilation only. --cuda-device-only - Do device-side compilation only. --cuda-gpu-arch=<ARCH> - specify GPU architecture for device-side compilation. E.g. sm_35, sm_30. Default is sm_20. May be used more than once in which case one device-compilation will be done per unique specified GPU architecture. Differential Revision: http://reviews.llvm.org/D9509 llvm-svn: 242085
* This reverts commit r242058, r242065, r242067.Rafael Espindola2015-07-131-2/+0
| | | | | | | | | | The tests were failing on OS X. Revert "[cuda] Driver changes to compile and stitch together host and device-side CUDA code." Revert "Fixed regex to properly match '64' in the test case." Revert "clang/test/Driver/cuda-options.cu REQUIRES clang-driver, at least." llvm-svn: 242077
* [cuda] Driver changes to compile and stitch together host and device-side ↵Artem Belevich2015-07-131-0/+2
| | | | | | | | | | | | | | | | | | | | | | | CUDA code. - Changed driver pipeline to compile host and device side of CUDA files and incorporate results of device-side compilation into host object file. - Added a test for cuda pipeline creation in clang driver. New clang options: --cuda-host-only - Do host-side compilation only. --cuda-device-only - Do device-side compilation only. --cuda-gpu-arch=<ARCH> - specify GPU architecture for device-side compilation. E.g. sm_35, sm_30. Default is sm_20. May be used more than once in which case one device-compilation will be done per unique specified GPU architecture. Differential Revision: http://reviews.llvm.org/D9509 llvm-svn: 242058
* [Sanitizers] Provide better diagnostic for sanitizers unsupported for target ↵Alexey Samsonov2015-06-191-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | triple. Introduce ToolChain::getSupportedSanitizers() that would return the set of sanitizers available on given toolchain. By default, these are sanitizers which don't necessarily require runtime support and are not toolchain- or architecture-dependent. Sanitizers (ASan, DFSan, TSan, MSan etc.) which cannot function without runtime library are marked as supported only on platforms for which we actually build these runtimes. This would allow more fine-grained checks in the future: for instance, we have to restrict availability of -fsanitize=vptr to Mac OS 10.9+ (PR23539). Update test cases accrodingly: add tests for certain unsupported configurations, remove test cases for -fsanitize=vptr + PS4 integration, as we don't build the runtime for PS4 at the moment. This change was first submitted as r239953 and reverted in r239958. The problem was and still is in Darwin toolchains, which get the knowledge about target platform too late after initializaition, while now we require this information when ToolChain::getSanitizerArgs() is called. r240170 works around this issue. llvm-svn: 240179
* Allow case-insensitive values for -mcpu for ARMGabor Ballabas2015-06-041-1/+1
| | | | | | | GCC allows case-insensitive values for -mcpu, -march and -mtune options. This patch implements the same behaviour for the -mcpu option. llvm-svn: 239059
* [ARM] Add v8.1a architectureVladimir Sukharev2015-05-141-3/+6
| | | | | | | | | | | | | | Add support for ARMv8.1a architecture. Briefly it is described on http://community.arm.com/groups/processors/blog/2014/12/02/the-armv8-a-architecture-and-its-ongoing-development Reviewers: jmolloy, rengolin Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D8799 llvm-svn: 237349
* Don't claim exception related arguments when looking at RTTIModeFilipe Cabecinhas2015-03-201-1/+1
| | | | | | | | | | | | | | | | | | Summary: We were claiming the -f*exceptions arguments when looking for the RTTIMode. This makes us not warn about unused arguments if compiling a C file with -fcxx-exceptions. This patch fixes it by not claiming the exception-related arguments at that point. Reviewers: rsmith, samsonov Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D8507 llvm-svn: 232860
* Simplify boolean expressions in clang with clang-tidyDavid Blaikie2015-03-091-4/+1
| | | | | | | | Patch by Richard (legalize at xmission dot com). Differential Revision: http://reviews.llvm.org/D8155 llvm-svn: 231619
* Improve our handling of rtti/sanitize=vptr/sanitize=undefinedFilipe Cabecinhas2015-02-191-3/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch removes the huge blob of code that is dealing with rtti/exceptions/sanitizers and replaces it with: A ToolChain function which, for a given set of Args, figures out if rtti should be: - enabled - disabled implicitly - disabled explicitly A change in the way SanitizerArgs figures out what sanitizers to enable (or if it should error out, or warn); And a check for exceptions/rtti interaction inside addExceptionArgs. The RTTIMode algorithm is: - If -mkernel, -fapple-kext, or -fno-rtti are passed, rtti was disabled explicitly; - If -frtti was passed or we're not targetting the PS4, rtti is enabled; - If -fexceptions or -fcxx-exceptions was passed and we're targetting the PS4, rtti was enabled implicitly; - If we're targetting the PS4, rtti is disabled implicitly; - Otherwise, rtti is enabled; Since the only flag needed to pass to -cc1 is -fno-rtti if we want to disable it, there's no problem in saying rtti is enabled if we're compiling C code, so we don't look at the input file type. addExceptionArgs now looks at the RTTIMode and warns that rtti is being enabled implicitly if targetting the PS4 and exceptions are on. It also errors out if, targetting the PS4, -fno-rtti was passed, and exceptions were turned on. SanitizerArgs now errors out if rtti was disabled explicitly and the vptr sanitizer was enabled implicitly, but just turns off vptr if rtti is disabled but -fsanitize=undefined was passed. Also fixed tests, removed duplicate name from addExceptionArgs comment, and added one or two surrounding lines when running clang-format. This changes test/Driver/fsanitize.c to make it not expect a warning when passed -fsanitize=undefined -fno-rtti, but expect vptr to not be on. Removed all users and definition of SanitizerArgs::sanitizesVptr(). Reviewers: samsonov Subscribers: llvm-commits, samsonov, rsmith Differential Revision: http://reviews.llvm.org/D7525 llvm-svn: 229801
* Reapply "Change -save-temps to emit unoptimized bitcode files."Bob Wilson2014-12-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Revert "Change -save-temps to emit unoptimized bitcode files."Reid Kleckner2014-12-181-1/+0
| | | | | | | | | | 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
* Change -save-temps to emit unoptimized bitcode files.Bob Wilson2014-12-181-0/+1
| | | | | | | | | | | | | | | | | | | 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
* CFE Knob for: Add a thread-model knob for lowering atomics on baremetal & ↵Jonathan Roelofs2014-10-031-2/+20
| | | | | | | | single threaded systems http://reviews.llvm.org/D4985 llvm-svn: 219027
* Return a StringRef in getDefaultUniversalArchName.Rafael Espindola2014-07-251-1/+1
| | | | | | Patch by Stephen Drake. llvm-svn: 213964
* MachO: use "arm64" as the triple name in modules.Tim Northover2014-07-241-0/+11
| | | | | | | | | Current versions of ld64 can't cope with "aarch64" being stored. I'm fixing that, but in the transitionary period we'll need to still emit "arm64". rdar://problem/17783765 llvm-svn: 213852
* Implement the -fuse-ld= option.Logan Chien2014-06-261-0/+25
| | | | | | | | | | | | | | This commit implements the -fuse-ld= option, so that the user can specify -fuse-ld=bfd to use ld.bfd. This commit re-applies r194328 with some test case changes. It seems that r194328 was breaking macosx or mingw build because clang can't find ld.bfd or ld.gold in the given sysroot. We should use -B to specify the executable search path instead. Patch originally by David Chisnall. llvm-svn: 211785
* ARM: Add command line option to select big or little endianChristian Pirker2014-04-101-0/+10
| | | | llvm-svn: 205967
* Driver: add target definition for Windows on ARMSaleem Abdulrasool2014-04-041-0/+3
| | | | | | | | | This introduces the definitions needed for the Windows on ARM target. Add target definitions for both the MSVC environment and the MSVC + Itanium C++ ABI environment. The Visual Studio definitions correspond to the definitions provided by Visual Studio 2012. llvm-svn: 205650
* Driver: implement addClangWarningOptionsTim Northover2014-03-291-0/+2
| | | | | | | This function allows certain platforms to enable or disable diagnostics by default. llvm-svn: 205095
* Add ARM big endian Target (armeb, thumbeb)Christian Pirker2014-03-281-4/+20
| | | | | | Reviewed at http://llvm-reviews.chandlerc.com/D3096 llvm-svn: 205008
* Fix an logic error in the clang driver preventing crtfastmath.o from linking ↵Benjamin Kramer2014-03-251-10/+13
| | | | | | | | | | | | | | when -Ofast is used without -ffast-math In gcc using -Ofast forces linking of crtfastmath.o. In the current clang crtfastmath.o is only linked when -ffast-math/-funsafe-math-optimizations passed. It can lead to performance issues, when using only -Ofast without explicit -ffast-math (I faced with it). My patch fixes inconsistency with gcc behaviour and also introduces few tests on it. Patch by Zinovy Nis! Differential Revision: http://llvm-reviews.chandlerc.com/D3114 llvm-svn: 204742
* clang: add -f{no-,}integrate-as as consistent parametersSaleem Abdulrasool2014-02-231-2/+2
| | | | | | | | The integrated assembler is a feature. This makes the new flags the default option, and the previous versions aliases. Ideally, at some point the aliases would be entirely removed. llvm-svn: 201963
* Move -verify-pch to use VerifyJobActionBen Langmuir2014-02-061-1/+2
| | | | | | | | | Use the verify hook rather than the compile hook to represent the -verify-pch action, and move the exising --verify-debug-info action into its own subclass of VerifyJobAction. Incidentally change the name printed by -ccc-print-phases for --verify-debug-info. llvm-svn: 200938
* Remove an unnecessary special case to check for a few Darwin-specific options.Bob Wilson2014-01-161-7/+0
| | | | | | | | | | | Using -mmacosx-version-min (etc.) on non-Darwin platforms should be a warning, not a hard error. There is no reason to add a special check for these options in the default toolchain. This just removes the special check and then we get the usual -Wunused-command-line-argument warning if someone tries to use one of these options for a target where they are not supported. <rdar://problem/15569346> llvm-svn: 199431
* MachO: use *-*-*-macho for MachO embedded targets.Tim Northover2014-01-161-3/+3
| | | | | | | | | | | | Previously we had bodged together some hacks mapping MachO embedded targets (i.e. mainly ARM v6M and v7M) to the "*-*-darwin-eabi" triple. This is incorrect in both details (they don't run Darwin and they're not EABI in any real sense). This commit appropriates the existing "MachO" environment for the purpose instead. llvm-svn: 199367
OpenPOWER on IntegriCloud