Commit Graph

107 Commits

Author SHA1 Message Date
Ismail Donmez ca9cdadeab Add support for openSUSE ARM Triples
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
2017-04-21 12:26:43 +00:00
Sumanth Gundapaneni 1952acf958 [Hexagon] Linux linker does not support .gnu-hash
Hexagon Linux dynamic loader does not use (in fact does not support)
.gnu-hash

Differential Revision: https://reviews.llvm.org/D28865

llvm-svn: 292496
2017-01-19 16:54:04 +00:00
Kostya Kortchinsky af6a9b982c [Driver] Add openSuse AArch64 Triple
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
2017-01-10 21:13:08 +00:00
Michal Gorny 108044a61c [Driver] Attempt to fix new linux-ld tests on Windows
(broken by r289436)

llvm-svn: 289440
2016-12-12 16:04:37 +00:00
Michal Gorny f4debddb09 [Driver] Fix finding multilib gcc install on Gentoo (with gcc-config)
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
2016-12-12 15:07:43 +00:00
Diana Picus 86db9e7b66 Fix two bugs for musl-libc on ARM
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
2016-08-08 08:27:36 +00:00
Jonas Hahnfeld d196fa524f Support setting default value for -rtlib at build time
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
2016-07-27 08:15:54 +00:00
Rafael Espindola 0fa668072f Add support for musl-libc on ARM Linux.
Patch by Lei Zhang!

llvm-svn: 273735
2016-06-24 21:35:06 +00:00
Bryan Chan d346ae6ee6 [Driver] Adapt Linux::GCCVersion::Parse to match GCC 5 installations
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
2016-06-17 16:47:14 +00:00
Rafael Espindola b31478bf40 Add a few Musl related tests that already pass.
Patch by Lei Zhang.

llvm-svn: 272825
2016-06-15 20:02:22 +00:00
Rafael Espindola 164fe34e98 Start adding support for Musl.
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
2016-06-14 12:47:24 +00:00
Strahinja Petrovic b859896815 This patch fixes target linker emulation for ARM 32 big endian.
llvm-svn: 272402
2016-06-10 16:09:20 +00:00
Saleem Abdulrasool 6f8442bdd8 Driver: support exherbo's multiarch support
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
2016-05-23 02:17:28 +00:00
Vasileios Kalintiris 44deb63ff2 [mips] Add test for the dynamic linker when using the mips64el-fedora-linux 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
2016-05-16 11:53:51 +00:00
Hans Wennborg 2151d12ec0 Fix CHECK directives that weren't checking.
llvm-svn: 246492
2015-08-31 21:48:52 +00:00
Renato Golin 24ba3e9852 Setting ARM dynamic linker name from commandline
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
2015-07-27 09:56:37 +00:00
Renato Golin 830f0c4c46 [Compiler-RT] Remove dependency on libgcc_s/eh
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
2015-07-23 17:24:41 +00:00
Douglas Katzman ecddb3a38a [PPC]: Fix bug in getMultiarchTriple.
And generally prefer not to restate TargetTriple.str() over and over.

Differential Revision: http://reviews.llvm.org/D10605

llvm-svn: 240808
2015-06-26 18:37:15 +00:00
James Y Knight f9373862ea [SPARC] Fix windows test failure after r239154.
(Hopefully)

llvm-svn: 239156
2015-06-05 14:16:39 +00:00
James Y Knight 09677ad882 [SPARC] Add multiarch include paths.
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
2015-06-05 13:44:43 +00:00
Douglas Katzman f36dddf426 [Sparc] Add support for 'sparcel' to clang.
Differential Revision: http://reviews.llvm.org/D8784

llvm-svn: 237001
2015-05-11 15:21:44 +00:00
Hal Finkel 0d0a1a53e3 [PowerPC] ABI support for the QPX vector instruction set
Support for the QPX vector instruction set, used on the IBM BG/Q supercomputer,
has recently been added to the LLVM PowerPC backend. This vector instruction
set requires some ABI modifications because the ABI on the BG/Q expects
<4 x double> vectors to be provided with 32-byte stack alignment, and to be
handled as native vector types (similar to how Altivec vectors are handled on
mainline PPC systems). I've named this ABI variant elfv1-qpx, have made this
the default ABI when QPX is supported, and have updated the ABI handling code
to provide QPX vectors with the correct stack alignment and associated
register-assignment logic.

llvm-svn: 231960
2015-03-11 19:14:15 +00:00
Chandler Carruth 7e7dd47fc2 Much like we silence warnings about -flto in many cases to facilitate
simplicity in build systems, silence '-stdlib=libc++' when linking. Even
if we're not linking C++ code per-se, we may be passing this flag so
that when we are linking C++ code we pick up the desired standard
library. While most build systems already provide separate C and C++
compile flags, many conflate link flags. Sadly, CMake is among them
causing this warning in a libc++ selfhost.

llvm-svn: 231559
2015-03-07 10:01:29 +00:00
Dan Albert 77214a4498 Don't force -pie for Android.
Summary:
There is no -no-pie flag that can override this, so making it default
to being on for Android means it is no longer possible to create
non-PIE executables on Android. While current versions of Android
support (and the most recent requires) PIE, ICS and earlier versions
of Android cannot run PIE executables, so this needs to be optional.

Reviewers: srhines

Reviewed By: srhines

Subscribers: thakis, volkalexey, cfe-commits

Differential Revision: http://reviews.llvm.org/D8015

llvm-svn: 231091
2015-03-03 18:24:57 +00:00
Joerg Sonnenberger 1689d3f732 For the --be8 flag, check explicitly for pre-v7 / pre-v6m cores.
Those used the old Big Endian support on ARM and don't need flags.
Refactor the logic in a separate common function, which also looks at
-march. Add corresponding logic for the Linux toolchain.

llvm-svn: 227393
2015-01-28 23:30:39 +00:00
Dan Albert 6f2875d834 [clang] Use -android environment for all compiler-rt libs.
Summary:
This was already done for the sanitizers, but it needs to be done for
the profile and builtin libs as well.

Reviewers: srhines, timmurray, eugenis, samsonov

Reviewed By: samsonov

Subscribers: compnerd, cfe-commits

Differential Revision: http://reviews.llvm.org/D7187

llvm-svn: 227392
2015-01-28 23:23:36 +00:00
Samuel Antao 4ae1f67ccf Fix clash of gcc toolchains in driver regression tests.
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.

llvm-svn: 225182
2015-01-05 17:07:42 +00:00
Pavel Chupin 4a29468dcd [x32] Handle -m64/-m32 switches by Driver in x32 mode
Summary:
Adding remaining 2 cases handling:
* from x32 to 32 via -m32
* from x32 to 64 via -m64

Test Plan: linux-ld test updated

Reviewers: chandlerc, atanasyan

Subscribers: cfe-commits, zinovy.nis

Differential Revision: http://reviews.llvm.org/D4930

llvm-svn: 215899
2014-08-18 15:38:38 +00:00
Rafael Espindola d76eb44cdf Use a valid arch name in this triple.
llvm-svn: 215726
2014-08-15 16:55:25 +00:00
Ulrich Weigand 8afad61a93 [PowerPC] Support ELFv1/ELFv2 ABI selection via -mabi= option
While Clang now supports both ELFv1 and ELFv2 ABIs, their use is currently
hard-coded via the target triple: powerpc64-linux is always ELFv1, while
powerpc64le-linux is always ELFv2.

These are of course the most common scenarios, but in principle it is
possible to support the ELFv2 ABI on big-endian or the ELFv1 ABI on
little-endian systems (and GCC does support that), and there are some
special use cases for that (e.g. certain Linux kernel versions could
only be built using ELFv1 on LE).

This patch implements the Clang side of supporting this, based on the
LLVM commit 214072.  The command line options -mabi=elfv1 or -mabi=elfv2
select the desired ABI if present.  (If not, Clang uses the same default
rules as now.)

Specifically, the patch implements the following changes based on the
presence of the -mabi= option:

In the driver:
- Pass the appropiate -target-abi flag to the back-end
- Select the correct dynamic loader version (/lib64/ld64.so.[12])

In the preprocessor:
- Define _CALL_ELF to the appropriate value (1 or 2)

In the compiler back-end:
- Select the correct ABI in TargetInfo.cpp
- Select the desired ABI for LLVM via feature (elfv1/elfv2)

llvm-svn: 214074
2014-07-28 13:17:52 +00:00
Evgeniy Stepanov a333117852 Don't add -Bsymbolic by default on Android.
-Bsymbolic is not a platform requirement and should not
be added unconditionally.

llvm-svn: 213126
2014-07-16 08:46:35 +00:00
Zinovy Nis 3d16387413 [PATCH] [x32] Introduce -mx32 flag enforcing x32 mode for other triplets. By Pavel Chupin (@pavel.v.chupin).
-mx32 flag setup target environment to GNUX32 and can be used for 
other 32/64-bit triplets (i386-unknown-linux, x86_64-unknown-linux) to
turn on x32 mode. Compatible with GCC -mx32 flag.

Differential Revision: http://reviews.llvm.org/D4470

llvm-svn: 212817
2014-07-11 14:28:45 +00:00
Zinovy Nis 1db9573f03 [x32] Adding X32 target support to driver, including TargetInfo,DescriptionString, flags, paths lookup, etc. Cover changes with new tests. The author of the patch is Pavel Chupin (@pavel.v.chupin).
The changes enable "hello world" on x32 target (x86_64-*-linux-gnux32). s/isX32/IsX32/ also fixed.

Differential Revision: http://reviews.llvm.org/D4180

llvm-svn: 212725
2014-07-10 15:27:19 +00:00
Reid Kleckner 69071442f0 Forward -u to the linker on gnutools toolchains
Summary:
The BSDs and Darwin all forward the whole 'u' group, but gcc only
forwards -u so far as I can tell.  I only forward -u, since that's a
minimal change, and many people object to magically recognizing and
forwarding linker arguments.

Reviewers: chandlerc, joerg

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D4304

llvm-svn: 211756
2014-06-26 01:08:54 +00:00
Simon Atanasyan 3a46afafef [Driver][Mips] Support mips64-linux-gnuabi64 / mips64el-linux-gnuabi64 target triples.
The patch fixes the bug #19869.
http://llvm.org/bugs/show_bug.cgi?id=19869

llvm-svn: 211619
2014-06-24 19:00:12 +00:00
Daniel Sanders 3b92c5bd41 [mips] Correct linux dynamic linker for -mnan=2008
Summary:
The dynamic linker is named ld-linux-mipsn8.so.1 when -mnan=2008 is given (or
is the default). It remains ld.so.1 for other cases.

This is necessary for MIPS32r6/MIPS64r6 since these ISA's default to -mnan=2008.

Differential Revision: http://reviews.llvm.org/D4273

llvm-svn: 211598
2014-06-24 15:04:16 +00:00
Ulrich Weigand 68e902c360 [PowerPC] Fix ELF interpreter name for powerpc64le-linux
On PowerPC LE the system uses the /lib64/ld64.so.2 dynamic linker name
instead of /lib64/ld64.so.1 (to indicate the ELFv2 ABI version).

This fixes the clang driver to pass the appropriate -dynamic-linker
setting, and adds some more tests to linux-ld.c.

llvm-svn: 211360
2014-06-20 14:19:02 +00:00
Evgeniy Stepanov dad9206564 Fix driver warning about -pthread on Android.
-pthread is no-op on Android. Suppress the unused argument warning.

llvm-svn: 210253
2014-06-05 11:41:39 +00:00
Evgeniy Stepanov 152b023b97 -pthread does not translate to -lpthread on Android.
There is no libpthread.so, and pthread interface is implemented in libc.so.
This mirrors gcc behavior.

llvm-svn: 209731
2014-05-28 12:53:34 +00:00
Alexey Samsonov 99ee10d2b8 Unify the name of compiler-rt builtins library on Linux.
Call it "libclang_rt.builtins-<arch>.a" to be consistent
with sanitizers/profile libraries naming. Modify Makefile
and CMake build systems and Clang driver accordingly.

Fixes PR19822.

llvm-svn: 209474
2014-05-22 21:13:30 +00:00
Tilmann Scheller e914bc8d46 Add driver support for AArch64 Fedora.
Reviewed by Eric Christopher.

llvm-svn: 208105
2014-05-06 16:58:14 +00:00
Bradley Smith 4da7dd837d [ARM64] Port remaining relevant AArch64 clang tests over to ARM64
llvm-svn: 207632
2014-04-30 10:52:05 +00:00
Logan Chien 6a00cc8306 Add aarch64-linux-android triple for Android.
llvm-svn: 206979
2014-04-23 13:36:23 +00:00
Benjamin Kramer ab88f62614 Fix an logic error in the clang driver preventing crtfastmath.o from linking when -Ofast is used without -ffast-math
In gcc using -Ofast forces linking of crtfastmath.o.
In the current clang crtfastmath.o is only linked when -ffast-math/-funsafe-math-optimizations passed. It can lead to performance issues, when using only -Ofast without explicit -ffast-math (I faced with it).
My patch fixes inconsistency with gcc behaviour and also introduces few tests on it.

Patch by Zinovy Nis!

Differential Revision: http://llvm-reviews.chandlerc.com/D3114

llvm-svn: 204742
2014-03-25 18:02:07 +00:00
Renato Golin c4b4924a13 Add EXPERIMENTAL --rtlib=compiler-rt to GNU Clang
This commit is not strictly correct nor accounts for all uses (shared
objects, for example), but it allows one to test the compiler-rt library
on GNU targets.

Using this patch to run the test-suite has already shown me problems
on ARM. Since this is a Darwin-only flag, nobody is using it, so it
shouldn't be a problem.

I will need extension to deal with the shared cases, but since we're
not compiling libclang_rt.so, that's not yet applicable. Many other
problems will have to be fixed first in compiler-rt (such as removing
the 'arch' name from it and making it trully multi-arch, moving it to
the default lib directory, make both .a and .so variants, etc).

llvm-svn: 201307
2014-02-13 10:01:16 +00:00
Simon Atanasyan 68855fe3c9 [Mips] Add support for mips64el-linux-android triple.
llvm-svn: 200081
2014-01-25 16:04:08 +00:00
Alexey Bataev cf7ae30135 Improve x86 android support, add x86_64 android target
llvm-svn: 199875
2014-01-23 09:08:32 +00:00
Chandler Carruth 902efc61be Teach Clang to look in its installation libdir for libraries (such as
libc++) when the installation is within the system root.

This doesn't really help cross compiles much, but we don't (currently)
have a great story around libc++, cross compiles, and who is responsible
for building and/or installing the libraries. However, it handles the
very common case of non-cross builds in a way entirely consistent with
GCC, so I'm hopeful this won't really hose anyone.

This is the second patch that I think should be backported to 3.4 to
give folks an easy to checkout and install working Clang+libc++
toolchain.

llvm-svn: 199769
2014-01-21 22:49:05 +00:00
Alexey Bataev 75db8c386d Rename target i386-linux-android to i686-linux-android
llvm-svn: 199073
2014-01-13 03:49:38 +00:00
Jakob Stoklund Olesen 73cb84c271 Use the right dynamic linker for SPARC Linux executables.
llvm-svn: 198923
2014-01-10 08:18:34 +00:00