Commit Graph

3252 Commits

Author SHA1 Message Date
Saleem Abdulrasool d44901f21b Driver: support ARM/HF on a single toolchain
ARM EABI adds target attributes to the object file.  Amongst the attributes that
are emitted is the VFP argument passing (Hard vs Soft).  The linker is
responsible for checking these attributes and erroring on mismatches.  This
causes problems for the compiler-rt builtins when targeting both hard and
soft.  Because both of these options name the builtins compiler-rt component
the same (libclang_rt.builtins-arm.a or libclang_rt.builtins-arm-android).  GCC
is able to get away with this as it does one target per toolchain.  This
changes the naming convention for the ARM compiler-rt builtins to differentiate
between HF and Soft.  Although this means that compiler-rt may be duplicated, it
enables supporting both variants from a single toolchain.  A similar approach is
taken by the Darwin toolchain, naming the library to differentiate between the
calling conventions.

llvm-svn: 248649
2015-09-26 03:26:44 +00:00
Eric Christopher 74a7c5dc16 The Clang gcc-compatible driver (clang/tools/driver/driver.cpp) has some
logic to select an alternate target based on the executable it was
called as. For instance, if you symlink i686-linux-android-gcc to clang
and invoke it, the driver will act as though it were called with another
argument ("-target i686-linux-android"). This leads to visible effects
even in syntax-only compilations (like the ANDROID preprocessor symbol
being defined).

This behavior is not replicated for tool invocations--for instance,
clang::createInvocationFromCommandLine will not choose an alternate
target based on ArgList[0]. This means that configurations stored in
compilation databases aren't accurately replayed.

This patch separates the logic for selecting a mode flag and target from
the executable name into a new member function on ToolChain. It should
have no functional effects (but will allow other code to reuse the
target/mode selection logic).

Patch by Luke Zarko!

llvm-svn: 248592
2015-09-25 17:44:31 +00:00
Greg Bedwell 80b325c799 Revert "This patch adds missing pieces to clang, including the PS4 toolchain definition, added warnings, PS4 defaults, and Driver changes needed for our compiler."
This reverts commit r248546 to get our bot green again while we discuss the best way forward.

llvm-svn: 248578
2015-09-25 16:11:00 +00:00
Ekaterina Romanova c52c30a78e This patch adds missing pieces to clang, including the PS4 toolchain
definition, added warnings, PS4 defaults, and Driver changes needed for
our compiler.

A patch by Filipe Cabecinhas, Pierre Gousseau and Katya Romanova!

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

llvm-svn: 248546
2015-09-24 22:06:52 +00:00
Evgeniy Stepanov 299238a67b Enable SafeStack on all Linux platforms.
llvm-svn: 248518
2015-09-24 17:22:46 +00:00
Benjamin Kramer 72e64317a7 Drop useless const in for-range loops.
StringRefs always point to immutable memory so the const doesn't add value
here. Also quiets clang's -Wrange-loop-analysis which warns about the implicit
copying.

llvm-svn: 248496
2015-09-24 14:48:49 +00:00
Benjamin Kramer e8b764144e [Driver] Don't implicitly copy std::strings in for-range loop.
Found by -Wrange-loop-analysis.

llvm-svn: 248495
2015-09-24 14:48:37 +00:00
Daniel Sanders e0395a7f7f [mips] Relax -mnan=2008 acceptance to permit MIPS32R2 and MIPS64R2.
Summary:
Strictly speaking, the MIPS*R2 ISA's should not permit -mnan=2008 since this
feature was added in MIPS*R3. However, other toolchains permit this and we
should do the same.

Reviewers: atanasyan

Subscribers: cfe-commits

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

llvm-svn: 248481
2015-09-24 10:22:17 +00:00
Vladimir Sukharev a317dfb767 [ARM] Follow-up to fix crash "-target arm -mcpu=generic", without "-march="
Fix of dangling StringRef after temporary std::string is destroyed

Follow-up to: http://reviews.llvm.org/rL248479

Reviewers: alexfh

Subscribers: cfe-commits
llvm-svn: 248480
2015-09-24 10:06:44 +00:00
Vladimir Sukharev 2eef4b52cd [ARM] Follow-up to fix crash "-target arm -mcpu=generic", without "-march="
Fix of dangling StringRef after temporary std::string is destroyed

Follow-up to: http://reviews.llvm.org/rL248370

Reviewers: alexfh

Subscribers: cfe-commits
llvm-svn: 248479
2015-09-24 09:55:08 +00:00
Igor Kudrin f2e7524356 [Driver] Add support for Windows 10 SDK
Summary:
With Windows 10 SDK, Include and Lib directories now contain an additional subfolder with the name that corresponds to the full version of the SDK, for example:
  - C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\um
  - C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\um\x64


Reviewers: ruiu, rnk

Subscribers: majnemer, cfe-commits

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

llvm-svn: 248463
2015-09-24 05:16:36 +00:00
NAKAMURA Takumi 0c8decd108 cuda-path: StringRef cannot be used here.
llvm-svn: 248459
2015-09-24 03:15:44 +00:00
Chris Bieneman 25bc0debf3 [darwin] [builtins] Stop generating cc_kext_ios5 and move iOS architectures out of cc_kext into cc_kext_ios
Summary:
This corresponds to a patch to compiler-rt (D13112).

Xcode 7 doesn't support targeting iOS5 and earlier. Instead of just dropping cc_kext_ios5, I've repurposed it to cc_kext_ios, and I'm pulling the iOS architectures out of cc_kext. Putting OS X and iOS slices inside the same archive was just odd.

Reviewers: bogner, bob.wilson

Subscribers: cfe-commits

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

llvm-svn: 248442
2015-09-23 22:52:35 +00:00
Artem Belevich 98607b6757 [CUDA] Added CUDA installation detector class.
Added new option --cuda-path=<path> which allows
overriding default search paths.
If it's not specified we look for CUDA installation in
/usr/include/cuda and /usr/include/cuda-7.0.

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

llvm-svn: 248433
2015-09-23 21:49:39 +00:00
Joerg Sonnenberger 27a69a2ba0 Support linking against OpenMP runtime on NetBSD.
llvm-svn: 248426
2015-09-23 20:11:00 +00:00
Joerg Sonnenberger 5c3f9d516d Push OpenMP linker flags after linker input on Darwin. Don't add any
libraries if -nostdlib is specified. Test.

llvm-svn: 248424
2015-09-23 20:07:56 +00:00
Artem Belevich 8d20bd3917 Reverted r248408 "[CUDA] Added CUDA installation detector class."
because included test fails on some platforms.

llvm-svn: 248413
2015-09-23 18:28:30 +00:00
Artem Belevich e75405b4ea [CUDA] Added CUDA installation detector class.
Added new option --cuda-path=<path> which allows
overriding default search paths.
If it's not specified we look for CUDA installation in
/usr/include/cuda and /usr/include/cuda-7.0.

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

llvm-svn: 248408
2015-09-23 18:13:25 +00:00
Joerg Sonnenberger 95a90134ac Refactor library decision for -fopenmp support from Darwin into a
function for sharing with other platforms.

llvm-svn: 248379
2015-09-23 14:06:52 +00:00
John Brawn ad31ace8c8 Add -fplugin=name.so option to the driver
This translates to -load name.so in the cc1 command. We can't name the driver
option -load, as that means "link against oad", so instead we follow GCC's lead
and name the option -fplugin.

llvm-svn: 248378
2015-09-23 13:55:40 +00:00
Vladimir Sukharev 64f68248cd [ARM] Fix crash "-target arm -mcpu=generic", without "-march="
An assertion hit has been fixed for cmdlines like

$ clang --target=arm-linux-gnueabi -mcpu=generic hello.c

Related to: http://reviews.llvm.org/rL245445

Reviewers: rengolin

Subscribers: cfe-commits

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

llvm-svn: 248370
2015-09-23 09:29:32 +00:00
Artem Belevich ccf0d699f0 Augmented CudaHostAction to carry device-side triple.
Differential Revision: http://reviews.llvm.org/D12893

llvm-svn: 248298
2015-09-22 17:23:13 +00:00
Artem Belevich 2325675143 [CUDA] Fixes minor cuda-related issues in the driver
* Only the last of the --cuda-host-only/--cuda-device-only options has effect.
* CudaHostAction always wraps host-side compilation now.
* Fixed printing of empty action lists.

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

llvm-svn: 248297
2015-09-22 17:23:09 +00:00
Daniel Sanders 63f2826361 [mips] Added support for using the command line options -Wa,-msoft-float and -Wa,-mhard-float.
Patch by Scott Egerton.

Reviewers: vkalintiris, dsanders

Subscribers: cfe-commits

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

llvm-svn: 248276
2015-09-22 13:52:32 +00:00
Craig Topper 3db9ba4248 Don't pass StringRefs around by const reference. Pass by value instead per coding standards. NFC
llvm-svn: 248137
2015-09-21 00:20:04 +00:00
Nico Weber fb80f961df Convert two loops to range-based loops. No behavior change.
llvm-svn: 248100
2015-09-19 21:36:51 +00:00
Saleem Abdulrasool 06f6f995a1 Driver: alter the getARMFloatABI signature
This changes getARMFloatABI to use the ToolChain and Args instead of Driver,
Args, Triple.  Although this pushes the Triple calculation/parsing into the
function itself, it enables the use of the function for a future change.  The
reason to sink the triple calculation here is to avoid threading the Triple
through multiple layers in a future change.

llvm-svn: 248095
2015-09-19 20:40:16 +00:00
Saleem Abdulrasool ce63ce947e Driver: tweak ARM target feature calculation
Rather than using re-calculating the effective triple, thread the already
calculated value down into AddARMTargetArgs.  This avoids both recreating the
triple, as well as re-parsing the triple as it was already done in the previous
frame.

llvm-svn: 248094
2015-09-19 18:19:44 +00:00
Saleem Abdulrasool d5556e34e4 Driver: avoid unnecessary string ops
Use an enumeration for the Floating Point ABIs supported on MIPS.  This is
replicating the ARM change to avoid string based tracking of the floating point
ABI.  NFC.

llvm-svn: 248083
2015-09-19 04:33:38 +00:00
Hans Wennborg 0f0e8d624c clang-cl: Use 'pc' for the vendor field in the default triple
Leaving it unset can make the triple look confusing, especially
when using -m32 or -m64.

llvm-svn: 248005
2015-09-18 17:11:50 +00:00
Douglas Katzman 8c39e6aee8 Use None instead of an explicit constructor.
And remove a needless 'const' since ArrayRef is immutable.
Both as suggested by dblaikie on cfe-commits.

llvm-svn: 247995
2015-09-18 15:23:16 +00:00
Saleem Abdulrasool eee54b4d7c Driver: avoid unnecessary string based operations
Use an enumeration and change the use of the FloatABI from a string to the
enumeration.  This avoids the use of string values to represent an enumeration.
NFC.

llvm-svn: 247967
2015-09-18 05:32:23 +00:00
Douglas Katzman b1278f3349 [Myriad]: add "<sysroot>/include" to standard search path
llvm-svn: 247948
2015-09-17 21:20:16 +00:00
Douglas Katzman e793f19831 Try to unbreak windows compiler after r247926.
It might not like {} implicitly cast to an Arrayref.
That's the theory, since I can't test it.

llvm-svn: 247932
2015-09-17 20:25:09 +00:00
Douglas Katzman d6e597c2be [Shave]: Drive sparc-myriad-elf-ld directly rather than via gcc.
Differential Revision: http://reviews.llvm.org/D12541

llvm-svn: 247924
2015-09-17 19:56:40 +00:00
Adhemerval Zanella 567b9260fa [sanitizers] Enable memory sanitizer on clang
This patch enables MSan for aarch64/linux

llvm-svn: 247808
2015-09-16 15:11:21 +00:00
Piotr Padlewski 338c9d0ade Emiting llvm.invariant.group.barrier when dynamic type changes
For more goto:
http://lists.llvm.org/pipermail/cfe-dev/2015-July/044227.html

http://reviews.llvm.org/D12312

llvm-svn: 247723
2015-09-15 21:46:47 +00:00
Rafael Espindola fe71f3887c [Solaris] Default to -fno-cxa-finalize.
There is no __cxa_finalize symbol available on recent Solaris OS
versions, so we need this flag to make non trivial C++ programs run.

Also stop looking for cxa_finalize.o, since it won't be there.

Patch by Xan López!

llvm-svn: 247634
2015-09-14 23:21:31 +00:00
Gabor Horvath e30859959f [Static Analyzer] Turn on some nullability checks by default.
Differential Revision: http://reviews.llvm.org/D12858

llvm-svn: 247614
2015-09-14 20:34:06 +00:00
Douglas Katzman 553927a78a Driver should forward at most one gdwarf-N flag to cc1as.
llvm-svn: 247611
2015-09-14 20:31:28 +00:00
Rafael Espindola 8d4d9d2f67 [Solaris] Add -lc also when linking shared libraries
This is actually needed, otherwise libc won't be added at all. For
instance when building libclang.so all the libc symbols won't be
found, with ld warning about libc being an "implicit dependency".

Patch by Xan López!

llvm-svn: 247603
2015-09-14 19:30:53 +00:00
Douglas Katzman ae2f358af5 [Shave]: pass -isystem dirs and "-Wa," args to moviAsm
llvm-svn: 247474
2015-09-11 21:13:46 +00:00
Akira Hatanaka aecca041c9 Record function attribute "stackrealign" instead of using backend option
-force-align-stack.

Also, make changes to the driver so that -mno-stack-realign is no longer
an option exposed to the end-user that disallows stack realignment in
the backend.

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

llvm-svn: 247451
2015-09-11 18:55:09 +00:00
Richard Smith 7acebe4cf1 [modules] Don't load files specified by -fmodule-file= when modules are
disabled. (We still allow this via -cc1 / -Xclang, primarily for testing.)

llvm-svn: 247384
2015-09-11 03:58:07 +00:00
Reid Kleckner 7531f7dd8d [Driver] Use UniversalCRT on Windows if available
Summary:
With Visual Studio 2015 release, a part of runtime library was extracted
and now comes with Windows Kits. This patch enables clang to use
Universal CRT library if  %INCLUDE or %LIB environment varaibles are not
specified.

See also https://llvm.org/bugs/show_bug.cgi?id=24741

Patch by Igor Kudrin

Reviewers: zturner, hans, rnk

Subscribers: ruiu, cfe-commits

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

llvm-svn: 247362
2015-09-11 00:09:39 +00:00
Peter Collingbourne 24ec4924c0 Driver: Support cfi-icall on all OSs when targeting x86/x86_64.
llvm-svn: 247324
2015-09-10 19:18:05 +00:00
Hans Wennborg 7eb5464bc5 Re-commit r247218: "Fix Clang-tidy misc-use-override warnings, other minor fixes"
This never broke the build; it was the LLVM side, r247216, that caused problems.

llvm-svn: 247302
2015-09-10 17:07:54 +00:00
Alexey Bataev 6a43c00ebd [OPENMP] Generate threadprivates as TLS variables by default.
If target supports TLS all threadprivates are generated as TLS. If target does not support TLS, use runtime calls for proper codegen of threadprivate variables.

llvm-svn: 247273
2015-09-10 12:06:58 +00:00
Peter Collingbourne 2c7f7e31c4 CFI: Introduce -fsanitize=cfi-icall flag.
This flag causes the compiler to emit bit set entries for functions as well
as runtime bitset checks at indirect call sites. Depends on the new function
bitset mechanism.

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

llvm-svn: 247238
2015-09-10 02:17:40 +00:00
Hans Wennborg e89c8c8033 Revert r247218: "Fix Clang-tidy misc-use-override warnings, other minor fixes"
Seems it broke the Polly build.
From http://lab.llvm.org:8011/builders/perf-x86_64-penryn-O3-polly-fast/builds/11687/steps/compile/logs/stdio:

In file included from /home/grosser/buildslave/perf-x86_64-penryn-O3-polly-fast/llvm.src/lib/TableGen/Record.cpp:14:0:
/home/grosser/buildslave/perf-x86_64-penryn-O3-polly-fast/llvm.src/include/llvm/TableGen/Record.h:369:3: error: looser throw specifier for 'virtual llvm::TypedInit::~TypedInit()'
/home/grosser/buildslave/perf-x86_64-penryn-O3-polly-fast/llvm.src/include/llvm/TableGen/Record.h:270:11: error:   overriding 'virtual llvm::Init::~Init() noexcept (true)'

llvm-svn: 247222
2015-09-10 00:37:18 +00:00