Commit Graph

823 Commits

Author SHA1 Message Date
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
Simon Atanasyan b4abcc55a3 [driver][mips] Factor out findMIPSMultilibs code into separate functions. NFC
The findMIPSMultilibs is too long. One more reason for splitting is to
escape redundant calls of MultilibSet::FilterOut method which lead to
disk access.

llvm-svn: 273465
2016-06-22 20:00:50 +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
Andrey Turetskiy 4798eb6d59 Compilation for Intel MCU (Part 2/3)
This is the second patch required to support compilation for Intel MCU target (e.g. Intel(R) Quark(TM) micro controller D 2000).
When IAMCU triple is used:
 * Recognize and use IAMCU GCC toolchain
 * Set up include paths
 * Forbid C++

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

llvm-svn: 272883
2016-06-16 10:36:09 +00:00
Justin Lebar 4db224e199 [CUDA] Don't pass top-level -march down to device cc1 or ptxas.
Summary:
Previously if you did e.g.

  $ clang -march=haswell -x cuda foo.cu

we would pass "-march=haswell -march=sm_20" down to the ptxas tool.
This causes it to assert, and rightly so!

Reviewers: tra

Subscribers: cfe-commits, echristo

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

llvm-svn: 272857
2016-06-15 23:46:11 +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
Rafael Espindola 5ed89d4a01 Don't pass --build-id to ld by default.
We now have a cmake option to change the default: ENABLE_LINKER_BUILD_ID.

The reason is that build-id is fairly expensive, so we shouldn't impose
it in the regular edit/build cycle.

This is similar to gcc, that has an off by default --enable-linker-build-id
option.

llvm-svn: 271692
2016-06-03 17:26:16 +00:00
Chih-Hung Hsieh b4d3bf72d2 [driver][arm] add armv7 and thumb include and lib paths
Add a new test android-ndk-standalone.cpp
with new Android NDK release tree structure.
Detect armv7 sub architecture and thumb mode,
to add system include and link search paths.

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

llvm-svn: 271427
2016-06-01 20:48:46 +00:00
Simon Atanasyan 96d06c6972 [driver][mips] Fix local variable naming. NFC
llvm-svn: 271110
2016-05-28 09:44:15 +00:00
Simon Atanasyan 4de8e6d283 [driver][mips] Revert support for CodeSourcery MIPS toolchain
This is revert of r270366. The support for CS toolchain were dropped too early.

llvm-svn: 271109
2016-05-28 09:44:04 +00:00
Justin Lebar 91f6f07bb8 [CUDA] Add -fcuda-approx-transcendentals flag.
Summary:
This lets us emit e.g. sin.approx.f32.  See
http://docs.nvidia.com/cuda/parallel-thread-execution/#floating-point-instructions-sin

Reviewers: rnk

Subscribers: tra, cfe-commits

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

llvm-svn: 270484
2016-05-23 20:19:56 +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
Simon Atanasyan 6c51f5aca8 [driver][mips] clang-format the code. NFC
llvm-svn: 270374
2016-05-22 18:18:41 +00:00
Simon Atanasyan 2834a229b2 [driver][mips] Support new versions of MIPS CodeScape toolchains
llvm-svn: 270373
2016-05-22 18:18:07 +00:00
Simon Atanasyan 4f3fe5b1a6 [driver][mips] Use target triple mips-mti-linux-gnu for toolchain detection
llvm-svn: 270368
2016-05-22 15:28:34 +00:00
Simon Atanasyan cf7ac67f69 [driver][mips] Rename some variables to better reflect their purpose. NFC
llvm-svn: 270367
2016-05-22 15:27:58 +00:00
Simon Atanasyan 74468a5bc9 [driver][mips] Drop support for outdated version of CodeSourcery MIPS toolchain
llvm-svn: 270366
2016-05-22 15:27:36 +00:00
Saleem Abdulrasool 783fc635f6 Driver: sink getLinuxDynamicLoader into the Toolchain
The parameter already requires the toolchain, sink the method into the class.
This also enables the use of the distro detection logic which will be needed to
support Exherbo's multiarch approach.

llvm-svn: 270352
2016-05-22 03:12:19 +00:00
Artem Belevich ffa5fc51b8 [CUDA] Allow sm_50,52,53 GPUs
LLVM accepts them since r233575.

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

llvm-svn: 270084
2016-05-19 17:47:47 +00:00
Simon Atanasyan a45502d412 [driver] Do not pass install dir to the MultilibSet include dirs callback
All additional include directories are relative to the toolchain install
folder. So let's do not pass this folder to each callback to simplify
and slightly reduce the code.

llvm-svn: 270069
2016-05-19 15:07:21 +00:00
Simon Atanasyan c69d28162b [driver] Do not pass target triple to the MultilibSet include dirs callback
No one callback uses target triple so we can escape passing the unused
argument.

llvm-svn: 270068
2016-05-19 15:07:00 +00:00
Simon Atanasyan d9fc3f030a [driver][mips] Hardcode triple name in case of CodeSourcery toolchain. NFC
CodeSourcery toolchain is a standalone toolchain which always uses
the same triple name in its paths. It is independent from target
triple used by the driver.

llvm-svn: 270067
2016-05-19 15:05:22 +00:00
Yaron Keren 5439b64af0 Teach clang to look for libcxx in /usr/local/include/c++ on Linux
As The default CMAKE install prefix is /usr/local ( https://cmake.org/cmake/help/v3.0/variable/CMAKE_INSTALL_PREFIX.html ),
sudo ninja install ends up installing clang, LLVM and libcxx under /usr/local.
In development scenario, when clang is run from the build location it will not
find libcxx at neither (build location)/../include/c++ nor /usr/include/c++.
This patch lets development clang find system installed libcxx without adding
-isystem /usr/local/include/c++. Also addresses the FIXME by explaining the 
use-case for these include paths.

llvm-svn: 269801
2016-05-17 19:01:16 +00:00
Paul Robinson 9d61361acb [PS4] Change the names of some "environmental" things to what our
licensees actually see in the toolchain we deliver to them.  This will
reduce the set of local patches we have to maintain.  The triple is
not changing.  (The term ORBIS is an internal code name for PS4.)

llvm-svn: 269671
2016-05-16 17:22:25 +00:00
Daniel Sanders e160f83f71 [mips] Enable IAS by default for 32-bit MIPS targets (O32).
Summary:
The MIPS IAS can now pass 'ninja check-all', recurse, build a bootable linux
kernel, and pass a variety of LNT testing.

Unfortunately we can't enable it by default for 64-bit targets yet since the N32
ABI is still very buggy and this also means we can't enable it for N64 either
because we can't distinguish between N32 and N64 in the relevant code.

Reviewers: vkalintiris

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D18759
Differential Revision: http://reviews.llvm.org/D18761

llvm-svn: 269560
2016-05-14 12:43:08 +00:00
Reid Kleckner 330fb175d4 Update clang support on recent Haiku
[ Copied from https://llvm.org/bugs/show_bug.cgi?id=26404 ]

clang support on Haiku is lagging a bit, and missing on x86_64.

This patch updates support for x86 and add support for x86_64. It should
apply directly to trunk and it's harmless in the sense that it only
affects Haiku.

Reviewers: rnk, rsmith

Patch by Jérôme Duval

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

llvm-svn: 269201
2016-05-11 16:19:05 +00:00
Douglas Katzman 5eddc2395b [Myriad] Use Generic_ELF::addClangTargetOptions()
llvm-svn: 268956
2016-05-09 19:09:59 +00:00
Rafael Espindola 52fe8966b5 Proper detection and handling of RHEL and variants.
- Don't consider "/etc/lsb-release" to be Ubuntu only.
- Detect SL, too.
- Only add "--no-add-needed" for RHEL7 (or Fedora), not for RHEL6
  (that's what the compilers shipped with RHEL do).
- removed RHEL4 which is now four years past EOL and certainly incapable
  of building or running any recent version of llvm/clang.

llvm-svn: 268914
2016-05-09 13:13:50 +00:00
Rafael Espindola 2edca417c1 RHEL: Look in more places to find g++ headers and runtime.
Some distros with ten years of support ship an old gcc but later offer
more recent versions for installation in parallel. These versions are
typically not only needed for the compilation of llvm/clang, but also to
properly use the clang binary that comes out.

Clang already searches /usr at runtime for the most recent installation
of gcc. This patch appends paths for add-on installations of gcc in
RHEL.

Patch by Michael Lampe.

llvm-svn: 268912
2016-05-09 13:03:10 +00:00
Chandler Carruth 81296fb3a4 Teach header search about GCC 4.9 header search paths in Gentoo, they
now use the full GCC version in their weird suffix.

llvm-svn: 268874
2016-05-08 07:59:56 +00:00
Chris Bieneman e60e7c2987 Add a new warning to notify users of mismatched SDK and deployment target
Summary:
This patch adds a new driver warning -Wincompatible-sdk which notifies the user when they are mismatching the version min options and the sysroot.

The patch works by checking the sysroot (if present) for an SDK name, then matching that against the target platform. In the case of a mismatch it logs a warning.

Reviewers: bob.wilson, rsmith

Subscribers: rsmith, edward-san, cfe-commits

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

llvm-svn: 268127
2016-04-29 22:28:34 +00:00
Derek Bruening 256c2e14c7 [esan] EfficiencySanitizer driver flags
Summary:
Adds a framework to enable the instrumentation pass for the new
EfficiencySanitizer ("esan") family of tools.  Adds a flag for esan's
cache fragmentation tool via -fsanitize=efficiency-cache-frag.
Adds appropriate tests for the new flag.

Reviewers: eugenis, vitalybuka, aizatsky, filcab

Subscribers: filcab, kubabrecka, llvm-commits, zhaoqin, kcc

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

llvm-svn: 267059
2016-04-21 21:32:04 +00:00
Justin Lebar 423019d059 [CUDA] Raise an error if the CUDA install can't be found.
Summary:
Without this change, we silently proceed on without including
__clang_cuda_runtime_wrapper.h.  This leads to very strange behavior --
you say you're compiling CUDA code, but e.g. __device__ is not defined!

Reviewers: tra

Subscribers: cfe-commits

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

llvm-svn: 266496
2016-04-16 00:11:11 +00:00
Justin Lebar d3a44f6885 [CUDA] Add -fcuda-flush-denormals-to-zero.
Summary:
Setting this flag causes all functions are annotated with the
"nvvm-f32ftz" = "true" attribute.

In addition, we annotate the module with "nvvm-reflect-ftz" set
to 0 or 1, depending on whether -cuda-flush-denormals-to-zero is set.
This is read by the NVVMReflect pass.

Reviewers: tra, rnk

Subscribers: cfe-commits

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

llvm-svn: 265435
2016-04-05 18:26:20 +00:00
Ed Schouten fc79d2ca42 Enable the SafeStack sanitizer on CloudABI by default.
Over the last month we've been testing SafeStack extensively. As far as
we know, it works perfectly fine. That why I'd like to see us having
this enabled by default for CloudABI.

This change introduces a getDefaultSanitizers() function that toolchains
can use to specify which sanitizers are enabled by default. Once all
flags are processed, only flags that had no -fno-sanitize overrides are
enabled.

Extend the thests for CloudABI to test both the default case and the
case in which we want to explicitly disable SafeStack.

Reviewed by:	eugenis, pcc
Differential Revision:	http://reviews.llvm.org/D18505

llvm-svn: 264787
2016-03-29 21:13:53 +00:00
Devin Coughlin fcfa38cf76 [tsan] Allow -fsanitize=thread for iOS-style simulator targets
Update the clang driver to allow -fsanitize=thread when targeting x86_64 iOS and tvOS
simulators. Also restrict TSan targeting OS X to only be supported on x86_64 and not i386.

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

llvm-svn: 263913
2016-03-20 18:24:33 +00:00
Chaoren Lin 37cbc43ecb Remove usage of LLVM_PREFIX.
Summary: LLVM_PREFIX could be undefined if CMAKE_INSTALL_PREFIX were set to empty.

Reviewers: kparzysz, bkramer, chandlerc

Subscribers: cfe-commits

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

llvm-svn: 263766
2016-03-18 00:05:37 +00:00
Chris Bieneman 7f2844f8f7 [Driver] [Darwin] Fix linking libclang_rt.profile_*sim.a
Summary: isTarget*() calls are order-dependent. This is because iOS Sim *is* iOS. This means checks for the simulator version of the platform must always be ahead of checks for the embedded platform.

Reviewers: zaks.anna, bogner

Subscribers: cfe-commits

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

llvm-svn: 263567
2016-03-15 18:08:20 +00:00
Jonas Hahnfeld 099541907f Make FreeBSD and NetBSD use CLANG_DEFAULT_CXX_STDLIB
Also introduce -stdlib=platform to override the configured value
and use it to make the tests always pass.

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

llvm-svn: 263434
2016-03-14 14:34:04 +00:00
Steven Wu 574b0f2f9c Introduce -fembed-bitcode driver option
Summary:
This is the clang driver part of the change to embedded bitcode. This
includes:
1. -fembed-bitcode option which breaks down the compilation into two
stages. The first stage emits optimized bitcode and the second stage
compiles bitcode into object file.
2. -fembed-bitcode-marker option which doesn't really break down to
two stages to speedup the compilation flow.
3. pass the correct linker flag to darwin linker if tool chains supports
embedded bitcode.

Reviewers: rsmith, thakis

Subscribers: thakis, cfe-commits

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

llvm-svn: 262282
2016-03-01 01:07:58 +00:00
Dan Gohman 57b62c5e16 [WebAssembly] Initial driver support for standard library paths.
llvm-svn: 261560
2016-02-22 19:26:15 +00:00
Ed Schouten 51bfbe7f2c Enable SafeStack for CloudABI.
Summary:
I've got a patchset in my home directory to integrate support for
SafeStack into CloudABI's C library. All of the CloudABI unit tests
still seem to pass. Pretty sweet!

This change adds the necessary changes to Clang to make
-fsanitize=safe-stack work on CloudABI. Without it, passing this command
line flag throws an error.

Reviewers: eugenis, samsonov

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

llvm-svn: 261135
2016-02-17 18:56:20 +00:00
Tim Northover 3a098c1b9f Darwin: fix stdlib handling when CLANG_DEFAULT_STDLIB is set
I'd accidentally skipped the CMake check in a premature optimisation. I'd also
put the original test in completely the wrong place.

Thanks Jonas Hahnfeld!

llvm-svn: 260898
2016-02-15 16:38:10 +00:00
Dimitry Andric 6090739f8d As reported in https://llvm.org/bugs/show_bug.cgi?id=25496, on FreeBSD,
C++ programs compiled for profiling (using `-pg`) should be linked with
`-lc++_p` (or `-lstdc++_p`, depending on the `-stdlib=` setting), not
with the regular C++ libraries.

Add a `FreeBSD::AddCXXStdlibLibArgs()` override to handle this, and add
a test case for it.  While here, extend the test case for the proper
passing of -lm and -lm_p.

Reviewers: compnerd, davide, dws, emaste
Reviewed By: compnerd
Differential Revision: http://reviews.llvm.org/D16264

llvm-svn: 260851
2016-02-14 16:08:20 +00:00
Eugene Zelenko 1ced5095e4 Fix remaining Clang-tidy readability-redundant-control-flow warnings; other minor fixes.
Differential revision: http://reviews.llvm.org/D17218

llvm-svn: 260757
2016-02-12 22:53:10 +00:00
Tim Northover b534ce46bd Darwin: pass -stdlib=libc++ down to cc1 whenever we're targeting libc++
Recent refactoring meant it only got passed down when explicitly specified,
which breaks header search on Darwin.

llvm-svn: 260755
2016-02-12 22:30:42 +00:00
Jonas Hahnfeld aae8374004 [CMake] Add option to switch default C++ stdlib
With this option one can optionally override the architecture dependent
default library to use if no -stdlib= is provided on compiler invocation.

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

llvm-svn: 260662
2016-02-12 07:48:37 +00:00
Joerg Sonnenberger 21156e80ba Remove decision logic for old NetBSD development versions, the 7.0
release made this obsolete.

llvm-svn: 260617
2016-02-11 23:35:03 +00:00
Joerg Sonnenberger 059613cb68 Now that Sparc/Sparc64 backend is mostly usable, provide the same
linking defaults as other NetBSD targets, i.e. compiler_rt-in-libc and
libc++ as STL.

llvm-svn: 260616
2016-02-11 23:18:36 +00:00
Anna Zaks e67b402e45 [asan] Add iOS support for Address Sanitizer
Differential Revision: http://reviews.llvm.org/D15624

llvm-svn: 259453
2016-02-02 02:04:48 +00:00