aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Driver/Tools.cpp
AgeCommit message (Collapse)AuthorFilesLines
2015-02-20[Mips] Support mips32r3, mips32r5, mips64r3, mips64r5 MIPS ISA namesSimon Atanasyan1-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
2015-02-20Implement Control Flow Integrity for virtual calls.Peter Collingbourne1-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
2015-02-20Add -funique-section-names and -fno-unique-section-names options.Rafael Espindola1-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
2015-02-20Add -fno-implicit-modules.Manuel Klimek1-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
2015-02-20Add -fno-sized-deallocation option for completeness of fix in r229241 in ↵Larisse Voufo1-0/+4
documentation in r229818. llvm-svn: 229950
2015-02-19Improve our handling of rtti/sanitize=vptr/sanitize=undefinedFilipe Cabecinhas1-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
2015-02-18[ARM] Add missing M/R class CPUsBradley Smith1-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
2015-02-18Rename flags and options to match current naming: from -fdef-sized-delete to ↵Larisse Voufo1-3/+3
-fdefine-sized-deallocation, and from DefaultSizedDelete to DefineSizedDeallocation. llvm-svn: 229597
2015-02-14Replace snprintf with a Twine. NFC.Benjamin Kramer1-5/+3
llvm-svn: 229264
2015-02-14Revise the implementation logic of sized deallocation: Do not automatically ↵Larisse Voufo1-0/+5
generate weak definitions of the sized operator delete (in terms of unsized operator delete). Instead, provide the funcitonality via a new compiler flag, -fdef-sized-delete. The current implementation causes link-time ODR violations when the delete symbols are exported into the dynamic table. llvm-svn: 229241
2015-02-14Revert "Revert r229082 for a bit, it caused PR22577."David Majnemer1-0/+13
This reverts commit r229123. It was a red herring, the bug was present without r229082. llvm-svn: 229205
2015-02-13Revert r229082 for a bit, it caused PR22577.Nico Weber1-13/+0
llvm-svn: 229123
2015-02-13MS ABI: Implement /volatile:msDavid Majnemer1-0/+13
The /volatile:ms semantics turn volatile loads and stores into atomic acquire and release operations. This distinction is important because volatile memory operations do not form a happens-before relationship with non-atomic memory. This means that a volatile store is not sufficient for implementing a mutex unlock routine. Differential Revision: http://reviews.llvm.org/D7580 llvm-svn: 229082
2015-02-10[PowerPC] Remove the --no-tls-optimize workaround from the clang driverBill Schmidt1-7/+0
llvm-svn: 228739
2015-02-06-iframework option should be forwarded to linkerSteven Wu1-0/+6
Summary: -iframework option is used to specified System framework path so the path specified should be passed to linker as -F option rdar://problem/18234544 Reviewers: bob.wilson Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D7106 llvm-svn: 228413
2015-02-06[PowerPC] Re-disable linker optimizations for nowBill Schmidt1-0/+7
llvm-svn: 228402
2015-02-05Re-land r228258 and make clang-cl's /EHs- disable -fexceptions againReid Kleckner1-3/+3
After r228258, Clang started emitting C++ EH IR that LLVM wasn't ready to deal with, even when exceptions were disabled with /EHs-. This time, make /EHs- turn off -fexceptions while still emitting exceptional constructs in functions using __try. Since Sema rejects C++ exception handling constructs before CodeGen, landingpads should only appear in such functions as the result of a __try. llvm-svn: 228329
2015-02-05[PowerPC] Revert workaround for TLS linker bugBill Schmidt1-7/+0
In r227480, Ulrich Weigand introduced a workaround for a linker optimization bug that can create mis-optimized code for accesses to general-dynamic or local-dynamic TLS variables. The linker optimization bug only occurred for Clang/LLVM because of some inefficient code being generated for these TLS accesses. I have recently corrected LLVM to produce the efficient code sequence expected by the linkers, so this workaround is no longer needed. Therefore this patch reverts r227480. I've tested that the previous bootstrap failure no longer occurs with the workaround reverted. llvm-svn: 228253
2015-02-04Driver: Stop forcing frame pointer usage on WindowsReid Kleckner1-17/+39
Previously, we would use a frame pointer by default on non-Linux OSs. On Linux, any optimization flags imply -fomit-frame-pointer. XCore always defaulted to -fomit-frame-pointer. Now x86 Windows matches our behavior on Linux. All other ISAs supported by Windows (ARM, x64) use xdata information, and frame pointers aren't useful. Frame pointers are now off by default for such targets, but can be forced via -fno-omit-frame-pointer and code using alloca(). In fact, on Win64 our frame-pointer prologue is not describable with UNWIND_INFO. This change is a workaround to avoid using the broken FP using prologue for most functions. This is PR22467. llvm-svn: 228236
2015-02-04Replace isalnum with isAlphanumeric per reviewBen Langmuir1-1/+2
Thanks Dmitri! llvm-svn: 228163
2015-02-04Teaches the Clang driver to accept Cortex-A72Renato Golin1-2/+2
A previous commit added Cortex-A72 to LLVM, this teaches Clang to accept it as well. Patch by Ranjeet Singh. llvm-svn: 228141
2015-02-03Make the default module cache user-specificBen Langmuir1-1/+38
Appends the username to the first component (after the temp dir) of the module cache path. If the username contains a character that shouldn't go into a path (for now conservatively allow [a-zA-Z0-9_]), we fallback to the user id. llvm-svn: 228013
2015-02-03Use CLANG_LIBDIR_SUFFIX when looking for the gold plugin.Rafael Espindola1-1/+2
Patch by İsmail Dönmez! llvm-svn: 227979
2015-02-02PR 17421: Implemented -save-temps={obj|cwd} optionReid Kleckner1-1/+1
-save-temps=cwd is equivalent to -save-temps -save-temps=obj saves temporary file in the same directory as output This helps to avoid clobbering of temp files in case of parallel compilation with -save-temps of the files that have the same name but located in different directories. Patch by Artem Belevich Reviewed By: rnk Differential Revision: http://reviews.llvm.org/D7304 llvm-svn: 227886
2015-01-31Tweak behavior due to -fexceptions, in C++ mode, imply -fcxx-exceptionsFilipe Cabecinhas1-3/+11
Added test llvm-svn: 227695
2015-01-30Fix regression in r227409 where we were passing -fsyntax-onlyEric Christopher1-0/+1
in all cases. Patch by Artem Belevich. llvm-svn: 227591
2015-01-30[mips] Pass ABI name via -target-abi instead of target-featuresDaniel Sanders1-11/+24
Patch by Vladimir Medic Reviewers: echristo, atanasyan, dsanders Reviewed By: atanasyan, dsanders Subscribers: llvm-commits, echristo, atanasyan Differential Revision: http://reviews.llvm.org/D6091 llvm-svn: 227583
2015-01-30Remove unneeded codeFilipe Cabecinhas1-2/+1
We don't really care about enabling RTTI with -fexceptions, only with -fcxx-exceptions. llvm-svn: 227567
2015-01-30clang-cl: Enable -fexceptions but not -fcxx-exceptions by defaultReid Kleckner1-3/+3
This enables proper IRgen of SEH constructs. llvm-svn: 227528
2015-01-29Add some more PS4 driver settings related to rtti and exceptions.Filipe Cabecinhas1-9/+37
Summary: The PS4 defaults to -fno-rtti, and has to have rtti enabled when enabling exceptions. This commit makes clang add the -fno-rtti by default on the PS4, unless -frtti was passed in. It also diagnoses misuses for the PS4: - Exceptions need rtti. Warn and enable rtti if no rtti flag was passed, error if -fno-rtti was passed. I also added a more general warning for when -fno-rtti is the default (currently it's only on the PS4) and the vptr sanitizer is on. Fixed a few tests, due to different flag order when passing cc1 arguments. Reviewers: chandlerc Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D7250 llvm-svn: 227518
2015-01-29[PowerPC] Work around TLS linker bugUlrich Weigand1-0/+7
Work around a bug in GNU ld (and gold) linker versions up to 2.25 that may mis-optimize code generated by this version of clang/LLVM to access general-dynamic or local-dynamic TLS variables. Bug is fixed here: https://sourceware.org/ml/binutils/2015-01/msg00318.html llvm-svn: 227480
2015-01-29Ensure that -fsyntax-only with fortran 90 passes along silentlyEric Christopher1-7/+12
to the underlying gcc. PR22234 Patch by Artem Belevich. llvm-svn: 227409
2015-01-28For the --be8 flag, check explicitly for pre-v7 / pre-v6m cores.Joerg Sonnenberger1-2/+19
Those used the old Big Endian support on ARM and don't need flags. Refactor the logic in a separate common function, which also looks at -march. Add corresponding logic for the Linux toolchain. llvm-svn: 227393
2015-01-28[clang] Use -android environment for all compiler-rt libs.Dan Albert1-8/+6
Summary: This was already done for the sanitizers, but it needs to be done for the profile and builtin libs as well. Reviewers: srhines, timmurray, eugenis, samsonov Reviewed By: samsonov Subscribers: compnerd, cfe-commits Differential Revision: http://reviews.llvm.org/D7187 llvm-svn: 227392
2015-01-27Fix part of r227215. PS4 code just omits leaf frame pointers.Filipe Cabecinhas1-3/+4
llvm-svn: 227219
2015-01-27Added more PS4 defaults for code generationFilipe Cabecinhas1-2/+9
llvm-svn: 227215
2015-01-26For NetBSD/ARM-EB, link with --be8. Support for the older BE32 isJoerg Sonnenberger1-0/+2
currently not planned. llvm-svn: 227088
2015-01-25Allows Clang to use LLVM's fixes-x18 optionRenato Golin1-0/+5
This patch allows clang to have llvm reserve the x18 platform register on AArch64. FreeBSD will use this in the kernel for per-cpu data but has no need to reserve this register in userland so will need this flag to reserve it. This uses llvm r226664 to allow this register to be reserved. Patch by Andrew Turner. llvm-svn: 227062
2015-01-23Process the -fno-signed-zeros optimization flag (PR20870)Sanjay Patel1-0/+2
The driver currently accepts but ignores the -fno-signed-zeros flag. This patch passes the flag through and enables 'nsz' fast-math-flag generation in IR. The existing OpenCL flag for the same functionality is made into an alias here. It may be removed in a subsequent patch. This should resolve bug 20870 ( http://llvm.org/bugs/show_bug.cgi?id=20870 ); patches for the optimizer were checked in at: http://llvm.org/viewvc/llvm-project?view=revision&revision=225050 http://llvm.org/viewvc/llvm-project?view=revision&revision=224583 Differential Revision: http://reviews.llvm.org/D6873 llvm-svn: 226915
2015-01-20Implement command line options for stack probe spaceHans Wennborg1-0/+9
This code adds the -mstack-probe-size command line option and implements the /Gs compiler switch for clang-cl. This should fix http://llvm.org/bugs/show_bug.cgi?id=21896 Patch by Andrew H! Differential Revision: http://reviews.llvm.org/D6685 llvm-svn: 226601
2015-01-16Adding option -fno-inline-asm to disallow inline asmSteven Wu1-0/+5
Summary: This patch add a new option to dis-allow all inline asm. Any GCC style inline asm will be reported as an error. Reviewers: rnk, echristo Reviewed By: rnk, echristo Subscribers: bob.wilson, rnk, echristo, rsmith, cfe-commits Differential Revision: http://reviews.llvm.org/D6870 llvm-svn: 226340
2015-01-14Revert "Insert random noops to increase security against ROP attacks (clang)"JF Bastien1-11/+0
This reverts commit: http://reviews.llvm.org/D3393 llvm-svn: 225947
2015-01-14Insert random noops to increase security against ROP attacks (clang)JF Bastien1-0/+11
A pass that adds random noops to X86 binaries to introduce diversity with the goal of increasing security against most return-oriented programming attacks. Command line options: -noop-insertion // Enable noop insertion. -noop-insertion-percentage=X // X% of assembly instructions will have a noop prepended (default: 50%, requires -noop-insertion) -max-noops-per-instruction=X // Randomly generate X noops per instruction. ie. roll the dice X times with probability set above (default: 1). This doesn't guarantee X noop instructions. In addition, the following 'quick switch' in clang enables basic diversity using default settings (currently: noop insertion and schedule randomization; it is intended to be extended in the future). -fdiversify This is the clang part of the patch. llvm part: D3392 http://reviews.llvm.org/D3393 Patch by Stephen Crane (@rinon) llvm-svn: 225910
2015-01-09Driver: begin threading frontend support for SymbolRewriterSaleem Abdulrasool1-0/+13
Allow blessed access to the symbol rewriter from the driver. Although the symbol rewriter could be invoked through tools like opt and llc, it would not accessible from the frontend. This allows us to read the rewrite map files in the frontend rather than the backend and enable symbol rewriting for actually performing the symbol interpositioning. llvm-svn: 225504
2015-01-06R600: Handle amdgcn tripleTom Stellard1-0/+2
For now there is no difference between amdgcn and r600. llvm-svn: 225294
2015-01-06Set the default ISA for OpenBSD/mips64 to MIPS III.Brad Smith1-0/+4
llvm-svn: 225241
2015-01-05Fix formatting. NFC.Rafael Espindola1-6/+3
llvm-svn: 225168
2015-01-03Really don't warn about -flto/fno-lto :-(Rafael Espindola1-8/+27
This should fix the last bots. llvm-svn: 225100
2015-01-02Also avoid warning on -flto/-fno-lto on linux.Rafael Espindola1-2/+7
On OS X a .s file is preprocessed, it is not on linux, which is why the warning was still showing up on linux but not OS X. llvm-svn: 225095
2015-01-02Don't warn on unused -fno-lto.Rafael Espindola1-2/+3
It is somewhat common for CFLAGS to be used with .s files. We were already ignoring -flto. This patch just does the same for -fno-lto. llvm-svn: 225093