Commit Graph

2689 Commits

Author SHA1 Message Date
Renato Golin de72b918f3 Revert "[sanitizer-coverage] one more flavor of coverage: -fsanitize-coverage=inline-8bit-counters. Experimental so far, not documenting yet. (clang part)"
This reverts commit r304631, as it broke ARM/AArch64 bots for 2 days.

llvm-svn: 304697
2017-06-05 07:35:45 +00:00
Kostya Serebryany e425aada63 [sanitizer-coverage] one more flavor of coverage: -fsanitize-coverage=inline-8bit-counters. Experimental so far, not documenting yet. (clang part)
llvm-svn: 304631
2017-06-03 01:36:23 +00:00
Vedant Kumar a125eb55cb [ubsan] Add a check for pointer overflow UB
Check pointer arithmetic for overflow.

For some more background on this check, see:

  https://wdtz.org/catching-pointer-overflow-bugs.html
  https://reviews.llvm.org/D20322

Patch by Will Dietz and John Regehr!

This version of the patch is different from the original in a few ways:

  - It introduces the EmitCheckedInBoundsGEP utility which inserts
    checks when the pointer overflow check is enabled.

  - It does some constant-folding to reduce instrumentation overhead.

  - It does not check some GEPs in CGExprCXX. I'm not sure that
    inserting checks here, or in CGClass, would catch many bugs.

Possible future directions for this check:

  - Introduce CGF.EmitCheckedStructGEP, to detect overflows when
    accessing structures.

Testing: Apart from the added lit test, I ran check-llvm and check-clang
with a stage2, ubsan-instrumented clang. Will and John have also done
extensive testing on numerous open source projects.

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

llvm-svn: 304459
2017-06-01 19:22:18 +00:00
Alexander Kornienko c7a0b672b8 Make the clang-cl test less restrictive.
Make the test less restrictive to allow directory layout used in our test setup.

llvm-svn: 304408
2017-06-01 11:41:21 +00:00
Kristof Beyls 348df0de15 Adapt tests after making mcpu=generic the default for armv7-a and armv8-a.
llvm-svn: 304391
2017-06-01 07:31:50 +00:00
Reid Kleckner 8ea89eaf7d [clang-cl] Expose -nostdinc and -nobuiltininc
These are already wired up to work in the MSVC toolchain header search
code. However, they were unreachable from clang-cl. A user attempted to
use them in https://bugs.llvm.org/show_bug.cgi?id=33205, so let's expose
them.

llvm-svn: 304345
2017-05-31 20:42:43 +00:00
Reid Kleckner 1d4cde6283 Fix cl-diagnostics.c test by hardcoding the version of MSVC to mimic
llvm-svn: 304337
2017-05-31 20:07:36 +00:00
Reid Kleckner 2918a2000b Add test case for r304316 which implemented clang-cl /diagnostics:*
llvm-svn: 304336
2017-05-31 20:02:27 +00:00
Reid Kleckner 6344f10fa9 Fix incorrect spelling of calling conv flag and add -Wno-msvc-not-found to test
llvm-svn: 304308
2017-05-31 15:50:35 +00:00
Reid Kleckner 4b2f3269ab [clang-cl] Improve default calling convention flag handling
Ignore default CC flags that don't make sense for the target arch. This
is consistent with MSVC.

Addresses part of PR33237

llvm-svn: 304305
2017-05-31 15:39:28 +00:00
Reid Kleckner 36438ba651 [clang-cl] Ignore /Zc:ternary, clang behaves this way already
Addresses part of PR33237

llvm-svn: 304303
2017-05-31 14:50:28 +00:00
Alexey Bataev 9780faaf8f [OpenMP][Driver] Put target binary for each offload target into a
separate section, by Sergey Dmitriev

Linker script that is generated by the clang driver for creating fat binary puts target binaries for all offload targets into a single ELF section .omp_offloading. This is not convenient because it greatly complicates operations with the final fat binary once it is linked. For example extracting target binary for a particular target from such fat executable would not be an easy task if you have more than one offload target.

Attached patch changes clang driver to put target binary for each
offload target into a separate ELF section .omp_offloading.<target
triple>.

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

llvm-svn: 304229
2017-05-30 18:57:51 +00:00
Mehdi Amini 6aa9e9b41a IRGen: Add optnone attribute on function during O0
Amongst other, this will help LTO to correctly handle/honor files
compiled with O0, helping debugging failures.
It also seems in line with how we handle other options, like how
-fnoinline adds the appropriate attribute as well.

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

llvm-svn: 304127
2017-05-29 05:38:20 +00:00
Ismail Donmez fd934c29d3 baremetal.cpp: Fix tests where lib suffix is 64
llvm-svn: 304085
2017-05-28 06:15:42 +00:00
Richard Trieu d3bc3e0138 "*" => "+" to avoid matching on empty string.
llvm-svn: 303934
2017-05-25 23:25:36 +00:00
Richard Trieu 13b12dc02d Make test/Driver/baremetal.cpp work when output directory isn't named 'bin'.
llvm-svn: 303932
2017-05-25 23:03:08 +00:00
Hans Wennborg ca7a3947f5 Make test/Driver/baremetal.cpp pass on Windows
llvm-svn: 303910
2017-05-25 20:39:52 +00:00
Jonathan Roelofs 8d765ef92d Relax testcase to appease buildbots
When lld isn't built, the tests as they were previously, were too picky about
the path to the linker.

llvm-svn: 303880
2017-05-25 16:20:51 +00:00
Jonathan Roelofs 901c776d06 Don't defer to the GCC driver for linking arm-baremetal
Also comes with a cmake cache for building the runtime bits:

 $ cmake <normal cmake flags> \
   -DBAREMETAL_ARMV6M_SYSROOT=/path/to/sysroot \
   -DBAREMETAL_ARMV7M_SYSROOT=/path/to/sysroot \
   -DBAREMETAL_ARMV7EM_SYSROOT=/path/to/sysroot \
   -C /path/to/clang/cmake/caches/BaremetalARM.cmake \
   /path/to/llvm

https://reviews.llvm.org/D33259

llvm-svn: 303873
2017-05-25 15:42:13 +00:00
Serge Pavlov b43573b9a4 Driver must return non-zero code on errors in command line
This is recommit of r302775, reverted in r302777 due to a fail in
clang-tidy. Original mesage is below.

Now if clang driver is given wrong arguments, in some cases it
continues execution and returns zero code. This change fixes this
behavior.

The fix revealed some errors in clang test set.

File test/Driver/gfortran.f90 added in r118203 checks forwarding
gfortran flags to GCC. Now driver reports error on this file, because
the option -working-directory implemented in clang differs from the
option with the same name implemented in gfortran, in clang the option
requires argument, in gfortran does not.

In the file test/Driver/arm-darwin-builtin.c clang is called with
options -fbuiltin-strcat and -fbuiltin-strcpy. These option were removed
in r191435 and now clang reports error on this test.

File arm-default-build-attributes.s uses option -verify, which is not
supported by driver, it is cc1 option.

Similarly, the file split-debug.h uses options -fmodules-embed-all-files
and -fmodule-format=obj, which are not supported by driver.

Other revealed errors are mainly mistypes.

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

llvm-svn: 303756
2017-05-24 14:57:17 +00:00
Yuka Takahashi c8068dbb07 [GSoC] Shell autocompletion for clang
Summary:
This is a first patch for GSoC project, bash-completion for clang.
To use this on bash, please run `source clang/utils/bash-autocomplete.sh`.
bash-autocomplete.sh is code for bash-completion.

Simple flag completion and path completion is available in this patch.

Reviewers: teemperor, v.g.vassilev, ruiu, Bigcheese, efriedma

Subscribers: llvm-commits

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

llvm-svn: 303670
2017-05-23 18:39:08 +00:00
Serge Pavlov 738d3b97af Reverted r302775
llvm-svn: 302777
2017-05-11 08:25:22 +00:00
Serge Pavlov c5cc230587 Driver must return non-zero code on errors in command line
Now if clang driver is given wrong arguments, in some cases it
continues execution and returns zero code. This change fixes this
behavior.

The fix revealed some errors in clang test set.

File test/Driver/gfortran.f90 added in r118203 checks forwarding
gfortran flags to GCC. Now driver reports error on this file, because
the option -working-directory implemented in clang differs from the
option with the same name implemented in gfortran, in clang the option
requires argument, in gfortran does not.

In the file test/Driver/arm-darwin-builtin.c clang is called with
options -fbuiltin-strcat and -fbuiltin-strcpy. These option were removed
in r191435 and now clang reports error on this test.

File arm-default-build-attributes.s uses option -verify, which is not
supported by driver, it is cc1 option.

Similarly, the file split-debug.h uses options -fmodules-embed-all-files
and -fmodule-format=obj, which are not supported by driver.

Other revealed errors are mainly mistypes.

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

llvm-svn: 302775
2017-05-11 08:00:33 +00:00
James Y Knight 86a8df74f5 [Myriad] Pass -Xclang and -mllvm flags to moviCompile
Patch by Walter Lee.

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

llvm-svn: 302738
2017-05-10 21:48:13 +00:00
Evgeniy Stepanov c39f67bb2e Fix clang_cl argument in fsanitize.c driver test.
llvm-svn: 302594
2017-05-09 22:28:57 +00:00
Evgeniy Stepanov d991cdd50b [asan] A clang flag to enable ELF globals-gc.
This feature is subtly broken when the linker is gold 2.26 or
earlier. See the following bug for details:
  https://sourceware.org/bugzilla/show_bug.cgi?id=19002

Since the decision needs to be made at compilation time, we can not
test the linker version. The flag is off by default on ELF targets,
and on otherwise.

llvm-svn: 302591
2017-05-09 21:57:43 +00:00
Sam Clegg 8f0129c407 [WebAssembly] Fix failing wasm-toolchain test
This test was broken in r302558.

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

llvm-svn: 302569
2017-05-09 18:44:23 +00:00
Vedant Kumar a9d8be68c1 [Driver] Don't enable -fsanitize-use-after-scope when ASan is disabled
When enabling any sanitizer, -fsanitize-use-after-scope is enabled by
default. This doesn't actually turn ASan on, because we've been getting
lucky and there are extra checks in BackendUtil that stop this from
happening.

However, this has been causing a behavior change: extra lifetime markers
are emitted in some cases where they aren't needed or expected.

llvm-svn: 302468
2017-05-08 21:11:55 +00:00
Kostya Serebryany 50fb618b93 [sanitizer-coverage] implement -fsanitize-coverage=no-prune,... instead of a hidden -mllvm flag. clang part.
llvm-svn: 302320
2017-05-05 23:28:18 +00:00
Alex Lorenz 921ab75854 [Driver] Add a "-mmacos_version_min" option that's an alias for
"-mmacosx_version_min"

The option -mmacosx_version_min will still be the canonical option for now, but
in the future we will switch over to -mmacos_version_min and make
-mmacosx_version_min an alias instead.

rdar://27043820

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

llvm-svn: 302240
2017-05-05 14:52:48 +00:00
Jonathan Roelofs 55bec44c9c Document that Multilib flags must be actual flags
This is because -print-multi-lib depends on them being flags for correctness.

Fixes a case of this in the arm-android multilib selection logic.

llvm-svn: 302207
2017-05-05 00:18:27 +00:00
Saleem Abdulrasool c5728ca3e1 Driver: only inject libstdc++ paths when needed on CrossWindows
When building with libc++ don't bother with injecting the libstdc++
search paths into the linker search path.  This will make it easier to
switch between ld and lld.

llvm-svn: 302184
2017-05-04 19:18:21 +00:00
Tim Northover 4c1104e199 Tests: strengthen CHECK line to avoid picking up stray path.
A bot had "-LTO" in its working directory, which matched the regex used in this
test. Since the arg is quoted, we can exploit that instead. Still broken if
there's a path with a quote in, but I think that's pretty niche.

llvm-svn: 302066
2017-05-03 19:20:45 +00:00
Yuka Takahashi 5511fc2eb3 Revert rL301998: "Fix a bug that -isysroot is completely ignored on Unix"
This reverts commit because it broke
sanitizer-x86_64-linux-autoconf bot and
clang-ppc64be-linux-multistage  bot.

llvm-svn: 302000
2017-05-03 06:02:45 +00:00
Yuka Takahashi 79d310713a Fix a bug that -isysroot is completely ignored on Unix
-isysroot is the flag which set the system root directory.
This bug report https://bugs.llvm.org//show_bug.cgi?id=11503
shows that -isysroot is not handled at all on Unix, so fixed this bug.

After this diff, I could get this result https://pastebin.com/TeCmn9mj .

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

llvm-svn: 301998
2017-05-03 04:58:39 +00:00
Kostya Serebryany 8955efc36f [sanitizer-coverage] add a deprecation warning to the old sanitizer-coverage flag combinations
llvm-svn: 301994
2017-05-03 01:27:28 +00:00
David Blaikie 9bb296cb05 Enable -fno-split-dwarf-inlining even when -gsplit-dwarf isn't specified.
Since -gsplit-dwarf is specified on a backend compile (in ThinLTO
parlance) it isn't passed during the frontend compile (because no ELF
object/dwo file is produced then), yet the -fno-split-dwarf-inlining
value needs to be encoded in the LLVM DebugInfo metadata to have
effect...

So let it be specified & it'll be silently ignored if -gsplit-dwarf
isn't used in the end, otherwise it'll be used on a per-cu basis
depending on where it's specified in the frontend compile actions.

llvm-svn: 301684
2017-04-28 20:50:25 +00:00
Hans Wennborg 883522b1fa clang-cl: Alias /d1reportAllClassLayout to -fdump-record-layouts (PR32826)
llvm-svn: 301567
2017-04-27 17:19:07 +00:00
Richard Smith 8c8fb80490 Improve diagnostics for bad -std= flag.
Don't list deprecated -std= values (c++0x etc). Only produce one line of output
per standard, even if we know it by multiple names.

In passing, add missing -std=gnu++03 alias (supported by GCC), and add new
spelling '-std=cl1.0' for OpenCL 1.0 for consistency with the other values,
with the same meaning as the preexisting '-std=cl'.

llvm-svn: 301507
2017-04-27 01:17:05 +00:00
Richard Smith b0fe70451e Don't accept -std= values that would switch us to a different source language.
We already prohibited this in most cases (in r130710), but had some bugs in our
enforcement of this rule. Specifically, this prevents the following
combinations:

 * -x c -std=clN.M, which would previously effectively act as if -x cl were
   used, despite the input being a C source file. (-x cl -std=cNN continues
   to be disallowed.)

 * -x c++ -std=cuda, which would previously select C++98 + CUDA, despite that
   not being a C++ standard. (-x cuda -std=c++NN is still permitted, and
   selects CUDA with the given C++ standard as its base language.
   -x cuda -std=cuda is still supported with the meaning of CUDA + C++98.)

 * -x renderscript -std=c++NN, which would previously form a hybrid "C++ with
   RenderScript extensions" language. We could support such a thing, but
   shouldn't do so by accident.

llvm-svn: 301497
2017-04-26 23:44:33 +00:00
Krzysztof Parzyszek dcda945971 [Hexagon] Set -ffp-contract=fast at -O3 unless explicitly specified
llvm-svn: 301361
2017-04-25 20:51:51 +00:00
Ismail Donmez b971198ea2 Fix fuzzer.c test on platforms where CLANG_DEFAULT_CXX_STDLIB is libc++
llvm-svn: 301302
2017-04-25 11:24:14 +00:00
George Karpenkov d4fec71b9b Specify a target explicitly in libfuzzer driver flag test
llvm-svn: 301246
2017-04-24 20:38:56 +00:00
George Karpenkov 38b0d82b2d Remove erroneous driver test for -fsanitize=fuzzer flag
libfuzzer is not available on all platforms, and hence we can not always
rely that it was compiled.

llvm-svn: 301216
2017-04-24 18:36:31 +00:00
George Karpenkov f2fc5b068e Flag -fsanitize=fuzzer to enable libfuzzer
Previously, adding libfuzzer to a project was a multi-step procedure,
involving libfuzzer compilation, linking the library, and specifying
coverage flags.
With this change,libfuzzer can be enabled by adding a single
-fsanitize=fuzzer flag instead.

llvm-svn: 301212
2017-04-24 18:23:24 +00:00
David Blaikie 8150355498 Move Split DWARF handling to an MC option/command line argument rather than using metadata
Since Split DWARF needs to name the actual .dwo file that is generated,
it can't be known at the time the llvm::Module is produced as it may be
merged with other Modules before the object is generated and that object
may be generated with any name.

By passing the Split DWARF file name when LLVM is producing object code
the .dwo file name in the object file can match correctly.

The support for Split DWARF for implicit modules remains the same -
using metadata to store the dwo name and dwo id so that potentially
multiple skeleton CUs referring to different dwo files can be generated
from one llvm::Module.

llvm-svn: 301063
2017-04-21 23:35:36 +00:00
Richard Smith 81328ac3a5 P0629R0: Switch to latest proposal for distinguishing module interface from implementation.
This switches from the prototype syntax in P0273R0 ('module' and 'module
implementation') to the consensus syntax 'export module' and 'module'.

In passing, drop the "module declaration must be first" enforcement, since EWG
seems to have changed its mind on that.

llvm-svn: 301056
2017-04-21 22:39:18 +00:00
Ismail Donmez ca9cdadeab Add support for openSUSE ARM Triples
Summary: Add support for armv6hl-suse-linux-gnueabi and armv7hl-suse-linux-gnueabi triples used by openSUSE/SUSE.

Reviewers: cfe-commits, rovka, compnerd, rengolin

Reviewed By: rengolin

Subscribers: aemerson, rengolin, bkramer, chandlerc

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

llvm-svn: 300969
2017-04-21 12:26:43 +00:00
Francis Ricci 8e63e54177 Enable leak sanitizer builds for darwin
Summary:
Support for leak sanitizer on darwin has been added to
compiler-rt, this patch adds compiler support.

Reviewers: dexonsmith, compnerd

Subscribers: alekseyshl, kubamracek, cfe-commits

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

llvm-svn: 300894
2017-04-20 21:11:51 +00:00
Benjamin Kramer b12345c04c [Driver] Add a missing -no-canonical-prefixes to test.
llvm-svn: 300873
2017-04-20 19:06:24 +00:00