summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/ToolChains/Linux.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [Gnu toolchain] Look at standard GCC paths for libstdcxx by defaultKristina Brooks2020-01-051-70/+7
| | | | | | | | | | | Linux' current addLibCxxIncludePaths and addLibStdCxxIncludePaths are actually almost non-Linux-specific at all, and can be reused almost as such for all gcc toolchains. Only keep Android/Freescale/Cray hacks in Linux's version. Patch by sthibaul (Samuel Thibault) Differential Revision: https://reviews.llvm.org/D69758
* Reland 198fbcb8, "Driver: Don't look for libc++ headers in the install ↵Peter Collingbourne2019-12-091-11/+16
| | | | | | | | | | | | | | | | | | | | | | directory on Android.", which was reverted in b3249027. Fixed the test case to set --sysroot, which lets it succeed in the case where a directory named "/usr/include/c++/v1" or "/usr/local/include/c++/v1" exists. Original commit message: > The NDK uses a separate set of libc++ headers in the sysroot. Any headers > in the installation directory are not going to work on Android, not least > because they use a different name for the inline namespace (std::__1 instead > of std::__ndk1). > > This effectively makes it impossible to produce a single toolchain that is > capable of targeting both Android and another platform that expects libc++ > headers to be installed in the installation directory, such as Mac. > > In order to allow this scenario to work, stop looking for headers in the > install directory on Android. Differential Revision: https://reviews.llvm.org/D71154
* Revert "Driver: Don't look for libc++ headers in the install directory on ↵David Zarzycki2019-12-081-16/+11
| | | | | | | | Android." This reverts commit 198fbcb817492ff45946e3f7517de15e8cdf0607. This breaks Fedora 31.
* Driver: Don't look for libc++ headers in the install directory on Android.Peter Collingbourne2019-12-061-11/+16
| | | | | | | | | | | | | | | | The NDK uses a separate set of libc++ headers in the sysroot. Any headers in the installation directory are not going to work on Android, not least because they use a different name for the inline namespace (std::__1 instead of std::__ndk1). This effectively makes it impossible to produce a single toolchain that is capable of targeting both Android and another platform that expects libc++ headers to be installed in the installation directory, such as Mac. In order to allow this scenario to work, stop looking for headers in the install directory on Android. Differential Revision: https://reviews.llvm.org/D71154
* [Clang] Bypass distro detection on non-Linux hostsAlexandre Ganea2019-11-281-2/+2
| | | | | | Skip distro detection when we're not running on Linux, or when the target triple is not Linux. This saves a few OS calls for each invocation of clang.exe. Differential Revision: https://reviews.llvm.org/D70467
* Enable memtag sanitizer in all AArch64 toolchainsMomchil Velikov2019-08-131-2/+0
| | | | | | | | That sanitizer does not have runtime library or other dependencies. Differential Revision: https://reviews.llvm.org/D65642 llvm-svn: 368697
* [Driver] Prioritize SYSROOT/usr/include over RESOURCE_DIR/include on linux-muslFangrui Song2019-08-061-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On a musl-based Linux distribution, stdalign.h stdarg.h stdbool.h stddef.h stdint.h stdnoreturn.h are expected to be provided by musl (/usr/include), instead of RESOURCE_DIR/include. Reorder RESOURCE_DIR/include to fix the search order problem. (Currently musl doesn't provide stdatomic.h. stdatomic.h is still found in RESOURCE_DIR/include.) gcc on musl has a similar search order: ``` /usr/lib/gcc/x86_64-alpine-linux-musl/8.3.0/../../../../include/c++/8.3.0 /usr/lib/gcc/x86_64-alpine-linux-musl/8.3.0/../../../../include/c++/8.3.0/x86_64-alpine-linux-musl /usr/lib/gcc/x86_64-alpine-linux-musl/8.3.0/../../../../include/c++/8.3.0/backward /usr/local/include /usr/include/fortify /usr/include /usr/lib/gcc/x86_64-alpine-linux-musl/8.3.0/include ``` This is different from a glibc-based distribution where RESOURCE_DIR/include is placed before SYSROOT/usr/include. According to the maintainer of musl: > musl does not support use/mixing of compiler-provided std headers with its headers, and intentionally has no mechanism for communicating with such headers as to which types have already been defined or still need to be defined. If the current include order, with clang's headers before the libc ones, works in some situations, it's only by accident. Reviewed by: phosek Differential Revision: https://reviews.llvm.org/D65699 llvm-svn: 367981
* ARM MTE stack sanitizer.Evgeniy Stepanov2019-07-151-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Add "memtag" sanitizer that detects and mitigates stack memory issues using armv8.5 Memory Tagging Extension. It is similar in principle to HWASan, which is a software implementation of the same idea, but there are enough differencies to warrant a new sanitizer type IMHO. It is also expected to have very different performance properties. The new sanitizer does not have a runtime library (it may grow one later, along with a "debugging" mode). Similar to SafeStack and StackProtector, the instrumentation pass (in a follow up change) will be inserted in all cases, but will only affect functions marked with the new sanitize_memtag attribute. Reviewers: pcc, hctim, vitalybuka, ostannard Subscribers: srhines, mehdi_amini, javed.absar, kristof.beyls, hiraditya, cryptoad, steven_wu, dexonsmith, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D64169 llvm-svn: 366123
* [Driver] Delete --no-add-needed for RHEL7 or newerFangrui Song2019-07-121-3/+0
| | | | | | | | This is really not needed. gcc driver doesn't add this option. BTW, since binutils 2.22, --no-copy-dt-needed-entries (new name of --no-add-needed) is the default. llvm-svn: 365877
* Update libc++ include path detection to use VFS on LinuxJulie Hockett2019-07-101-6/+7
| | | | | | | | | | The DetectLibcxxIncludePath function had been using llvm::sys::fs::directory_iterator, and this updates it to use llvm::vfs::directory_iterator. Differential Revision: https://reviews.llvm.org/D64381 llvm-svn: 365682
* [RISCV][NFC] Make use of Triple::isRISCVAlex Bradbury2019-07-081-2/+1
| | | | | | Use new helper introduced in rL365327. llvm-svn: 365329
* [runtimes] Move libunwind, libc++abi and libc++ to lib/$target/c++ and ↵Petr Hosek2019-05-221-1/+0
| | | | | | | | | | | | | | | | | include/c++ This change is a consequence of the discussion in "RFC: Place libs in Clang-dedicated directories", specifically the suggestion that libunwind, libc++abi and libc++ shouldn't be using Clang resource directory. Tools like clangd make this assumption, but this is currently not true for the LLVM_ENABLE_PER_TARGET_RUNTIME_DIR build. This change addresses that by moving the output of these libraries to lib/$target/c++ and include/c++ directories, leaving resource directory only for compiler-rt runtimes and Clang builtin headers. Differential Revision: https://reviews.llvm.org/D59168 llvm-svn: 361432
* [Driver] Verify GCCInstallation is validNick Desaulniers2019-05-211-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Values returned by GCCInstallation.getParentLibPath() and GCCInstallation.getTriple() are not valid unless GCCInstallation.isValid() returns true. This has previously been ignored, and the former two values were used without checking whether GCCInstallation is valid. This led to the bad path "/../bin" being added to the list of program paths. author: danielmentz "Daniel Mentz <danielmentz@google.com>" Reviewers: #clang, tstellar, srhines Reviewed By: srhines Subscribers: danielmentz, ormris, nickdesaulniers, srhines, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D57930 llvm-svn: 361314
* [asan] Add gcc 8's driver option -fsanitize=pointer-compare and ↵Pierre Gousseau2019-04-121-0/+2
| | | | | | | | | | | | -fsanitize=pointer-substract. Disabled by default as this is still an experimental feature. Reviewed By: thakis Differential Revision: https://reviews.llvm.org/D59221 llvm-svn: 358285
* [driver][mips] Check both `gnuabi64` and `gnu` suffixes in `getMultiarchTriple`Simon Atanasyan2019-04-021-14/+19
| | | | | | | | | | In case of N64 ABI toolchain paths migth have `mips-linux-gnuabi64` or `mips-linux-gnu` directory regardless of selected environment. Check both variants while detecting a multiarch triple. Fix for the bug https://bugs.llvm.org/show_bug.cgi?id=41204 llvm-svn: 357506
* [driver] clang-format. Fix indentation, split long lines. NFCSimon Atanasyan2019-04-021-5/+8
| | | | llvm-svn: 357505
* [Driver] Default Android toolchains to noexecstack.Dan Albert2019-03-281-0/+4
| | | | | | | | | | | | | | Android does not support executable stacks. Reviewers: srhines, pirama Reviewed By: pirama Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D53343 llvm-svn: 357197
* Remove esan.Nico Weber2019-03-111-2/+0
| | | | | | | | | | | It hasn't seen active development in years, and it hasn't reached a state where it was useful. Remove the code until someone is interested in working on it again. Differential Revision: https://reviews.llvm.org/D59133 llvm-svn: 355862
* Revert "[runtimes] Move libunwind, libc++abi and libc++ to lib/ and include/"Matthew Voss2019-03-081-0/+1
| | | | | | | | This broke the windows bots. This reverts commit 28302c66d2586074f77497d5dc4eac7182b679e0. llvm-svn: 355725
* [runtimes] Move libunwind, libc++abi and libc++ to lib/ and include/Petr Hosek2019-03-081-1/+0
| | | | | | | | | | | | | | | This change is a consequence of the discussion in "RFC: Place libs in Clang-dedicated directories", specifically the suggestion that libunwind, libc++abi and libc++ shouldn't be using Clang resource directory. Tools like clangd make this assumption, but this is currently not true for the LLVM_ENABLE_PER_TARGET_RUNTIME_DIR build. This change addresses that by moving the output of these libraries to lib/<target> and include/ directories, leaving resource directory only for compiler-rt runtimes and Clang builtin headers. Differential Revision: https://reviews.llvm.org/D59013 llvm-svn: 355665
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* set default max-page-size to 4KB in lld for Android Aarch64Zhizhou Yang2018-11-291-0/+8
| | | | | | | | | | | | | | | | | | | | Summary: This patch passes an option '-z max-page-size=4096' to lld through clang driver. This is for Android on Aarch64 target. The lld default page size is too large for Aarch64, which produces larger .so files and images for arm64 device targets. In this patch we set default page size to 4KB for Android Aarch64 targets instead. Reviewers: srhines, danalbert, ruiu, chh, peter.smith Reviewed By: srhines Subscribers: javed.absar, kristof.beyls, cfe-commits, george.burgess.iv, llozano Differential Revision: https://reviews.llvm.org/D55029 llvm-svn: 347897
* Fix linker option for -fprofile-arcs -ftest-coverageMarco Castelluccio2018-11-271-1/+1
| | | | | | | | | | | | | | | | Summary: Linux toolchain accidentally added "-u__llvm_runtime_variable" when "-fprofile-arcs -ftest-coverage", this is not added when "--coverage" option is used. Using "-u__llvm_runtime_variable" generates an empty default.profraw file while an application built with "-fprofile-arcs -ftest-coverage" is running. Reviewers: calixte, marco-c, sylvestre.ledru Reviewed By: marco-c Subscribers: vsk, cfe-commits Differential Revision: https://reviews.llvm.org/D54195 llvm-svn: 347677
* [Driver] Support g++ headers in include/g++David Greene2018-11-131-0/+3
| | | | | | | | | | ray's gcc installation puts C++ headers in PREFIX/include/g++ without indicating a gcc version at all. Typically this is because the version is encoded somewhere in PREFIX. Differential Revision: https://reviews.llvm.org/D53770 llvm-svn: 346802
* [Driver] Reland again again: Default Android toolchains to libc++.Dan Albert2018-11-051-0/+6
| | | | | | | | Landed more fixes to the compiler-rt Android tests. Original review was https://reviews.llvm.org/D53109. llvm-svn: 346167
* Revert "[Driver] Reland again: Default Android toolchains to libc++."Dan Albert2018-10-221-6/+0
| | | | | | More compiler-rt test bot breakages... llvm-svn: 344963
* [Driver] Reland again: Default Android toolchains to libc++.Dan Albert2018-10-221-0/+6
| | | | | | | | | Some of the test data went missing last time I tried to submit this, causing the tests to fail when the build did not include libc++. Original review was https://reviews.llvm.org/D53109. llvm-svn: 344946
* Revert "[Driver] Reland: Default Android toolchains to libc++."Dan Albert2018-10-191-6/+0
| | | | | | This reverts commit 84677d5009d613232d360fda27e6e41fb5cb6700. llvm-svn: 344806
* [Driver] Reland: Default Android toolchains to libc++.Dan Albert2018-10-191-0/+6
| | | | | | | | The sanitizer builder that was broken by this should now be fixed. Original review was https://reviews.llvm.org/D53109 llvm-svn: 344795
* [driver][mips] Support MIPS R6 target triplesSimon Atanasyan2018-10-161-21/+56
| | | | | | | | | | | | | | | | This change adds support for the following MIPS target triples: mipsisa32r6-linux-gnu mipsisa32r6el-linux-gnu mipsisa64r6-linux-gnuabi64 mipsisa64r6el-linux-gnuabi64 mipsisa64r6-linux-gnuabin32 mipsisa64r6el-linux-gnuabin32 Patch by Yun Qiang Su. Differential revision: https://reviews.llvm.org/D50850 llvm-svn: 344608
* [mips] Fix handling of GNUABIN32 environment in a target tripleSimon Atanasyan2018-10-151-10/+19
| | | | | | | | | | | | The `GNUABIN32` environment in a target triple implies using the N32 ABI. This patch adds support for this environment and switches on N32 ABI if necessary. Patch by Patch by YunQiang Su. Differential revision: https://reviews.llvm.org/D51464 llvm-svn: 344570
* Revert "[Driver] Default Android toolchains to libc++."Dan Albert2018-10-111-6/+0
| | | | | | | | | Breaks some of the Android bots because they aren't expecting to need to explicitly set -stdlib. This reverts commit 031072f5048654b01a40f639633de1ff4e2f3dc8. llvm-svn: 344297
* [Driver] Default Android toolchains to libc++.Dan Albert2018-10-111-0/+6
| | | | | | | | | | | | Reviewers: srhines, pirama, EricWF Reviewed By: srhines Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D53109 llvm-svn: 344296
* [Driver] Default to `-z now` and `-z relro` on Android.Dan Albert2018-10-111-2/+3
| | | | | | | | | | | | | | | | | | Summary: RTLD_LAZY is not supported on Android (though failing to use `-z now` will work since it is assumed by the loader). RelRO is required. Reviewers: srhines, pirama Reviewed By: srhines Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D53117 llvm-svn: 344295
* [Driver] Fix --hash-style choice for Android.Dan Albert2018-10-111-5/+8
| | | | | | | | | | | | | | | | | Summary: Android supports GNU style hashes as of Marshmallow, so we should be generating both styles for pre-M targets and GNU hashes for newer targets. Reviewers: srhines, pirama Reviewed By: srhines Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D53118 llvm-svn: 344293
* Lift VFS from clang to llvm (NFC)Jonas Devlieghere2018-10-101-1/+1
| | | | | | | | | | | | | | | | | | | This patch moves the virtual file system form clang to llvm so it can be used by more projects. Concretely the patch: - Moves VirtualFileSystem.{h|cpp} from clang/Basic to llvm/Support. - Moves the corresponding unit test from clang to llvm. - Moves the vfs namespace from clang::vfs to llvm::vfs. - Formats the lines affected by this change, mostly this is the result of the added llvm namespace. RFC on the mailing list: http://lists.llvm.org/pipermail/llvm-dev/2018-October/126657.html Differential revision: https://reviews.llvm.org/D52783 llvm-svn: 344140
* [Driver] Fix missing MultiArch include dir on powerpcspeKristina Brooks2018-09-141-1/+2
| | | | | | | | | | | | On powerpc-linux-gnuspe, the header files are located in their own include directory named /usr/lib/powerpc-linux-gnuspe, so add this directory to PPCMultiarchIncludeDirs. Patch by glaubitz (John Paul Adrian Glaubitz) Differential Revision: https://reviews.llvm.org/D52066 llvm-svn: 342231
* [MSan] add KMSAN support to Clang driverAlexander Potapenko2018-09-071-0/+2
| | | | | | | | | | | | | | | Boilerplate code for using KMSAN instrumentation in Clang. We add a new command line flag, -fsanitize=kernel-memory, with a corresponding SanitizerKind::KernelMemory, which, along with SanitizerKind::Memory, maps to the memory_sanitizer feature. KMSAN is only supported on x86_64 Linux. It's incompatible with other sanitizers, but supports code coverage instrumentation. llvm-svn: 341641
* Fix the -print-multi-directory flag to print the selected multilib.Christian Bruel2018-09-061-5/+4
| | | | | | | | | | | | | | Summary: Fix -print-multi-directory to print the selected multilib Reviewers: jroelofs Reviewed By: jroelofs Subscribers: jroelofs, timshen, thakis, srhines, cfe-commits Differential Revision: https://reviews.llvm.org/D51354 llvm-svn: 341547
* Revert r341373, since it fails on some targets.Tim Shen2018-09-041-4/+5
| | | | | | Differential Revision: https://reviews.llvm.org/D51354 llvm-svn: 341418
* Fix the -print-multi-directory flag to print the selected multilib.Christian Bruel2018-09-041-5/+4
| | | | | | | | | | | | | | Summary: Fix -print-multi-directory to print the selected multilib Reviewers: jroelofs Reviewed By: jroelofs Subscribers: srhines, cfe-commits Differential Revision: https://reviews.llvm.org/D51354 llvm-svn: 341373
* [Android] Default to -fno-math-errnoPirama Arumuga Nainar2018-08-221-0/+6
| | | | | | | | | | | | Summary: Android's libm does not set errno. Reviewers: srhines, enh Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D51068 llvm-svn: 340424
* [OpenEmbedded] Fix lib paths for OpenEmbedded targetsMandeep Singh Grang2018-07-301-1/+8
| | | | | | | | | | | | | | | | | | | | | Summary: The lib paths are not correctly picked up for OpenEmbedded sysroots (like arm-oe-linux-gnueabi) for 2 reasons: 1. OpenEmbedded sysroots are of the form <sysroot>/usr/lib/<triple>/x.y.z. This form is handled in clang but only for Freescale vendor. 2. 64-bit OpenEmbedded sysroots may not have a /usr/lib dir. So they cannot find /usr/lib64 as it is referenced as /usr/lib/../lib64 in clang. This is a follow-up to the llvm patch: D48861 Reviewers: dlj, rengolin, fedor.sergeev, javed.absar, hfinkel, rsmith Reviewed By: rsmith Subscribers: rsmith, kristof.beyls, cfe-commits Differential Revision: https://reviews.llvm.org/D48862 llvm-svn: 338294
* [Driver] Add PPC64 as supported for ScudoKostya Kortchinsky2018-07-031-1/+2
| | | | | | | | | | | | | | | | | | Summary: Scudo works on PPC64 as is, so mark the architecture as supported for it. This will also require a change to config-ix.cmake on the compiler-rt side. Update the tests accordingly. Reviewers: eugenis, alekseyshl Reviewed By: alekseyshl Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D48833 llvm-svn: 336202
* Driver: Don't mix system tools with devtoolset tools on RHELTom Stellard2018-06-301-0/+9
| | | | | | | | | | | | | | | | | Summary: On RHEL, devtoolset provides a more up-to-date toolchain than the base install, and we want to make sure all the tools use are from the same toolchain. Reviewers: rsmith, bruno Reviewed By: bruno Subscribers: bruno, cfe-commits Differential Revision: https://reviews.llvm.org/D34848 llvm-svn: 336037
* Support for multiarch runtimes layoutPetr Hosek2018-06-281-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This change adds a support for multiarch style runtimes layout, so in addition to the existing layout where runtimes get installed to: lib/clang/$version/lib/$os Clang now allows runtimes to be installed to: lib/clang/$version/$target/lib This also includes libc++, libc++abi and libunwind; today those are assumed to be in Clang library directory built for host, with the new layout it is possible to install libc++, libc++abi and libunwind into the runtime directory built for different targets. The use of new layout is enabled by setting the LLVM_ENABLE_RUNTIME_TARGET_DIR CMake variable and is supported by both projects and runtimes layouts. The runtimes CMake build has been further modified to use the new layout when building runtimes for multiple targets. Differential Revision: https://reviews.llvm.org/D45604 llvm-svn: 335809
* Use Triple::isMIPS() instead of enumerating all Triples. NFCAlexander Richardson2018-06-251-10/+7
| | | | | | | | Reviewed By: atanasyan Differential Revision: https://reviews.llvm.org/D48549 llvm-svn: 335495
* Remove \brief commands from doxygen comments.Adrian Prantl2018-05-091-1/+1
| | | | | | | | | | | | | | | | | | | This is similar to the LLVM change https://reviews.llvm.org/D46290. We've been running doxygen with the autobrief option for a couple of years now. This makes the \brief markers into our comments redundant. Since they are a visual distraction and we don't want to encourage more \brief markers in new code either, this patch removes them all. Patch produced by for i in $(git grep -l '\@brief'); do perl -pi -e 's/\@brief //g' $i & done for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done Differential Revision: https://reviews.llvm.org/D46320 llvm-svn: 331834
* [Driver] Infer Android sysroot location.Dan Albert2018-05-021-0/+9
| | | | | | | | | | | | | | | | Summary: Android toolchains include their headers and libraries in a self-contained directory within the toolchain. Reviewers: srhines Reviewed By: srhines Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D45291 llvm-svn: 331390
* [Driver] Obey computed sysroot when finding libc++ headers.Dan Albert2018-05-021-2/+3
| | | | | | | | | | | | | | | | Summary: A handful of targets will try some default paths if --sysroot is not provided. If that is the case, it should be used for the libc++ header paths. Reviewers: srhines, EricWF Reviewed By: srhines Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D45292 llvm-svn: 331389
OpenPOWER on IntegriCloud