Commit Graph

3367 Commits

Author SHA1 Message Date
Alexey Bataev a5178f5369 [DRIVER][OFFLOAD] Do not invoke unbundler on unsupported file types.
clang-offload-bundler should not be invoked with the unbundling action
when the input file type does not match the action type. For example,
.so files should be unbundled during linking phase and should be linked
only with the host code.

llvm-svn: 343335
2018-09-28 16:17:59 +00:00
Peter Smith 47a8980afa [ARM] Alter test to account for change to armv6k default CPU
Review D52594 will change the default in llvm for armv6k from the
non-existent cpu arm1176jf-s to mpcore. The tests in arm-cortex-cpus.c
need to be updated to account for this change.

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

llvm-svn: 343304
2018-09-28 09:04:31 +00:00
Jonas Hahnfeld fb8ca8a1ec Fix greedy FileCheck expression in test/Driver/mips-abi.c
'ld{{.*}}"' seems to match the complete line for me which is failing
the test. Only allow an optional '.exe' for Windows systems as most
other tests do.
Another possibility would be to collapse the greedy expression with
the next check to avoid matching the full line.

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

llvm-svn: 343240
2018-09-27 17:27:48 +00:00
Jonas Hahnfeld a981f67bcd [OpenMP] Improve search for libomptarget-nvptx
When looking for the bclib Clang considered the default library
path first while it preferred directories in LIBRARY_PATH when
constructing the invocation of nvlink. The latter actually makes
more sense because during development it allows using a non-default
runtime library. So change the search for the bclib to start
looking in directories given by LIBRARY_PATH.
Additionally add a new option --libomptarget-nvptx-path= which
will be searched first. This will be handy for testing purposes.

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

llvm-svn: 343230
2018-09-27 16:12:32 +00:00
Oliver Stannard 4ed966f90f [AArch64][v8.5A] Test optional Armv8.5-A random number extension
The implementation of this is in TargetParser, so we only need to add a
test for it in clang.

Patch by Pablo Barrio!

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

llvm-svn: 343220
2018-09-27 14:20:59 +00:00
Simon Atanasyan 0c0fb4b765 [driver][mips] Adjust target triple accordingly to provided ABI name
Explicitly selected MIPS ABI using the `-mabi` option implies
corresponding target triple. For 'O32' ABI it's a 32-bit target triple
like `mips-linux-gnu`. For 'N32' and 'N64' ABIs it's a 64-bit target
triple like `mips64-linux-gnu`. This patch adjusts target triple
accordingly these rules like we do for pseudo-target flags '-m64',
'-m32' etc already.

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

llvm-svn: 343169
2018-09-27 05:04:50 +00:00
Oliver Stannard a30b48d020 [ARM/AArch64][v8.5A] Add Armv8.5-A target
This patch allows targetting Armv8.5-A from Clang. Most of the
implementation is in TargetParser, so this is mostly just adding tests.

Patch by Pablo Barrio!

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

llvm-svn: 343111
2018-09-26 14:20:29 +00:00
Hans Wennborg 42a0bd189b [clang-cl] Make /Gs imply default stack probes, not /Gs0 (PR39074)
Differential revision: https://reviews.llvm.org/D52499

llvm-svn: 343077
2018-09-26 07:39:04 +00:00
Jiading Gai 664dd75b42 [CUDA] Fix two failed test cases using --cuda-path-ignore-env
Add --cuda-path-ignore-env option to those test cases to ensure the clang 
driver always pick the CUDA path specified by --sysroot.

Reviewers: tra, Hahnfeld

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

llvm-svn: 343075
2018-09-26 07:07:48 +00:00
Alexey Bataev 3dfc993437 Revert "[DRIVER][OFFLOAD] Do not invoke unbundler on unsupported file
types."

It reverts commit r342991 + several other commits intended to fix the
tests. Still have some failed tests, need to investigate it.

llvm-svn: 343002
2018-09-25 18:31:56 +00:00
Alexey Bataev a55471138d [OPENMP] Fix the test, NFC.
Fixed test to pacify buildbot.

llvm-svn: 342996
2018-09-25 17:58:08 +00:00
Alexey Bataev 99de44bc54 [OPENMP] Fix failed test, NFC.
llvm-svn: 342995
2018-09-25 17:47:53 +00:00
Alexey Bataev 464ab241e7 [DRIVER][OFFLOAD] Do not invoke unbundler on unsupported file types.
clang-offload-bundler should not be invoked with the unbundling action
when the input file type does not match the action type. For example,
.so files should be unbundled during linking phase and should be linked
only with the host code.

llvm-svn: 342991
2018-09-25 17:09:17 +00:00
Tri Vo 28e7e60ea4 [AArch64] Support adding X[8-15,18] registers as CSRs.
Summary:
Making X[8-15,18] registers call-saved is used to support
CONFIG_ARM64_LSE_ATOMICS in Linux kernel.

Signed-off-by: Tri Vo <trong@android.com>

Reviewers: srhines, nickdesaulniers, javed.absar

Reviewed By: nickdesaulniers

Subscribers: kristof.beyls, jfb, cfe-commits

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

llvm-svn: 342990
2018-09-25 16:48:40 +00:00
Hans Wennborg 934230c061 [clang-cl] Provide separate flags for all the /O variants
This provides better help text in "clang-cl /?".

Also it cleans things up a bit: previously "/Od" could be handled either
as a separate flag aliased to "-O0", or by the main optimization flag
processing in TranslateOptArg. With this patch, all the flags get
aliased back to /O so they're handled by TranslateOptArg.

Thanks to Nico for the idea!

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

llvm-svn: 342977
2018-09-25 14:10:26 +00:00
Saleem Abdulrasool 51313bc6d9 Driver: render arguments for the embedded bitcode correctly
When embedding bitcode, only a subset of the arguments should be recorded into
the bitcode compilation commandline.  The frontend job is split into two jobs,
one which will generate the bitcode.  Ensure that the arguments for the
compilation to bitcode is properly stripped so that the embedded arguments are
the permitted subset.

llvm-svn: 342929
2018-09-24 23:50:02 +00:00
Sjoerd Meijer c017656202 [ARM][AArch64] Add feature +fp16fml
Armv8.4-A adds a few FP16 instructions that can optionally be implemented
in CPUs of Armv8.2-A and above.

This patch adds a feature to clang to permit selection of these
instructions. This interacts with the +fp16 option as follows:

Prior to Armv8.4-A:
*) +fp16fml implies +fp16
*) +nofp16 implies +nofp16fml

From Armv8.4-A:
*) The above conditions apply, additionally: +fp16 implies +fp16fml

Patch by Bernard Ogden.

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

llvm-svn: 342862
2018-09-24 07:55:20 +00:00
Dean Michael Berris 5082e25196 [XRay][clang] Propagate -fxray-instrumentation-bundle to -cc1
Summary:
Add a test and ensure that we propagate the
-fxray-instrumentation-bundle flag from the driver invocation to the
-cc1 options.

Reviewers: mboerger, tejohnson

Subscribers: cfe-commits

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

llvm-svn: 342715
2018-09-21 08:32:49 +00:00
Hans Wennborg 66db8af3aa FileCheckify test/Driver/Xarch.c
llvm-svn: 342636
2018-09-20 09:29:35 +00:00
Hans Wennborg b466bb24b6 cl-options.c: Fix negative -cfguard check
llvm-svn: 342470
2018-09-18 13:07:55 +00:00
Richard Smith cd35eff395 [modules] Driver support for precompiling a collection of files as a single
action.

llvm-svn: 342305
2018-09-15 01:21:16 +00:00
Fangrui Song 9851eafa0e test/Driver/output-file-cleanup.c: delete non-readable temporary file
%t-dir/2.c made tools (rsync, ripgrep, ...) sad (EACCES warning).

llvm-svn: 342290
2018-09-14 21:36:35 +00:00
Stephen Hines f9ca6dd8f7 Support -fno-omit-frame-pointer with -pg.
Summary:
Previously, any instance of -fomit-frame-pointer would make it such that
-pg was an invalid flag combination. If -fno-omit-frame-pointer is
passed later on the command line (such that it actually takes effect),
-pg should be allowed.

Reviewers: nickdesaulniers

Reviewed By: nickdesaulniers

Subscribers: manojgupta, nickdesaulniers, cfe-commits, kongyi, chh, pirama

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

llvm-svn: 342165
2018-09-13 19:50:02 +00:00
Tri Vo 6e8abbc8b9 [AArch64] Support reserving x1-7 registers.
Summary: Reserving registers x1-7 is used to support CONFIG_ARM64_LSE_ATOMICS in Linux kernel. This change adds support for reserving registers x1 through x7.

Reviewers: javed.absar, efriedma, nickdesaulniers, srhines, phosek

Reviewed By: nickdesaulniers

Subscribers: manojgupta, jfb, cfe-commits, kristof.beyls

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

llvm-svn: 342100
2018-09-12 23:45:04 +00:00
Brendon Cahoon e45c1eed0c [Hexagon] Remove fp-contract=fast setting for at O3
Change Hexagon so that the setting for fp-contract is the default setting.
This makes Hexagon consistent with all other targets.

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

llvm-svn: 342078
2018-09-12 20:35:56 +00:00
Roger Ferrer Ibanez bef9929d51 [RISCV] Explicitly set an empty --sysroot in the test
In rL341655 we added additional behaviour to the Driver for riscv32-unknown-elf
when the sysroot is empty.

The new tests that check the new behaviour expect that the absence of --sysroot
in the command-line implies that the sysroot empty. This doesn't hold if clang
is built with a non-empty DEFAULT_SYSROOT in cmake. When this is the case, this
test fails.

Since the new behaviour is triggered when the sysroot is empty, pass an empty
--sysroot to avoid using the default (if any).

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

llvm-svn: 342060
2018-09-12 15:55:14 +00:00
Christian Bruel eaf4fd749b Fix Check test to avoid output string mismatch
Differential Revision: http://reviews.llvm.org/D51354

llvm-svn: 342031
2018-09-12 08:59:17 +00:00
Petr Hosek 8f2499f804 [Driver] Search LibraryPaths when handling -print-file-name
This is necessary to handle the multiarch runtime directories.

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

llvm-svn: 342021
2018-09-12 03:26:10 +00:00
Mike Rice 58df1affed [clang-cl, PCH] Support for /Yc and /Yu without filename and #pragma hdrstop
With clang-cl, when the user specifies /Yc or /Yu without a filename
the compiler uses a #pragma hdrstop in the main source file to
determine the end of the PCH. If a header is specified with /Yc or
/Yu #pragma hdrstop has no effect.

The optional #pragma hdrstop filename argument is not yet supported.

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

llvm-svn: 341963
2018-09-11 17:10:44 +00:00
Douglas Yung 28ea6775c7 Make test more robust in case the expected output appears in clang version string.
llvm-svn: 341907
2018-09-11 06:48:45 +00:00
Alexandre Ganea f8acd723e8 [clang-cl] Enable -march option
This change allows usage of -march when using the clang-cl driver. This is similar to MSVC's /arch; however -march can target precisely all supported CPUs, while /arch has a more restricted set.

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

llvm-svn: 341847
2018-09-10 17:54:32 +00:00
Kristina Brooks 8f060aac2f Differential Revision: https://reviews.llvm.org/D50246
[RISCV] Add support for computing sysroot for riscv32-unknown-elf

Extends r338385 to allow the driver to compute the sysroot when an explicit path is not provided. This allows the linker to find C runtime files and the correct include directory for header files.

Patch by lewis-revill (Lewis Revill)

llvm-svn: 341655
2018-09-07 13:03:31 +00:00
Nico Weber 50824c9caf Reland r341390 clang-cl: Pass /Brepro to linker if it was passed to the compiler
The test was missing  '--' on mac as pointed out by -Wslash-u-filename:
<stdin>:5:69: note: possible intended match here
clang: warning: '/Users/thakis/src/llvm-mono/clang/test/Driver/msvc-link.c' treated as the '/U' option [-Wslash-u-filename]

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

llvm-svn: 341654
2018-09-07 12:47:02 +00:00
Alexander Potapenko d49c32ce3f [MSan] add KMSAN support to Clang driver
Boilerplate code for using KMSAN instrumentation in Clang.

We add a new command line flag, -fsanitize=kernel-memory, with a
corresponding SanitizerKind::KernelMemory, which, along with
SanitizerKind::Memory, maps to the memory_sanitizer feature.

KMSAN is only supported on x86_64 Linux.

It's incompatible with other sanitizers, but supports code coverage
instrumentation.

llvm-svn: 341641
2018-09-07 09:21:09 +00:00
Pavel Labath c1e0c34e45 Re-commit "Enable DWARF accelerator tables by default when tuning for lldb (-glldb => -gpubnames)""
This recommits r341472, which was reverted due to test failures on macos bots.

The issue was that a macos target implies -glldb which, together with
this patch added a -gpubnames switch where there previously wasn't one.
The intentions of those checks was to check that -gpubnames is not
emitted by default so I add an explicit -ggdb arg to those command lines
to get same behavior on all platforms (the fact that -glldb *does* set
-gpubnames is tested by a separate test).

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

llvm-svn: 341564
2018-09-06 17:01:45 +00:00
A Bergen 51fdaba4ad Reverting r 341390 because it is causing test failures on GreenDragon.
http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental/52810/

llvm-svn: 341560
2018-09-06 16:29:40 +00:00
Christian Bruel 6ccc4a7c20 Fix the -print-multi-directory flag to print the selected multilib.
Summary: Fix -print-multi-directory to print the selected multilib

Reviewers: jroelofs

Reviewed By: jroelofs

Subscribers: jroelofs, timshen, thakis, srhines, cfe-commits

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

llvm-svn: 341547
2018-09-06 14:03:44 +00:00
Pavel Labath df6c3d4452 Revert "Enable DWARF accelerator tables by default when tuning for lldb (-glldb => -gpubnames)"
This reverts commit r341472 due to breakage in green dragon bots.

llvm-svn: 341492
2018-09-05 20:20:28 +00:00
Pavel Labath 5795673ef8 Enable DWARF accelerator tables by default when tuning for lldb (-glldb => -gpubnames)
Summary:
DWARF v5 accelerator tables provide a considerable performance
improvement for lldb and will make the default -glldb behavior same on
all targets (right now we emit apple tables on apple targets, but these
are not controlled by -gpubnames, only by -glldb).

Reviewers: dblaikie

Subscribers: probinson, clayborg, JDevlieghere, aprantl, cfe-commits

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

llvm-svn: 341472
2018-09-05 14:38:44 +00:00
Tim Shen 034423377c Revert r341373, since it fails on some targets.
Differential Revision: https://reviews.llvm.org/D51354

llvm-svn: 341418
2018-09-04 22:20:11 +00:00
Nico Weber 88f7285415 clang-cl: Pass /Brepro to linker if it was passed to the compiler
Differential Revision: https://reviews.llvm.org/D51635

llvm-svn: 341390
2018-09-04 18:00:14 +00:00
Christian Bruel ed1d6db907 Fix the -print-multi-directory flag to print the selected multilib.
Summary: Fix -print-multi-directory to print the selected multilib

Reviewers: jroelofs

Reviewed By: jroelofs

Subscribers: srhines, cfe-commits

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

llvm-svn: 341373
2018-09-04 15:22:13 +00:00
Chandler Carruth 664aa868f5 [x86/SLH] Add a real Clang flag and LLVM IR attribute for Speculative
Load Hardening.

Wires up the existing pass to work with a proper IR attribute rather
than just a hidden/internal flag. The internal flag continues to work
for now, but I'll likely remove it soon.

Most of the churn here is adding the IR attribute. I talked about this
Kristof Beyls and he seemed at least initially OK with this direction.
The idea of using a full attribute here is that we *do* expect at least
some forms of this for other architectures. There isn't anything
*inherently* x86-specific about this technique, just that we only have
an implementation for x86 at the moment.

While we could potentially expose this as a Clang-level attribute as
well, that seems like a good question to defer for the moment as it
isn't 100% clear whether that or some other programmer interface (or
both?) would be best. We'll defer the programmer interface side of this
for now, but at least get to the point where the feature can be enabled
without relying on implementation details.

This also allows us to do something that was really hard before: we can
enable *just* the indirect call retpolines when using SLH. For x86, we
don't have any other way to mitigate indirect calls. Other architectures
may take a different approach of course, and none of this is surfaced to
user-level flags.

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

llvm-svn: 341363
2018-09-04 12:38:00 +00:00
Brian Gesiak c1b7a98934 Removing -debug-info-macros from option suggestions test
Summary:
https://reviews.llvm.org/D46776 added better support for prefixes for the
"did you mean ...?" command line option suggestions. One of the tests was
checking against the `-debug-info-macro` option, which was failing on the
PS4 build bot. Tests would succeed against the `--help` and `--version`
options.

From https://llvm.org/devmtg/2013-11/slides/Robinson-PS4Toolchain.pdf, it
looks like the PS4 SDK forces optimizations and *could be* disabling the
`-debug-info-macro` altogether.

This diff removes `-debug-info-macro` altogether.

Patch by Arnaud Coomans!

Test Plan: untested since we do not have access to a PS4 with the SDK.

Reviewers: cfe-commits, modocache

Reviewed By: modocache

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

llvm-svn: 341327
2018-09-03 16:55:02 +00:00
Peter Smith d8e7ed6457 [Aarch64] Fix linker emulation for Aarch64 big endian
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
2018-09-03 12:36:32 +00:00
Heejin Ahn 4fa8dd95dd [WebAssembly] clang-format (NFC)
Summary: This patch runs clang-format on all wasm-only files.

Subscribers: dschuff, sbc100, jgravelle-google, sunfish, jfb, cfe-commits

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

llvm-svn: 341254
2018-08-31 20:57:00 +00:00
Sterling Augustine 1c04e1f552 Refactor Addlibgcc to make the when and what logic more straightfoward.
Add Android tests.

llvm-svn: 341231
2018-08-31 17:59:03 +00:00
Alexey Bataev 80e1b5eb34 [DEBUGINFO] Add support for emission of the debug directives only.
Summary:
Added option -gline-directives-only to support emission of the debug directives
only. It behaves very similar to -gline-tables-only, except that it sets
llvm debug info emission kind to
llvm::DICompileUnit::DebugDirectivesOnly.

Reviewers: echristo

Subscribers: aprantl, fedor.sergeev, JDevlieghere, cfe-commits

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

llvm-svn: 341212
2018-08-31 13:56:14 +00:00
Douglas Yung 11982cd7db Change %clang++ to %clangxx in test run line as it was expanding to clang.exe++ on Windows.
llvm-svn: 341106
2018-08-30 19:52:57 +00:00
Sterling Augustine 5acd669330 Test the cross-product of how libgcc-related arguments are passed to the linker.
llvm-svn: 341083
2018-08-30 16:37:06 +00:00