aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Driver/ToolChain.cpp
AgeCommit message (Collapse)AuthorFilesLines
2022-11-17Add generic KCFI operand bundle loweringSami Tolvanen1-4/+1
The KCFI sanitizer emits "kcfi" operand bundles to indirect call instructions, which the LLVM back-end lowers into an architecture-specific type check with a known machine instruction sequence. Currently, KCFI operand bundle lowering is supported only on 64-bit X86 and AArch64 architectures. As a lightweight forward-edge CFI implementation that doesn't require LTO is also useful for non-Linux low-level targets on other machine architectures, add a generic KCFI operand bundle lowering pass that's only used when back-end lowering support is not available and allows -fsanitize=kcfi to be enabled in Clang on all architectures. Reviewed By: nickdesaulniers, MaskRay Differential Revision: https://reviews.llvm.org/D135411
2022-10-26[Driver] Allow target override containing . in executable nameDan McGregor1-1/+8
The gcc compatible driver has support for overriding the default target based on the driver's executable name, for instance x86_64-pc-linux-gnu-clang will set the default target to x86_64-pc-linux-gnu. Previously, this failed when the target contained a minor version, for example x86_64-pc-freebsd13.1, so instead of finding the file's stem, use the whole file name, but strip off any '.exe' from the tail. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D135284
2022-10-14[clang][macho] Add support for -darwin-target-variant-sdk-version in cc1asDaniel Rodríguez Troitiño1-0/+3
D121868 provided support for -darwin-target-variant-triple, but the support for -darwin-target-variant-sdk-version was still missing for cc1as. These changes build upon the previous and provides such support. - Extracted the common code to handle -darwin-target-variant-triple and -darwin-target-variant-sdk-version in the Darwin toolchain to a method that can be used for both the cc1 and the cc1as job construction. cc1as does not support some of the parameters that were provided to cc1, so the same code cannot be used for both. - Invoke that new common code when constructing a cc1as invocation. - Parse the new -darwin-target-variant-sdk-version in the cc1as driver. Apply its value to the MCObjectFileInfo to generate the right values in the object files. - Includes two new tests that check that cc1as uses the provided values in -darwin-target-variant-sdk and that the Clang driver creates the jobs with the correct arguments. Differential Revision: https://reviews.llvm.org/D135729
2022-09-23[clang] Make --ld-path= work with -fuse-ld=lldNico Weber1-1/+6
This allows using --ld-path= to set a custom linker path, while still informing clang that the binary at that path is an lld built at the same revision as clang, so that clang can make assumptions about the flags it supports, its output format, etc. This currently only has an observable effect on Darwin. Differential Revision: https://reviews.llvm.org/D134063
2022-09-20Refactor unwind table driver interface to expose default level. NFC.Tim Northover1-2/+3
2022-09-14[OpenMP][AMDGPU] Link bitcode ROCm device libraries per-TUJoseph Huber1-1/+1
Previously, we linked in the ROCm device libraries which provide math and other utility functions late. This is not stricly correct as this library contains several flags that are only set per-TU, such as fast math or denormalization. This patch changes this to pass the bitcode libraries per-TU using the same method we use for the CUDA libraries. This has the advantage that we correctly propagate attributes making this implementation more correct. Additionally, many annoying unused functions were not being fully removed during LTO. This lead to erroneous warning messages and remarks on unused functions. I am not sure if not finding these libraries should be a hard error. let me know if it should be demoted to a warning saying that some device utilities will not work without them. Reviewed By: JonChesterfield Differential Revision: https://reviews.llvm.org/D133726
2022-08-26[OpenMP] Deprecate the old driver for OpenMP offloadingJoseph Huber1-8/+0
Recently OpenMP has transitioned to using the "new" driver which primarily merges the device and host linking phases into a single wrapper that handles both at the same time. This replaced a few tools that were only used for OpenMP offloading, such as the `clang-offload-wrapper` and `clang-nvlink-wrapper`. The new driver carries some marked benefits compared to the old driver that is now being deprecated. Things like device-side LTO, static library support, and more compatible tooling. As such, we should be able to completely deprecate the old driver, at least for OpenMP. The old driver support will still exist for CUDA and HIP, although both of these can currently be compiled on Linux with `--offload-new-driver` to use the new method. Note that this does not deprecate the `clang-offload-bundler`, although it is unused by OpenMP now, it is still used by the HIP toolchain both as their device binary format and object format. When I proposed deprecating this code I heard some vendors voice concernes about needing to update their code in their fork. They should be able to just revert this commit if it lands. Reviewed By: jdoerfert, MaskRay, ye-luo Differential Revision: https://reviews.llvm.org/D130020
2022-08-24KCFI sanitizerSami Tolvanen1-0/+3
The KCFI sanitizer, enabled with `-fsanitize=kcfi`, implements a forward-edge control flow integrity scheme for indirect calls. It uses a !kcfi_type metadata node to attach a type identifier for each function and injects verification code before indirect calls. Unlike the current CFI schemes implemented in LLVM, KCFI does not require LTO, does not alter function references to point to a jump table, and never breaks function address equality. KCFI is intended to be used in low-level code, such as operating system kernels, where the existing schemes can cause undue complications because of the aforementioned properties. However, unlike the existing schemes, KCFI is limited to validating only function pointers and is not compatible with executable-only memory. KCFI does not provide runtime support, but always traps when a type mismatch is encountered. Users of the scheme are expected to handle the trap. With `-fsanitize=kcfi`, Clang emits a `kcfi` operand bundle to indirect calls, and LLVM lowers this to a known architecture-specific sequence of instructions for each callsite to make runtime patching easier for users who require this functionality. A KCFI type identifier is a 32-bit constant produced by taking the lower half of xxHash64 from a C++ mangled typename. If a program contains indirect calls to assembly functions, they must be manually annotated with the expected type identifiers to prevent errors. To make this easier, Clang generates a weak SHN_ABS `__kcfi_typeid_<function>` symbol for each address-taken function declaration, which can be used to annotate functions in assembly as long as at least one C translation unit linked into the program takes the function address. For example on AArch64, we might have the following code: ``` .c: int f(void); int (*p)(void) = f; p(); .s: .4byte __kcfi_typeid_f .global f f: ... ``` Note that X86 uses a different preamble format for compatibility with Linux kernel tooling. See the comments in `X86AsmPrinter::emitKCFITypeId` for details. As users of KCFI may need to locate trap locations for binary validation and error handling, LLVM can additionally emit the locations of traps to a `.kcfi_traps` section. Similarly to other sanitizers, KCFI checking can be disabled for a function with a `no_sanitize("kcfi")` function attribute. Relands 67504c95494ff05be2a613129110c9bcf17f6c13 with a fix for 32-bit builds. Reviewed By: nickdesaulniers, kees, joaomoreira, MaskRay Differential Revision: https://reviews.llvm.org/D119296
2022-08-24Revert "KCFI sanitizer"Sami Tolvanen1-3/+0
This reverts commit 67504c95494ff05be2a613129110c9bcf17f6c13 as using PointerEmbeddedInt to store 32 bits breaks 32-bit arm builds.
2022-08-24KCFI sanitizerSami Tolvanen1-0/+3
The KCFI sanitizer, enabled with `-fsanitize=kcfi`, implements a forward-edge control flow integrity scheme for indirect calls. It uses a !kcfi_type metadata node to attach a type identifier for each function and injects verification code before indirect calls. Unlike the current CFI schemes implemented in LLVM, KCFI does not require LTO, does not alter function references to point to a jump table, and never breaks function address equality. KCFI is intended to be used in low-level code, such as operating system kernels, where the existing schemes can cause undue complications because of the aforementioned properties. However, unlike the existing schemes, KCFI is limited to validating only function pointers and is not compatible with executable-only memory. KCFI does not provide runtime support, but always traps when a type mismatch is encountered. Users of the scheme are expected to handle the trap. With `-fsanitize=kcfi`, Clang emits a `kcfi` operand bundle to indirect calls, and LLVM lowers this to a known architecture-specific sequence of instructions for each callsite to make runtime patching easier for users who require this functionality. A KCFI type identifier is a 32-bit constant produced by taking the lower half of xxHash64 from a C++ mangled typename. If a program contains indirect calls to assembly functions, they must be manually annotated with the expected type identifiers to prevent errors. To make this easier, Clang generates a weak SHN_ABS `__kcfi_typeid_<function>` symbol for each address-taken function declaration, which can be used to annotate functions in assembly as long as at least one C translation unit linked into the program takes the function address. For example on AArch64, we might have the following code: ``` .c: int f(void); int (*p)(void) = f; p(); .s: .4byte __kcfi_typeid_f .global f f: ... ``` Note that X86 uses a different preamble format for compatibility with Linux kernel tooling. See the comments in `X86AsmPrinter::emitKCFITypeId` for details. As users of KCFI may need to locate trap locations for binary validation and error handling, LLVM can additionally emit the locations of traps to a `.kcfi_traps` section. Similarly to other sanitizers, KCFI checking can be disabled for a function with a `no_sanitize("kcfi")` function attribute. Reviewed By: nickdesaulniers, kees, joaomoreira, MaskRay Differential Revision: https://reviews.llvm.org/D119296
2022-08-20Use range-based for loops (NFC)Kazu Hirata1-3/+3
2022-08-10Driver: Refactor and support per target dirs in baremetalManoj Gupta1-1/+7
Refactor baremetal driver code to reduce the bespoke additions and base class overrides. This lets us use the per target runtimes like other clang targets. E.g. clang -target armv7m-cros-none-eabi will now be able to use the runtimes installed at <resource_dir>/lib/armv7m-cros-none-eabi instead of the hardcoded path <resource_dir>/lib/baremetal. The older code paths should still continue to work as before if <resource_dir>/lib/<tuple> does not exist. Reviewed By: MaskRay, barannikov88 Differential Revision: https://reviews.llvm.org/D131225
2022-07-19[clang] Add a new flag -fexperimental-library to enable experimental library ↵Louis Dionne1-0/+2
features Based on the discussion at [1], this patch adds a Clang flag called -fexperimental-library that controls whether experimental library features are provided in libc++. In essence, it links against the experimental static archive provided by libc++ and defines a feature that can be picked up by libc++ to enable experimental features. This ensures that users don't start depending on experimental (and hence unstable) features unknowingly. [1]: https://discourse.llvm.org/t/rfc-a-compiler-flag-to-enable-experimental-unstable-language-and-library-features Differential Revision: https://reviews.llvm.org/D121141
2022-05-27[Clang][Driver] Fix include paths for `--sysroot /` on LinuxEgor Zhdan1-0/+8
Currently if `--sysroot /` is passed to the Clang driver, the include paths generated by the Clang driver will start with a double slash: `//usr/include/...`. If VFS is used to inject files into the include paths (for example, the Swift compiler does this), VFS will get confused and the injected files won't be visible. This change makes sure that the include paths start with a single slash. Fixes #28283. Differential Revision: https://reviews.llvm.org/D126289
2022-05-25[PS5] Default to -fno-rttiPaul Robinson1-2/+2
2022-05-25[Clang] Added options for integrated backend.Anastasia Stulova1-0/+28
Following the new flow for external object code emission, provide flags to switch between integrated and external backend similar to the integrated assembler options. SPIR-V target is the only user of this functionality at this point. This patch also updated SPIR-V documentation to clarify that integrated object code emission for SPIR-V is an experimental feature. Differential Revision: https://reviews.llvm.org/D125679
2022-05-14[LowerTypeTests][clang] Implement and allow -fsanitize=cfi-icall for RISCVWende Tan1-1/+1
Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D106888
2022-05-13[Clang] Add DriverKit supportEgor Zhdan1-2/+3
This is the second patch that upstreams the support for Apple's DriverKit. The first patch: https://reviews.llvm.org/D118046. Differential Revision: https://reviews.llvm.org/D121911
2022-05-11[Clang] Introduce clang-offload-packager tool to bundle device filesJoseph Huber1-0/+8
In order to do offloading compilation we need to embed files into the host and create fatbainaries. Clang uses a special binary format to bundle several files along with their metadata into a single binary image. This is currently performed using the `-fembed-offload-binary` option. However this is not very extensibile since it requires changing the command flag every time we want to add something and makes optional arguments difficult. This patch introduces a new tool called `clang-offload-packager` that behaves similarly to CUDA's `fatbinary`. This tool takes several input files with metadata and embeds it into a single image that can then be embedded in the host. Reviewed By: tra Differential Revision: https://reviews.llvm.org/D125165
2022-04-15[HLSL][clang][Driver] Support target profile command line option.Xiang Li1-0/+1
The target profile option(/T) decide the shader model when compile hlsl. The format is shaderKind_major_minor like ps_6_1. The shader model is saved as llvm::Triple is clang/llvm like dxil-unknown-shadermodel6.1-hull. The main job to support the option is translating ps_6_1 into shadermodel6.1-pixel. That is done inside tryParseProfile at HLSL.cpp. To integrate the option into clang Driver, a new DriverMode DxcMode is created. When DxcMode is enabled, OSType for TargetTriple will be forced into Triple::ShaderModel. And new ToolChain HLSLToolChain will be created when OSType is Triple::ShaderModel. In HLSLToolChain, ComputeEffectiveClangTriple is overridden to call tryParseProfile when targetProfile option is set. To make test work, Fo option is added and .hlsl is added for active -xhlsl. Reviewed By: beanz Differential Revision: https://reviews.llvm.org/D122865 Patch by: Xiang Li <python3kgae@outlook.com>
2022-03-21Ensure -extract-api handles multiple headers correctlyDaniel Grumberg1-0/+1
clang -extract-api should accept multiple headers and forward them to a single CC1 instance. This change introduces a new ExtractAPIJobAction. Currently API Extraction is done during the Precompile phase as this is the current phase that matches the requirements the most. Adding a new phase would need to change some logic in how phases are scheduled. If the headers scheduled for API extraction are of different types the driver emits a diagnostic. Differential Revision: https://reviews.llvm.org/D121936
2022-03-03[PS4] isPS4 and isPS4CPU are not meaningfully differentPaul Robinson1-2/+2
2022-01-31[Clang] Introduce Clang Linker Wrapper ToolJoseph Huber1-0/+8
This patch introduces a linker wrapper tool that allows us to preprocess files before they are sent to the linker. This adds a dummy action and job to the driver stage that builds the linker command as usual and then replaces the command line with the wrapper tool. Depends on D116543 Reviewed By: JonChesterfield Differential Revision: https://reviews.llvm.org/D116544
2022-01-28[OpenMP] Accept shortened triples for -Xopenmp-target=Joseph Huber1-1/+3
This patch builds on the change in D117634 that expanded the short triples when passed in by the user. This patch adds the same functionality for the `-Xopenmp-target=` flag. Previously it was unintuitive that passing `-fopenmp-targets=nvptx64 -Xopenmp-target=nvptx64 <arg>` would not forward the arg because the triples did not match on account of `nvptx64` being expanded to `nvptx64-nvidia-cuda`. Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D118495
2022-01-27[CMake] [Clang] Add option to specify PowerPC long double formatQiu Chaofan1-0/+4
This method introduces new CMake variable PPC_LINUX_DEFAULT_IEEELONGDOUBLE (false by default) to enable fp128 as default long double format. Reviewed By: jsji Differential Revision: https://reviews.llvm.org/D118110
2022-01-26Revert "Rename llvm::array_lengthof into llvm::size to match std::size from ↵Benjamin Kramer1-1/+1
C++17" This reverts commit ef8206320769ad31422a803a0d6de6077fd231d2. - It conflicts with the existing llvm::size in STLExtras, which will now never be called. - Calling it without llvm:: breaks C++17 compat
2022-01-26Rename llvm::array_lengthof into llvm::size to match std::size from C++17serge-sans-paille1-1/+1
As a conquence move llvm::array_lengthof from STLExtras.h to STLForwardCompat.h (which is included by STLExtras.h so no build breakage expected).
2022-01-05[clang] Fall back on Android triple w/o API level for runtimes searchCollin Baker1-16/+34
Clang searches for runtimes (e.g. libclang_rt*) first in a subdirectory named for the target triple (corresponding to LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON), then if it's not found uses .../lib/<os>/libclang_rt* with a suffix corresponding to the arch and environment name. Android triples optionally include an API level indicating the minimum Android version to be run on (e.g. aarch64-unknown-linux-android21). When compiler-rt is built with LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON this API level is part of the output path. Linking code built for a later API level against a runtime built for an earlier one is safe. In projects with several API level targets this is desireable to avoid re-building the same runtimes many times. This is difficult with the current runtime search method: if the API levels don't exactly match Clang gives up on the per-target runtime directory path. To enable this more simply, this change tries target triple without the API level before falling back on the old layout. Another option would be to try every API level in the triple, e.g. check aarch-64-unknown-linux-android21, then ...20, then ...19, etc. Differential Revision: https://reviews.llvm.org/D115049
2021-12-23[SPIR-V] Add a toolchain for SPIR-V in clangAnastasia Stulova1-1/+1
This patch adds a toolchain (TC) for SPIR-V along with the following changes in Driver and base ToolChain and Tool. This is required to provide a mechanism in clang to bypass SPIR-V backend in LLVM for SPIR-V until it lands in LLVM and matures. The SPIR-V code is generated by the SPIRV-LLVM translator tool named 'llvm-spirv' that is sought in 'PATH'. The compilation phases/actions should be bound for SPIR-V in the meantime as following: compile -> tools::Clang backend -> tools::SPIRV::Translator assemble -> tools::SPIRV::Translator However, Driver’s ToolSelector collapses compile-backend-assemble and compile-backend sequences to tools::Clang. To prevent this, added new {use,has}IntegratedBackend properties in ToolChain and Tool to which the ToolSelector reacts on, and which SPIR-V TC overrides. Linking of multiple input files is currently not supported but can be added separately. Differential Revision: https://reviews.llvm.org/D112410 Co-authored-by: Henry Linjamäki <henry.linjamaki@parmance.com>
2021-12-06Revert "[Clang] Ignore CLANG_DEFAULT_LINKER for custom-linker toolchains"Simon Moll1-7/+1
Reverted until all Toolchains are fixed for the new behavior. This reverts commit 34a43f2115af79f896c889433c57f3b400e9f2c6.
2021-12-06[Clang] Ignore CLANG_DEFAULT_LINKER for custom-linker toolchainsSimon Moll1-1/+7
Before, the CLANG_DEFAULT_LINKER cmake option was a global override for the linker that shall be used on all toolchains. The linker binary specified that way may not be available on toolchains with custom linkers. Eg, the only linker for VE is named 'nld' - any other linker invalidates the toolchain. This patch removes the hard override and instead lets the generic toolchain implementation default to CLANG_DEFAULT_LINKER. Toolchains can now deviate with a custom linker name or deliberatly default to CLANG_DEFAULT_LINKER. Reviewed By: MaskRay, phosek Differential Revision: https://reviews.llvm.org/D115045
2021-12-02[clang][Darwin] Remove old lld implementation handlingKeith Smiley1-8/+2
This now assumes that for the darwin driver any lld is the "new" macho lld implementation. Differential Revision: https://reviews.llvm.org/D114974
2021-11-17[Driver][Android] Remove unneeded isNoExecStackDefaultFangrui Song1-4/+0
ld.lld used by Android ignores .note.GNU-stack and defaults to noexecstack, so the `-z noexecstack` linker option is unneeded. The `--noexecstack` assembler option is unneeded because AsmPrinter.cpp prints `.section .note.GNU-stack,"",@progbits` (when `llvm.init.trampoline` is unused), so the assembler won't synthesize an executable .note.GNU-stack. Reviewed By: danalbert Differential Revision: https://reviews.llvm.org/D113840
2021-11-11[Driver] Fix ToolChain::getSanitizerArgsYaxun (Sam) Liu1-4/+5
The driver uses class SanitizerArgs to store parsed sanitizer arguments. It keeps a cached SanitizerArgs object in ToolChain and uses it for different jobs. This does not work if the sanitizer options are different for different jobs, which could happen when an offloading toolchain translates the options for different jobs. To fix this, SanitizerArgs should be created by using the actual arguments passed to jobs instead of the original arguments passed to the driver, since the toolchain may change the original arguments. And the sanitizer arguments should be diagnose once. This patch also fixes HIP toolchain for handling -fgpu-sanitize: a warning is emitted for GPU's not supporting sanitizer and skipped. This is for backward compatibility with existing -fsanitize options. -fgpu-sanitize is also turned on by default. Reviewed by: Artem Belevich, Evgenii Stepanov Differential Revision: https://reviews.llvm.org/D111443
2021-10-29Support: Use sys::path::is_style_{posix,windows}() in a few placesDuncan P. N. Exon Smith1-4/+5
Use the new sys::path::is_style_posix() and is_style_windows() in a few places that need to detect the system's native path style. In llvm/lib/Support/Path.cpp, this patch removes most uses of the private `real_style()`, where is_style_posix() and is_style_windows() are just a little tidier. Elsewhere, this removes `_WIN32` macro checks. Added a FIXME to a FileManagerTest that seemed fishy, but maintained the existing behaviour. Differential Revision: https://reviews.llvm.org/D112289
2021-10-19[Driver, Frontend] Use StringRef::contains (NFC)Kazu Hirata1-1/+1
2021-10-08Move TargetRegistry.(h|cpp) from Support to MCReid Kleckner1-2/+2
This moves the registry higher in the LLVM library dependency stack. Every client of the target registry needs to link against MC anyway to actually use the target, so we might as well move this out of Support. This allows us to ensure that Support doesn't have includes from MC/*. Differential Revision: https://reviews.llvm.org/D111454
2021-09-27[HIP] Fix linking of asanrt.bcYaxun (Sam) Liu1-1/+1
HIP currently uses -mlink-builtin-bitcode to link all bitcode libraries, which changes the linkage of functions to be internal once they are linked in. This works for common bitcode libraries since these functions are not intended to be exposed for external callers. However, the functions in the sanitizer bitcode library is intended to be called by instructions generated by the sanitizer pass. If their linkage is changed to internal, their parameters may be altered by optimizations before the sanitizer pass, which renders them unusable by the sanitizer pass. To fix this issue, HIP toolchain links the sanitizer bitcode library with -mlink-bitcode-file, which does not change the linkage. A struct BitCodeLibraryInfo is introduced in ToolChain as a generic approach to pass the bitcode library information between ToolChain and Tool. Reviewed by: Artem Belevich Differential Revision: https://reviews.llvm.org/D110304
2021-09-17[clang][darwin] Add support for --emit-static-libKeith Smiley1-0/+2
This uses darwin's default libtool since llvm-ar isn't normally available. Differential Revision: https://reviews.llvm.org/D109461
2021-07-27[clang][driver] NFC: Move InputInfo.h from lib to includeJan Svoboda1-1/+1
Moving `InputInfo.h` from `lib/Driver/` into `include/Driver` to be able to expose it in an API consumed from outside of `clangDriver`. Reviewed By: dexonsmith Differential Revision: https://reviews.llvm.org/D106787
2021-07-15[Driver] Fix compiler-rt lookup for x32Harald van Dijk1-0/+3
x86_64-linux-gnu and x86_64-linux-gnux32 use different ABIs and objects built for one cannot be used for the other. In order to build and use compiler-rt for x32, we need to treat x32 as a new arch there. This updates the driver to search using the new arch name. Reviewed By: glaubitz Differential Revision: https://reviews.llvm.org/D100148
2021-05-27[AIX] Add -lc++abi and -lunwind for linkingjasonliu1-1/+1
Summary: We are going to have libc++abi.a and libunwind.a on AIX. Add the necessary linking command to pick the libraries up. Reviewed By: daltenty Differential Revision: https://reviews.llvm.org/D102813
2021-05-04[Driver] Fix `ToolChain::getCompilerRTPath()` to return the correct path on ↵Dan Liew1-0/+3
Apple platforms. When the target triple was an Apple platform `ToolChain::getOSLibName()` (called by `getCompilerRTPath()`) would return the full OS name including the version number (e.g. `darwin20.3.0`). This is not correct because the library directory for all Apple platforms is `darwin`. This in turn caused * `-print-runtime-dir` to return a non-existant path. * `-print-file-name=<any compiler-rt library>` to return the filename instead of the full path to the library. Two regression tests are included. rdar://77417317 Differential Revision: https://reviews.llvm.org/D101682
2021-04-27[Driver] Use normalized triples for per-target runtimesPetr Hosek1-3/+10
This is a partial revert of b4537c3f51bc6c011ddd9c10b80043ac4ce16a01 based on the discussion in https://reviews.llvm.org/D101194. Rather than using the getMultiarchTriple, we use the getTripleString.
2021-04-26[Driver] Push multiarch path setup to individual driversPetr Hosek1-39/+9
Different platforms use different rules for multiarch triples so it's difficult to provide a single method for all platforms. We instead move the getMultiarchTriple to the ToolChain class and let individual platforms override it and provide their custom logic. Differential Revision: https://reviews.llvm.org/D101194
2021-04-21[libcxx] Stop using use c++ subdirectory for libc++ libraryPetr Hosek1-7/+5
The new layout more closely matches the layout used by other compilers. This is only used when LLVM_ENABLE_PER_TARGET_RUNTIME_DIR is enabled. Differential Revision: https://reviews.llvm.org/D100869
2021-03-31[Driver] Move detectLibcxxIncludePath to ToolChainPetr Hosek1-0/+23
This helper method is useful even outside of Gnu toolchains, so move it to ToolChain so it can be reused in other toolchains such as Fuchsia. Differential Revision: https://reviews.llvm.org/D88452
2021-03-28[Driver] Suppress libstdc++/libc++ path with -nostdincFangrui Song1-1/+2
This follows GCC. Having libstdc++/libc++ include paths is not useful anyway because libstdc++/libc++ header files cannot find features.h. While here, suppress -stdlib++-isystem with -nostdlibinc.
2021-03-18Revert "[NFC] Minor cleanup to use default setting of getLastArg()"Maxim Kuvyrkov1-2/+2
The patch was wrong. We use "const Arg *A" at the end of GetLinkerPath, so can't remove it. This reverts commit 6802fdf8871f69d52b06d0a2b7f62f3af8292690.
2021-03-18[NFC] Minor cleanup to use default setting of getLastArg()Maxim Kuvyrkov1-2/+2
Noticed this while I was looking at linker defaults. Reviewed By: asl Differential Revision: https://reviews.llvm.org/D98494