summaryrefslogtreecommitdiffstats
path: root/clang/test/Driver/linux-ld.c
Commit message (Collapse)AuthorAgeFilesLines
* Add support for openSUSE RISC-V tripleSam Elliott2019-08-011-0/+20
| | | | | | | | | | | | | | | | Reviewers: asb Reviewed By: asb Subscribers: lenary, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, zzheng, edward-jones, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, lebedev.ri, kito-cheng, shiva0217, rogfer01, dexonsmith, rkruppe, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D63497 Patch by Andreas Schwab (schwab) llvm-svn: 367565
* [Driver] -static-pie: add -z textFangrui Song2019-05-301-0/+6
| | | | | | | | | | | | | | | | | | | | | | | This matches gcc -static-pie. The intention is to prevent dynamic relocations in read-only segments. In ld.bfd and gold, -z notext is the default. If text relocations are needed: * -z notext: allow and emit DF_TEXTREL. DF_TEXTREL is not emitted if there is no text relocation. * -z text: error In lld, -z text is the default (this change is a no-op). * -z text: error on text relocations * -z notext: allow text relocations, and emit DF_TEXTREL no matter whether text relocations exist. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D62606 llvm-svn: 362050
* Let -static-pie win if it is specified along with -pie or -static.Siva Chandra2019-05-211-0/+33
| | | | | | | | Also, disallow specifying -no-pie/-nopie along with -static-pie. Differential Revision: https://reviews.llvm.org/D59841 llvm-svn: 361312
* [Driver] Support compiler-rt crtbegin.o/crtend.o for LinuxPetr Hosek2019-04-301-61/+66
| | | | | | | | | | When compiler-rt is selected as the runtime library for Linux targets use its crtbegin.o/crtend.o implemenetation rather than platform one if available. Differential Revision: https://reviews.llvm.org/D59264 llvm-svn: 359603
* [driver][mips] Check both `gnuabi64` and `gnu` suffixes in `getMultiarchTriple`Simon Atanasyan2019-04-021-0/+10
| | | | | | | | | | 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] Use --warn-shared-textrel for Android.Dan Albert2019-03-291-1/+7
| | | | | | | | | | | | | | | Android does not allow shared text relocations. Enable the linker warning to detect them by default. Reviewers: srhines, pirama Reviewed By: srhines Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D53344 llvm-svn: 357296
* [Driver] Default Android toolchains to noexecstack.Dan Albert2019-03-281-0/+9
| | | | | | | | | | | | | | 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
* [Clang Driver] Add support for "-static-pie" argument to the Clang driver.Siva Chandra2019-02-201-0/+13
| | | | | | | | | | | | Summary: This change mimics GCC's support for the "-static-pie" argument. Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D58307 llvm-svn: 354502
* Properly support -shared-libgcc.Sterling Augustine2019-01-101-12/+7
| | | | | | This revision was revied in D55016. llvm-svn: 350900
* [ARM][AArch64] Pass through endian flags to assembler and linker.Peter Smith2018-10-161-0/+73
| | | | | | | | | | | | | | | | | The big-endian arm32 Linux builds are currently failing when the -mbig-endian flag is used but the binutils default on the system is little endian. This also holds when -mlittle-endian is used and the binutils default is big endian. The patch always passes through -EL or -BE to the assembler and linker, taking into account the target and the -mbig-endian and -mlittle-endian flag. Fixes pr38770 Differential Revision: https://reviews.llvm.org/D52784 llvm-svn: 344597
* [mips] Fix handling of GNUABIN32 environment in a target tripleSimon Atanasyan2018-10-151-0/+14
| | | | | | | | | | | | 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
* [Hexagon] Update tests account for non-hardcoded linker name.Sid Manning2018-10-141-1/+1
| | | | | | | | | Tests should not assume the linker's name, CLANG_DEFAULT_LINKER could change it. Differential Revision: https://reviews.llvm.org/D53219 llvm-svn: 344482
* [Driver] Default to `-z now` and `-z relro` on Android.Dan Albert2018-10-111-0/+2
| | | | | | | | | | | | | | | | | | 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-0/+14
| | | | | | | | | | | | | | | | | 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
* [Aarch64] Fix linker emulation for Aarch64 big endianPeter Smith2018-09-031-0/+8
| | | | | | | | | | | | | | This patch fixes target linker emulation for aarch64 big endian. aarch64_be_linux is not recognized by gnu ld. The equivalent emulation mode supported by gnu ld is aarch64linuxb. Patch by: Bharathi Seshadri Reviewed by: Peter Smith Differential Revision: https://reviews.llvm.org/D42930 llvm-svn: 341312
* Refactor Addlibgcc to make the when and what logic more straightfoward.Sterling Augustine2018-08-311-0/+24
| | | | | | Add Android tests. llvm-svn: 341231
* Change %clang++ to %clangxx in test run line as it was expanding to ↵Douglas Yung2018-08-301-1/+1
| | | | | | clang.exe++ on Windows. llvm-svn: 341106
* Test the cross-product of how libgcc-related arguments are passed to the linker.Sterling Augustine2018-08-301-0/+82
| | | | llvm-svn: 341083
* Fix clash of gcc toolchains in driver regression testsKarl-Johan Karlsson2018-08-071-0/+2
| | | | | | | | | | | | | | | | For some regression tests the path to the right toolchain is specified using the -sysroot switch. However, if clang was configured with a custom gcc toolchain (either by using GCC_INSTALL_PREFIX in cmake or the equivalent configure command), the path to the custom gcc toolchain path takes precedence to the one specified by sysroot. This causes several regression tests to fail as they will be using an unexpected path. This patch fixes this issue by adding --gcc-toolchain='' to all tests that rely on that. The empty string causes the driver to pick the path from sysroot instead. This patch contain the same kind of fixes as done in rC225182 llvm-svn: 339112
* [OpenEmbedded] Explicitly specify -rtlib in testsPetr Hosek2018-08-011-2/+2
| | | | | | | | | | | Tests added in r338294 implicitly assume that libgcc is the runtime library, but that's not the case when the user configures Clang to use compiler-rt in which case these tests will break. Explicitly request libgcc when invoking clang in these tests to avoid that. Differential Revision: https://reviews.llvm.org/D50123 llvm-svn: 338482
* [OpenEmbedded] Fix lib paths for OpenEmbedded targetsMandeep Singh Grang2018-07-301-1/+37
| | | | | | | | | | | | | | | | | | | | | 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
* For x86_64, gcc 7.2 under Amazon Linux AMI sets its path to x86_64-amazon-linux.Jiading Gai2018-07-241-0/+22
| | | | | | | | | | | | | | | gcc 7.2 under Amazon Linux AMI sets its paths to x86_64-amazon-linux. Adding this triple to the list of search, plus a test case to cover this. The patch fixes the following bug reported in bugzilla: https://bugs.llvm.org/show_bug.cgi?id=35992 Reviewers: echristo Differential Revision: https://reviews.llvm.org/D46230 llvm-svn: 337811
* Driver: Add an explicit target to testcase from r336037Tom Stellard2018-06-301-0/+1
| | | | llvm-svn: 336039
* 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/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [Driver] Generate .eh_frame_hdr for static executables too.Dan Albert2018-02-211-1/+1
| | | | | | | | | | | | | | Summary: libgcc won't unwind without an .eh_frame_hdr section. Reviewers: srhines, chandlerc Reviewed By: chandlerc Subscribers: chandlerc, cfe-commits Differential Revision: https://reviews.llvm.org/D43203 llvm-svn: 325733
* Enable -pie and --enable-new-dtags by default on Android.Evgeniy Stepanov2017-10-251-25/+1
| | | | | | | | | | | | | | | Summary: Also enable -no-pie on Gnu toolchain (previously available on Darwin only). Non-PIE executables won't even start on recent Android, and DT_RPATH is ignored by the loader. Reviewers: srhines, danalbert Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D38430 llvm-svn: 316606
* Reland r311836 - [Driver] Use arch type to find compiler-rt libraries (on Linux)Michal Gorny2017-08-281-0/+21
| | | | | | | | | | | | | | | | | | | | 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
* Revert r311836 - [Driver] Use arch type to find compiler-rt libraries (on Linux)Michal Gorny2017-08-271-21/+0
| | | | | | | 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-0/+21
| | | | | | | | | | | | | | | | | | | | 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 support for openSUSE ARM TriplesIsmail Donmez2017-04-211-0/+40
| | | | | | | | | | | | | | Summary: Add support for armv6hl-suse-linux-gnueabi and armv7hl-suse-linux-gnueabi triples used by openSUSE/SUSE. Reviewers: cfe-commits, rovka, compnerd, rengolin Reviewed By: rengolin Subscribers: aemerson, rengolin, bkramer, chandlerc Differential Revision: https://reviews.llvm.org/D32347 llvm-svn: 300969
* [Hexagon] Linux linker does not support .gnu-hashSumanth Gundapaneni2017-01-191-0/+8
| | | | | | | | | Hexagon Linux dynamic loader does not use (in fact does not support) .gnu-hash Differential Revision: https://reviews.llvm.org/D28865 llvm-svn: 292496
* [Driver] Add openSuse AArch64 TripleKostya Kortchinsky2017-01-101-0/+20
| | | | | | | | | | | | | | | | Summary: openSuse has AArch64 support, with images running on the Raspberry Pi 3. The libraries and headers live under the aarch64-suse-linux subdirectory, which is currently not in the AArch64 triples list. Address this by adding the corresponding string to AArch64Triples. Reviewers: chandlerc, bruno, bkramer, rengolin Subscribers: aemerson, rengolin, cfe-commits Differential Revision: https://reviews.llvm.org/D28238 llvm-svn: 291598
* [Driver] Attempt to fix new linux-ld tests on WindowsMichal Gorny2016-12-121-3/+3
| | | | | | (broken by r289436) llvm-svn: 289440
* [Driver] Fix finding multilib gcc install on Gentoo (with gcc-config)Michal Gorny2016-12-121-0/+53
| | | | | | | | | | | | | | | | | | | | | | | | | Fix the gcc-config code to support multilib gcc installs properly. This solves two problems: -mx32 using the 64-bit gcc directory (due to matching installation triple), and -m32 not respecting gcc-config at all (due to mismatched installation triple). In order to fix the former issue, split the multilib scan out of Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple() (the code is otherwise unchanged), and call it for each installation found via gcc-config. In order to fix the latter issue, split the gcc-config processing out of Generic_GCC::GCCInstallationDetector::init() and repeat it for all triples, including extra and biarch triples. The only change in the gcc-config code itself is adding the call to multilib scan. Convert the gentoo_linux_gcc_multi_version_tree test input to multilib x86_64+32+x32 install, and add appropriate tests to linux-header-search and linux-ld. Differential Revision: https://reviews.llvm.org/D26887 llvm-svn: 289436
* Fix two bugs for musl-libc on ARMDiana Picus2016-08-081-0/+12
| | | | | | | | | | | | | | | Bug 1: triples like armv7-pc-linux-musl use the wrong linker name ld-musl-armv7.so.1; the right name should be ld-musl-arm.so.1, disregarding the subarch field. Bug 2: when compiler option -mhard-float is used, we should use the "hardfloat" linker, no matter whether the triple itself mentions "hardfloat". Patch by Lei Zhang! Differential Revision: https://reviews.llvm.org/D22904 llvm-svn: 277985
* Support setting default value for -rtlib at build timeJonas Hahnfeld2016-07-271-38/+38
| | | | | | | | | | | | | | | | | This patch introduces a new cmake variable: CLANG_DEFAULT_RTLIB, thru which we can specify a default value for -rtlib (libgcc or compiler-rt) at build time, just like how we set the default C++ stdlib thru CLANG_DEFAULT_CXX_STDLIB. With these two options, we can configure clang to build binaries on Linux that have no runtime dependence on any gcc libs (libstdc++ or libgcc_s). Patch by Lei Zhang! Differential Revision: https://reviews.llvm.org/D22663 llvm-svn: 276848
* Add support for musl-libc on ARM Linux.Rafael Espindola2016-06-241-8/+44
| | | | | | Patch by Lei Zhang! llvm-svn: 273735
* [Driver] Adapt Linux::GCCVersion::Parse to match GCC 5 installationsBryan Chan2016-06-171-0/+9
| | | | | | | | | | | | | | | | | Summary: Some GCC 5 installations store the libstdc++ includes and GCC-specific files in paths without the minor part of the version number, such as /usr/include/c++/5 /usr/lib64/gcc/x86_64-suse-linux/5 Reviewers: cfe-commits, thiagomacieira, jroelofs Subscribers: tinti, jroelofs Differential Revision: http://reviews.llvm.org/D14727 llvm-svn: 273012
* Add a few Musl related tests that already pass.Rafael Espindola2016-06-151-4/+28
| | | | | | Patch by Lei Zhang. llvm-svn: 272825
* Start adding support for Musl.Rafael Espindola2016-06-141-0/+10
| | | | | | | | | | | The two patches together enable clang to support targets like "x86_64-pc-linux-musl" and build binaries against musl-libc instead of glibc. This make it easy for clang to work on some musl-based systems like Alpine Linux and certain flavors of Gentoo. Patch by Lei Zhang. llvm-svn: 272662
* This patch fixes target linker emulation for ARM 32 big endian.Strahinja Petrovic2016-06-101-2/+2
| | | | llvm-svn: 272402
* Driver: support exherbo's multiarch supportSaleem Abdulrasool2016-05-231-20/+20
| | | | | | | | Exherbo has an alternative file system layout to accommodate multiarch. The loader is located at /usr/${triple}/lib/${loader}. Adjust the Linux toolchain to support that on exherbo. llvm-svn: 270392
* [mips] Add test for the dynamic linker when using the mips64el-fedora-linux ↵Vasileios Kalintiris2016-05-161-0/+8
| | | | | | | | | | triple. We should use the musl linker only when there's no environment specified and the vendor is MTI. The new test verifies this behaviour and is a follow-up to the r269411 commit that added the vendor field check. llvm-svn: 269651
* Fix CHECK directives that weren't checking.Hans Wennborg2015-08-311-1/+1
| | | | llvm-svn: 246492
* Setting ARM dynamic linker name from commandlineRenato Golin2015-07-271-0/+7
| | | | | | | | | | Currently trigger to select hard-float linker is only based of -gnueabihf appearing in target triplet, but we should also select it when hardfloat is requested via cmdline. Patch by Khem Raj. llvm-svn: 243262
* [Compiler-RT] Remove dependency on libgcc_s/ehRenato Golin2015-07-231-4/+4
| | | | | | | | | | | | | | Currently, for --rtlib=compiler-rt on GNU systems, we're assuming that one has libgcc_s and libgcc_eh as low-level libraries, which when used in conjunction with -lunwind or -lc++abi, breaks that assumption. My original fix was wrong, and this patch reverts it to prepare for a new flag to choose the unwinder/C++ libraries. For the time being, people can use "-lgcc_s -lgcc_eh" or "-lunwind -lc++abi" or any combination they need explicitly. llvm-svn: 243025
* [PPC]: Fix bug in getMultiarchTriple.Douglas Katzman2015-06-261-0/+13
| | | | | | | | And generally prefer not to restate TargetTriple.str() over and over. Differential Revision: http://reviews.llvm.org/D10605 llvm-svn: 240808
* [SPARC] Fix windows test failure after r239154.James Y Knight2015-06-051-15/+15
| | | | | | (Hopefully) llvm-svn: 239156
* [SPARC] Add multiarch include paths.James Y Knight2015-06-051-0/+61
| | | | | | | | | | | Adds tests verifying the proper dirs are found in the Debian 8/GCC4.9 layout for sparc (32bit), sparc (32bit) with lib64 multilib, and sparc64. The test cases added here also cover r239047, which fixed the linker paths. llvm-svn: 239154
OpenPOWER on IntegriCloud