summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver
Commit message (Collapse)AuthorAgeFilesLines
...
* [ASan] Initial support for Kernel AddressSanitizerAlexander Potapenko2015-06-191-1/+4
| | | | | | | | | This patch adds initial support for the -fsanitize=kernel-address flag to Clang. Right now it's quite restricted: only out-of-line instrumentation is supported, globals are not instrumented, some GCC kasan flags are not supported. Using this patch I am able to build and boot the KASan tree with LLVMLinux patches from github.com/ramosian-glider/kasan/tree/kasan_llvmlinux. To disable KASan instrumentation for a certain function attribute((no_sanitize("kernel-address"))) can be used. llvm-svn: 240131
* Implement diagnostic mode for -fsanitize=cfi*, -fsanitize=cfi-diag.Peter Collingbourne2015-06-191-2/+6
| | | | | | | | | | | | | | | | | This causes programs compiled with this flag to print a diagnostic when a control flow integrity check fails instead of aborting. Diagnostics are printed using UBSan's runtime library. The main motivation of this feature over -fsanitize=vptr is fidelity with the -fsanitize=cfi implementation: the diagnostics are printed under exactly the same conditions as those which would cause -fsanitize=cfi to abort the program. This means that the same restrictions apply regarding compiling all translation units with -fsanitize=cfi, cross-DSO virtual calls are forbidden, etc. Differential Revision: http://reviews.llvm.org/D10268 llvm-svn: 240109
* Introduce -fsanitize-trap= flag.Peter Collingbourne2015-06-181-17/+75
| | | | | | | | | | | | | | | | | | | | | | | | This flag controls whether a given sanitizer traps upon detecting an error. It currently only supports UBSan. The existing flag -fsanitize-undefined-trap-on-error has been made an alias of -fsanitize-trap=undefined. This change also cleans up some awkward behavior around the combination of -fsanitize-trap=undefined and -fsanitize=undefined. Previously we would reject command lines containing the combination of these two flags, as -fsanitize=vptr is not compatible with trapping. This required the creation of -fsanitize=undefined-trap, which excluded -fsanitize=vptr (and -fsanitize=function, but this seems like an oversight). Now, -fsanitize=undefined is an alias for -fsanitize=undefined-trap, and if -fsanitize-trap=undefined is specified, we treat -fsanitize=vptr as an "unsupported" flag, which means that we error out if the flag is specified explicitly, but implicitly disable it if the flag was implied by -fsanitize=undefined. Differential Revision: http://reviews.llvm.org/D10464 llvm-svn: 240105
* [Driver] Compute MacOS/iOS version from triple if/when we actually need it. NFC.Alexey Samsonov2015-06-182-33/+19
| | | | llvm-svn: 240065
* Allow case-insensitive values for -march for AArch64 target in line with GCC.Gabor Ballabas2015-06-181-1/+2
| | | | | | | GCC allows case-insensitive values for -mcpu, -march and -mtune options. This patch implements the same behaviour for the -march option for the AArch64 target. llvm-svn: 240019
* [Driver] Remove unused class member. NFC.Alexey Samsonov2015-06-182-9/+0
| | | | llvm-svn: 239981
* [Driver] Simplify code choosing between MacOS and iOS platforms. NFC.Alexey Samsonov2015-06-181-12/+10
| | | | llvm-svn: 239980
* [Driver] Add an assert to Darwin::isTargetMacOS() for consistency.Alexey Samsonov2015-06-171-0/+1
| | | | llvm-svn: 239967
* Revert "[Sanitizers] Provide better diagnostic for sanitizers unsupported ↵Alexey Samsonov2015-06-174-84/+45
| | | | | | | | | for target triple." This reverts commit r239953, while I'm investigating assertion failure from http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental_check/9994/ llvm-svn: 239958
* [Sanitizers] Provide better diagnostic for sanitizers unsupported for target ↵Alexey Samsonov2015-06-174-45/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | triple. Summary: 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 (i.e. set from -fsanitize=undefined-trap). 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. Test Plan: regression test suite Reviewers: pcc Subscribers: cfe-commits, filcab, eugenis, thakis, kubabrecka, emaste, rsmith Differential Revision: http://reviews.llvm.org/D10467 llvm-svn: 239953
* Remove duplicated alteration to getProgramPaths().Douglas Katzman2015-06-161-4/+0
| | | | | | | | This appears to have been accidental. Differential Revision: http://reviews.llvm.org/D10444 llvm-svn: 239844
* If/else looks nicer when both branches have (or don't have) braces. NFCDouglas Katzman2015-06-161-1/+2
| | | | llvm-svn: 239834
* [mips] Don't propagate -mfpxx by default if soft/single float were also set.Toma Tabacu2015-06-162-5/+27
| | | | | | | | | | | | | | | | | Summary: If the driver is only given -msoft-float/-mfloat-abi=soft or -msingle-float, we should refrain from propagating -mfpxx, unless it was explicitly given on the command line. Reviewers: atanasyan, dsanders Reviewed By: atanasyan, dsanders Subscribers: cfe-commits, mpf Differential Revision: http://reviews.llvm.org/D10387 llvm-svn: 239818
* [modules] Rename -fmodule-maps to -fimplicit-module-maps (and likewise forRichard Smith2015-06-161-2/+2
| | | | | | -fno-module-maps). The old names are preserved for compatibility. llvm-svn: 239792
* [modules] Simplify -cc1 interface for enabling implicit module maps.Richard Smith2015-06-161-6/+6
| | | | | | | | | | | | | We used to have a flag to enable module maps, and two more flags to enable implicit module maps. This is all redundant; we don't need any flag for enabling module maps in the abstract, and we don't usually have -fno- flags for -cc1. We now have just a single flag, -fimplicit-module-maps, that enables implicitly searching the file system for module map files and loading them. The driver interface is unchanged for now. We should probably rename -fmodule-maps to -fimplicit-module-maps at some point. llvm-svn: 239789
* Protection against stack-based memory corruption errors using SafeStack: ↵Peter Collingbourne2015-06-151-1/+17
| | | | | | | | | | | | | | | | | | | | | | | | | Clang command line option and function attribute This patch adds the -fsanitize=safe-stack command line argument for clang, which enables the Safe Stack protection (see http://reviews.llvm.org/D6094 for the detailed description of the Safe Stack). This patch is our implementation of the safe stack on top of Clang. The patches make the following changes: - Add -fsanitize=safe-stack and -fno-sanitize=safe-stack options to clang to control safe stack usage (the safe stack is disabled by default). - Add __attribute__((no_sanitize("safe-stack"))) attribute to clang that can be used to disable the safe stack for individual functions even when enabled globally. Original patch by Volodymyr Kuznetsov and others at the Dependable Systems Lab at EPFL; updates and upstreaming by myself. Differential Revision: http://reviews.llvm.org/D6095 llvm-svn: 239762
* [Sparc] Make soft-float emit an error.James Y Knight2015-06-151-39/+13
| | | | | | | | | | | | LLVM does not and has not ever supported a soft-float ABI mode on Sparc, so don't pretend that it does. Also switch the default from "soft-float" -- which was actually hard-float because soft-float is unimplemented -- to hard-float. Differential Revision: http://reviews.llvm.org/D10457 llvm-svn: 239755
* Revert r239213: "clang-cl: Implement /GL in terms of -flto."Hans Wennborg2015-06-132-2/+2
| | | | | | | Reverting until it's easier to use this in a real-world build, e.g. when the linker can handle it. llvm-svn: 239656
* Driver: only set -mlinker-version based on host if it's validTim Northover2015-06-121-1/+2
| | | | | | | | | | | | We were adding an extra "-mlinker-version" argument to the invocation based on a value inferred from "ld -v". This is set by the build systems to either a sane value or an empty string (e.g. for custom built ld), which we don't want to pass on. No test really possible because the value depends on both host system and how CMake was invoked. llvm-svn: 239633
* Allow case-insensitive values for -mcpu for AArch64 target in line with GCC.Gabor Ballabas2015-06-121-3/+5
| | | | | | | GCC allows case-insensitive values for -mcpu, -march and -mtune options. This patch implements the same behaviour for the -mcpu option for the AArch64 target. llvm-svn: 239619
* Allow ToolChain to decide if Clang is not the right C compiler.Douglas Katzman2015-06-121-3/+2
| | | | | | | | | Removed comment in Driver::ShouldUseClangCompiler implying that there was an opt-out ability at that point - there isn't. Differential Revision: http://reviews.llvm.org/D10246 llvm-svn: 239608
* Revert commit r239481 as it is dependent on reverted llvm commit r239480.Teresa Johnson2015-06-121-4/+0
| | | | llvm-svn: 239588
* Add comments to PrintActions1 and Driver::PrintActions.Douglas Katzman2015-06-111-1/+6
| | | | | | Differential Revision: http://reviews.llvm.org/D10214 llvm-svn: 239537
* add the -mrecip driver flag and process its options (3rd try)Sanjay Patel2015-06-111-0/+133
| | | | | | | | | | | | | | | | | | | The 1st and 2nd tries to land this (r238055, r238851) were reverted due to bot failures caused by the LLVM part of the patch. That was hopefully fixed after r239001. This is the front-end counterpart to D8982. The -mrecip option interface is based on maintaining compatibility with gcc: https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/i386-and-x86-64-Options.html#index-mrecip_003dopt-1627 https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/RS_002f6000-and-PowerPC-Options.html#index-mrecip-2289 ...while adding more functionality (allowing users to specify the number of refinement steps for each estimate type). Differential Revision: http://reviews.llvm.org/D8989 llvm-svn: 239536
* Allow case-insensitive values for -march for ARM in line with GCC.Gabor Ballabas2015-06-112-8/+9
| | | | | | | GCC allows case-insensitive values for -mcpu, -march and -mtune options. This patch implements the same behaviour for the -march option for ARM. llvm-svn: 239527
* [mips] Pass on -m{single,double}-float to GAS.Toma Tabacu2015-06-111-0/+3
| | | | | | | | | | | | | | Summary: We already pass these to the IAS, but not to GAS. Reviewers: dsanders, atanasyan Reviewed By: atanasyan Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D10358 llvm-svn: 239525
* [bpf] add support for BPF backendAlexei Starovoitov2015-06-101-0/+2
| | | | | | add support for bpfel/bpfeb targets llvm-svn: 239496
* Pass down the -flto option to the -cc1 job, and from there into theTeresa Johnson2015-06-101-0/+4
| | | | | | | | | | | | CodeGenOptions and onto the PassManagerBuilder. This enables gating the new EliminateAvailableExternally module pass on whether we are preparing for LTO. If we are preparing for LTO (e.g. a -flto -c compile), the new pass is not included as we want to preserve available externally functions for possible link time inlining. llvm-svn: 239481
* clang-cl: Ignore the /o option when /P is specified.Greg Bedwell2015-06-091-2/+1
| | | | | | | | | This matches the cl.exe behavior (tested with 18.00.31101). In order to specify an output file for /P, use the /Fi option instead. Differential Revision: http://reviews.llvm.org/D10313 llvm-svn: 239393
* [Driver] Preserve the object file format in ComputeEffectiveClangTripleDavid Majnemer2015-06-091-2/+8
| | | | | | | | The object file format is sometimes overridden for MSVC targets to use ELF instead of COFF. Make sure we preserve this choice when setting the msvc version number in the triple. llvm-svn: 239388
* range-for'ify Args->filtered_begin(...) loopsSean Silva2015-06-093-72/+39
| | | | | | | We already have Args->filtered(...) which is a drop-in range-for replacement. llvm-svn: 239381
* [Driver] Inject the MSVC compatibility version into the tripleDavid Majnemer2015-06-084-30/+79
| | | | | | | Encoding the version into the triple will allow us to communicate to LLVM what functions it can expect to depend upon in the implementation. llvm-svn: 239273
* clang-cl: Implement /GL in terms of -flto.Peter Collingbourne2015-06-062-2/+2
| | | | | | | | No documentation yet; the linker needs more work. Differential Revision: http://reviews.llvm.org/D10270 llvm-svn: 239213
* [SPARC] Add multiarch include paths.James Y Knight2015-06-051-0/+10
| | | | | | | | | | | Adds tests verifying the proper dirs are found in the Debian 8/GCC4.9 layout for sparc (32bit), sparc (32bit) with lib64 multilib, and sparc64. The test cases added here also cover r239047, which fixed the linker paths. llvm-svn: 239154
* [ARM] Use TargetParser to determine FPU subtarget featuresJohn Brawn2015-06-051-74/+2
| | | | | | | | | | | | | | | The main effect of this is to fix anomalies where certain -mfpu options didn't disable everything that they should causing strange behaviour when combined with -mcpu or -march values that themselves enabled fpu subtarget features, e.g. -mfpu=fpv5-dp-d16 with -march=armv7em previously behaved the same as -mfpu=fpv5-sp-d16 due to fp-only-sp not being disabled. Invalid -mfpu options now also give an error, which is consistent with the handling of the .fpu directive. Differential Revision: http://reviews.llvm.org/D10239 llvm-svn: 239152
* Simplify ARMTargetParser::parseArch(ARMTargetParser::getCanonical()), ↵Artyom Skrobov2015-06-041-7/+3
| | | | | | | | | | | | | | following r239099 Reviewers: rengolin Reviewed By: rengolin Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D10256 llvm-svn: 239101
* Allow case-insensitive values for -mcpu for ARMGabor Ballabas2015-06-043-8/+8
| | | | | | | GCC allows case-insensitive values for -mcpu, -march and -mtune options. This patch implements the same behaviour for the -mcpu option. llvm-svn: 239059
* [SPARC] Fix multiarch path detection for sparc and sparcv9.James Y Knight2015-06-041-0/+8
| | | | llvm-svn: 239047
* Remove extraneous qualifiers due to "using namespace". NFCDouglas Katzman2015-06-042-10/+10
| | | | llvm-svn: 239038
* Use the appropriate PIE level for OpenBSD/sparc.Brad Smith2015-06-041-1/+1
| | | | llvm-svn: 239028
* Save getArch() in a local var instead of calling it 20 times, etc.Douglas Katzman2015-06-041-80/+74
| | | | | | Differential Revision: http://reviews.llvm.org/D10224 llvm-svn: 238992
* Change big 'if' statement into a switch. NFCDouglas Katzman2015-06-031-15/+20
| | | | | | Differential Revision: http://reviews.llvm.org/D10223 llvm-svn: 238955
* Fix misleading comment. NFCDouglas Katzman2015-06-031-1/+1
| | | | llvm-svn: 238938
* Revert "add the -mrecip driver flag and process its options (2nd try)"Rafael Espindola2015-06-031-134/+0
| | | | | | | | This reverts commit r238851. It depends on a llvm commit that was reverted. llvm-svn: 238904
* add the -mrecip driver flag and process its options (2nd try)Sanjay Patel2015-06-021-0/+134
| | | | | | | | | | | | | | | | | | | The first try to land this (r238055) was reverted due to bot failures caused by the LLVM part of the patch. That was hopefully fixed by r238788, and the LLVM patch was resubmitted at r238842. This is the front-end counterpart to D8982. The -mrecip option interface is based on maintaining compatibility with gcc: https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/i386-and-x86-64-Options.html#index-mrecip_003dopt-1627 https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/RS_002f6000-and-PowerPC-Options.html#index-mrecip-2289 ...while adding more functionality (allowing users to specify the number of refinement steps for each estimate type). Differential Revision: http://reviews.llvm.org/D8989 llvm-svn: 238851
* Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial typesBenjamin Kramer2015-05-292-3/+3
| | | | | | | | | | | | | | | | | | | | If the type isn't trivially moveable emplace can skip a potentially expensive move. It also saves a couple of characters. Call sites were found with the ASTMatcher + some semi-automated cleanup. memberCallExpr( argumentCountIs(1), callee(methodDecl(hasName("push_back"))), on(hasType(recordDecl(has(namedDecl(hasName("emplace_back")))))), hasArgument(0, bindTemporaryExpr( hasType(recordDecl(hasNonTrivialDestructor())), has(constructExpr()))), unless(isInTemplateInstantiation())) No functional change intended. llvm-svn: 238601
* [ARM] Adjust -march checkingJohn Brawn2015-05-291-4/+5
| | | | | | | | | | getCanonicalArchName can return an empty string for an architecture that is well-formed but meaningless. Use parseArch to determine if it's actually valid or not. Differential Revision: http://reviews.llvm.org/D10120 llvm-svn: 238553
* [omp] Fix a typo in a comment and a line I forgot to clang-format thatChandler Carruth2015-05-281-2/+3
| | | | | | Justin pointed out in post-commit review. llvm-svn: 238498
* [ARMTargetParser] FIXME MachO arch names. NFCRenato Golin2015-05-281-21/+26
| | | | llvm-svn: 238435
* [ARMTargetParser] FIXME on getLLVMArchSuffixForARM. NFCRenato Golin2015-05-281-33/+7
| | | | llvm-svn: 238430
OpenPOWER on IntegriCloud