summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/ToolChain.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [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
* Fix indentation from r197490 plus some typosAlp Toker2013-12-171-8/+7
| | | | llvm-svn: 197507
* LIBRARY_PATH environment variable should only be supported on a native compiler.Richard Barton2013-12-171-0/+14
| | | | llvm-svn: 197490
* Refactor duplicate functionsBernard Ogden2013-12-121-114/+3
| | | | | | | | | | getARMCPU and getLLVMArchSuffixForARM existed as very similar functions in both ToolChain.cpp and Tools.cpp. Create a single implementation of each in Tools.cpp, eliminate the duplicate and share via Tools.h. Creates an 'arm' namespace in Tools.h to be used by any ARM-targetting tools. llvm-svn: 197153
* Make thumb the default instruction set for v7m and v7emBernard Ogden2013-12-121-1/+2
| | | | llvm-svn: 197152
* Fix -mthumb resetting of target cpuBernard Ogden2013-12-121-1/+15
| | | | | | | | Passing -mthumb with no explicit CPU on the command line resulted in target CPU changing from the architecture default to arm7tdmi. Now it does not. llvm-svn: 197151
* Added support for mcpu kraitAna Pazos2013-12-061-1/+1
| | | | | | | | | | | | - krait processor currently modeled with the same features as A9. - Krait processor additionally has VFP4 (fused multiply add/sub) and hardware division features enabled. - krait has currently the same Schedule model as A9 - krait cpu flag is not recognized by the GNU assembler yet, it is replaced with march=armv7-a to avoid a lower march from being used. llvm-svn: 196618
* For NetBSD, use arm1176jzf-s as default CPU for ARMv6.Joerg Sonnenberger2013-12-051-0/+5
| | | | llvm-svn: 196538
* X86: Make specifying avx2 simpler on Darwin with '-arch'Jim Grosbach2013-11-161-1/+15
| | | | | | | | Teach the '-arch' command line option to enable the compiler-friendly features of core-avx2 CPUs on Darwin. Pass the information along in the target triple like Darwin+ARM does. llvm-svn: 194907
* This reverts commit r194330, r194329 and r194328.Rafael Espindola2013-11-091-22/+0
| | | | | | The test was still failing on OS X and mingw. llvm-svn: 194334
* Add support for -fuse-ld=.David Chisnall2013-11-091-0/+22
| | | | llvm-svn: 194328
* SanitizerArgs: add ability to filter/diagnose unsupported sanitizers.Peter Collingbourne2013-11-011-1/+4
| | | | | | | | | | | | The thread, memory, dataflow and function sanitizers are now diagnosed if enabled explicitly on an unsupported platform. Unsupported sanitizers which are enabled implicitly (as part of a larger group) are silently disabled. As a side effect, this makes SanitizerArgs parsing toolchain-dependent (and thus essentially reverts r188058), and moves SanitizerArgs ownership to ToolChain. Differential Revision: http://llvm-reviews.chandlerc.com/D1990 llvm-svn: 193875
* Teach clang driver about Cortex-A53 and Cortex-A57.Bernard Ogden2013-10-241-1/+1
| | | | | | | | | | | Adds some Cortex-A53 strings where they were missing before. Cortex-A57 is entirely new to clang. Doesn't touch code only used by Darwin, in consequence of which one of the A53 lines has been removed. Change-Id: I5edb58f6eae93947334787e26a8772c736de6483 llvm-svn: 193364
* Add more Cortex CPUs and testsRenato Golin2013-09-131-2/+2
| | | | llvm-svn: 190703
* ARM: default to arm1176jzf-s for hard-float platforms.Tim Northover2013-08-201-2/+10
| | | | | | | | | | | | It makes no sense to try and compile for arm7tdmi when we're targeting something like gnueabihf. Although not strictly the most basic hardware conceivable, I believe arm1176jzf-s is a reasonable compromise (that can always be overridden explicitly if needed) since it's still in reasonably common use unlike earlier cores. Patch by Stephen Kelly. llvm-svn: 188796
* Move SanitizerArgs to the clang DriverAlexey Samsonov2013-08-191-0/+4
| | | | | | | | | | | | | | | | Summary: This change turns SanitizerArgs into high-level options stored in the Driver, which are parsed lazily. This fixes an issue of multiple copies of the same diagnostic message produced by sanitizer arguments parser. Reviewers: rsmith Reviewed By: rsmith CC: chandlerc, eugenis, cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1341 llvm-svn: 188660
* [PowerPC] Support powerpc64le as a syntax-checking target.Bill Schmidt2013-07-261-0/+2
| | | | | | | | | | | | | | | | | | | This patch provides basic support for powerpc64le as an LLVM target. However, use of this target will not actually generate little-endian code. Instead, use of the target will cause the correct little-endian built-in defines to be generated, so that code that tests for __LITTLE_ENDIAN__, for example, will be correctly parsed for syntax-only testing. Code generation will otherwise be the same as powerpc64 (big-endian), for now. The patch leaves open the possibility of creating a little-endian PowerPC64 back end, but there is no immediate intent to create such a thing. The new test case variant ensures that correct built-in defines for little-endian code are generated. llvm-svn: 187180
* Add support for passing '-target armv8' through the Driver.Joey Gouly2013-06-261-0/+2
| | | | llvm-svn: 184970
* [Driver] Refactor clang driver to use LLVM's Option libraryReid Kleckner2013-06-141-4/+5
| | | | | | | | | | | | | | | | | | The big changes are: - Deleting Driver/(Arg|Opt)* - Rewriting includes to llvm/Option/ and re-sorting - 'using namespace llvm::opt' in clang::driver - Fixing the autoconf build by adding option everywhere As discussed in the review, this change includes using directives in header files. I'll make follow up changes to remove those in favor of name specifiers. Reviewers: espindola Differential Revision: http://llvm-reviews.chandlerc.com/D975 llvm-svn: 183989
* Teach clang about the armv4/armv4t distinctionTim Northover2013-06-131-2/+5
| | | | | | | | | When choosing a default CPU, clang used to pick ARM7TDMI (which has Thumb) even when the more restrictive armv4 triple was specified. This should fix that. Patch by Jeroen Hofstee. llvm-svn: 183905
* Supports Sourcery CodeBench Mips toolchain directories tree.Simon Atanasyan2013-04-201-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sourcery CodeBench and modern FSF Mips toolchains require a bit more complicated algorithm to calculate headers, libraries and sysroot paths than implemented by Clang driver now. The main problem is that all these paths depend on a set of command line arguments additionally to a target triple value. For example, let $TC is a toolchain installation directory. If we compile big-endian 32-bit mips code, crtbegin.o is in the $TC/lib/gcc/mips-linux-gnu/4.7.2 folder and the toolchain's linker requires --sysroot=$TC/mips-linux-gnu/libc argument. If we compile little-endian 32-bit soft-float mips code, crtbegin.o is in the $TC/lib/gcc/mips-linux-gnu/4.7.2/soft-float/el folder and the toolchain's linker requires --sysroot=$TC/mips-linux-gnu/libc/soft-float/el argument. 1. Calculate MultiarchSuffix using all necessary command line options and use this MultiarchSuffix to detect crtbegin.o location in the GCCInstallationDetector::ScanLibDirForGCCTriple() routine. 2. If a user does not provide --sysroot argument to the driver explicitly, calculate new sysroot value based on command line options. Then use this calculated sysroot path: a. To populate a file search paths list in the Linux::Linux() constructor. b. To find Mips toolchain specific include headers directories in the Linux::AddClangSystemIncludeArgs() routine. c. To provide -–sysroot argument for a linker. Note: - The FSF's tree slightly differs (folder names) and is not supported yet. - New addExternCSystemIncludeIfExits() routine is a temporary solution. I plan to move path existence check to the addExternCSystemInclude() routine by a separate commit. The patch reviewed by Rafael Espindola. http://llvm-reviews.chandlerc.com/D644 llvm-svn: 179934
* Reject -no-integrated-as on windows.Rafael Espindola2013-03-241-4/+4
| | | | llvm-svn: 177840
* Avoid warnings from compilers that think you can drop off the end of a fully ↵Benjamin Kramer2013-03-211-0/+2
| | | | | | covered switch. llvm-svn: 177656
* Remove the Tools DensMap from the toolchain.Rafael Espindola2013-03-201-25/+45
| | | | | | | | | | Each toolchain has a set of tools, but they are all of known types. It can have a linker, an assembler, a "clang" (compile, analyze, ...) a non-clang compiler, etc. Instead of keeping a map, just have member variable for each type of tool. llvm-svn: 177479
* Finish refactoring the tool selection logic.Rafael Espindola2013-03-191-0/+20
| | | | | | | | | The general pattern now is that Foobar::constructTool only creates tools defined in the tools::foobar namespace and then delegates to the parent. The remaining duplicated code is now in the tools themselves. llvm-svn: 177368
* Centralize the logic for using the integrated assembler.Rafael Espindola2013-03-181-0/+2
| | | | llvm-svn: 177360
* Centralize the recording of which tools have been constructed.Rafael Espindola2013-03-181-0/+24
| | | | llvm-svn: 177319
* Pass an ArgList to every toolchain constructor. Remove the useIntegratedAsRafael Espindola2013-03-181-3/+4
| | | | | | argument. llvm-svn: 177301
OpenPOWER on IntegriCloud