Commit Graph

4784 Commits

Author SHA1 Message Date
Petr Hosek 4b9940b50a [Driver] Support sanitized libraries on Fuchsia
When using sanitizers, add <resource_dir>/<target>/lib/<sanitizer>
to the list of library paths to support using sanitized version of
runtime libraries if available.

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

llvm-svn: 345537
2018-10-29 20:37:52 +00:00
Brad Smith 704247c37a Reapply Pass the nopie flag to the linker when linking with -pg.
llvm-svn: 345470
2018-10-28 03:30:18 +00:00
Alina Sbirlea d981cc88b2 Revert r345170 [along with its llvm counterpart r345169] as it makes Halide builds timeout.
llvm-svn: 345446
2018-10-27 04:51:09 +00:00
Brad Smith 7d0ee07f40 Revert "Pass the nopie flag to the linker when linking with -pg." until
one of the tests can be fixed on !OpenBSD hosts.

llvm-svn: 345443
2018-10-27 01:14:22 +00:00
Brad Smith 6adb5ee409 Pass the nopie flag to the linker when linking with -pg.
llvm-svn: 345439
2018-10-27 00:23:28 +00:00
Martin Storsjo b547ef2a29 Revert "Reapply: [Driver] Use forward slashes in most linker arguments"
This reverts commit r345370, as it uncovered even more issues in
tests with partial/inconsistent path normalization:
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/13562
http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/886
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/20994

In particular, these tests seem to have failed:
    Clang :: CodeGen/thinlto-diagnostic-handler-remarks-with-hotness.ll
    Clang :: CodeGen/thinlto-multi-module.ll
    Clang :: Driver/cuda-external-tools.cu
    Clang :: Driver/cuda-options.cu
    Clang :: Driver/hip-toolchain-no-rdc.hip
    Clang :: Driver/hip-toolchain-rdc.hip
    Clang :: Driver/openmp-offload-gpu.c

At least the Driver tests could potentially be fixed by extending
the path normalization to even more places, but the issues with the
CodeGen tests are still unknown.

In addition, a number of other tests seem to have been broken in
other clang dependent tools such as clang-tidy and clangd.

llvm-svn: 345372
2018-10-26 08:33:29 +00:00
Martin Storsjo cbd73574e4 Reapply: [Driver] Use forward slashes in most linker arguments
libtool inspects the output of $CC -v to detect what object files and
libraries are linked in by default. When clang is built as a native
windows executable, all paths are formatted with backslashes, and
the backslashes cause each argument to be enclosed in quotes. The
backslashes and quotes break further processing within libtool (which
is implemented in shell script, running in e.g. msys) pretty badly.

Between unix style pathes (that only work in tools that are linked
to the msys runtime, essentially the same as cygwin) and proper windows
style paths (with backslashes, that can easily break shell scripts
and msys environments), the best compromise is to use windows style
paths (starting with e.g. c:) but with forward slashes, which both
msys based tools, shell scripts and native windows executables can
cope with. This incidentally turns out to be the form of paths that
GCC prints out when run with -v on windows as well.

This change potentially makes the output from clang -v a bit more
inconsistent, but it is isn't necessarily very consistent to begin with.

Compared to the previous attempt in SVN r345004, this now does
the same transformation on more paths, hopefully on the right set
of paths so that all tests pass (previously some tests failed, where
path fragments that were required to be identical turned out to
use different path separators in different places). This now also
is done only for non-windows, or cygwin/mingw targets, to preserve
all backslashes for MSVC cases (where the paths can end up e.g. embedded
into PDB files. (The transformation function itself,
llvm::sys::path::convert_to_slash only has an effect when run on windows.)

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

llvm-svn: 345370
2018-10-26 07:01:59 +00:00
Luke Cheeseman a8a24aa042 [AArch64] Branch Protection and Return Address Signing B Key Support
- Add support for -mbranch-protection=<type>[+<type>]* where
  - <type> ::= [standard, none, bti, pac-ret[+b-key,+leaf]*]
- The protection emits relevant function attributes
  - sign-return-address=<scope>
  - sign-return-address-key=<key>
  - branch-protection

llvm-svn: 345273
2018-10-25 15:23:49 +00:00
Saleem Abdulrasool 81a650ee87 Driver,CodeGen: introduce support for Swift CFString layout
Add a new driver level flag `-fcf-runtime-abi=` that allows one to specify the
runtime ABI for CoreFoundation.  This controls the language interoperability.
In particular, this is relevant for generating the CFConstantString classes
(primarily through the `__builtin___CFStringMakeConstantString` builtin) which
construct a reference to the "CFObject"'s `isa` field.  This type differs
between swift 4.1 and 4.2+.

Valid values for the new option include:
  - objc [default behaviour] - enable ObjectiveC interoperability
  - swift-4.1 - enable interoperability with swift 4.1
  - swift-4.2 - enable interoperability with swift 4.2
  - swift-5.0 - enable interoperability with swift 5.0
  - swift [alias] - target the latest swift ABI

Furthermore, swift 4.2+ changed the layout for the CFString when building
CoreFoundation *without* ObjectiveC interoperability.  In such a case, a field
was added to the CFObject base type changing it from: <{ const int*, int }> to
<{ uintptr_t, uintptr_t, uint64_t }>.

In swift 5.0, the CFString type will be further adjusted to change the length
from a uint32_t on everything but BE LP64 targets to uint64_t.

Note that the default behaviour for clang remains unchanged and the new layout
must be explicitly opted into via `-fcf-runtime-abi=swift*`.

llvm-svn: 345222
2018-10-24 23:28:28 +00:00
Krzysztof Parzyszek f124275cf9 [Hexagon] Flip hexagon-autohvx to be true by default
This will allow other generators of LLVM IR to use the auto-vectorizer
without having to change that flag.

Note: on its own, this patch will disable auto-vectorization on Hexagon
in all cases, regardless of the -fvectorize flag. There is a companion
LLVM patch that together with this one forms an NFC for clang users.

llvm-svn: 345170
2018-10-24 17:55:18 +00:00
Yuka Takahashi 46106f5ebe [autocompletion] Handle the space before pressing tab
Summary:
Distinguish "--autocomplete=-someflag" and "--autocomplete=-someflag,"
because the latter indicates that the user put a space before pushing tab
which should end up in a file completion.

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

llvm-svn: 345133
2018-10-24 12:43:25 +00:00
Yuka Takahashi df9c7e3001 [bash-autocompletion] Fix bug when a flag ends with '='
There was a bug that when a flag ends with '=' and no value was suggested,
clang autocompletes the flag itself.
For example, in bash, it looked like this:
```
$ clang -fmodule-file=[tab]
-> $clang -fmodule-file=-fmodule-file
```
This is not what we expect. We expect a file autocompletion when no value
was found. With this patch, pressing tab suggests files in the current
directory.

Reviewers: teemperor, ruiu

Subscribers: cfe-commits
llvm-svn: 345121
2018-10-24 08:24:16 +00:00
Martin Storsjo e133c7867e Revert "[Driver] Use forward slashes in most linker arguments"
This reverts commit r345004, as it broke tests when actually run
on windows; see e.g.
http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/763.

This broke tests that had captured a variable containing a path
with backslashes, which failed to match cases in the output
where the path separators had been changed into forward slashes.

llvm-svn: 345005
2018-10-23 07:01:55 +00:00
Martin Storsjo 965a361f57 [Driver] Use forward slashes in most linker arguments
libtool inspects the output of $CC -v to detect what object files and
libraries are linked in by default. When clang is built as a native
windows executable, all paths are formatted with backslashes, and
the backslashes cause each argument to be enclosed in quotes. The
backslashes and quotes break further processing within libtool (which
is implemented in shell script, running in e.g. msys) pretty badly.

Between unix style pathes (that only work in tools that are linked
to the msys runtime, essentially the same as cygwin) and proper windows
style paths (with backslashes, that can easily break shell scripts
and msys environments), the best compromise is to use windows style
paths (starting with e.g. c:) but with forward slashes, which both
msys based tools, shell scripts and native windows executables can
cope with. This incidentally turns out to be the form of paths that
GCC prints out when run with -v on windows as well.

This change potentially makes the output from clang -v a bit more
inconsistent, but it is isn't necessarily very consistent to begin with.

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

llvm-svn: 345004
2018-10-23 06:33:26 +00:00
Martin Storsjo bf6f82a10d [MinGW] Link to correct openmp library
Patch by Peiyuan Song!

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

llvm-svn: 345003
2018-10-23 06:33:22 +00:00
Dan Albert 3577af082a Revert "[Driver] Reland again: Default Android toolchains to libc++."
More compiler-rt test bot breakages...

llvm-svn: 344963
2018-10-22 21:58:22 +00:00
Dan Albert e2936ee49b [Driver] Reland again: Default Android toolchains to libc++.
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
2018-10-22 20:16:21 +00:00
Nick Desaulniers 11dadac247 [Driver] allow Android triples to alias for non Android targets
Summary:
Partial revert of r330873 ('[Driver] Reland "Android triples are not
aliases for other triples."')

While we don't want `-target *-linux-android` to alias to non
*-linux-android libs and binaries, it turns out we do want the
opposite. Ie. We would like for `-target *-linux-gnu` to still be
able to use *-android libs and binaries.

In fact, this is used to cross assemble and link the Linux kernel for
Android devices.

`-target *-linux-gnu` needs to be used for the Linux kernel when
using the android binutils prebuilts (*-linux-android).

The use of `-target *-linux-android` on C source files will cause
Clang to perform optimizations based on the presence of bionic (due to
r265481 ('Faster stack-protector for Android/AArch64.')) which is
invalid within the Linux kernel and will produce a non-bootable kernel
image.

Of course, you could just use the standard binutils (*-linux-gnu),
but Android does not distribute these.  So this patch fixes a problem
that only occurs when cross assembling and linking a Linux kernel with
the Android provided binutils, which is what is done within Android's
build system.

Reviewers: srhines, pirama, danalbert

Reviewed By: srhines, danalbert

Subscribers: javed.absar, kristof.beyls, cfe-commits

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

llvm-svn: 344941
2018-10-22 19:48:08 +00:00
David Greene 7eae99999d Always search sysroot for GCC installs
Previously, if clang was configured with -DGCC_INSTALL_PREFIX, then it
would not search a provided sysroot for a gcc install. This caused a
number of regression tests to fail.  If a sysroot is given, skip
searching GCC_INSTALL_PREFIX as it is likely not valid for the
provided sysroot.

llvm-svn: 344901
2018-10-22 13:46:12 +00:00
Peter Smith eac18cd3c2 [ARM][AArch64] Add LLVM_FALLTHROUGH to silence warning [NFC]
A follow up to D52784 to add in LLVM_FALLTHROUGH where there is an
intentional fall through in a switch statement. This will hopefully silence
a GCC warning.

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

llvm-svn: 344890
2018-10-22 10:40:52 +00:00
Dan Albert 8365cc3a1f Revert "[Driver] Reland: Default Android toolchains to libc++."
This reverts commit 84677d5009d613232d360fda27e6e41fb5cb6700.

llvm-svn: 344806
2018-10-19 19:23:01 +00:00
Dan Albert 386a2a4eea [Driver] Reland: Default Android toolchains to libc++.
The sanitizer builder that was broken by this should now be fixed.

Original review was https://reviews.llvm.org/D53109

llvm-svn: 344795
2018-10-19 18:06:02 +00:00
Kristina Brooks 7f569b7c4f Add support for -mno-tls-direct-seg-refs to Clang
This patch exposes functionality added in rL344723 to the Clang driver/frontend
as a flag and adds appropriate metadata.

Driver tests pass:
```
ninja check-clang-driver
-snip-
  Expected Passes    : 472
  Expected Failures  : 3
  Unsupported Tests  : 65
```

Odd failure in CodeGen tests but unrelated to this:
```
ninja check-clang-codegen
-snip-
/SourceCache/llvm-trunk-8.0/tools/clang/test/CodeGen/builtins-wasm.c:87:10:
error: cannot compile this builtin function yet
-snip-
Failing Tests (1):
    Clang :: CodeGen/builtins-wasm.c

  Expected Passes    : 1250
  Expected Failures  : 2
  Unsupported Tests  : 120
  Unexpected Failures: 1
```

Original commit:
[X86] Support for the mno-tls-direct-seg-refs flag
Allows to disable direct TLS segment access (%fs or %gs). GCC supports a
similar flag, it can be useful in some circumstances, e.g. when a thread
context block needs to be updated directly from user space. More info and
specific use cases: https://bugs.llvm.org/show_bug.cgi?id=16145

Patch by nruslan (Ruslan Nikolaev).

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

llvm-svn: 344739
2018-10-18 14:07:02 +00:00
Yaxun Liu 9b6d9f2a62 Disable code object version 3 for HIP toolchain
AMDGPU backend will switch to code object version 3 by default.
Since HIP runtime is not ready, disable it until the runtime is ready.

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

llvm-svn: 344630
2018-10-16 17:36:23 +00:00
Simon Atanasyan eaab2b77e1 [driver][mips] Support MIPS R6 target triples
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
2018-10-16 14:29:27 +00:00
Simon Atanasyan e60eae4256 [driver][mips] Adjust target triple's environment accordingly to provided ABI name
For MIPS we need to adjust not only architecture name accordingly to ABI
provided by the `-mabi` command line option, but also modify triple's
environment. For example, for `mips-linux-gnu` triple and `-mabi=n32`
option a correct final triple is `mips64-linux-gnuabin32`.

llvm-svn: 344603
2018-10-16 10:19:06 +00:00
Peter Smith e75b6d78e0 [ARM][AArch64] Pass through endian flags to assembler and linker.
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
2018-10-16 09:21:17 +00:00
Simon Atanasyan db81c7b9c9 [mips] Fix handling of GNUABIN32 environment in a target triple
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
2018-10-15 22:43:23 +00:00
Petr Hosek d3265358b4 [Driver] Support direct split DWARF emission for Fuchsia
This enables the driver support for direct split DWARF emission for
Fuchsia in addition to Linux.

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

llvm-svn: 344556
2018-10-15 21:30:32 +00:00
Nick Desaulniers 9d0df31bed Revert 344389 "Revert r344375 "[Driver] check for exit code from SIGPIPE""
Summary:
Add preprocessor guards for UNIX.

This reverts commit r344389.

Reviewers: rnk, majnemer, jfb

Reviewed By: rnk

Subscribers: cfe-commits, pirama, srhines

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

llvm-svn: 344536
2018-10-15 17:39:00 +00:00
Hans Wennborg 2fe010473d Re-commit r344234 "clang-cl: Add /showFilenames option (PR31957)"
The test was failing on e.g. PPC which can't target Windows. Fix by
requiring X86 target in the test. Also, make sure the output goes to a
temporary directory, since CWD may not be writable.

llvm-svn: 344462
2018-10-13 19:13:14 +00:00
Martin Storsjo 4b75df2cca [MinGW] Allow using LTO when lld is used as linker
Differential Revision: https://reviews.llvm.org/D53195

llvm-svn: 344412
2018-10-12 20:15:51 +00:00
Simon Pilgrim 0e50d4c47b Consistently make llvm::opt::ArgStringList usage explicit to try and appease MSVC 2015 buildbots. NFCI.
llvm-svn: 344398
2018-10-12 18:55:36 +00:00
Reid Kleckner 3185977105 Revert r344375 "[Driver] check for exit code from SIGPIPE"
This doesn't build on Windows.

llvm-svn: 344389
2018-10-12 18:08:11 +00:00
Nick Desaulniers c7a3e4a478 [Driver] check for exit code from SIGPIPE
Summary:
D53000 adds a special exit code for SIGPIPE (writing to a closed
reader), and rather than print a fatal warning, skips printing the
error.  This can be seen commonly from piping into head, tee, or
split.

Fixes PR25349, rdar://problem/14285346, b/77310947.

Reviewers: jfb

Reviewed By: jfb

Subscribers: cfe-commits, thakis, srhines

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

llvm-svn: 344375
2018-10-12 17:22:46 +00:00
Dan Albert d0fbef9c75 [Driver] Add defaults for Android ARM FPUs.
Summary:
Android mandates that devices have at least vfpv3-d16 until
Marshmallow and NEON after that. Still honor the user's decision, but
raise the defaults for Android targets.

Reviewers: srhines, pirama, javed.absar, kristof.beyls, peter.smith

Reviewed By: peter.smith

Subscribers: peter.smith, rengolin, kristof.beyls, chrib, cfe-commits

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

llvm-svn: 344367
2018-10-12 17:06:31 +00:00
Simon Pilgrim 0a3bb81974 Fix MSVC 2015 ambiguous symbol warning introduced by rL344337. NFCI.
llvm-svn: 344352
2018-10-12 15:16:25 +00:00
Dan Albert 86b1488faa Revert "[Driver] Default Android toolchains to libc++."
Breaks some of the Android bots because they aren't expecting to need
to explicitly set -stdlib.

This reverts commit 031072f5048654b01a40f639633de1ff4e2f3dc8.

llvm-svn: 344297
2018-10-11 21:28:42 +00:00
Dan Albert dc112f4595 [Driver] Default Android toolchains to libc++.
Reviewers: srhines, pirama, EricWF

Reviewed By: srhines

Subscribers: cfe-commits

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

llvm-svn: 344296
2018-10-11 20:58:43 +00:00
Dan Albert e4dd75a9cb [Driver] Default to `-z now` and `-z relro` on Android.
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
2018-10-11 20:57:54 +00:00
Dan Albert 99ac6c8e89 [Driver] Fix --hash-style choice for Android.
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
2018-10-11 20:39:32 +00:00
Aaron Enye Shi e1a353adb0 [HIP] Replace irif library with hip.amdgcn.bc
No longer use irif amdgcn library, instead we will use the previous fence functions from new hip.amdgcn.bc bitcode library. Update hip-device-libs.hip test as well.

llvm-svn: 344281
2018-10-11 19:41:54 +00:00
Sean Fertile 518be95072 Revert "clang-cl: Add /showFilenames option (PR31957)"
This reverts https://reviews.llvm.org/rL344234 which is causing failures on
several bots due to invalid llvm.linker.options.

llvm-svn: 344276
2018-10-11 18:40:35 +00:00
Brad Smith 3910c7b832 Some improvements to the OpenBSD driver.
- OpenBSD has switched to compiler_rt / libcxx
- Fix sysroot and lib path handling
- Some cleaning up

llvm-svn: 344257
2018-10-11 16:13:44 +00:00
Hans Wennborg fe4bfe80ff clang-cl: Add /showFilenames option (PR31957)
Add a /showFilenames option for users who want clang to echo the
currently compiled filename. MSVC does this echoing by default, and it's
useful for showing progress in build systems that doesn't otherwise
provide any progress report, such as MSBuild.

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

llvm-svn: 344234
2018-10-11 10:04:15 +00:00
Richard Smith 8654ae52b0 Add a flag to remap manglings when reading profile data information.
This can be used to preserve profiling information across codebase
changes that have widespread impact on mangled names, but across which
most profiling data should still be usable. For example, when switching
from libstdc++ to libc++, or from the old libstdc++ ABI to the new ABI,
or even from a 32-bit to a 64-bit build.

The user can provide a remapping file specifying parts of mangled names
that should be treated as equivalent (eg, std::__1 should be treated as
equivalent to std::__cxx11), and profile data will be treated as
applying to a particular function if its name is equivalent to the name
of a function in the profile data under the provided equivalences. See
the documentation change for a description of how this is configured.

Remapping is supported for both sample-based profiling and instruction
profiling. We do not support remapping indirect branch target
information, but all other profile data should be remapped
appropriately.

Support is only added for the new pass manager. If someone wants to also
add support for this for the old pass manager, doing so should be
straightforward.

llvm-svn: 344199
2018-10-10 23:13:35 +00:00
Sid Manning a6a201916a [Hexagon] Use GetLinkerPath instead of hard-coded string.
Add GetLinkerPath and set the default to "hexagon-link".
Use GetLinkerPath instead of the hard-coded string.

This change will allow -fuse-ld to function correctly.

Differential revision: https://reviews.llvm.org/D53038

llvm-svn: 344147
2018-10-10 15:37:03 +00:00
Jonas Devlieghere fc51490baf Lift VFS from clang to llvm (NFC)
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
2018-10-10 13:27:25 +00:00
Fangrui Song d002823830 [Driver][cc1][cc1as] Call OptTable::PrintHelp with explicit " [options] file..."
Summary: This is to accommodate a change in llvm/lib/Option/OptTable.cpp D51009

Reviewers: rupprecht, alexshap, jhenderson

Reviewed By: rupprecht

Subscribers: cfe-commits

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

llvm-svn: 344098
2018-10-10 00:15:33 +00:00
Sjoerd Meijer d60540a046 [AArch64][ARM] Context sensitive meaning of crypto
For AArch64, crypto means:
- sm4 + sha3 + sha2 + aes for Armv8.4-A and up, and
- sha2 + aes for Armv8.3-A and earlier.

For AArch32:
Crypto means sha2 + aes, because the Armv8.2-A crypto instructions
were added to AArch64 only.

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

llvm-svn: 343758
2018-10-04 07:38:53 +00:00