summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver
Commit message (Collapse)AuthorAgeFilesLines
...
* Driver: extract `-fbuiltin` option handling (NFC)Saleem Abdulrasool2017-09-011-47/+51
| | | | | | | | | Extract the handling of the `-fbuiltin` family of flags to the driver. This centralises the handling of those options, keeping the long standing `#if 0`'ed block of code. This requires some additional code archaeology to determine if we need to enable this functionality. llvm-svn: 312392
* Driver: extract floating point optimization handling (NFC)Saleem Abdulrasool2017-09-011-154/+160
| | | | | | | | Extract the logic for the floating point handling into its own function. None of this information is needed for calculating the remainder of the arguments to the frontend. NFC llvm-svn: 312385
* Driver: extract diagnostics flag handling (NFC)Saleem Abdulrasool2017-09-011-107/+116
| | | | | | | | Extract a function to render the diagnostics options to the clang frontend. This continues the simplification of the clang cc1 command line invocation generation. NFC llvm-svn: 312351
* [libFuzzer] switch -fsanitize=fuzzer from trace-pc-guard to inline-8bit-countersKostya Serebryany2017-09-011-1/+1
| | | | llvm-svn: 312346
* Driver: extract ObjC option rendering (NFC)Saleem Abdulrasool2017-09-011-84/+87
| | | | | | | | | | | | | Extract the ObjC option rendering for the frontend. This localises the option translation. It augments the existing `AddRuntimeObjCOptions` which handles the runtime/ABI versioning flags only. This new function handles the non-runtime selecting flags. This logic was previously inlined into the `ConstructJob` function. Minor change to the flag ordering to group the blocks related flags together. llvm-svn: 312344
* Driver: extract modules flag handling (NFC)Saleem Abdulrasool2017-09-011-157/+162
| | | | | | | Extract a function to render the options related to modules. This reduces the cyclomatic complexity of the `ConstructJob` function. NFC. llvm-svn: 312330
* [clang-cl] Explicitly set object format to COFF in CL modeOleg Ranevskyy2017-08-311-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Currently object format is taken from the default target triple. For toolchains with a non-COFF default target this may result in an object format inappropriate for pc-windows and lead to compilation issues. For example, the default triple `aarch64-linux-elf` may produce something like `aarch64-pc-windows-msvc19.0.24215-elf` in CL mode. Clang creates `MicrosoftARM64TargetInfo` for such triple with data layout `e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128`. On the other hand, the AArch64 backend in `computeDataLayout` detects a non-COFF target and selects `e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128` as data layout for little endian. Different layouts used by clang and the backend cause an error: ``` error: backend data layout 'e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128' does not match expected target description 'e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128' ``` This can be observed on the clang's Driver/cl-pch.c test with AArch64 as a default target. This patch enforces COFF in CL mode. Reviewers: hans Reviewed By: hans Subscribers: cfe-commits, aemerson, asl, kristof.beyls Differential Revision: https://reviews.llvm.org/D37336 llvm-svn: 312275
* Driver: extract ARCMT flag construction (NFC)Saleem Abdulrasool2017-08-311-69/+73
| | | | | | | | Extract the ARC migration tool flag handling into its own function. This simplifies the flow of the clang frontend command line construction function. NFC. llvm-svn: 312244
* [modules] Add ability to specify module name to module file mapping (reapply)Boris Kolpackov2017-08-311-2/+7
| | | | | | | | | | | | | | | | | | | | Extend the -fmodule-file option to support the [<name>=]<file> value format. If the name is omitted, then the old semantics is preserved (the module file is loaded whether needed or not). If the name is specified, then the mapping is treated as just another prebuilt module search mechanism, similar to -fprebuilt-module-path, and the module file is only loaded if actually used (e.g., via import). With one exception: this mapping also overrides module file references embedded in other modules (which can be useful if module files are moved/renamed as often happens during remote compilation). This override semantics requires some extra work: we now store the module name in addition to the file name in the serialized AST representation. Reviewed By: rsmith Differential Revision: https://reviews.llvm.org/D35020 llvm-svn: 312220
* [SanitizeCoverage] Enable stack-depth coverage for -fsanitize=fuzzerMatt Morehouse2017-08-301-1/+5
| | | | | | | | | | | | | | | | | | Summary: - Don't sanitize __sancov_lowest_stack. - Don't instrument leaf functions. - Add CoverageStackDepth to Fuzzer and FuzzerNoLink. - Only enable on Linux. Reviewers: vitalybuka, kcc, george.karpenkov Reviewed By: kcc Subscribers: kubamracek, cfe-commits, llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D37156 llvm-svn: 312185
* Driver: out-of-line static analyzer flag handling (NFC)Saleem Abdulrasool2017-08-301-72/+74
| | | | | | | | Extract the analyzer flag handling into its own function to reduce the overall complexity of the construction of the clang compiler arguments. NFC. llvm-svn: 312124
* Revert r312105 [modules] Add ability to specify module name to module file ↵Victor Leschuk2017-08-301-7/+2
| | | | | | | | mapping Looks like it breaks win10 builder. llvm-svn: 312112
* [modules] Add ability to specify module name to module file mappingBoris Kolpackov2017-08-301-2/+7
| | | | | | | | | | | | | | | | | | | | Extend the -fmodule-file option to support the [<name>=]<file> value format. If the name is omitted, then the old semantics is preserved (the module file is loaded whether needed or not). If the name is specified, then the mapping is treated as just another prebuilt module search mechanism, similar to -fprebuilt-module-path, and the module file is only loaded if actually used (e.g., via import). With one exception: this mapping also overrides module file references embedded in other modules (which can be useful if module files are moved/renamed as often happens during remote compilation). This override semantics requires some extra work: we now store the module name in addition to the file name in the serialized AST representation. Reviewed By: rsmith Differential Revision: https://reviews.llvm.org/D35020 llvm-svn: 312105
* Driver: refactor SSP argument handling (NFC)Saleem Abdulrasool2017-08-291-48/+59
| | | | | | | | Out-of-line the SSP argument handling for the sake of readability. Pass along some state information to avoid re-computing the command line flags. llvm-svn: 312084
* Driver: refactor OpenCL argument forwardingSaleem Abdulrasool2017-08-291-38/+26
| | | | | | | | | | | Extract the argument forwarding for OpenCL arguments. Make this more data driven as we are just repeating the argument name and spelling. This costs a slight bit more memory due to the string duplication, but makes it easier to follow. It should be possible to forward the internal string representation from the TableGen data to avoid this. But, this makes the code simpler to follow for now. llvm-svn: 312083
* Driver: reuse existing `D` variable (NFC)Saleem Abdulrasool2017-08-291-10/+9
| | | | | | | Change the rest of the function to use the `D` variable for the driver instance. NFC. llvm-svn: 312082
* Driver: hoist a local variable (NFC)Saleem Abdulrasool2017-08-291-32/+27
| | | | | | | Hoist the `getToolChain().getTriple()` to a variable rather than re-fetching it every time. NFC. llvm-svn: 312081
* Restore clang_rt library name on i686-android.Evgeniy Stepanov2017-08-291-0/+4
| | | | | | | | | | | | | | | | | Summary: Recent changes canonicalized clang_rt library names to refer to "i386" on all x86 targets. Android historically uses i686. This change adds a special case to keep i686 in all clang_rt libraries when targeting Android. Reviewers: hans, mgorny, beanz Subscribers: srhines, cfe-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D37278 llvm-svn: 312048
* Revert "[SanitizeCoverage] Enable stack-depth coverage for -fsanitize=fuzzer"Matt Morehouse2017-08-291-5/+1
| | | | | | This reverts r312026 due to bot breakage. llvm-svn: 312047
* Re-enable stack depth instrumentation on Windows.Matt Morehouse2017-08-291-2/+2
| | | | | | | Specified tls_model attribute properly. Should compile on Windows now. llvm-svn: 312037
* Disable stack depth tracking on Windows.Matt Morehouse2017-08-291-2/+2
| | | | | | Windows doesn't support the tls_model attribute. llvm-svn: 312032
* Minimal runtime for UBSan.Evgeniy Stepanov2017-08-292-3/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: An implementation of ubsan runtime library suitable for use in production. Minimal attack surface. * No stack traces. * Definitely no C++ demangling. * No UBSAN_OPTIONS=log_file=/path (very suid-unfriendly). And no UBSAN_OPTIONS in general. * as simple as possible Minimal CPU and RAM overhead. * Source locations unnecessary in the presence of (split) debug info. * Values and types (as in A+B overflows T) can be reconstructed from register/stack dumps, once you know what type of error you are looking at. * above two items save 3% binary size. When UBSan is used with -ftrap-function=abort, sometimes it is hard to reason about failures. This library replaces abort with a slightly more informative message without much extra overhead. Since ubsan interface in not stable, this code must reside in compiler-rt. Reviewers: pcc, kcc Subscribers: srhines, mgorny, aprantl, krytarowski, llvm-commits Differential Revision: https://reviews.llvm.org/D36810 llvm-svn: 312029
* [SanitizeCoverage] Enable stack-depth coverage for -fsanitize=fuzzerMatt Morehouse2017-08-291-1/+5
| | | | | | | | | | | | | | | | | | Summary: - Don't sanitize __sancov_lowest_stack. - Don't instrument leaf functions. - Add CoverageStackDepth to Fuzzer and FuzzerNoLink. - Disable stack depth tracking on Mac. Reviewers: vitalybuka, kcc, george.karpenkov Reviewed By: kcc Subscribers: kubamracek, cfe-commits, llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D37156 llvm-svn: 312026
* [Bash-autocomplete] Refactor autocomplete code into own functionYuka Takahashi2017-08-291-43/+51
| | | | | | | | | | | | | | Summary: We wrote many codes in HandleImediateArgs, so I've refactored it into handleAutocompletions. Reviewers: v.g.vassilev, teemperor Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D37249 llvm-svn: 312018
* Use class to pass information about executable nameSerge Pavlov2017-08-292-22/+24
| | | | | | | | | | | | | Information about clang executable name components, such as target and driver mode, was passes in std::pair. With this change it is passed in a special structure. It improves readability and makes access to this information more convenient. NFC. Differential Revision: https://reviews.llvm.org/D36057 llvm-svn: 311981
* Revert "Revert r311552: [Bash-autocompletion] Add support for static ↵Yuka Takahashi2017-08-291-1/+10
| | | | | | | | | | | analyzer flags" This reverts commit 7c46b80c022e18d43c1fdafb117b0c409c5a6d1e. r311552 broke lld buildbot because I've changed OptionInfos type from ArrayRef to vector. However the bug is fixed, so I'll commit this again. llvm-svn: 311958
* Reland r311836 - [Driver] Use arch type to find compiler-rt libraries (on Linux)Michal Gorny2017-08-281-4/+1
| | | | | | | | | | | | | | | | | | | | Use llvm::Triple::getArchTypeName() when looking for compiler-rt libraries, rather than the exact arch string from the triple. This is more correct as it matches the values used when building compiler-rt (builtin-config-ix.cmake) which are the subset of the values allowed in triples. For example, this fixes an issue when the compiler set for i686-pc-linux-gnu triple would not find an i386 compiler-rt library, while this is the exact arch that is detected by compiler-rt. The same applies to any other i?86 variant allowed by LLVM. This also makes the special case for MSVC unnecessary, since now i386 will be used reliably for all 32-bit x86 variants. Differential Revision: https://reviews.llvm.org/D26796 llvm-svn: 311923
* Fix inaccurate comment about -fdelayed-template-parsing and MSVCReid Kleckner2017-08-281-2/+4
| | | | llvm-svn: 311899
* Revert r311836 - [Driver] Use arch type to find compiler-rt libraries (on Linux)Michal Gorny2017-08-271-1/+4
| | | | | | | This causes a breakage on the Android build bot. Let's revert it until we figure out the correct solution there. llvm-svn: 311861
* [Driver] Use arch type to find compiler-rt libraries (on Linux)Michal Gorny2017-08-261-4/+1
| | | | | | | | | | | | | | | | | | | | Use llvm::Triple::getArchTypeName() when looking for compiler-rt libraries, rather than the exact arch string from the triple. This is more correct as it matches the values used when building compiler-rt (builtin-config-ix.cmake) which are the subset of the values allowed in triples. For example, this fixes an issue when the compiler set for i686-pc-linux-gnu triple would not find an i386 compiler-rt library, while this is the exact arch that is detected by compiler-rt. The same applies to any other i?86 variant allowed by LLVM. This also makes the special case for MSVC unnecessary, since now i386 will be used reliably for all 32-bit x86 variants. Differential Revision: https://reviews.llvm.org/D26796 llvm-svn: 311836
* Add flag to request Clang is ABI-compatible with older versions of itselfRichard Smith2017-08-261-0/+3
| | | | | | | | | | | | | | | | | | This patch adds a flag -fclang-abi-compat that can be used to request that Clang attempts to be ABI-compatible with some older version of itself. This is provided on a best-effort basis; right now, this can be used to undo the ABI change in r310401, reverting Clang to its prior C++ ABI for pass/return by value of class types affected by that change, and to undo the ABI change in r262688, reverting Clang to using integer registers rather than SSE registers for passing <1 x long long> vectors. The intent is that we will maintain this backwards compatibility path as we make ABI-breaking fixes in future. The reversion to the old behavior for r310401 is also applied to the PS4 target since that change is not part of its platform ABI (which is essentially to do whatever Clang 3.2 did). llvm-svn: 311823
* Revert "[SanitizeCoverage] Enable stack-depth coverage for -fsanitize=fuzzer"Matt Morehouse2017-08-251-3/+2
| | | | | | This reverts r311801 due to a bot failure. llvm-svn: 311803
* [SanitizeCoverage] Enable stack-depth coverage for -fsanitize=fuzzerMatt Morehouse2017-08-251-2/+3
| | | | | | | | | | | | | | | | | Summary: - Don't sanitize __sancov_lowest_stack. - Don't instrument leaf functions. - Add CoverageStackDepth to Fuzzer and FuzzerNoLink. Reviewers: vitalybuka, kcc Reviewed By: kcc Subscribers: cfe-commits, llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D37156 llvm-svn: 311801
* Expose -mllvm -accurate-sample-profile to clang.Dehao Chen2017-08-241-0/+4
| | | | | | | | | | | | | | Summary: With accurate sample profile, we can do more aggressive size optimization. For some size-critical application, this can reduce the text size by 20% Reviewers: davidxl, rsmith Reviewed By: davidxl, rsmith Subscribers: mehdi_amini, eraman, sanjoy, cfe-commits Differential Revision: https://reviews.llvm.org/D37091 llvm-svn: 311707
* [mips] Introducing option -mabs=[legacy/2008]Petar Jovanovic2017-08-241-0/+22
| | | | | | | | | | | | | | | | | In patch r205628 using abs.[ds] instruction is forced, as they should behave in accordance with flags Has2008 and ABS2008. Unfortunately for revisions prior mips32r6 and mips64r6, abs.[ds] is not generating correct result when working with NaNs. To generate a sequence which always produce a correct result but also to allow user more control on how his code is compiled, option -mabs is added where user can choose legacy or 2008. By default legacy mode is used on revisions prior R6. Mips32r6 and mips64r6 use abs2008 mode by default. Patch by Aleksandar Beserminji Differential Revision: https://reviews.llvm.org/D35982 llvm-svn: 311669
* [Driver] Register effective triple before get arm float abi.Leo Li2017-08-241-0/+2
| | | | | | | | | | | | | | | | Summary: We need to register effective triple before calling `getARMFloatABI`. Add missing code when `--print-libgcc-file-name` is passed. Reviewers: atanasyan, rsmith, mgorny, peter.smith, kristof.beyls, compnerd, jroelofs Reviewed By: compnerd Subscribers: llvm-commits, aemerson, javed.absar, srhines, kristof.beyls, pirama Differential Revision: https://reviews.llvm.org/D35742 llvm-svn: 311624
* Revert r311552: [Bash-autocompletion] Add support for static analyzer flagsRui Ueyama2017-08-231-10/+1
| | | | | | This reverts commit r311552 because it broke ubsan and asan bots. llvm-svn: 311557
* [Bash-autocompletion] Add support for static analyzer flagsYuka Takahashi2017-08-231-1/+10
| | | | | | | | | | | | | | | | | | | | | | Summary: This is a patch for clang autocomplete feature. It will collect values which -analyzer-checker takes, which is defined in clang/StaticAnalyzer/Checkers/Checkers.inc, dynamically. First, from ValuesCode class in Options.td, TableGen will generate C++ code in Options.inc. Options.inc will be included in DriverOptions.cpp, and calls OptTable's addValues function. addValues function will add second argument to Option's Values class. Values contains string like "foo,bar,.." which is handed to Values class in OptTable. Reviewers: v.g.vassilev, teemperor, ruiu Subscribers: hiraditya, cfe-commits Differential Revision: https://reviews.llvm.org/D36782 llvm-svn: 311552
* bpf: add -mcpu=# support for bpfYonghong Song2017-08-231-0/+2
| | | | | | | | | | | | | | | | | | | | | -mcpu=# will support: . generic: the default insn set . v1: insn set version 1, the same as generic . v2: insn set version 2, version 1 + additional jmp insns . probe: the compiler will probe the underlying kernel to decide proper version of insn set. Examples: $ clang -target bpf -mcpu=v1 -c t.c $ clang -target bpf -mcpu=v2 -c t.c $ clang -target bpf -mcpu=generic -c t.c $ clang -target bpf -mcpu=probe -c t.c $ clang -target bpf -mcpu=v3 -c t.c error: unknown target CPU 'v3' Signed-off-by: Yonghong Song <yhs@fb.com> Acked-by: Alexei Starovoitov <ast@kernel.org> llvm-svn: 311523
* Revert "Revert "Revert "Revert "Fix LLVMgold plugin name/path for non-Linux.""""Dan Albert2017-08-221-2/+14
| | | | | | | With tests fixed for Windows style paths now that they are going through path canonicalization. llvm-svn: 311487
* [mips] Rename getSupportedNanEncoding() to getIEEE754Standard()Petar Jovanovic2017-08-222-25/+26
| | | | | | | | | | | Rename the function getSupportedNanEncoding() to getIEEE754Standard(), since this function will be used for non-nan related features. Patch by Aleksandar Beserminji. Differential Revision: https://reviews.llvm.org/D36824 llvm-svn: 311454
* Test fix: only add shared libraries to rpath.George Karpenkov2017-08-221-1/+1
| | | | llvm-svn: 311422
* Moving libFuzzer to compiler-rt: required updates to the Clang driver.George Karpenkov2017-08-213-33/+16
| | | | | | Differential Revision: https://reviews.llvm.org/D36909 llvm-svn: 311406
* [Driver][Darwin] Do not pass -munwind-table if -fno-excpetions isAkira Hatanaka2017-08-211-1/+6
| | | | | | | | | | | | supplied. With this change, -fno-exceptions disables unwind tables unless -funwind-tables is supplied too or the target is x86-64 (x86-64 requires emitting unwind tables). rdar://problem/33934446 llvm-svn: 311397
* [Driver] Recognize DevDiv internal builds of MSVC, with a different ↵Stephan T. Lavavej2017-08-212-26/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | directory structure. This is a reasonably non-intrusive change, which I've verified works for both x86 and x64 DevDiv-internal builds. The idea is to change `bool IsVS2017OrNewer` into a 3-state `ToolsetLayout VSLayout`. Either a build is DevDiv-internal, released VS 2017 or newer, or released VS 2015 or older. When looking at the directory structure, if instead of `"VC"` we see `"x86ret"`, `"x86chk"`, `"amd64ret"`, or `"amd64chk"`, we recognize this as a DevDiv-internal build. After we get past the directory structure validation, we use this knowledge to regenerate paths appropriately. `llvmArchToDevDivInternalArch()` knows how we use `"i386"` subdirectories, and `MSVCToolChain::getSubDirectoryPath()` uses that. It also knows that DevDiv-internal builds have an `"inc"` subdirectory instead of `"include"`. This may still not be the "right" fix in any sense, but I believe that it's non-intrusive in the sense that if the special directory names aren't found, no codepaths are affected. (`ToolsetLayout::OlderVS` and `ToolsetLayout::VS2017OrNewer` correspond to `IsVS2017OrNewer` being `false` or `true`, respectively.) I searched for all references to `IsVS2017OrNewer`, which are places where Clang cares about VS's directory structure, and the only one that isn't being patched is some logic to deal with cross-compilation. I'm fine with that not working for DevDiv-internal builds for the moment (we typically test the native compilers), so I added a comment. Fixes D36860. llvm-svn: 311391
* Enable libfuzzer on NetBSD/amd64Kamil Rytarowski2017-08-211-0/+2
| | | | | | | | | | | | | | | | | | | Summary: Enable SanitizerKind::Fuzzer and SanitizerKind::FuzzerNoLink on x86_64. Sponsored by <The NetBSD Foundation> Reviewers: joerg, kcc, vitalybuka, george.karpenkov Reviewed By: vitalybuka Subscribers: cfe-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D36935 llvm-svn: 311365
* [mips] Remove checking of the redundant condition. NFCSimon Atanasyan2017-08-211-2/+1
| | | | llvm-svn: 311334
* [ARM][AArch64] Cortex-A75 and Cortex-A55 testsSam Parker2017-08-211-0/+11
| | | | | | | | | | | | | | | | | | Add frontend tests for Cortex-A75 and Cortex-A55, Arm's latest big.LITTLE A-class cores. They implement the ARMv8.2-A architecture, including the cryptography and RAS extensions, plus the optional dot product extension. They also implement the RCpc AArch64 extension from ARMv8.3-A. Cortex-A75: https://developer.arm.com/products/processors/cortex-a/cortex-a75 Cortex-A55: https://developer.arm.com/products/processors/cortex-a/cortex-a55 Differential Revision: https://reviews.llvm.org/D36731 llvm-svn: 311319
* [SanitizerCoverage] Add stack depth tracing instrumentation.Matt Morehouse2017-08-181-5/+12
| | | | | | | | | | | | | | | | | | | | | | Summary: Augment SanitizerCoverage to insert maximum stack depth tracing for use by libFuzzer. The new instrumentation is enabled by the flag -fsanitize-coverage=stack-depth and is compatible with the existing trace-pc-guard coverage. The user must also declare the following global variable in their code: thread_local uintptr_t __sancov_lowest_stack https://bugs.llvm.org/show_bug.cgi?id=33857 Reviewers: vitalybuka, kcc Reviewed By: vitalybuka Subscribers: kubamracek, hiraditya, cfe-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D36839 llvm-svn: 311186
* Revert r311137 (GlobalISel ABI commit).Tim Northover2017-08-181-1/+1
| | | | | | | It was committed by mistake since it was in the same monorepo as the LLVM change I was working on. llvm-svn: 311140
OpenPOWER on IntegriCloud