Commit Graph

4476 Commits

Author SHA1 Message Date
Dean Michael Berris 488f7c2b67 [XRay][clang] Add flag to choose instrumentation bundles
Summary:
This change addresses http://llvm.org/PR36926 by allowing users to pick
which instrumentation bundles to use, when instrumenting with XRay. In
particular, the flag `-fxray-instrumentation-bundle=` has four valid
values:

- `all`: the default, emits all instrumentation kinds
- `none`: equivalent to -fnoxray-instrument
- `function`: emits the entry/exit instrumentation
- `custom`: emits the custom event instrumentation

These can be combined either as comma-separated values, or as
repeated flag values.

Reviewers: echristo, kpw, eizan, pelikan

Reviewed By: pelikan

Subscribers: mgorny, cfe-commits

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

llvm-svn: 329985
2018-04-13 02:31:58 +00:00
Eli Friedman 01d349bab1 Remove -cc1 option "-backend-option".
It means the same thing as -mllvm; there isn't any reason to have two
options which do the same thing.

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

llvm-svn: 329965
2018-04-12 22:21:36 +00:00
Martin Storsjo acd9ca34d8 [MinGW] Look for libc++ headers in a triplet prefixed path as well
This makes it consistent with libstdc++ and the other default
include directories.

If these headers are found in both locations and one isn't a
symlink to the other, this will cause errors due to libc++ headers
having wrapper headers for some standard C headers, wrappers that
do #include_next the actual one.

If the same libc++ standard C wrapper header exists in more than one
include directory before the real system one, the header include
guard will stop it from doing another #include_next to pick up the
real one, breaking things.

As this is a rather uncommon situation, this should be acceptable
and toolchain maintainers can adapt accordingly if necessary.

Also simplify some of the existing code with a local variable.

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

llvm-svn: 329946
2018-04-12 20:07:38 +00:00
Mandeep Singh Grang 0c5300a93f [RISCV] Fix logic to check if frame pointer should be used
Summary: The logic was broken for Linux triples as it returns true in the switch for Triple.isOSLinux().

Reviewers: asb, apazos

Reviewed By: asb

Subscribers: kito-cheng, shiva0217, cfe-commits

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

llvm-svn: 329941
2018-04-12 19:31:37 +00:00
Krzysztof Parzyszek e4b0b6e374 [Hexagon] Enable auto-vectorization only when -fvectorize was given
llvm-svn: 329923
2018-04-12 16:25:35 +00:00
Tom Stellard a557852719 Driver: Add gcc search path for RHEL devtoolset-7
Reviewers: bruno

Reviewed By: bruno

Subscribers: bruno, cfe-commits

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

llvm-svn: 329854
2018-04-11 22:29:35 +00:00
Chad Rosier 6df46f7665 [Driver] Don't forward -m[no-]unaligned-access options to GCC when assembling/linking
Differential Revision: https://reviews.llvm.org/D45092

llvm-svn: 329810
2018-04-11 14:20:37 +00:00
Strahinja Petrovic 269a6e7952 [PowerPC] Option for secure plt mode
This patch enables option for secure plt mode in
clang (-msecure-plt).

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

llvm-svn: 329795
2018-04-11 12:24:44 +00:00
Dean Michael Berris bfd98d064a Adding fuzzer flags support to OpenBSD driver
Summary: - Following-up the sanitizer's part commit https://reviews.llvm.org/rCRT329631, we enable fuzzer flags.

Reviewers: brad, thakis, dberris

Reviewed By: dberris

Subscribers: cfe-commits

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

llvm-svn: 329779
2018-04-11 05:40:47 +00:00
Dean Michael Berris 826e666cc7 [XRay][clang+compiler-rt] Support build-time mode selection
Summary:
This patch implements the `-fxray-modes=` flag which allows users
building with XRay instrumentation to decide which modes to pre-package
into the binary being linked. The default is the status quo, which will
link all the available modes.

For this to work we're also breaking apart the mode implementations
(xray-fdr and xray-basic) from the main xray runtime. This gives more
granular control of which modes are pre-packaged, and picked from
clang's invocation.

This fixes llvm.org/PR37066.

Note that in the future, we may change the default for clang to only
contain the profiling implementation under development in D44620, when
that implementation is ready.

Reviewers: echristo, eizan, chandlerc

Reviewed By: echristo

Subscribers: mgorny, mgrang, cfe-commits, llvm-commits

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

llvm-svn: 329772
2018-04-11 01:28:25 +00:00
Petr Hosek 52b1f9a30b Revert "Handle the default case"
This reverts commit r329758.

llvm-svn: 329760
2018-04-10 21:29:18 +00:00
Petr Hosek d5c9420ff5 Handle the default case
This was omitted in D45422 resulting in a warning.

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

llvm-svn: 329758
2018-04-10 21:19:05 +00:00
Chad Rosier d880416722 [Driver] Handle the default case missed in r329748.
Differential Revision: https://reviews.llvm.org/D45499

llvm-svn: 329754
2018-04-10 20:30:16 +00:00
Petr Hosek 8d612149db [Driver] Allow drivers to add multiple libc++ include paths
This allows toolchain drivers to add multiple libc++ include paths akin
to libstdc++. This is useful in multiarch setup when some headers might
be in target specific include directory. There should be no functional
change.

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

llvm-svn: 329748
2018-04-10 19:55:55 +00:00
Artem Belevich dde3dc27ee [CUDA] Added --[no-]cuda-include-ptx=sm_XX|all option.
Currently we always include PTX into the fatbin along
with the GPU code.It about doubles the size of the GPU binary
we need to carry in the executable. These options allow control
inclusion of PTX into GPU binary.

This patch does not change the defaults, though we may consider
making no-PTX the default in the future.

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

llvm-svn: 329737
2018-04-10 18:38:22 +00:00
Dean Michael Berris 20dc6ef746 [XRay][llvm+clang] Consolidate attribute list files
Summary:
This change consolidates the always/never lists that may be provided to
clang to externally control which functions should be XRay instrumented
by imbuing attributes. The files follow the same format as defined in
https://clang.llvm.org/docs/SanitizerSpecialCaseList.html for the
sanitizer blacklist.

We also deprecate the existing `-fxray-instrument-always=` and
`-fxray-instrument-never=` flags, in favour of `-fxray-attr-list=`.

This fixes http://llvm.org/PR34721.

Reviewers: echristo, vlad.tsyrklevich, eugenis

Reviewed By: vlad.tsyrklevich

Subscribers: llvm-commits, cfe-commits

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

llvm-svn: 329543
2018-04-09 04:02:09 +00:00
Manoj Gupta 9487d90e22 [Driver] Update GCC libraries detection logic for Gentoo.
Summary:
1. Find GCC's LDPATH from the actual GCC config file.
2. Avoid picking libraries from a similar named tuple if the exact
   tuple is installed.

Reviewers: mgorny, chandlerc, thakis, rnk

Reviewed By: mgorny, rnk

Subscribers: cfe-commits, mgorny

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

llvm-svn: 329512
2018-04-07 19:59:58 +00:00
Alex Lorenz 045c514fb4 Recommit r329442: Generate Libclang invocation reproducers using a new
-cc1gen-reproducer driver option

The recommit fixes:
- An MSAN failure (CCPrintOptions wasn't initialized in the Driver)
- Ensures that the strings in the libclang invocation files are escaped

Original message:

This commit is a follow up to the previous work that recorded Libclang invocations
into temporary files: r319702.

It adds a new -cc1 mode to clang: -cc1gen-reproducer. The goal of this mode is to generate
Clang reproducer files for Libclang tool invocation. The JSON format in the invocation
files is not really intended to be stable, so Libclang and Clang should be of the same version
when generating reproducers.
The new mode emits the information about the temporary files and Libclang-specific information
to stdout using JSON.

rdar://35322614

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

llvm-svn: 329465
2018-04-07 00:03:27 +00:00
Alex Lorenz c884b7187c Revert r329442 "Generate Libclang invocation reproducers using a new
-cc1gen-reproducer driver option"

The tests are failing on some bots

llvm-svn: 329447
2018-04-06 19:45:29 +00:00
Alex Lorenz 1e720916fa Generate Libclang invocation reproducers using a new -cc1gen-reproducer
driver option

This commit is a follow up to the previous work that recorded Libclang invocations
into temporary files: r319702.

It adds a new -cc1 mode to clang: -cc1gen-reproducer. The goal of this mode is to generate
Clang reproducer files for Libclang tool invocation. The JSON format in the invocation
files is not really intended to be stable, so Libclang and Clang should be of the same version
when generating reproducers.
The new mode emits the information about the temporary files and Libclang-specific information
to stdout using JSON.

rdar://35322614

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

llvm-svn: 329442
2018-04-06 18:30:14 +00:00
Alexander Kornienko 2a8c18d991 Fix typos in clang
Found via codespell -q 3 -I ../clang-whitelist.txt
Where whitelist consists of:

  archtype
  cas
  classs
  checkk
  compres
  definit
  frome
  iff
  inteval
  ith
  lod
  methode
  nd
  optin
  ot
  pres
  statics
  te
  thru

Patch by luzpaz! (This is a subset of D44188 that applies cleanly with a few
files that have dubious fixes reverted.)

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

llvm-svn: 329399
2018-04-06 15:14:32 +00:00
Dean Michael Berris 248148db00 [XRay][clang] Add a flag to enable/disable linking XRay deps explicitly
Summary:
This change introduces `-fxray-link-deps` and `-fnoxray-link-deps`. The
`-fnoxray-link-deps` allows for directly controlling which specific XRay
runtime to link. The default is for clang to link the XRay runtime that
is shipped with the compiler (if there are any), but users may want to
explicitly add the XRay dependencies from other locations or other
means.

Reviewers: eizan, echristo, chandlerc

Reviewed By: eizan

Subscribers: cfe-commits

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

llvm-svn: 329376
2018-04-06 05:28:54 +00:00
Dean Michael Berris 624403784f [XRay][clang] Consolidate runtime and link-time flag processing (NFC)
Summary:
This change fixes http://llvm.org/PR36985 to define a single place in
CommonArgs.{h,cpp} where XRay runtime flags and link-time dependencies
are processed for all toolchains that support XRay instrumentation. This
is a refactoring of the same functionality spread across multiple
toolchain definitions.

Reviewers: echristo, devnexen, eizan

Reviewed By: eizan

Subscribers: emaste, cfe-commits

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

llvm-svn: 329372
2018-04-06 03:53:04 +00:00
Petr Hosek c3aa97a49a CMake option to allow enabling experimental new pass manager by default
This CMake flag allows setting the default value for the
-f[no]-experimental-new-pass-manager flag.

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

llvm-svn: 329366
2018-04-06 00:53:00 +00:00
Manoj Gupta 4b3eefa5e8 Disable -fmerge-all-constants as default.
Summary:
"-fmerge-all-constants" is a non-conforming optimization and should not
be the default. It is also causing miscompiles when building Linux
Kernel (https://lkml.org/lkml/2018/3/20/872).

Fixes PR18538.

Reviewers: rjmccall, rsmith, chandlerc

Reviewed By: rsmith, chandlerc

Subscribers: srhines, cfe-commits

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

llvm-svn: 329300
2018-04-05 15:29:52 +00:00
Evgeniy Stepanov 072b1a2d6c Enable msan unconditionally on Linux.
Memory sanitizer compatibility are already done in
MemorySanitizer::doInitialization. It verifies whether the necessary offsets
exist and bails out if not. For this reason it is no good to duplicate two
checks in two projects. This patch removes clang check and postpones msan
compatibility validation till MemorySanitizer::doInitialization.

Another reason for this patch is to allow using msan with any CPU (given
compatible runtime) and custom mapping provided via the arguments added by
https://reviews.llvm.org/D44926.

Patch by vit9696.

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

llvm-svn: 329241
2018-04-04 23:48:06 +00:00
Peter Collingbourne f11eb3ebe7 AArch64: Implement support for the shadowcallstack attribute.
The implementation of shadow call stack on aarch64 is quite different to
the implementation on x86_64. Instead of reserving a segment register for
the shadow call stack, we reserve the platform register, x18. Any function
that spills lr to sp also spills it to the shadow call stack, a pointer to
which is stored in x18.

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

llvm-svn: 329236
2018-04-04 21:55:44 +00:00
Dan Albert e00799ea04 [Driver] Include the Android multiarch includes.
Summary:
Most Android headers live in a single directory, but a small handful
live in multiarch directories.

Reviewers: srhines

Reviewed By: srhines

Subscribers: javed.absar, cfe-commits

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

llvm-svn: 329234
2018-04-04 21:28:34 +00:00
Dean Michael Berris 9b59233f57 [XRay][clang] Allow clang to build XRay instrumented binaries in OpenBSD
Summary:
This patch was originally reviewed in D45126. It enables clang to add
the XRay runtime and the link-time dependencies for XRay instrumentation
in OpenBSD.

Landing for devnexen.

Reviewers: brad, dberris

Subscribers: dberris, krytarowski, cfe-commits

Author: devnexen

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

llvm-svn: 329183
2018-04-04 12:47:49 +00:00
Vlad Tsyrklevich e55aa03ad4 Add the -fsanitize=shadow-call-stack flag
Summary:
Add support for the -fsanitize=shadow-call-stack flag which causes clang
to add ShadowCallStack attribute to functions compiled with that flag
enabled.

Reviewers: pcc, kcc

Reviewed By: pcc, kcc

Subscribers: cryptoad, cfe-commits, kcc

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

llvm-svn: 329122
2018-04-03 22:33:53 +00:00
Alex Lorenz 9114eb40b5 [driver][darwin] Do not infer -simulator environment for non-simulator SDKs
rdar://36369832

llvm-svn: 329110
2018-04-03 20:50:05 +00:00
Krzysztof Parzyszek 3163610010 [Hexagon] Remove -mhvx-double and the corresponding subtarget feature
Specifying the HVX vector length should be done via the -mhvx-length
option.

llvm-svn: 329077
2018-04-03 15:59:10 +00:00
Petr Hosek bae4856d31 [Driver] Wire up the -f[no-]rtlib-add-rpath flag and tests
D30700 added the -f[no-]rtlib-add-rpath flag, but that flag was never
wired up in the driver and tests were updated to check whether it
actually does anything. This patch wires up the flag and updates test.

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

llvm-svn: 329032
2018-04-02 23:36:14 +00:00
Shiva Chen 203917e26e [PATCH] [RISCV] Verify the input value of -march=
Summary:
This patch doing more check and verify the -march= string and will issue
an error if it's a invalid combination.

Reviewers: asb, apazos

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

Patch by Kito Cheng.

llvm-svn: 328690
2018-03-28 08:29:50 +00:00
Petr Hosek 99c8eb8781 [Driver] Add fuzzer-no-link into the list of supported Fuchsia sanitizers
This is needed in addition to fuzzer in order to use libFuzzer.

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

llvm-svn: 328672
2018-03-27 21:33:12 +00:00
Mandeep Singh Grang c205d8cc8d [clang] Change std::sort to llvm::sort in response to r327219
r327219 added wrappers to std::sort which randomly shuffle the container before
sorting.  This will help in uncovering non-determinism caused due to undefined
sorting order of objects having the same key.

To make use of that infrastructure we need to invoke llvm::sort instead of
std::sort.

llvm-svn: 328636
2018-03-27 16:50:00 +00:00
Alex Shlyapnikov 0a20cefffd [HWASan] Port HWASan to Linux x86-64 (clang)
Summary: Porting HWASan to Linux x86-64, the third of the three patches, clang part.

Reviewers: eugenis

Subscribers: cryptoad, cfe-commits

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

llvm-svn: 328361
2018-03-23 19:47:45 +00:00
Artem Belevich ecb178bb35 [CUDA] Disable LTO for device-side compilations.
This fixes host-side LTO during CUDA compilation. Before, LTO
pipeline construction was clashing with CUDA pipeline construction.

At the moment there's no point doing LTO on device side as each
device-side TU is a complete program.  We will need to figure out
compilation pipeline construction for the device-side LTO when we
have working support for multi-TU device-side CUDA compilation.

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

llvm-svn: 328161
2018-03-21 22:22:59 +00:00
Eugene Zelenko 5e4511cfc7 [Driver] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 328044
2018-03-20 21:08:59 +00:00
Gheorghe-Teodor Bercea 0d5aa84ad9 [OpenMP] Add flag for linking runtime bitcode library
Summary: This patch adds an additional flag to the OpenMP device offloading toolchain to link in the runtime library bitcode.

Reviewers: Hahnfeld, ABataev, carlo.bertolli, caomhin, grokos, hfinkel

Reviewed By: ABataev, grokos

Subscribers: jholewinski, guansong, cfe-commits

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

llvm-svn: 327460
2018-03-13 23:19:52 +00:00
Gheorghe-Teodor Bercea 0805b80a73 Revert revision 327438.
llvm-svn: 327447
2018-03-13 20:50:12 +00:00
Gheorghe-Teodor Bercea 148046c11b [OpenMP] Add flag for linking runtime bitcode library
Summary: This patch adds an additional flag to the OpenMP device offloading toolchain to link in the runtime library bitcode.

Reviewers: Hahnfeld, ABataev, carlo.bertolli, caomhin, grokos, hfinkel

Reviewed By: ABataev, grokos

Subscribers: jholewinski, guansong, cfe-commits

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

llvm-svn: 327438
2018-03-13 19:39:19 +00:00
Petr Hosek 8b8d6bf62f [Driver] Update the comment about incompatible sanitizers
Differential Revision: https://reviews.llvm.org/D44371

llvm-svn: 327249
2018-03-12 00:23:37 +00:00
Akira Hatanaka 9f9d766037 [Driver] Pass Default=false to hasFlag.
I forgot to do this in r326530.

llvm-svn: 327204
2018-03-10 05:55:21 +00:00
Evgeniy Stepanov d48c0cd910 Don't use -pie in relocatable link.
Summary:
Android, in particular, got PIE enabled by default in r316606. It resulted in
relocatable links passing both -r and -pie to the linker, which is not allowed.

Reviewers: srhines

Subscribers: cfe-commits

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

llvm-svn: 327165
2018-03-09 19:35:16 +00:00
Petr Hosek fdcbcfb040 [Driver] Enable SafeStack by default on Fuchsia
This is already used throughout the entire system, so make it a default.

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

llvm-svn: 326867
2018-03-07 02:49:58 +00:00
Petr Hosek a14b46073e [Driver] Automatically disable incompatible default sanitizers
When a sanitizer incompatible with one of the default sanitizers
is explicitly enabled, automatically disable all the conflicting
default sanitizers.

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

llvm-svn: 326860
2018-03-07 01:27:03 +00:00
Reid Kleckner ce30b76b1d [msvc] Allow MSVC toolchain driver to find the aarch64 / arm64 cross-compiler.
Starting with the Fall Creators Update, Windows 10 Desktop can run on
machines that are powered by aarch64 processors.

Microsoft call the aarch64 architecture "arm64". This patch maps
ArchType::aarch64 to "arm64" to allow the MSVC toolchain driver to find
the aarch64 / arm64 cross-compiler.

Patch by Chris January

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

llvm-svn: 326744
2018-03-05 21:36:23 +00:00
Yuka Takahashi 503da8ff1f [Bash-autocompletion] Fixed formatting
Fixed a trivial formatting and indent.

llvm-svn: 326685
2018-03-05 09:01:31 +00:00
Yuka Takahashi 41789e46a6 [Bash-autocompletion] Pass all flags in shell command-line to Clang
Previously, we passed "#" to --autocomplete to indicate to enable cc1
flags. For example, when -cc1 or -Xclang was passed to bash, bash
executed `clang --autocomplete=#-<flag they want to complete>`.

However, this was not a good implementation because it depends -Xclang
and -cc1 parsing to shell. So I changed this to pass all flags shell
has, so that Clang can handle them internally.

I had to change many testcases because API spec changed quite a lot.

Reviewers: teemperor, v.g.vassilev

Subscribers: cfe-commits

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

llvm-svn: 326684
2018-03-05 08:54:20 +00:00