aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Driver/Tools.cpp
AgeCommit message (Collapse)AuthorFilesLines
2015-06-15Protection against stack-based memory corruption errors using SafeStack: ↵Peter Collingbourne1-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
2015-06-15[Sparc] Make soft-float emit an error.James Y Knight1-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
2015-06-12Allow case-insensitive values for -mcpu for AArch64 target in line with GCC.Gabor Ballabas1-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
2015-06-12Revert commit r239481 as it is dependent on reverted llvm commit r239480.Teresa Johnson1-4/+0
llvm-svn: 239588
2015-06-11add the -mrecip driver flag and process its options (3rd try)Sanjay Patel1-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
2015-06-11Allow case-insensitive values for -march for ARM in line with GCC.Gabor Ballabas1-6/+7
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
2015-06-11[mips] Pass on -m{single,double}-float to GAS.Toma Tabacu1-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
2015-06-10Pass down the -flto option to the -cc1 job, and from there into theTeresa Johnson1-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
2015-06-09range-for'ify Args->filtered_begin(...) loopsSean Silva1-54/+31
We already have Args->filtered(...) which is a drop-in range-for replacement. llvm-svn: 239381
2015-06-08[Driver] Inject the MSVC compatibility version into the tripleDavid Majnemer1-30/+50
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
2015-06-05[ARM] Use TargetParser to determine FPU subtarget featuresJohn Brawn1-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
2015-06-04Simplify ARMTargetParser::parseArch(ARMTargetParser::getCanonical()), ↵Artyom Skrobov1-7/+3
following r239099 Reviewers: rengolin Reviewed By: rengolin Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D10256 llvm-svn: 239101
2015-06-04Allow case-insensitive values for -mcpu for ARMGabor Ballabas1-5/+5
GCC allows case-insensitive values for -mcpu, -march and -mtune options. This patch implements the same behaviour for the -mcpu option. llvm-svn: 239059
2015-06-04Use the appropriate PIE level for OpenBSD/sparc.Brad Smith1-1/+1
llvm-svn: 239028
2015-06-04Save getArch() in a local var instead of calling it 20 times, etc.Douglas Katzman1-80/+74
Differential Revision: http://reviews.llvm.org/D10224 llvm-svn: 238992
2015-06-03Revert "add the -mrecip driver flag and process its options (2nd try)"Rafael Espindola1-134/+0
This reverts commit r238851. It depends on a llvm commit that was reverted. llvm-svn: 238904
2015-06-02add the -mrecip driver flag and process its options (2nd try)Sanjay Patel1-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
2015-05-29Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial typesBenjamin Kramer1-1/+1
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
2015-05-29[ARM] Adjust -march checkingJohn Brawn1-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
2015-05-28[omp] Fix a typo in a comment and a line I forgot to clang-format thatChandler Carruth1-2/+3
Justin pointed out in post-commit review. llvm-svn: 238498
2015-05-28[ARMTargetParser] FIXME on getLLVMArchSuffixForARM. NFCRenato Golin1-33/+7
llvm-svn: 238430
2015-05-28[omp] Re-work Clang's handling of -fopenmp and undo r237769.Chandler Carruth1-53/+94
This isn't an actual revert of r237769, it just restores the behavior of the Clang driver prior to it while completely re-implementing how that behavior works. This also re-does the work of making the default OpenMP runtime selectable at CMake (or configure) time to work in the way all of our other such hooks do (config.h, configure and cmake hooks, etc.). I've re-implemented how we manage the '-fopenmp' flagset in an important way. Now, the "default" hook just makes '-fopenmp' equivalent to '-fopenmp=<default>' rather than a separate special beast. Also, there is an '-fno-openmp' flag which does the obvious thing. Also, the code is shared between all the places to select a known OpenMP runtime and act on it. Finally, and most significantly, I've taught the driver to inspect the selected runtime when choosing whether to propagate the '-fopenmp' flag to the frontend in the CC1 commandline. Without this, it isn't possible to use Clang with libgomp, even if you were happy with the serial, boring way in which it worked previously (ignoring all #pragmas but linking in the library to satisfy direct calls into the runtime). While I'm here, I've gone ahead and sketched out a path for the future name of LLVM's OpenMP runtime (libomp) and the legacy support for its current name (libiomp5) in what seems a more reasonable way. To re-enable LLVM's OpenMP runtime (which I think should wait until the normal getting started instructions are a reasonable way for falks to check out, build, and install Clang with the runtime) all that needs to change is the default string in the CMakeLists.txt and configure.ac file. No code changes necessary. I also added a test for the driver's behavior around OpenMP since it was *completely missing* previously. Makes it unsurprising that we got it wrong. llvm-svn: 238389
2015-05-23[Driver] Unbreak hexagon build botsDavid Majnemer1-1/+1
AddHexagonTargetArgs didn't respect the driver flags by unconditionally pushing -fno-signed-char. Instead, add Hexagon handling to isSignedCharDefault. llvm-svn: 238106
2015-05-23[Driver] Handle -fno-signed-char and -fno-unsigned-charDavid Majnemer1-2/+9
GCC maps -fno-unsigned-char to -fsigned-char and -fno-signed-char to -funsigned-char. llvm-svn: 238105
2015-05-23This reverts commit r238064 and r238055.Rafael Espindola1-134/+0
They depend on a reverted llvm commit. llvm-svn: 238076
2015-05-22add the -mrecip driver flag and process its optionsSanjay Patel1-0/+134
This is the front-end counterpart to D8982 (LLVM r238051). 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: 238055
2015-05-22Make unique section names the default again.Rafael Espindola1-6/+3
Using non unique names found a bug in the ICF inplementation in gold: https://sourceware.org/bugzilla/show_bug.cgi?id=18440 This reverts commit r234143. llvm-svn: 238048
2015-05-22Use profile and version parsers from ARMTargetParserRenato Golin1-32/+5
Now that ARMTargetParser can parse profile and version numbers, use them instead of the local implementation. llvm-svn: 238037
2015-05-21[ARM] Restructure cpu handling in the driver to mostly use the tripleJohn Brawn1-44/+92
Using the target cpu to determine some behaviour is sprinkled in several places in the driver, but in almost all the information that is needed can be found in the triple. Restructure things so that the triple is used, and the cpu is only used if the exact cpu name is needed. Also add a check that the -mcpu argument is valid, and correct the -march argument checking so that it handles -march=native correctly. I would have liked to move these checks into the computation of the triple, but the triple is calculated several times in several places and that would lead to multiple error messages for the same thing. Differential Revision: http://reviews.llvm.org/D9879 llvm-svn: 237894
2015-05-20[OpenMP] Make default OpenMP library (the one selected with just -fopenmp)Richard Smith1-41/+52
configurable in the CMake build. There shouldn't be any change in default behavior. Derived from a patch by Daniel Jasper! llvm-svn: 237850
2015-05-20[OPENMP] -fopenmp enables OpenMP support (fix for http://llvm.org/PR23492)Alexey Bataev1-10/+16
-fopenmp turns on OpenMP support and links libiomp5 as OpenMP library. Also there is -fopenmp={libiomp5|libgomp} option that allows to override effect of -fopenmp and link libgomp library (if -fopenmp=libgomp is specified). Differential Revision: http://reviews.llvm.org/D9736 llvm-svn: 237769
2015-05-18[clang-cl] Enable C++14 when targeting 2015 compatibilityDavid Majnemer1-2/+11
llvm-svn: 237553
2015-05-14Remove unused function HasPICArg().Ikhlas Ajbar1-5/+0
llvm-svn: 237374
2015-05-14Factor out SmallDataThresholdIkhlas Ajbar1-31/+11
This patch factors out SmallDataThreshold code. llvm-svn: 237364
2015-05-14[ARM] Add v8.1a architectureVladimir Sukharev1-10/+32
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
2015-05-12Change TargetParser enum names to avoid macro conflicts (clang)Renato Golin1-14/+14
sys/time.h on Solaris (and possibly other systems) defines "SEC" as "1" using a cpp macro. The result is that this fails to compile. Fixes https://llvm.org/PR23482 llvm-svn: 237113
2015-05-12Re-apply "Driver: Make profiling flags work with -nostdlib on Darwin"Justin Bogner1-0/+5
This time without a stray "true" in an argument list. This reverts r237077, restoring r237074. llvm-svn: 237091
2015-05-12Revert "Driver: Make profiling flags work with -nostdlib on Darwin"Justin Bogner1-5/+0
This revert r237074. These tests are failing all over the place. llvm-svn: 237077
2015-05-12Driver: Make profiling flags work with -nostdlib on DarwinJustin Bogner1-0/+5
Compiler-rt's Profiling library isn't part of the stdlib, so -nostdlib shouldn't prevent it from being linked. This makes Darwin behave like other toolchains, and link in the profile runtime irrespective of -nostdlib, since the resulting program can't be run unless you link this. I've also added a test to show that other toolchains already behave like this. llvm-svn: 237074
2015-05-11[Sparc] Add support for 'sparcel' to clang.Douglas Katzman1-1/+11
Differential Revision: http://reviews.llvm.org/D8784 llvm-svn: 237001
2015-05-09Factor out Hexagon code to build args.Ikhlas Ajbar1-8/+21
This patch factor out the code in hexagon::Link::ConstructJob to be reused in other functions. No functionality change intended. llvm-svn: 236926
2015-05-08Using ARMTargetParser in ClangRenato Golin1-44/+48
This is a starting point for using the TargetParser in Clang, in a simple enough part of the code that can be used without disrupting the crazy platform support that we need to be compatible with other toolchains. Also adding a few FIXME on obvious places that need replacing, but those cases will indeed break a few of the platform assumptions, as arch/cpu names change multiple times in the driver. Finally, I'm changing the "neon-vfpv3" behaviour to match standard NEON, since -mfpu=neon implies vfpv3 by default in both Clang and LLVM. That option string is still supported as an alias to "neon". llvm-svn: 236901
2015-05-08Revert "Allow case-insensitive values for -mcpu for ARM and AArch64"Renato Golin1-4/+3
This reverts commit r236859, as it broke multiple builds. I'll investigate and reapply when safe. llvm-svn: 236869
2015-05-08Allow case-insensitive values for -mcpu for ARM and AArch64Renato Golin1-3/+4
GCC allows case-insensitive values for -mcpu, -march and -mtune options. This patch implements the same behaviour for the -mcpu option. Patch by Gabor Ballabas. llvm-svn: 236859
2015-05-08[ARM] Give an error on invalid -march valuesJohn Brawn1-1/+14
llvm::Triple::getARMCPUForArch now returns nullptr for invalid -march values, instead of silently translating it to arm7tdmi. Use this to give an error message, which is consistent with how gcc behaves. Differential Revision: http://reviews.llvm.org/D9602 llvm-svn: 236846
2015-05-06[driver] Cosmetic change to use Input instead of Inputs[0].Artem Belevich1-13/+13
Differential Revision: http://reviews.llvm.org/D9506 llvm-svn: 236621
2015-05-05[SystemZ] Add support for z13 and its vector facilityUlrich Weigand1-0/+8
This patch adds support for the z13 architecture type. For compatibility with GCC, a pair of options -mvx / -mno-vx can be used to selectively enable/disable use of the vector facility. When the vector facility is present, we default to the new vector ABI. This is characterized by two major differences: - Vector types are passed/returned in vector registers (except for unnamed arguments of a variable-argument list function). - Vector types are at most 8-byte aligned. The reason for the choice of 8-byte vector alignment is that the hardware is able to efficiently load vectors at 8-byte alignment, and the ABI only guarantees 8-byte alignment of the stack pointer, so requiring any higher alignment for vectors would require dynamic stack re-alignment code. However, for compatibility with old code that may use vector types, when *not* using the vector facility, the old alignment rules (vector types are naturally aligned) remain in use. These alignment rules are not only implemented at the C language level, but also at the LLVM IR level. This is done by selecting a different DataLayout string depending on whether the vector ABI is in effect or not. Based on a patch by Richard Sandiford. llvm-svn: 236531
2015-04-30InstrProf: Support for setting profile output from command lineJustin Bogner1-3/+9
This change is the third of 3 patches to add support for specifying the profile output from the command line via -fprofile-instr-generate=<path>, where the specified output path/file will be overridden by the LLVM_PROFILE_FILE environment variable. This patch adds the necessary support to the clang frontend, and adds a new test. The compiler-rt and llvm parts are r236055 and r236288, respectively. Patch by Teresa Johnson. Thanks! llvm-svn: 236289
2015-04-29Revert r236060, it caused PR23375.Nico Weber1-1/+23
llvm-svn: 236159
2015-04-28Stop emitting the soft-float and soft-float-abi target featuresEric Christopher1-23/+1
for ARM while the backend will only ignore them. No functional change intended. llvm-svn: 236060