summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/Tools.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [Driver] Properly support -mglobal-merge using explicit options.Ahmed Bougacha2015-04-111-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
* NaCl ARM: fix assembler float abi flagsDerek Schuff2015-04-101-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
* Process the -freciprocal-math optimization flag (PR20912)Sanjay Patel2015-04-091-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
* [ARM] add support for Cortex-R4/R4FJaved Absar2015-04-091-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
* This reverts commit r234104, bringing back 233393 now that ARM is fixed.Rafael Espindola2015-04-061-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
* Revert "Revert "Revert "Don't use unique section names by default if using ↵Rafael Espindola2015-04-041-6/+3
| | | | | | | | the integrated as.""" This reverts commit r234101. I will debug what went wrong with ARM. llvm-svn: 234104
* Revert "Revert "Don't use unique section names by default if using the ↵Rafael Espindola2015-04-041-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
* Complete comment. Reflow conditional.Eric Christopher2015-04-041-3/+2
| | | | llvm-svn: 234083
* [UBSan] Embed UBSan into ASan runtime (Clang part).Alexey Samsonov2015-04-011-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
* [SystemZ] Support transactional execution on zEC12Ulrich Weigand2015-04-011-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
* [X86] Use getHostCPUFeatures when 'native' is specified for cpu.Craig Topper2015-03-311-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
* Add driver support for Native Client SDKDerek Schuff2015-03-301-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
* Revert "Don't use unique section names by default if using the integrated as."Rafael Espindola2015-03-271-6/+3
| | | | | | This reverts commit r233393 while a debug a bot failure. llvm-svn: 233398
* Don't use unique section names by default if using the integrated as.Rafael Espindola2015-03-271-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
* Enable -ffunction-sections and -fdata-sections for CloudABI by default.Ed Schouten2015-03-261-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
* Let Clang invoke CloudABI's linker.Ed Schouten2015-03-261-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
* [UBSan] Introduce "ubsan_standalone" library (Clang part).Alexey Samsonov2015-03-231-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
* Fix and update comments and a small reformatting.Eric Christopher2015-03-231-4/+3
| | | | llvm-svn: 232997
* handle armeb/thumb/thumbeb consistently in gnutools::Assemble::ConstructJobScott Douglass2015-03-231-5/+10
| | | | | | Differential Revision: http://reviews.llvm.org/D8196 llvm-svn: 232940
* Convert cascading if-else-if to switch. NFCScott Douglass2015-03-231-14/+32
| | | | | | Differential Revision: http://reviews.llvm.org/D8485 llvm-svn: 232939
* MS ABI: Implement driver-level support for thread-safe staticsDavid Majnemer2015-03-221-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
* Only add -fno-rtti if KernelOrKext or in C++ mode.Filipe Cabecinhas2015-03-201-2/+3
| | | | llvm-svn: 232869
* C++14: Disable sized deallocation by default due to ABI breakageReid Kleckner2015-03-201-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
* Add option to switch off putting header modules into the dependency file.Manuel Klimek2015-03-191-2/+3
| | | | llvm-svn: 232721
* Remove many superfluous SmallString::str() calls.Yaron Keren2015-03-181-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
* Imply linker arguments from '-fveclib' option.Michael Zolotukhin2015-03-171-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
* Add fveclib option.Michael Zolotukhin2015-03-171-0/+2
| | | | | Review: http://reviews.llvm.org/D8097 llvm-svn: 232533
* [ARM] Add support for ARMV6K subtarget (Clang)Renato Golin2015-03-171-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
* Fix grammar in a comment, wrap to 80 columns. No behavior change.Nico Weber2015-03-121-2/+3
| | | | llvm-svn: 232087
* [PowerPC] ABI support for the QPX vector instruction setHal Finkel2015-03-111-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
* Gender-neutralize a comment.Nico Weber2015-03-111-2/+2
| | | | llvm-svn: 231891
* Much like we silence warnings about -flto in many cases to facilitateChandler Carruth2015-03-071-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
* Pass -dll to link.exe when building with -shared (PR22697)Hans Wennborg2015-03-041-1/+3
| | | | | | And start building a test for non-clang-cl link.exe invocations. llvm-svn: 231312
* Don't force -pie for Android.Dan Albert2015-03-031-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
* [SDK modernizer]. Patch fixes driver's lack ofFariborz Jahanian2015-03-031-0/+1
| | | | | | | recognition of mernizer's -objcmt-migrate-property-dot-syntax option with a new test in test/Driver. rdar://19994452 llvm-svn: 231080
* Revert r231008 (and dependent r231019).Daniel Jasper2015-03-031-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
* [SDK modernizer]. Patch fixes driver's lack ofFariborz Jahanian2015-03-021-0/+1
| | | | | | | recognition of mernizer's -objcmt-migrate-property-dot-syntax option. rdar://19994452 llvm-svn: 231008
* Add clang support for Objective-C application extensions.Bob Wilson2015-03-021-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
* Add missing include.Benjamin Kramer2015-03-011-0/+1
| | | | llvm-svn: 230910
* Add -fuse-line-directive flag to control usage of #line with -EReid Kleckner2015-02-261-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
* -fms-extensions: Bump the default _MSC_VER from 1700 to 1800, aka VS2013Reid Kleckner2015-02-231-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
* Move -fdefine-sized-deallocation and -fno-sized-deallocation options from ↵Larisse Voufo2015-02-211-9/+0
| | | | | | driver into CC1 for now. llvm-svn: 230112
* [Mips] Support mips32r3, mips32r5, mips64r3, mips64r5 MIPS ISA namesSimon Atanasyan2015-02-201-2/+2
| | | | | | | | | The patch teaches the clang's driver to understand new MIPS ISA names, pass appropriate options to the assembler, defines corresponding macros etc http://reviews.llvm.org/D7737 llvm-svn: 230092
* Implement Control Flow Integrity for virtual calls.Peter Collingbourne2015-02-201-3/+4
| | | | | | | | | | | | | | | This patch introduces the -fsanitize=cfi-vptr flag, which enables a control flow integrity scheme that checks that virtual calls take place using a vptr of the correct dynamic type. More details in the new docs/ControlFlowIntegrity.rst file. It also introduces the -fsanitize=cfi flag, which is currently a synonym for -fsanitize=cfi-vptr, but will eventually cover all CFI checks implemented in Clang. Differential Revision: http://reviews.llvm.org/D7424 llvm-svn: 230055
* Add -funique-section-names and -fno-unique-section-names options.Rafael Espindola2015-02-201-0/+4
| | | | | | | | | For now -funique-section-names is the default, so no change in default behavior. The total .o size in a build of llvm and clang goes from 241687775 to 230649031 bytes if -fno-unique-section-names is used. llvm-svn: 230031
* Add -fno-implicit-modules.Manuel Klimek2015-02-201-0/+6
| | | | | | | If this flag is set, we error out when a module build is required. This is useful in environments where all required modules are passed via -fmodule-file. llvm-svn: 230006
* Add -fno-sized-deallocation option for completeness of fix in r229241 in ↵Larisse Voufo2015-02-201-0/+4
| | | | | | documentation in r229818. llvm-svn: 229950
* Improve our handling of rtti/sanitize=vptr/sanitize=undefinedFilipe Cabecinhas2015-02-191-63/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [ARM] Add missing M/R class CPUsBradley Smith2015-02-181-3/+3
| | | | | | | | | | | | Add some of the missing M and R class Cortex CPUs, namely: Cortex-M0+ (called Cortex-M0plus for GCC compatibility) Cortex-M1 SC000 SC300 Cortex-R5 llvm-svn: 229661
* Rename flags and options to match current naming: from -fdef-sized-delete to ↵Larisse Voufo2015-02-181-3/+3
| | | | | | -fdefine-sized-deallocation, and from DefaultSizedDelete to DefineSizedDeallocation. llvm-svn: 229597
OpenPOWER on IntegriCloud