aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Driver/Tools.cpp
AgeCommit message (Collapse)AuthorFilesLines
2015-04-27Introduce tsan_cxx and msan_cxx libraries (Clang part).Alexey Samsonov1-2/+8
For now tsan_cxx and msan_cxx contain only operator new/delete replacements. In the future, when we add support for running UBSan+TSan and UBSan+MSan, they will also contain bits ubsan_cxx runtime. llvm-svn: 235924
2015-04-27Revert "PR21000: pass -I options to assembler" as the test was failing on ↵Artem Belevich1-4/+0
hexagon. llvm-svn: 235919
2015-04-27PR21000: pass -I options to assemblerArtem Belevich1-0/+4
Pass -I options to assembly so it can find files included with .include. Differential Revision: http://reviews.llvm.org/D7472 llvm-svn: 235915
2015-04-27Support generating NMake/Jom-style depfiles.Paul Robinson1-0/+1
NMake is a Make-like builder that comes with Microsoft Visual Studio. Jom (https://wiki.qt.io/Jom) is an NMake-compatible build tool. Dependency files for NMake/Jom need to use double-quotes to wrap filespecs containing special characters, instead of the backslash escapes that GNU Make wants. Adds the -MV option, which specifies to use double-quotes as needed instead of backslash escapes when writing the dependency file. Differential Revision: http://reviews.llvm.org/D9260 llvm-svn: 235903
2015-04-16[AArch64] Add v8.1a architectureVladimir Sukharev1-1/+10
Add support for AArch64 v8.1 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 Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D8493 llvm-svn: 235110
2015-04-15uselistorder: -mllvm -preserve-bc-use-list-order => -emit-llvm-uselistsDuncan P. N. Exon Smith1-4/+2
Stop relying on `cl::opt` to pass along the driver's decision to preserve use-lists. Create a new `-cc1` option called `-emit-llvm-uselists` that does the right thing (when -emit-llvm-bc). Note that despite its generic name, it *doesn't* do the right thing when -emit-llvm (LLVM assembly) yet. I'll hook that up soon. This doesn't really change the behaviour of the driver. The default is still to preserve use-lists for `clang -emit-llvm` and `clang -save-temps`, and nothing else. But it stops relying on global state (and also is a nicer interface for hackers using `clang -cc1`). llvm-svn: 234962
2015-04-14IR: Change clang to set -preserve-bc-uselistorderDuncan P. N. Exon Smith1-0/+9
Change `clang` to set `-preserve-bc-uselistorder` for the driver options `-emit-llvm` and `-save-temps`. The former is useful for reproducing results from `clang` in `opt` or `llc`, while the latter prevents `-save-temps` from affecting the output. This is part of PR5680. `-preserve-bc-uselistorder=true` is currently on by default, but a follow-up commit in LLVM will reverse it. llvm-svn: 234920
2015-04-14[Mips] Generate warning for invalid '-mnan' and '-march' combinationsPetar Jovanovic1-5/+35
This patch generates a warning for invalid combination of '-mnan' and '-march' options, it properly sets NaN encoding for a given '-march', and it passes a proper NaN encoding to the assembler. Patch by Vladimir Radosavljevic. Differential Revision: http://reviews.llvm.org/D8170 llvm-svn: 234882
2015-04-11[Driver] Properly support -mglobal-merge using explicit options.Ahmed Bougacha1-6/+10
Follow-up to r234666. With this, the -m[no-]global-merge options have the expected behavior. Previously, -mglobal-merge was ignored, and there was no way of enabling the optimization. llvm-svn: 234668
2015-04-10NaCl ARM: fix assembler float abi flagsDerek Schuff1-1/+2
Summary: tools::arm::getARMFloatABI() was falling back to guessing soft-float because it wasn't seeing the GNUEABIHF environment from ComputeEffectivClangTriple when it was called from gnutools::Assemble::ConstructJob. Fix by using the effective clang triple in gnutools::Assemble, which now matches the -triple flag used by cc1 and ClangAs jobs. Reviewers: jvoung Subscribers: rengolin, jfb, aemerson, cfe-commits Differential Revision: http://reviews.llvm.org/D8902 llvm-svn: 234661
2015-04-09Process the -freciprocal-math optimization flag (PR20912)Sanjay Patel1-0/+3
The driver currently accepts but ignores the -freciprocal-math flag. This patch passes the flag through and enables 'arcp' fast-math-flag generation in IR. Note that this change does not actually enable the optimization for any target. The reassociation optimization that this flag specifies was implemented by http://reviews.llvm.org/D6334 : http://llvm.org/viewvc/llvm-project?view=revision&revision=222510 Because the optimization is done in the backend rather than IR, the backend must be modified to understand instruction-level fast-math-flags or a new function-level attribute must be created. Also note that -freciprocal-math is independent of any target-specific usage of reciprocal estimate hardware instructions. That requires its own flag ('-mrecip'). https://llvm.org/bugs/show_bug.cgi?id=20912 llvm-svn: 234493
2015-04-09[ARM] add support for Cortex-R4/R4FJaved Absar1-1/+1
Adds ARM Cortex-R4 and R4F support and tests in Clang. Though Cortex-R4 support was present, the support for hwdiv in thumb-mode was not defined or tested properly. This has also been added. llvm-svn: 234488
2015-04-06This reverts commit r234104, bringing back 233393 now that ARM is fixed.Rafael Espindola1-3/+6
Original message: Don't use unique section names by default if using the integrated as. This saves some IO and ccache space by not creating long section names. It should work with every ELF linker. llvm-svn: 234143
2015-04-04Revert "Revert "Revert "Don't use unique section names by default if using ↵Rafael Espindola1-6/+3
the integrated as.""" This reverts commit r234101. I will debug what went wrong with ARM. llvm-svn: 234104
2015-04-04Revert "Revert "Don't use unique section names by default if using the ↵Rafael Espindola1-3/+6
integrated as."" This reverts commit r233398, bringing back 233393 now that LLVM is fixed. Original message: Don't use unique section names by default if using the integrated as. This saves some IO and ccache space by not creating long section names. It should work with every ELF linker. llvm-svn: 234101
2015-04-04Complete comment. Reflow conditional.Eric Christopher1-3/+2
llvm-svn: 234083
2015-04-01[UBSan] Embed UBSan into ASan runtime (Clang part).Alexey Samsonov1-11/+3
Summary: Change the way we use ASan and UBSan together. Instead of keeping two separate runtimes (libclang_rt.asan and libclang_rt.ubsan), embed UBSan into ASan and get rid of libclang_rt.ubsan. If UBSan is not supported on a platform, all UBSan sources are just compiled into dummy empty object files. UBSan initialization code (e.g. flag parsing) is directly called from ASan initialization, so we are able to enforce correct initialization order. This mirrors the approach we already use for ASan+LSan. This change doesn't modify the way we use standalone UBSan. Test Plan: regression test suite Reviewers: kubabrecka, zaks.anna, kcc, rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D8645 llvm-svn: 233860
2015-04-01[SystemZ] Support transactional execution on zEC12Ulrich Weigand1-0/+15
The zEC12 provides the transactional-execution facility. This is exposed to users via a set of builtin routines on other compilers. This patch adds clang support to enable those builtins. In partciular, the patch: - enables the transactional-execution feature by default on zEC12 - allows to override presence of that feature via the -mhtm/-mno-htm options - adds a predefined macro __HTM__ if the feature is enabled - adds support for the transactional-execution GCC builtins - adds Sema checking to verify the __builtin_tabort abort code - adds the s390intrin.h header file (for GCC compatibility) - adds s390 sections to the htmintrin.h and htmxlintrin.h header files Since this is first use of target-specific intrinsics on the platform, the patch creates the include/clang/Basic/BuiltinsSystemZ.def file and hooks it up in TargetBuiltins.h and lib/Basic/Targets.cpp. An associated LLVM patch adds the required LLVM IR intrinsics. For reference, the transactional-execution instructions are documented in the z/Architecture Principles of Operation for the zEC12: http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/download/DZ9ZR009.pdf The associated builtins are documented in the GCC manual: http://gcc.gnu.org/onlinedocs/gcc/S_002f390-System-z-Built-in-Functions.html The htmxlintrin.h intrinsics provided for compatibility with the IBM XL compiler are documented in the "z/OS XL C/C++ Programming Guide". llvm-svn: 233804
2015-03-31[X86] Use getHostCPUFeatures when 'native' is specified for cpu.Craig Topper1-0/+11
This is necessary because not aall Sandybridge, Ivybrige, Haswell, and Broadwell CPUs support AVX. Currently we modify the CPU name back to Nehalem for this case, but that turns off additional features for these CPUs. llvm-svn: 233672
2015-03-30Add driver support for Native Client SDKDerek Schuff1-0/+166
Add Tool and ToolChain support for clang to target the NaCl OS using the NaCl SDK for x86-32, x86-64 and ARM. Includes nacltools::Assemble and Link which are derived from gnutools. They are similar to Linux but different enought that they warrant their own class. Also includes a NaCl_TC in ToolChains derived from Generic_ELF with library and include paths suitable for an SDK and independent of the system tools. Differential Revision: http://reviews.llvm.org/D8590 llvm-svn: 233594
2015-03-27Revert "Don't use unique section names by default if using the integrated as."Rafael Espindola1-6/+3
This reverts commit r233393 while a debug a bot failure. llvm-svn: 233398
2015-03-27Don't use unique section names by default if using the integrated as.Rafael Espindola1-3/+6
This saves some IO and ccache space by not creating long section names. It should work with every ELF linker. llvm-svn: 233393
2015-03-26Enable -ffunction-sections and -fdata-sections for CloudABI by default.Ed Schouten1-2/+5
Unlike most of the other platforms supported by Clang, CloudABI only supports static linkage, for the reason that global filesystem access is prohibited. Functions provided by dlfcn.h are not present. As we know that applications will not try to do any symbol lookups at run-time, we can garbage collect unused code quite aggressively. Because of this, it makes sense to enable -ffunction-sections and -fdata-sections by default. Object files will be a bit larger than usual, but the resulting binary will not be affected, as the sections are merged again. However, when --gc-sections is used, the linker is able to remove unused code far more more aggressively. It also has the advantage that transitive library dependencies only need to be provided to the linker in case that functionality is actually used. Differential Revision: http://reviews.llvm.org/D8635 Reviewed by: echristo llvm-svn: 233299
2015-03-26Let Clang invoke CloudABI's linker.Ed Schouten1-0/+70
Now that CloudABI's target information and header search logic for Clang has been submitted, the only thing that remains to be done is adding support for CloudABI's linker. CloudABI uses Binutils ld, although there is some work to use lld instead. This means that this code is largely based on what we use on FreeBSD. There are some exceptions, however: - Only static linking is performed. CloudABI does not support any dynamically linked executables. - CloudABI uses compiler-rt, libc++ and libc++abi unconditionally. Link in these libraries instead of using libgcc_s, libstdc++, etc. - We must ensure that the .eh_frame_hdr is present to make C++ exceptions work properly. Differential Revision: http://reviews.llvm.org/D8250 llvm-svn: 233269
2015-03-23[UBSan] Introduce "ubsan_standalone" library (Clang part).Alexey Samsonov1-7/+10
Get rid of "libclang_rt.san" library that used to contain sanitizer_common pieces required by UBSan if it's used in a standalone mode. Instead, build two variants of UBSan runtime: "ubsan" and "ubsan_standalone" (same for "ubsan_cxx" and "ubsan_standalone_cxx"). Later "ubsan" and "ubsan_cxx" libraries will go away, as they will embedded it into corresponding ASan runtimes. llvm-svn: 233010
2015-03-23Fix and update comments and a small reformatting.Eric Christopher1-4/+3
llvm-svn: 232997
2015-03-23handle armeb/thumb/thumbeb consistently in gnutools::Assemble::ConstructJobScott Douglass1-5/+10
Differential Revision: http://reviews.llvm.org/D8196 llvm-svn: 232940
2015-03-23Convert cascading if-else-if to switch. NFCScott Douglass1-14/+32
Differential Revision: http://reviews.llvm.org/D8485 llvm-svn: 232939
2015-03-22MS ABI: Implement driver-level support for thread-safe staticsDavid Majnemer1-27/+31
Decide whether or not to use thread-safe statics depending on whether or not we have an explicit request from the driver. If we don't have an explicit request, infer which behavior to use depending on the compatibility version we are targeting. N.B. CodeGen support is still ongoing. llvm-svn: 232906
2015-03-20Only add -fno-rtti if KernelOrKext or in C++ mode.Filipe Cabecinhas1-2/+3
llvm-svn: 232869
2015-03-20C++14: Disable sized deallocation by default due to ABI breakageReid Kleckner1-0/+6
There are no widely deployed standard libraries providing sized deallocation functions, so we have to punt and ask the user if they want us to use sized deallocation. In the future, when such libraries are deployed, we can teach the driver to detect them and enable this feature. N3536 claimed that a weak thunk from sized to unsized deallocation could be emitted to avoid breaking backwards compatibility with standard libraries not providing sized deallocation. However, this approach and other variations don't work in practice. With the weak function approach, the thunk has to have default visibility in order to ensure that it is overridden by other DSOs providing sized deallocation. Weak, default visibility symbols are particularly expensive on MachO, so John McCall was considering disabling this feature by default on Darwin. It also changes behavior ELF linking behavior, causing certain otherwise unreferenced object files from an archive to be pulled into the link. Our second approach was to use an extern_weak function declaration and do an inline conditional branch at the deletion call site. This doesn't work because extern_weak only works on MachO if you have some archive providing the default value of the extern_weak symbol. Arranging to provide such an archive has the same challenges as providing the symbol in the standard library. Not to mention that extern_weak doesn't really work on COFF. Reviewers: rsmith, rjmccall Differential Revision: http://reviews.llvm.org/D8467 llvm-svn: 232788
2015-03-19Add option to switch off putting header modules into the dependency file.Manuel Klimek1-2/+3
llvm-svn: 232721
2015-03-18Remove many superfluous SmallString::str() calls.Yaron Keren1-10/+10
Now that SmallString is a first-class citizen, most SmallString::str() calls are not required. This patch removes a whole bunch of them, yet there are lots more. There are two use cases where str() is really needed: 1) To use one of StringRef member functions which is not available in SmallString. 2) To convert to std::string, as StringRef implicitly converts while SmallString do not. We may wish to change this, but it may introduce ambiguity. llvm-svn: 232622
2015-03-17Imply linker arguments from '-fveclib' option.Michael Zolotukhin1-0/+10
Summary: As discussed in D8097, we should provide corresponding linking flags when 'fveclib' is specified. Reviewers: hfinkel Differential Revision: http://reviews.llvm.org/D8362 llvm-svn: 232556
2015-03-17Add fveclib option.Michael Zolotukhin1-0/+2
Review: http://reviews.llvm.org/D8097 llvm-svn: 232533
2015-03-17[ARM] Add support for ARMV6K subtarget (Clang)Renato Golin1-3/+4
ARMv6K is another layer between ARMV6 and ARMV6T2. This is the Clang side of the changes. ARMV6 family LLVM implementation. +-------------------------------------+ | ARMV6 | +----------------+--------------------+ | ARMV6M (thumb) | ARMV6K (arm,thumb) | <- From ARMV6K and ARMV6M processors +----------------+--------------------+ have support for hint instructions | ARMV6T2 (arm,thumb,thumb2) | (SEV/WFE/WFI/NOP/YIELD). They can +-------------------------------------+ be either real or default to NOP. | ARMV7 (arm,thumb,thumb2) | The two processors also use +-------------------------------------+ different encoding for them. Patch by Vinicius Tinti. llvm-svn: 232469
2015-03-12Fix grammar in a comment, wrap to 80 columns. No behavior change.Nico Weber1-2/+3
llvm-svn: 232087
2015-03-11[PowerPC] ABI support for the QPX vector instruction setHal Finkel1-1/+14
Support for the QPX vector instruction set, used on the IBM BG/Q supercomputer, has recently been added to the LLVM PowerPC backend. This vector instruction set requires some ABI modifications because the ABI on the BG/Q expects <4 x double> vectors to be provided with 32-byte stack alignment, and to be handled as native vector types (similar to how Altivec vectors are handled on mainline PPC systems). I've named this ABI variant elfv1-qpx, have made this the default ABI when QPX is supported, and have updated the ABI handling code to provide QPX vectors with the correct stack alignment and associated register-assignment logic. llvm-svn: 231960
2015-03-11Gender-neutralize a comment.Nico Weber1-2/+2
llvm-svn: 231891
2015-03-07Much like we silence warnings about -flto in many cases to facilitateChandler Carruth1-0/+2
simplicity in build systems, silence '-stdlib=libc++' when linking. Even if we're not linking C++ code per-se, we may be passing this flag so that when we are linking C++ code we pick up the desired standard library. While most build systems already provide separate C and C++ compile flags, many conflate link flags. Sadly, CMake is among them causing this warning in a libc++ selfhost. llvm-svn: 231559
2015-03-04Pass -dll to link.exe when building with -shared (PR22697)Hans Wennborg1-1/+3
And start building a test for non-clang-cl link.exe invocations. llvm-svn: 231312
2015-03-03Don't force -pie for Android.Dan Albert1-5/+1
Summary: There is no -no-pie flag that can override this, so making it default to being on for Android means it is no longer possible to create non-PIE executables on Android. While current versions of Android support (and the most recent requires) PIE, ICS and earlier versions of Android cannot run PIE executables, so this needs to be optional. Reviewers: srhines Reviewed By: srhines Subscribers: thakis, volkalexey, cfe-commits Differential Revision: http://reviews.llvm.org/D8015 llvm-svn: 231091
2015-03-03[SDK modernizer]. Patch fixes driver's lack ofFariborz Jahanian1-0/+1
recognition of mernizer's -objcmt-migrate-property-dot-syntax option with a new test in test/Driver. rdar://19994452 llvm-svn: 231080
2015-03-03Revert r231008 (and dependent r231019).Daniel Jasper1-1/+0
As Chandler responded on the initial commit, just directly setting the triple through -Xclang option to the driver creates havoc on other platforms. The driver test should specifically go into test/Driver and test the cc1 commandline itself. llvm-svn: 231063
2015-03-02[SDK modernizer]. Patch fixes driver's lack ofFariborz Jahanian1-0/+1
recognition of mernizer's -objcmt-migrate-property-dot-syntax option. rdar://19994452 llvm-svn: 231008
2015-03-02Add clang support for Objective-C application extensions.Bob Wilson1-0/+10
This adds the -fapplication-extension option, along with the ios_app_extension and macosx_app_extension availability attributes. Patch by Ted Kremenek llvm-svn: 230989
2015-03-01Add missing include.Benjamin Kramer1-0/+1
llvm-svn: 230910
2015-02-26Add -fuse-line-directive flag to control usage of #line with -EReid Kleckner1-0/+5
Currently -fms-extensions controls this behavior, which doesn't make much sense. It means we can't identify what is and isn't a system header when compiling our own preprocessed output, because #line doesn't represent this information. If someone is feeding Clang's preprocessed output to another compiler, they can use this flag. Fixes PR20553. Reviewers: rsmith Differential Revision: http://reviews.llvm.org/D5217 llvm-svn: 230587
2015-02-23-fms-extensions: Bump the default _MSC_VER from 1700 to 1800, aka VS2013Reid Kleckner1-1/+1
VS 2013 is the minimum supported version, so it's reasonable for Clang to simulate this by default. This also simplifies the clang-cl self-host, since we have the 18.00 version check. llvm-svn: 230243
2015-02-21Move -fdefine-sized-deallocation and -fno-sized-deallocation options from ↵Larisse Voufo1-9/+0
driver into CC1 for now. llvm-svn: 230112