aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Driver/Tools.cpp
AgeCommit message (Collapse)AuthorFilesLines
2014-10-07Emit diagnostic for -munaligned-access on v6mJonathan Roelofs1-2/+1
Patch by: Charlie Turner <charlie.turner@arm.com> llvm-svn: 219211
2014-10-03CFE Knob for: Add a thread-model knob for lowering atomics on baremetal & ↵Jonathan Roelofs1-0/+6
single threaded systems http://reviews.llvm.org/D4985 llvm-svn: 219027
2014-10-03Revert changes in r218863, r218864Asiri Rathnayake1-51/+7
Summary: The changes introduced in the above two commits are giving a rough time to one of the build bots. Reverting the changes for the moment so that the bot can go green again. Change-Id: Id19f6cb2a8bc292631fac2262268927563d820c2 llvm-svn: 218970
2014-10-02[ARM] Handle conflicts between -mfpu and -mfloat-abi options.Asiri Rathnayake1-7/+51
Summary: This patch implements warnings/downgradable errors for invalid -mfpu, -mfloat-abi option combinations (e.g. -mfpu=none -mfloat-abi=hard). Change-Id: I94fa664e1bc0b5855ad835abd7a50a3e0395632d llvm-svn: 218863
2014-10-01[ARM] Add support for Cortex-M7, FPv5-SP and FPv5-DPOliver Stannard1-1/+13
The Cortex-M7 has 3 options for its FPU: none, FPv5-SP-D16 and FPv5-DP-D16. FPv5 has the same instructions as FP-ARMv8, so it can be modeled using the same target feature, and all double-precision operations are already disabled by the fp-only-sp target features. llvm-svn: 218748
2014-09-30Enable both C and C++ modules with -fmodules, by switching -fcxx-modules toRichard Smith1-4/+4
being on by default. -fno-cxx-modules can still be used to enable C modules but not C++ modules, but C++ modules is not significantly less stable than C modules any more. Also remove some of the scare words from the modules documentation. We're certainly not going to remove modules support (though we might change the interface), and it works well enough to bootstrap and build lots of non-trivial code. Note that this does not represent a commitment to the current interface nor implementation, and we still intend to follow whatever direction the C and C++ committees take regarding modules support. llvm-svn: 218717
2014-09-26Don't link in sanitizer runtimes if -nostdlib/-nodefaultlibs is provided.Alexey Samsonov1-0/+4
It makes no sense to link in sanitizer runtimes in this case: the user probably doesn't want to see any system/toolchain libs in his link if he provides these flags, and the link will most likely fail anyway - as sanitizer runtimes depend on libpthread, libdl, libc etc. Also, see discussion in https://code.google.com/p/address-sanitizer/issues/detail?id=344 llvm-svn: 218541
2014-09-16Fix forwarding -l to MSVC's link.exeReid Kleckner1-6/+24
Translate -lfoo to -lfoo.lib while making sure that -lfoo.lib stays as -lfoo.lib. Also, these arguments were being passed twice: once explicitly via AddAllArgs, and again implicitly as linker inputs. Now they are passed once. Fixes PR20868. llvm-svn: 217895
2014-09-15Major rewrite of linking strategy for sanitizer runtimes on Linux.Alexey Samsonov1-143/+105
Change 1: we used to add static sanitizer runtimes at the very beginning of the linker invocation, even before crtbegin.o, which is gross and not correct in general. Fix this: now addSanitizerRuntimes() adds all sanitizer-related link flags to the end of the linker invocation being constructed. It means, that we should call this function in the correct place, namely, before AddLinkerInputs() to make sure sanitizer versions of library functions will be preferred. Change 2: Put system libraries sanitizer libraries depend on at the end of the linker invocation, where all the rest system libraries are located. Respect --nodefaultlibs and --nostdlib flags. This is another way to fix PR15823. Original fix landed in r215940 put "-lpthread" and friends immediately after static ASan runtime, before the user linker inputs. This caused significant slowdown in dynamic linker for large binaries linked against thousands of shared objects. Instead, to mark system libraries as DT_NEEDED we prepend them with "--no-as-needed" flag, discarding the "-Wl,--as-needed" flag that could be provided by the user. Otherwise, this change is a code cleanup. Instead of having a special method for each sanitizer, we introduce a function collectSanitizerRuntimes() that analyzes -fsanitize= flags and returns the set of static and shared libraries that needs to be linked. llvm-svn: 217817
2014-09-15Teach Clang how to use response files when calling other toolsReid Kleckner1-3/+30
Patch by Rafael Auler! This patch addresses PR15171 and teaches Clang how to call other tools with response files, when the command line exceeds system limits. This is a problem for Windows systems, whose maximum command-line length is 32kb. I introduce the concept of "response file support" for each Tool object. A given Tool may have full support for response files (e.g. MSVC's link.exe) or only support file names inside response files, but no flags (e.g. Apple's ld64, as commented in PR15171), or no support at all (the default case). Therefore, if you implement a toolchain in the clang driver and you want clang to be able to use response files in your tools, you must override a method (getReponseFileSupport()) to tell so. I designed it to support different kinds of tools and internationalisation needs: - VS response files ( UTF-16 ) - GNU tools ( uses system's current code page, windows' legacy intl. support, with escaped backslashes. On unix, fallback to UTF-8 ) - Clang itself ( UTF-16 on windows, UTF-8 on unix ) - ld64 response files ( only a limited file list, UTF-8 on unix ) With this design, I was able to test input file names with spaces and international characters for Windows. When the linker input is large enough, it creates a response file with the correct encoding. On a Mac, to test ld64, I temporarily changed Clang's behavior to always use response files regardless of the command size limit (avoiding using huge command line inputs). I tested clang with the LLVM test suite (compiling benchmarks) and it did fine. Test Plan: A LIT test that tests proper response files support. This is tricky, since, for Unix systems, we need a 2MB response file, otherwise Clang will simply use regular arguments instead of a response file. To do this, my LIT test generate the file on the fly by cloning many -DTEST parameters until we have a 2MB file. I found out that processing 2MB of arguments is pretty slow, it takes 1 minute using my notebook in a debug build, or 10s in a Release build. Therefore, I also added "REQUIRES: long_tests", so it will only run when the user wants to run long tests. In the full discussion in http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20130408/171463.html, Rafael Espindola discusses a proper way to test llvm::sys::argumentsFitWithinSystemLimits(), and, there, Chandler suggests to use 10 times the current system limit (20MB resp file), so we guarantee that the system will always use response file, even if a new linux comes up that can handle a few more bytes of arguments. However, by testing with a 20MB resp file, the test takes long 8 minutes just to perform a silly check to see if the driver will use a response file. I found it to be unreasonable. Thus, I discarded this approach and uses a 2MB response file, which should be enough. Reviewers: asl, rafael, silvas Reviewed By: silvas Subscribers: silvas, rnk, thakis, cfe-commits Differential Revision: http://reviews.llvm.org/D4897 llvm-svn: 217792
2014-09-15Add -fseh-exceptions for MinGW-w64Reid Kleckner1-0/+2
This adds a flag called -fseh-exceptions that uses the native Windows .pdata and .xdata unwind mechanism to throw exceptions. The other EH possibilities are DWARF and SJLJ exceptions. Patch by Martell Malone! Reviewed By: asl, rnk Differential Revision: http://reviews.llvm.org/D3419 llvm-svn: 217790
2014-09-12[ASan/Win] Fix PR20918 -- SEH handler doesn't work with the MD runtimeTimur Iskhodzhanov1-0/+3
llvm-svn: 217679
2014-09-12[ASan/Win] Rename asan_win_uar_thunk.lib to asan_win_dynamic_runtime_thunk.libTimur Iskhodzhanov1-1/+2
It turned out that we have to bridge more stuff between the executable and the ASan RTL DLL than just __asan_option_detect_stack_use_after_return. See PR20918 for more details. llvm-svn: 217673
2014-09-11Use the simpler version of llvm::sys::fs::exists.Rafael Espindola1-4/+1
In all these cases it looks like the intention was to handle error in a similar way to the file not existing. llvm-svn: 217614
2014-09-11Avoid some unnecessary SmallVector copies.Benjamin Kramer1-2/+2
No functionality change. llvm-svn: 217586
2014-09-04unique_ptrify JobList::JobsDavid Blaikie1-41/+44
llvm-svn: 217168
2014-09-04ARM: Default to apcs-gnu ABI for NetBSDOliver Stannard1-1/+6
r216662 changed the default ABI for 32-bit ARM targets to be "aapcs" when no environment is given in the triple, however NetBSD requires it to be "apcs-gnu". llvm-svn: 217141
2014-08-30Fix some cases where StringRef was being passed by const reference. Remove ↵Craig Topper1-5/+5
const from some other StringRefs since its implicitly const already. llvm-svn: 216825
2014-08-28Call powerpc-darwin external tools with -arch ppc.Rafael Espindola1-11/+3
With this patch we call external tools for powerpc-darwin with "-arch ppc" instead of "-arch powerpc", so as to be compatible with the cctools assembler and ld64 linker. Patch by Stephen Drake! llvm-svn: 216687
2014-08-28[ARM] Change default ABI for AArch32 to be "aapcs" (was "apcs-gnu")Oliver Stannard1-2/+1
The current default abi when no environment is given is "apcs-gnu", which is obsolete. This patch changes the default to "aapcs". "aapcs" has both hard- and soft-float variants, so the -mhard-float, -msoft-float and -mfloat-abi= options now all behave as expected when no environment is specified in the triple. While writing this I also noticed that a preprocessor test claims to be checking darwin, but is actually checking the defaults, which are different for darwin. llvm-svn: 216662
2014-08-27Allow __fp16 as a function arg or return type for AArch64Oliver Stannard1-0/+4
ACLE 2.0 allows __fp16 to be used as a function argument or return type. This enables this for AArch64. This also fixes an existing bug that causes clang to not allow homogeneous floating-point aggregates with a base type of __fp16. This is valid for AAPCS64, but not for AAPCS-VFP. llvm-svn: 216558
2014-08-27[asan] Restore asan-rt name on linux back to pre-r216380.Evgeniy Stepanov1-2/+1
There is no reason to have different library names for shared and static cases on linux. It also breaks Android where we install the shared asan-rt library into the system and should keep the old name. This change reverts most of r216380 limiting it to win32 targets only. llvm-svn: 216533
2014-08-26Convert MC command line flag for fatal assembler warnings into a properJoerg Sonnenberger1-2/+1
flag. llvm-svn: 216472
2014-08-26[ASan/Win] Add an extra thunk.lib to handle stack-use-after-return optionTimur Iskhodzhanov1-1/+4
With this patch, "check-asan" passes all the tests with both MT and MD ASan RTL if you set COMPILER_RT_BUILD_SHARED_ASAN to ON (PR20214) llvm-svn: 216447
2014-08-25[ASan] Rename the ASan dynamic RTTimur Iskhodzhanov1-1/+1
Reviewed at http://reviews.llvm.org/D5026 llvm-svn: 216380
2014-08-19Handle SPARC float command line parameters for SPARCv9.Brad Smith1-1/+2
llvm-svn: 216029
2014-08-18Update link strategy for sanitizer runtime libraries on Linux:Alexey Samsonov1-26/+33
1. Always put static sanitizer runtimes to the front of the linker invocation line. This was already done for all sanitizers except UBSan: in case user provides static libstdc++ we need to make sure that new/delete operator definitions are picked from sanitizer runtimes instead of libstdc++. We have to put UBSan runtime first for similar reasons: it depends on some libstdc++ parts (e.g. __dynamic_cast function), and has to go first in link line to ensure these functions will be picked up from libstdc++. 2. Put sanitizer libraries system dependencies (-ldl, -lpthread etc.) right after sanitizer runtimes. This will ensure these libraries participate in the link even if user provided -Wl,-as-needed flag. This should fix PR15823. 3. In case we link in several sanitizer runtimes (e.g. "ubsan", "ubsan_cxx" and "san"), add system dependencies (-ldl, -lpthread, ...) only once. llvm-svn: 215940
2014-08-15Move some code into a helper function. NFC.Rafael Espindola1-45/+48
llvm-svn: 215731
2014-08-14Use the big endian emulations for NetBSD/arm in EB mode.Joerg Sonnenberger1-2/+17
llvm-svn: 215670
2014-08-14Delete support for AuroraUX.Rafael Espindola1-108/+0
auroraux.org is not resolving. llvm-svn: 215644
2014-08-13Revert what looks like an unintended change in r215557.Rafael Espindola1-1/+1
Should fix test ulibc driver tests. llvm-svn: 215561
2014-08-13Header guard canonicalization, clang part.Benjamin Kramer1-1/+1
Modifications made by clang-tidy with minor tweaks. llvm-svn: 215557
2014-08-13[Driver] Support -muclibc / -mglibc command line options for a coupleSimon Atanasyan1-1/+10
of MIPS toolchains. The uCLibc implemented for multiple architectures. A couple of MIPS toolchains contains both uCLibc and glibc implementation so these options allow to select used C library. Initially -muclibc / -mglibc (as well as -mbionic) have been implemented in gcc for various architectures so they are not MIPS specific. llvm-svn: 215552
2014-08-13For NetBSD, use the same settings for PPC64 as for PPC when it comes toJoerg Sonnenberger1-0/+12
integrated assembler, libc++ and libgcc. Set emulation for ld for both platforms for correct -m32 handling. llvm-svn: 215551
2014-08-13Emit diagnostic for -munaligned-access on v6m targetsOliver Stannard1-1/+5
Rather than silently disabling unaligned accesses for v6m targets as in the previous patch to llvm, instead produce a warning saying that this architecture doesn't support unaligned accesses. Patch by Ben Foster llvm-svn: 215531
2014-08-11GCC compatibility: Ignore -fexec-charset=UTF-8 argument. It is the default ↵Sylvestre Ledru1-0/+8
in Clang. Reject other values. Summary: Just like with -finput-charset=UTF-8 in review http://reviews.llvm.org/D4347, I think we should just ignore it when UTF-8 is provided. Reviewers: rnk, rafael Reviewed By: rafael Subscribers: rafael, cfe-commits Differential Revision: http://reviews.llvm.org/D4841 llvm-svn: 215368
2014-08-09NetBSD/aarch64 has no libgcc or libstdc++. Drop arm64 tests.Joerg Sonnenberger1-0/+1
llvm-svn: 215291
2014-08-08Add -link-cxx-sanitizer driver flag.Alexey Samsonov1-5/+5
Summary: This flag can be used to force linking of CXX-specific parts of sanitizer runtimes into the final executable. It gives more precise control than --driver-mode=g++ and comes handy when user links several object files with sanitized C++ code into an executable, but wants to provide libstdc++ himself, instead of relying on Clang dirver's behavior. Test Plan: clang regression test suite Reviewers: chandlerc, rsmith Reviewed By: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D4824 llvm-svn: 215252
2014-08-08Partially revert r215204 - [mips] Add -mabicalls/-mno-abicalls to the driverDaniel Sanders1-3/+0
It wasn't actually a bug that -mabicalls/-mno-abicalls wasn't being passed to GAS. The only reason we pass it to the integrated assembler is because it shares the same framework with CodeGen. llvm-svn: 215236
2014-08-08[mips] Invert the abicalls feature bit to be noabicalls so that it's ↵Daniel Sanders1-8/+2
possible for -mno-abicalls to take effect. Also added the testcase that should have been in r215194. This behaviour has surprised me a few times now. The problem is that the generated MipsSubtarget::ParseSubtargetFeatures() contains code like this: if ((Bits & Mips::FeatureABICalls) != 0) IsABICalls = true; so '-abicalls' means 'leave it at the default' and '+abicalls' means 'set it to true'. In this case, (and the similar -modd-spreg case) I'd like the code to be IsABICalls = (Bits & Mips::FeatureABICalls) != 0; or possibly: if ((Bits & Mips::FeatureABICalls) != 0) IsABICalls = true; else IsABICalls = false; and preferably arrange for 'Bits & Mips::FeatureABICalls' to be true by default (on some triples). llvm-svn: 215211
2014-08-08[mips] Add -mabicalls/-mno-abicalls to the driverDaniel Sanders1-0/+12
Based on a patch by Matheus Almeida. I've added testcases and fixed a bug where the options weren't passed on to GAS. llvm-svn: 215204
2014-08-07Driver: Add -fno-profile-arcs to go with -fprofile-arcsJustin Bogner1-2/+4
This is a trivial gcc-compatible change. llvm-svn: 215051
2014-08-07Use -Rblah, not -Wblah, to control remark diagnostics. This was always theRichard Smith1-9/+1
intent when we added remark support, but was never implemented in the general case, because the first -R flags didn't need it. (-Rpass= had special handling to accomodate its argument.) -Rno-foo, -Reverything, and -Rno-everything can be used to turn off a remark, or to turn on or off all remarks. Per discussion on cfe-commits, -Weverything does not affect remarks, and -Reverything does not affect warnings or errors. The only "real" -R flag we have right now is -Rmodule-build; that flag is effectively renamed from -Wmodule-build to -Rmodule-build by this change. -Wpass and -Wno-pass (and their friends) are also renamed to -Rpass and -Rno-pass by this change; it's not completely clear whether we intended to have a -Rpass (with no =pattern), but that is unchanged by this commit, other than the flag name. The default pattern is effectively one which matches no passes. In future, we may want to make the default pattern be .*, so that -Reverything works for -Rpass properly. llvm-svn: 215046
2014-08-05Introduce f[no-]max-unknown-pointer-align=[number] optionFariborz Jahanian1-0/+15
to instruct the code generator to not enforce a higher alignment than the given number (of bytes) when accessing memory via an opaque pointer or reference. Patch reviewed by John McCall (with post-commit review pending). rdar://16254558 llvm-svn: 214911
2014-08-04Add coverage mapping generation.Alex Lorenz1-0/+8
This patch adds the '-fcoverage-mapping' option which allows clang to generate the coverage mapping information that can be used to provide code coverage analysis using the execution counts obtained from the instrumentation based profiling (-fprofile-instr-generate). llvm-svn: 214752
2014-08-04[Driver][Mips] Construct dynamic linker path by string concatination.Simon Atanasyan1-12/+17
That reduces a number of `if` operators and prevent a combinatorics explosion if/when more dynamic linker path variants added. No functional changes. llvm-svn: 214712
2014-08-03Tools.cpp: Avoid std::to_string() on -fbuild-session-timestamp to appease ↵NAKAMURA Takumi1-3/+4
mingw32 builder. llvm-svn: 214656
2014-08-01Add -fbuild-session-file as an alternative to -fbuild-session-timestampBen Langmuir1-1/+15
Build systems tend to traffic in files and modification times, so having them touch a file at the beginning of the build can be easier than having them update the compile command they use every time they build. llvm-svn: 214577
2014-07-29Fix up handling of ARM options for controlling strict alignment.Bob Wilson1-23/+18
The -mstrict-align option was originally added in r167619 as a target- independent option. It was then changed in r167623 to be implemented with an ARM-specific backend option, even though the code remained in the target-independent Clang::ConstructJob function. This means that if you used the -mstrict-align option with a non-ARM target, you would still get the -arm-strict-align option getting passed to the backend, which was harmless but gross. The driver option was then replaced by the GCC-compatible -m[no-]unaligned-access option (r189175) and modified to work with AArch64 (r208075). However, in the process, the help text for -mstrict-align was incorrectly changed to show it as only being supported for AArch64. Even worse, the logic for handling these options together with -mkernel was wrong for AArch64, where -mkernel does not currently imply strict alignment. This patch fixes up all of those things. Besides the obvious change to the option help text, it moves the logic into the ARM and AArch64-specific parts of the driver, so that the option will be correctly ignored for non-ARM targets. <rdar://problem/17823697> llvm-svn: 214148
2014-07-28[PowerPC] Support ELFv1/ELFv2 ABI selection via -mabi= optionUlrich Weigand1-3/+43
While Clang now supports both ELFv1 and ELFv2 ABIs, their use is currently hard-coded via the target triple: powerpc64-linux is always ELFv1, while powerpc64le-linux is always ELFv2. These are of course the most common scenarios, but in principle it is possible to support the ELFv2 ABI on big-endian or the ELFv1 ABI on little-endian systems (and GCC does support that), and there are some special use cases for that (e.g. certain Linux kernel versions could only be built using ELFv1 on LE). This patch implements the Clang side of supporting this, based on the LLVM commit 214072. The command line options -mabi=elfv1 or -mabi=elfv2 select the desired ABI if present. (If not, Clang uses the same default rules as now.) Specifically, the patch implements the following changes based on the presence of the -mabi= option: In the driver: - Pass the appropiate -target-abi flag to the back-end - Select the correct dynamic loader version (/lib64/ld64.so.[12]) In the preprocessor: - Define _CALL_ELF to the appropriate value (1 or 2) In the compiler back-end: - Select the correct ABI in TargetInfo.cpp - Select the desired ABI for LLVM via feature (elfv1/elfv2) llvm-svn: 214074