Commit Graph

2891 Commits

Author SHA1 Message Date
Simon Atanasyan 59b25cbeaa [Mips] Handle -mips32r[3|5] / -mips64r[3|5] options while selecting lib/headers paths
There is no supported toolchain which provides headers / libs / object
files specific to the mips32r[3|5] and mips64r[3|5] ISA. So select "r2"
specific folders when they are available.

http://reviews.llvm.org/D7879

llvm-svn: 230611
2015-02-26 04:45:57 +00:00
Reid Kleckner 1df0fea593 Add -fuse-line-directive flag to control usage of #line with -E
Currently -fms-extensions controls this behavior, which doesn't make
much sense. It means we can't identify what is and isn't a system header
when compiling our own preprocessed output, because #line doesn't
represent this information.

If someone is feeding Clang's preprocessed output to another compiler,
they can use this flag.

Fixes PR20553.

Reviewers: rsmith

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

llvm-svn: 230587
2015-02-26 00:17:25 +00:00
Simon Atanasyan 3f02403b3a [Mips] Support mips-r6 path suffix for Adnroid MIPS toolchain
This path suffix is used if user provides the -mips32r6 command line
options.

llvm-svn: 230469
2015-02-25 07:31:12 +00:00
Reid Kleckner c4da9c8e50 -fms-extensions: Bump the default _MSC_VER from 1700 to 1800, aka VS2013
VS 2013 is the minimum supported version, so it's reasonable for Clang
to simulate this by default. This also simplifies the clang-cl
self-host, since we have the 18.00 version check.

llvm-svn: 230243
2015-02-23 19:25:48 +00:00
Mohit K. Bhakkad 69963e72f3 [TSan][Clang][MIPS] Enabled thread option for MIPS64 platform
Reviewers: kcc, samsonov, petarj, eugenis

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

llvm-svn: 230209
2015-02-23 09:32:35 +00:00
Larisse Voufo dcc0eddd18 Move -fdefine-sized-deallocation and -fno-sized-deallocation options from driver into CC1 for now.
llvm-svn: 230112
2015-02-21 01:03:48 +00:00
Simon Atanasyan 162feb5f8e [Mips] Support mips32r3, mips32r5, mips64r3, mips64r5 MIPS ISA names
The patch teaches the clang's driver to understand new MIPS ISA names,
pass appropriate options to the assembler, defines corresponding macros etc

http://reviews.llvm.org/D7737

llvm-svn: 230092
2015-02-20 23:37:40 +00:00
Peter Collingbourne a4ccff3281 Implement Control Flow Integrity for virtual calls.
This patch introduces the -fsanitize=cfi-vptr flag, which enables a control
flow integrity scheme that checks that virtual calls take place using a vptr of
the correct dynamic type. More details in the new docs/ControlFlowIntegrity.rst
file.

It also introduces the -fsanitize=cfi flag, which is currently a synonym for
-fsanitize=cfi-vptr, but will eventually cover all CFI checks implemented
in Clang.

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

llvm-svn: 230055
2015-02-20 20:30:56 +00:00
Rafael Espindola 6b07a1c6ee Add -funique-section-names and -fno-unique-section-names options.
For now -funique-section-names is the default, so no change in default behavior.

The total .o size in a build of llvm and clang goes from 241687775 to 230649031
bytes if -fno-unique-section-names is used.

llvm-svn: 230031
2015-02-20 18:08:57 +00:00
Manuel Klimek d2e8b04d61 Add -fno-implicit-modules.
If this flag is set, we error out when a module build is required. This is
useful in environments where all required modules are passed via -fmodule-file.

llvm-svn: 230006
2015-02-20 11:44:41 +00:00
Larisse Voufo 89088232b2 Add -fno-sized-deallocation option for completeness of fix in r229241 in documentation in r229818.
llvm-svn: 229950
2015-02-20 02:07:22 +00:00
Filipe Cabecinhas ec5d0e6423 Improve our handling of rtti/sanitize=vptr/sanitize=undefined
This patch removes the huge blob of code that is dealing with
rtti/exceptions/sanitizers and replaces it with:

A ToolChain function which, for a given set of Args, figures out if rtti
should be:
  - enabled
  - disabled implicitly
  - disabled explicitly

A change in the way SanitizerArgs figures out what sanitizers to enable
(or if it should error out, or warn);

And a check for exceptions/rtti interaction inside addExceptionArgs.

The RTTIMode algorithm is:
  - If -mkernel, -fapple-kext, or -fno-rtti are passed, rtti was disabled explicitly;
  - If -frtti was passed or we're not targetting the PS4, rtti is enabled;
  - If -fexceptions or -fcxx-exceptions was passed and we're targetting
    the PS4, rtti was enabled implicitly;
  - If we're targetting the PS4, rtti is disabled implicitly;
  - Otherwise, rtti is enabled;

Since the only flag needed to pass to -cc1 is -fno-rtti if we want to
disable it, there's no problem in saying rtti is enabled if we're
compiling C code, so we don't look at the input file type.

addExceptionArgs now looks at the RTTIMode and warns that rtti is being
enabled implicitly if targetting the PS4 and exceptions are on. It also
errors out if, targetting the PS4, -fno-rtti was passed, and exceptions
were turned on.

SanitizerArgs now errors out if rtti was disabled explicitly and the vptr
sanitizer was enabled implicitly, but just turns off vptr if rtti is
disabled but -fsanitize=undefined was passed.

Also fixed tests, removed duplicate name from addExceptionArgs comment,
and added one or two surrounding lines when running clang-format.
This changes test/Driver/fsanitize.c to make it not expect a warning when
passed -fsanitize=undefined -fno-rtti, but expect vptr to not be on.

Removed all users and definition of SanitizerArgs::sanitizesVptr().

Reviewers: samsonov

Subscribers: llvm-commits, samsonov, rsmith

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

llvm-svn: 229801
2015-02-19 01:04:49 +00:00
Benjamin Kramer 33cd6dcf87 Driver: Fix use of dangling std::string temporary
What's going on here is that the ternary operator produces a std::string rvalue
that the StringRef points to. I'd hoped bugs like this were a thing of the past
with our asan testing but apparently this code path is only used when LLVM is
configured with a custom --with-c-include-dirs setting.

Unbreaks bootstrapping with GCC5 on Fedora (PR22625), patch by Jonathan Wakely!

llvm-svn: 229719
2015-02-18 18:45:54 +00:00
Bradley Smith d86d670e85 [ARM] Add missing M/R class CPUs
Add some of the missing M and R class Cortex CPUs, namely:

Cortex-M0+ (called Cortex-M0plus for GCC compatibility)
Cortex-M1
SC000
SC300
Cortex-R5

llvm-svn: 229661
2015-02-18 10:34:48 +00:00
Larisse Voufo e990a3f60c Rename flags and options to match current naming: from -fdef-sized-delete to -fdefine-sized-deallocation, and from DefaultSizedDelete to DefineSizedDeallocation.
llvm-svn: 229597
2015-02-18 01:04:10 +00:00
Benjamin Kramer f989042f18 Prefer SmallVector::append/insert over push_back loops. Clang edition.
Same functionality, but hoists the vector growth out of the loop.

llvm-svn: 229508
2015-02-17 16:48:30 +00:00
Sergey Matveev 2ba8778157 Append -fno-assume-sane-operator-new in ASan builds.
This should help LSan detect leaks where operator new would otherwise be
optimized out.

llvm-svn: 229498
2015-02-17 15:09:33 +00:00
Benjamin Kramer 320fc2657b Replace snprintf with a Twine. NFC.
llvm-svn: 229264
2015-02-14 18:19:55 +00:00
Larisse Voufo 5526f4f094 Revise the implementation logic of sized deallocation: Do not automatically generate weak definitions of the sized operator delete (in terms of unsized operator delete). Instead, provide the funcitonality via a new compiler flag, -fdef-sized-delete.
The current implementation causes link-time ODR violations when the delete symbols are exported into the dynamic table.

llvm-svn: 229241
2015-02-14 05:42:57 +00:00
David Majnemer a5b195a1dc Revert "Revert r229082 for a bit, it caused PR22577."
This reverts commit r229123.  It was a red herring, the bug was present
without r229082.

llvm-svn: 229205
2015-02-14 01:35:12 +00:00
Nico Weber 7ce96b853d Revert r229082 for a bit, it caused PR22577.
llvm-svn: 229123
2015-02-13 16:27:00 +00:00
Chandler Carruth 24f59101b6 Remove a stray blank line that my sort_include.py script found.
llvm-svn: 229093
2015-02-13 09:57:05 +00:00
David Majnemer abc482effc MS ABI: Implement /volatile:ms
The /volatile:ms semantics turn volatile loads and stores into atomic
acquire and release operations.  This distinction is important because
volatile memory operations do not form a happens-before relationship
with non-atomic memory.  This means that a volatile store is not
sufficient for implementing a mutex unlock routine.

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

llvm-svn: 229082
2015-02-13 07:55:47 +00:00
Bill Schmidt 911b7b1de6 [PowerPC] Remove the --no-tls-optimize workaround from the clang driver
llvm-svn: 228739
2015-02-10 20:36:08 +00:00
Bob Wilson 14ebd851d9 Do not force "-static" for aarch64 iOS kernel/kext assembly code.
Somehow a check for aarch64 was added to the Darwin toolchain's
isKernelStatic function as part of the initial commit for Apple's
arm64 target (r205100). That check was not in any of Apple's internal
code and no one here knows where it came from. It has been harmless
because "-static" does not change much, if anything, for arm64 iOS code,
but it makes no sense to keep this check.

llvm-svn: 228673
2015-02-10 06:33:04 +00:00
Steven Wu 3ffb61b4ae -iframework option should be forwarded to linker
Summary:
-iframework option is used to specified System framework path so the
path specified should be passed to linker as -F option
rdar://problem/18234544

Reviewers: bob.wilson

Subscribers: cfe-commits

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

llvm-svn: 228413
2015-02-06 18:08:29 +00:00
Bill Schmidt 12ba5fd491 [PowerPC] Re-disable linker optimizations for now
llvm-svn: 228402
2015-02-06 15:31:03 +00:00
Reid Kleckner deeddeced3 Re-land r228258 and make clang-cl's /EHs- disable -fexceptions again
After r228258, Clang started emitting C++ EH IR that LLVM wasn't ready
to deal with, even when exceptions were disabled with /EHs-. This time,
make /EHs- turn off -fexceptions while still emitting exceptional
constructs in functions using __try.  Since Sema rejects C++ exception
handling constructs before CodeGen, landingpads should only appear in
such functions as the result of a __try.

llvm-svn: 228329
2015-02-05 18:56:03 +00:00
Bill Schmidt 0a9c061343 [PowerPC] Revert workaround for TLS linker bug
In r227480, Ulrich Weigand introduced a workaround for a linker
optimization bug that can create mis-optimized code for accesses to
general-dynamic or local-dynamic TLS variables.  The linker
optimization bug only occurred for Clang/LLVM because of some
inefficient code being generated for these TLS accesses.  I have
recently corrected LLVM to produce the efficient code sequence
expected by the linkers, so this workaround is no longer needed.
Therefore this patch reverts r227480.

I've tested that the previous bootstrap failure no longer occurs with
the workaround reverted.

llvm-svn: 228253
2015-02-05 01:12:24 +00:00
Reid Kleckner 86ea770775 Driver: Stop forcing frame pointer usage on Windows
Previously, we would use a frame pointer by default on non-Linux OSs. On
Linux, any optimization flags imply -fomit-frame-pointer. XCore always
defaulted to -fomit-frame-pointer.

Now x86 Windows matches our behavior on Linux. All other ISAs supported
by Windows (ARM, x64) use xdata information, and frame pointers aren't
useful. Frame pointers are now off by default for such targets, but can
be forced via -fno-omit-frame-pointer and code using alloca().

In fact, on Win64 our frame-pointer prologue is not describable with
UNWIND_INFO. This change is a workaround to avoid using the broken FP
using prologue for most functions. This is PR22467.

llvm-svn: 228236
2015-02-04 23:45:07 +00:00
Ben Langmuir e056ec32cd Replace isalnum with isAlphanumeric per review
Thanks Dmitri!

llvm-svn: 228163
2015-02-04 18:34:23 +00:00
Alexey Samsonov a511cdd247 Allow to specify multiple -fsanitize-blacklist= arguments.
Summary:
Allow user to provide multiple blacklists by passing several
-fsanitize-blacklist= options. These options now don't override
default blacklist from Clang resource directory, which is always
applied (which fixes PR22431).

-fno-sanitize-blacklist option now disables all blacklists that
were specified earlier in the command line (including the default
one).

This change depends on http://reviews.llvm.org/D7367.

Test Plan: regression test suite

Reviewers: timurrrr

Subscribers: cfe-commits, kcc, pcc

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

llvm-svn: 228156
2015-02-04 17:40:08 +00:00
Renato Golin 84545d7a5c Teaches the Clang driver to accept Cortex-A72
A previous commit added Cortex-A72 to LLVM, this teaches Clang to
accept it as well.

Patch by Ranjeet Singh.

llvm-svn: 228141
2015-02-04 13:31:56 +00:00
Ben Langmuir 3b7b540680 Make the default module cache user-specific
Appends the username to the first component (after the temp dir) of the
module cache path.  If the username contains a character that shouldn't
go into a path (for now conservatively allow [a-zA-Z0-9_]), we fallback
to the user id.

llvm-svn: 228013
2015-02-03 19:28:37 +00:00
Rafael Espindola 3e34e6546e Use CLANG_LIBDIR_SUFFIX when looking for the gold plugin.
Patch by İsmail Dönmez!

llvm-svn: 227979
2015-02-03 16:33:53 +00:00
Reid Kleckner 68eb60b8c4 PR 17421: Implemented -save-temps={obj|cwd} option
-save-temps=cwd is equivalent to -save-temps
-save-temps=obj saves temporary file in the same directory as output

This helps to avoid clobbering of temp files in case of parallel
compilation with -save-temps of the files that have the same name
but located in different directories.

Patch by Artem Belevich

Reviewed By: rnk

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

llvm-svn: 227886
2015-02-02 22:41:48 +00:00
Filipe Cabecinhas f2a3aec5c7 Tweak behavior due to -fexceptions, in C++ mode, imply -fcxx-exceptions
Added test

llvm-svn: 227695
2015-01-31 23:05:51 +00:00
Eric Christopher 58c2199cef Fix regression in r227409 where we were passing -fsyntax-only
in all cases.

Patch by Artem Belevich.

llvm-svn: 227591
2015-01-30 18:22:23 +00:00
Daniel Sanders 7f933f4c5e [mips] Pass ABI name via -target-abi instead of target-features
Patch by Vladimir Medic

Reviewers: echristo, atanasyan, dsanders

Reviewed By: atanasyan, dsanders

Subscribers: llvm-commits, echristo, atanasyan

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

llvm-svn: 227583
2015-01-30 17:35:23 +00:00
Filipe Cabecinhas c9c4025c8a Remove unneeded code
We don't really care about enabling RTTI with -fexceptions, only with
-fcxx-exceptions.

llvm-svn: 227567
2015-01-30 11:17:56 +00:00
Reid Kleckner ab80f18f57 clang-cl: Enable -fexceptions but not -fcxx-exceptions by default
This enables proper IRgen of SEH constructs.

llvm-svn: 227528
2015-01-30 01:04:16 +00:00
Filipe Cabecinhas 28f353c7d0 Add some more PS4 driver settings related to rtti and exceptions.
Summary:
The PS4 defaults to -fno-rtti, and has to have rtti enabled when enabling
exceptions.

This commit makes clang add the -fno-rtti by default on the PS4, unless
-frtti was passed in.

It also diagnoses misuses for the PS4:
- Exceptions need rtti. Warn and enable rtti if no rtti flag was passed,
  error if -fno-rtti was passed.

I also added a more general warning for when -fno-rtti is the default
(currently it's only on the PS4) and the vptr sanitizer is on.

Fixed a few tests, due to different flag order when passing cc1 arguments.

Reviewers: chandlerc

Subscribers: cfe-commits

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

llvm-svn: 227518
2015-01-29 23:56:43 +00:00
Ulrich Weigand f32a1acee8 [PowerPC] Work around TLS linker bug
Work around a bug in GNU ld (and gold) linker versions up to 2.25
that may mis-optimize code generated by this version of clang/LLVM
to access general-dynamic or local-dynamic TLS variables.

Bug is fixed here:
https://sourceware.org/ml/binutils/2015-01/msg00318.html

llvm-svn: 227480
2015-01-29 19:08:51 +00:00
Eric Christopher cc7ff50e43 Ensure that -fsyntax-only with fortran 90 passes along silently
to the underlying gcc.
PR22234

Patch by Artem Belevich.

llvm-svn: 227409
2015-01-29 00:56:17 +00:00
Joerg Sonnenberger 1689d3f732 For the --be8 flag, check explicitly for pre-v7 / pre-v6m cores.
Those used the old Big Endian support on ARM and don't need flags.
Refactor the logic in a separate common function, which also looks at
-march. Add corresponding logic for the Linux toolchain.

llvm-svn: 227393
2015-01-28 23:30:39 +00:00
Dan Albert 6f2875d834 [clang] Use -android environment for all compiler-rt libs.
Summary:
This was already done for the sanitizers, but it needs to be done for
the profile and builtin libs as well.

Reviewers: srhines, timmurray, eugenis, samsonov

Reviewed By: samsonov

Subscribers: compnerd, cfe-commits

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

llvm-svn: 227392
2015-01-28 23:23:36 +00:00
Filipe Cabecinhas b1e6c2dd3d Fix part of r227215. PS4 code just omits leaf frame pointers.
llvm-svn: 227219
2015-01-27 18:08:32 +00:00
Filipe Cabecinhas 4b44257c54 Added more PS4 defaults for code generation
llvm-svn: 227215
2015-01-27 17:27:37 +00:00
Joerg Sonnenberger dceac987bd For NetBSD/ARM-EB, link with --be8. Support for the older BE32 is
currently not planned.

llvm-svn: 227088
2015-01-26 12:30:16 +00:00
Renato Golin b625f48862 Allows Clang to use LLVM's fixes-x18 option
This patch allows clang to have llvm reserve the x18
platform register on AArch64. FreeBSD will use this in the kernel for
per-cpu data but has no need to reserve this register in userland so
will need this flag to reserve it.

This uses llvm r226664 to allow this register to be reserved.

Patch by Andrew Turner.

llvm-svn: 227062
2015-01-25 23:17:48 +00:00