1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
Commit Graph

1300 Commits

Author SHA1 Message Date
George Karpenkov
e4d95d0f5e Update LLVM fuzzers to use the libFuzzer bundled with the compiler toolchain
Differential Revision: https://reviews.llvm.org/D37041

llvm-svn: 311515
2017-08-23 00:40:58 +00:00
Oleg Ranevskyy
debe176873 [CMake][LLVM] Remove duplicated library mask. Broken clang linking against clangShared
Summary:
The `LLVM${c}Info` mask is listed twice in LLVM-Config.cmake. This results in the libraries such as LLVMARMInfo, LLVMAArch4Info, etc appearing twice in `extract_symbols.py` command line while building `clangShared`. `Extract_symbols.py` does not work well in such a case and completely ignores the symbols from the duplicated libraries. Thus, the LLVM(...)Info symbols do not get exported from `clangShared` and linking clang against it fails with unresolved dependencies.

Seems to be a mere copy-paste mistake.

Reviewers: beanz, chapuni

Reviewed By: chapuni

Subscribers: chapuni, aemerson, mgorny, kristof.beyls, llvm-commits, asl

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

llvm-svn: 310590
2017-08-10 13:37:58 +00:00
Michal Gorny
5b253b0ff7 [OCaml] Pass -D/-UNDEBUG through to ocamlc
Detect [/-][DU]NDEBUG in CMAKE_C_FLAGS* and pass them through to ocamlc.
This is necessary because their value might affect visibility of dump
functions in LLVM and ocamlc uses its own compiler and flags by default.

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

llvm-svn: 309483
2017-07-29 08:10:24 +00:00
Michal Gorny
b87953a433 [OCaml] Install dynamic libraries in 'stubdirs' directory
Install the OCaml dynamic libraries in the 'stubdirs' directory rather
than the llvm subdirectory in order to fix running executables created
by ocamlc. Otherwise, the executables fail to run being unable to locate
the libraries (unless the LLVM directory is explicitly added to
LD_LIBRARY_PATH).

The staging directories are not altered since they work for our
development setup anyway, and installing into two directories would
unnecessarily make the code more complex.

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

llvm-svn: 309481
2017-07-29 06:46:45 +00:00
Chris Bieneman
e99955f853 [CMake] NFC. Add intrinsics_gen target to CMake Exports
By creating a dummy of this target in LLVMConfig.cmake, projects that can build against out-of-tree LLVM can freely depend on the target without needing to have conditionals for if LLVM is in-tree or out-of-tree.

llvm-svn: 309389
2017-07-28 15:33:35 +00:00
Michal Gorny
02f548e4c4 Revert rL309320 - "[OCaml] Respect CMAKE_C_FLAGS for OCaml C files"
This causes buildbot breakage for systems where OCaml files are built
with a different compiler.

llvm-svn: 309364
2017-07-28 04:29:20 +00:00
Michal Gorny
d98f2d8cc6 [OCaml] Respect CMAKE_C_FLAGS for OCaml C files
Pass the values of CMAKE_C_FLAGS and CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE}
as -ccopt to ocamlc. This enforces the specific flags used for the LLVM
build to be used for OCaml bindings as well, notably -O and -march
flags.

This also solves the issue of the user being unable to force specific
flags for OCaml bindings builds. Gentoo needs this to enforce -DNDEBUG
consistently between the LLVM build and the split OCaml bindings build.

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

llvm-svn: 309320
2017-07-27 21:13:19 +00:00
Eric Beckmann
2c6035b9df Remove check for i686.
libxml2 is supported for 32 bit, so our build system should be checking
the target rather than native os when choosing shared libs.

llvm-svn: 309242
2017-07-27 01:16:19 +00:00
Petr Hosek
3f616d5af4 [CMake] Disable -Werror for CMake checks
-Werror may cause some of the CMake checks to fail, so we disable
it even if it's enabled for the build itself.

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

llvm-svn: 309235
2017-07-26 23:49:18 +00:00
Eric Beckmann
b617e67e80 Close if statement in config-ix.cmake while checking for i686 arch.
Reapply "Set a different var for checking I686, because LLVM_NATIVE_ARCH is"

This reverts commit e7400d7cbc2b7539de3aa7a20adc8f4ee0cb7bef.

llvm-svn: 309181
2017-07-26 21:20:24 +00:00
Eric Beckmann
4c87dcf654 Revert "Set a different var for checking I686, because LLVM_NATIVE_ARCH is"
This reverts commit 38a6db6397364ee91b04afea2cdcb1b5b4d252bf.

llvm-svn: 309179
2017-07-26 21:11:07 +00:00
Eric Beckmann
1b209b2dd2 Set a different var for checking I686, because LLVM_NATIVE_ARCH is
overwritten.

llvm-svn: 309177
2017-07-26 21:03:55 +00:00
Eric Beckmann
aa30d408ff Disable libxml on i686, because it is a 32 bit architecture and
libxml2.so is for 64 bit.

llvm-svn: 309169
2017-07-26 20:22:26 +00:00
Chris Bieneman
183732df36 [CMake] Fix broken builds from r309029
Fixing the mismatched beginning if and endif contents.

llvm-svn: 309030
2017-07-25 20:58:14 +00:00
Chris Bieneman
4ad17a33b8 [CMake] Allow TableGen.cmake to be included multiple times
This patch allows TableGen.cmake to be safely included multiple times in sub-projects.

llvm-svn: 309029
2017-07-25 20:53:31 +00:00
Erich Keane
8f7bec18df Remove Bitrig: LLVM Changes
Bitrig code has been merged back to OpenBSD, thus the OS has been abandoned.

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

llvm-svn: 308799
2017-07-21 22:48:47 +00:00
Eric Beckmann
92e074a254 Only use xml if iconv is found, which is a prerequisite.
llvm-svn: 308711
2017-07-21 02:13:02 +00:00
Eric Beckmann
d0be60f7c3 Explicitly disable libxml2 on android.
llvm-svn: 308699
2017-07-20 23:54:51 +00:00
George Karpenkov
9bdf94f683 Generate a compile_commands.json DB for external projects.
compile_commands.json file is very useful both for tooling and for
reproducible builds.
For files generated from recursive CMake invocation this information was
not previously generated.

Differential Review: https://reviews.llvm.org/D35219

llvm-svn: 308698
2017-07-20 23:46:46 +00:00
Eric Beckmann
b1df1a8bd7 Only enable libxml2 on linux, because systems like android lack libiconv
llvm-svn: 308689
2017-07-20 23:02:49 +00:00
Eric Beckmann
2a72bb6108 Implement parsing and writing of a single xml manifest file.
Summary: Implement parsing and writing of a single xml manifest file.

Subscribers: mgorny, llvm-commits, hiraditya

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

llvm-svn: 308679
2017-07-20 21:42:04 +00:00
Brian Gesiak
2866fad7f3 [cmake] GetSVN.cmake takes a list of arguments
Summary:
GetSVN.cmake currently takes one or two pairs of <source directory path,
name>, then attempts to get the remote repository URL and source control
revision of the repositories at those one or two paths.

It takes two pairs in order for Clang to get the revision of both
itself, and its dependency LLVM.

For projects that rely upon both LLVM and Clang (Apple's Swift is one
example, but there are others), GetSVN.cmake is used to fetch *three*
revisions: Swift, Clang, and LLVM.

To support this use case, change GetSVN.cmake: instead of taking one or
two pairs (specified via `FIRST_SOURCE_DIR`/`FIRST_NAME`, have it take a list
of pairs (`SOURCE_DIRS`/`NAMES`).

In order to allow Clang to migrate, have GetSVN.cmake support both sets
of arguments for now. The old arguments can be removed once Clang begins
using the new arguments, and Swift can follow when it updates its
copy of LLVM.

Test Plan:
1. Perform a clean build of Clang, verify that `clang --version` still
   prints the correct LLVM and Clang revision information.
2. Modify Clang's CMake to use the new arguments, then perform another
   clean build. `clang --version` should still print the correct
   revision information.

Reviewers: jordan_rose, beanz, probinson

Subscribers: echristo, chapuni, llvm-commits, mgorny

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

llvm-svn: 308507
2017-07-19 18:37:02 +00:00
Rui Ueyama
7d0fdbaded [Solaris] Detect Solaris LD, use detection results to pass Solaris-ld options
Solaris ld is not the only linker available on Solaris.
Introducing linker detection and using LLVM_LINKER_IS_SOLARISLD to
select Solaris-ld specific handling.

Patch by: Fedor Sergeev

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

llvm-svn: 307852
2017-07-12 21:43:14 +00:00
Rui Ueyama
f809fa7f30 Use --color-diagnostics instead of -color-diagnostics.
Solaris ld interprets -color-diagnostics as a -c option, so it is
better to use --color-diagnostics instead. lld accepts both.

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

llvm-svn: 307850
2017-07-12 21:37:02 +00:00
Petr Hosek
4ede09147b [CMake] Support multi-target runtimes build
This changes adds support for building runtimes for multiple
different targets using LLVM runtimes directory.

The implementation follow the model used already by the builtins
build which already supports this option. To specify the runtimes
targets to be built, use the LLVM_RUNTIME_TARGETS variable, where
the valuae is the list of targets to build runtimes for. To pass
a per target variable to the runtimes build, you can set
RUNTIMES_<target>_<variable> where <variable> will be passed to the
runtimes build for <target>.

Each runtime target (except for the default one) will be installed
into lib/<target> subdirectory. Build targets will be suffixed with
the target name.

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

llvm-svn: 307731
2017-07-11 23:41:15 +00:00
George Karpenkov
94225ca5a9 [cmake] Remove obsolete unset in CMake.
Differential Revision: https://reviews.llvm.org/D35024

llvm-svn: 307569
2017-07-10 18:58:05 +00:00
Tom Stellard
447f9d8866 CMake: Add LLVM_UTILS_INSTALL_DIR option
Summary:
This is like the LLVM_TOOLS_INSTALL_DIR option, but for the utils
that are installed when the LLVM_INSTALL_UTILS.  This option
defaults to 'bin' to remain consistent with the current behavior, but
distros may want to install these to libexec/llvm.

Reviewers: beanz

Reviewed By: beanz

Subscribers: llvm-commits, mgorny

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

llvm-svn: 307150
2017-07-05 12:57:30 +00:00
NAKAMURA Takumi
0b3ef4ffaa TableGen.cmake: Use DEPFILE for Ninja Generator with CMake>=3.7.
CMake emits build targets as relative paths (from build.ninja) but Ninja doesn't identify absolute path (in *.d) as relative path (in build.ninja).
So, let file names, in the command line, relative from ${CMAKE_BINARY_DIR}, where build.ninja is.

Note that tblgen is executed on ${CMAKE_BINARY_DIR} as working directory.

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

llvm-svn: 305961
2017-06-21 22:04:07 +00:00
Michael Gottesman
be2e357fd1 [cmake] Add support for using the standalone leaks sanitizer with LLVM.
This commit causes LLVM_USE_SANITIZER to now accept the "Leaks" option. This
will cause cmake to pass in -fsanitize=leak in all of the appropriate places.

I am making this change so that I can setup a linux bot that only detects
leaks.

llvm-svn: 305839
2017-06-20 20:28:07 +00:00
Vassil Vassilev
b1c3f2425a D33466: Make file non-executable.
llvm-svn: 305795
2017-06-20 14:20:48 +00:00
NAKAMURA Takumi
ad9505ab40 [CMake] Get rid of generating obj.*-tblgen if CMake >= 3.9 for Ninja generator.
CMake-3.9 doesn't let compilation units depend on their dependent libraries.

llvm-svn: 305635
2017-06-17 13:45:55 +00:00
NAKAMURA Takumi
e6ce8bcee4 [CMake] Introduce LLVM_TARGET_TRIPLE_ENV as an option to override LLVM_DEFAULT_TARGET_TRIPLE at runtime.
No behavior is changed if LLVM_TARGET_TRIPLE_ENV is blank or undefined.

If LLVM_TARGET_TRIPLE_ENV is "TEST_TARGET_TRIPLE" and $TEST_TARGET_TRIPLE is not blank,
llvm::sys::getDefaultTargetTriple() returns $TEST_TARGET_TRIPLE.
Lit resets config.target_triple and config.environment[LLVM_TARGET_TRIPLE_ENV] to change the default target.

Without changing LLVM_DEFAULT_TARGET_TRIPLE nor rebuilding, lit can be run;

  TEST_TARGET_TRIPLE=i686-pc-win32 bin/llvm-lit -sv path/to/test/
  TEST_TARGET_TRIPLE=i686-pc-win32 ninja check-clang-tools

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

llvm-svn: 305632
2017-06-17 03:19:08 +00:00
Galina Kistanova
511fe48bfd Addressed Takumi's comment about redundancy.
llvm-svn: 305222
2017-06-12 19:17:55 +00:00
NAKAMURA Takumi
510c2060fc TableGen.cmake: Try to fix build breakage introduce in r305142.
LLVM_TABLEGEN_TARGET is undefined in clang standalone build.
STREQUAL cannot omit LHS. Then I saw an error;

  CMake Error at /path/to/install/llvm/lib/cmake/llvm/TableGen.cmake:40 (if):
      if given arguments:
        "STREQUAL" "/path/to/install/llvm/bin/llvm-tblgen.exe"
      Unknown arguments specified

llvm-svn: 305159
2017-06-11 00:57:30 +00:00
Galina Kistanova
bafaba0c14 Added dependency on the TableGen executable file.
For the case when LLVM_OPTIMIZED_TABLEGEN is ON (enables LLVM_USE_HOST_TOOLS),
we need both _TABLEGEN_TARGET and _TABLEGEN_EXE in the  DEPENDS list
to have .inc files rebuilt on a tablegen change, as cmake does not propagate
file-level dependencies of custom targets.

We could always have just one dependency on both the target and
the file, but the 2 cases would produce cleaner cmake files.

llvm-svn: 305142
2017-06-10 07:48:49 +00:00
Vassil Vassilev
592c727a07 Enable c++1z experimental builds.
Patch by David Abdurachmanov!

llvm-svn: 305123
2017-06-09 22:09:57 +00:00
Mandeep Singh Grang
188048610f [cmake] Enable reverse iteration by default through build macro
Summary:
Reverse iteration can be turned on, by default, by setting -DLLVM_REVERSE_ITERATION:BOOL=ON during cmake.
With this enabled, we can uncover lots of cases of non-determinism in codegen by simply running our tests (without any other change).
We can then setup a buildbot which will have this turned on by default. Initially, a lot of unit tests will fail in this configuration.
Once we start fixing non-determinism issues, we can gradually make this a blocker for patches.

Reviewers: davide, dblaikie, mehdi_amini, dberlin

Reviewed By: dblaikie

Subscribers: probinson, mgorny, llvm-commits

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

llvm-svn: 304757
2017-06-06 00:36:09 +00:00
Tom Stellard
4f9f35db65 CMake: Fix docs-llvm-man target when clang+llvm is in the same source tree
Summary:
This was broken by r302499.  Configuring with -DLLVM_BUILD_DOCS=ON would
cause the docs-llvm-man target not to be created.

Reviewers: anemet, beanz

Reviewed By: anemet

Subscribers: llvm-commits, mgorny

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

llvm-svn: 303042
2017-05-15 09:34:23 +00:00
Tom Stellard
59a98b05ce Revert "Revert "CMake: Move sphinx detection into AddSphinxTarget.cmake""
This reverts commit r302054.

Re-commit now that I have fixes for clang/lld.

llvm-svn: 302499
2017-05-09 01:41:28 +00:00
Tom Stellard
e15d6e93f5 Revert "CMake: Move sphinx detection into AddSphinxTarget.cmake"
This reverts commit r302025.

clang and lld need to be updated too so they don't break with this patch.

llvm-svn: 302054
2017-05-03 17:22:23 +00:00
Tom Stellard
bc274a8acb CMake: Move sphinx detection into AddSphinxTarget.cmake
Reviewers: chandlerc, beanz, mgorny

Reviewed By: beanz

Subscribers: llvm-commits

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

llvm-svn: 302025
2017-05-03 14:29:56 +00:00
Tim Northover
efe8747147 CMake: Silence more stderr when running git.
It can confuse bots collecting errors.

llvm-svn: 301934
2017-05-02 16:37:37 +00:00
Bob Haarman
a06d21ff8f limit to 2 parallel links when using thinlto
Summary:
When using ThinLTO, the linker performs its own parallelism. This
change limits the number of parallel link jobs that Ninja will issue
to keep the total number of threads reasonable when linking with
ThinLTO.

Reviewers: hans, ruiu

Subscribers: mgorny, mehdi_amini, Prazek

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

llvm-svn: 301676
2017-04-28 20:17:15 +00:00
Tim Northover
6524f22a0e CMake: ignore git stderr when trying to sort out revision. NFC.
llvm-svn: 301650
2017-04-28 16:06:00 +00:00
Nitesh Jain
e92b868df0 [LLVM][MIPS] Fix different definition of off_t in LLDB and LLVM.
Reviewers: beanz

Subscribers: jaydeep, bhushan, lldb-commits, slthakur, llvm-commits, krytarowski, emaste

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

llvm-svn: 301171
2017-04-24 10:36:46 +00:00
Sylvestre Ledru
ea4b28cda6 Add a linker script to version LLVM symbols
Summary:
This patch adds a very simple linker script to version the lib's symbols
and thus trying to avoid crashes if an application loads two different
LLVM versions (as long as they do not share data between them).

Note that we deliberately *don't* make LLVM_5.0 depend on LLVM_4.0:
they're incompatible and the whole point of this patch is
to tell the linker that.


Avoid unexpected crashes when two LLVM versions are used in the same process.

Author: Rebecca N. Palmer <rebecca_palmer@zoho.com>
Author: Lisandro Damían Nicanor Pérez Meyer <lisandro@debian.org>
Author: Sylvestre Ledru <sylvestre@debian.org>
Bug-Debian:  https://bugs.debian.org/848368


Reviewers: beanz, rnk

Reviewed By: rnk

Subscribers: mgorny, llvm-commits

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

llvm-svn: 300496
2017-04-17 20:51:50 +00:00
Ayman Musa
93c5e0808b Reverting cmake/modules/AddLLVM.cmake changes from revision 300184 (Added by mistake).
llvm-svn: 300185
2017-04-13 09:26:49 +00:00
Ayman Musa
fb33fa064c [X86] Change instructions names to keep consistency with the naming convention. NFC
Differential Revision: https://reviews.llvm.org/D31743

llvm-svn: 300184
2017-04-13 09:12:32 +00:00
Peter Collingbourne
1553cd1af6 Support: Add a VCSRevision.h header file.
This is a magic header file supported by the build system that provides a
single definition, LLVM_REVISION, containing an LLVM revision identifier,
if available. This functionality previously lived in the LTO library, but
I am moving it out to lib/Support because I want to also start using it in
lib/Object to create the IR symbol table.

This change also fixes a bug where LLVM_REVISION was never actually being
used in lib/LTO because the macro HAS_LLVM_REVISION was never defined (it
was misspelled as HAVE_SVN_VERSION_INC in lib/LTO/CMakeLists.txt, and was
only being defined in a non-existent file Version.cpp).

I also changed the code to use "git rev-parse --git-dir" to locate the .git
directory, instead of looking for it in the LLVM source root directory,
which makes this compatible with monorepos as well as git worktrees.

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

llvm-svn: 300160
2017-04-13 01:26:12 +00:00
Vassil Vassilev
f54522eae6 Append -w when LLVM_ENABLE_WARNINGS is Off.
Reviewed by rnk (D31702)!

llvm-svn: 300100
2017-04-12 20:43:11 +00:00
Ed Maste
ea780becd1 Fix detection of backtrace() availability on FreeBSD
On FreeBSD backtrace is not part of libc and depends on libexecinfo
being available. Instead of using manual checks we can use the builtin
CMake module FindBacktrace.cmake to detect availability of backtrace()
in a portable way.

Patch By:	Alex Richardson
Differential Revision:	https://reviews.llvm.org/D27143

llvm-svn: 300062
2017-04-12 13:51:00 +00:00
Jonathan Roelofs
fdb54ce7e7 Respect CMAKE_INSTALL_MANDIR for sphinx generated manpages
This is a re-work of r297516, which was reverted in r297545.

https://reviews.llvm.org/D30906

llvm-svn: 299547
2017-04-05 14:49:46 +00:00
Serge Pavlov
4367811d11 Fix evaluation of LLVM_DEFINITIONS
CMake variable LLVM_DEFINITIONS collects preprocessor definitions provided
for host compiler that builds llvm components. A function
add_llvm_definitions was introduced in AddLLVMDefinitions.cmake to keep
track of these definitions and was intended to be a replacement for CMake
command add_definitions. Actually in many cases add_definitions is still
used and the content of LLVM_DEFINITIONS is not actual now. On the other
hand the current version of CMake allows getting set of definitions in a
more convenient way. This fix implements evaluation of the variable by
reading corresponding cmake property.

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

llvm-svn: 298336
2017-03-21 04:03:24 +00:00
Reid Kleckner
60f04f6ae0 [cmake] Refactor warning flag logic to use Unix warnings with clang-cl
Summary:
clang-cl understands the GCC-style -W[no-]foo flags, and for the most
part ignores MSVC -wd flags. So, let's pass the curated set of warning
flags we use on Unix on Windows. We can also stop passing /W4 -wd*,
which for the most part corresponds to -Wall -Wextra with a bunch of
flags that we mostly ignore.

I had to disable -Wnon-virtual-dtor on Windows, because it fires on
every COM class ever. I filed PR32286 to fix this.

So far I've only found two instances of -Wstring-conversion in the
WinASan code, which I'll fix. Other than that we seem clean.

Reviewers: hans

Subscribers: mgorny, llvm-commits

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

llvm-svn: 297964
2017-03-16 17:05:16 +00:00
Peter Collingbourne
d3ad65da26 Re-apply r296730, "cmake: Configure the ThinLTO cache directory when using ELF lld or gold."
All known cache-related bugs observed when self hosting have been fixed (r296907
and r297853).

llvm-svn: 297854
2017-03-15 16:28:43 +00:00
Eric Fiselier
0d1cc3c255 Revert r297516 - Respect CMAKE_INSTALL_MANDIR for sphinx generated manpages
When CMAKE_INSTALL_MANDIR isn't defined it ends up attempting to install
the man pages under "/man1" and we really don't want to accidentally install
stuff at the filesystem root.

llvm-svn: 297545
2017-03-11 02:24:13 +00:00
Jonathan Roelofs
097d589869 Respect CMAKE_INSTALL_MANDIR for sphinx generated manpages
llvm-svn: 297516
2017-03-10 21:44:16 +00:00
Tom Stellard
18aa6f59ce CMake: Don't install llvm-tblgen twice
Summary:
The add_tablegen macros defines its own install target, and it was also calling
add_llvm_utility which adds another install target.

Configuring with -DLLVM_TOOLS_INSTALL_DIR set to something other than
'bin' along with -DLLVM_INSTALL_UTILS=ON was causing llvm-tablgen
to be installed to two separate directories.

Reviewers: beanz, hans

Reviewed By: beanz

Subscribers: llvm-commits, mgorny

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

llvm-svn: 297403
2017-03-09 19:24:07 +00:00
Ayman Musa
5040c0050d [X86] Quick fix for build bot failure (r297127) due to unused variable.
llvm-svn: 297130
2017-03-07 08:56:27 +00:00
Ayman Musa
144efa4313 [X86][AVX512] Adding new LLVM TableGen backend which generates the EVEX2VEX compressing tables.
X86EvexToVex machine instruction pass compresses EVEX encoded instructions by replacing them with their identical VEX encoded instructions when possible.
It uses manually supported 2 large tables that map the EVEX instructions to their VEX ideticals.
This TableGen backend replaces the tables by automatically generating them.

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

llvm-svn: 297127
2017-03-07 08:11:19 +00:00
Krzysztof Parzyszek
817f226056 Detect the existence of pthread_{s,g}etname_np in libpthread on Linux
Older Linux distributions may not have those functions.

llvm-svn: 296915
2017-03-03 21:53:12 +00:00
Peter Collingbourne
29cd52dc0c Revert r296730, "cmake: Configure the ThinLTO cache directory when using ELF lld or gold."
Causes a build failure on the clang-with-thin-lto-ubuntu bot.
http://lab.llvm.org:8011/builders/clang-with-thin-lto-ubuntu/builds/2117/steps/build-stage3-compiler/logs/stdio

llvm-svn: 296850
2017-03-03 02:00:22 +00:00
Tom Stellard
b0fef6ac31 CMake: Clean up VersionFromVCS.cmake
Summary:
Fix a few problems in VersionFromVCS.cmake to make it more reliable:

- Stop using git svn info to retrieve the svn revision.  I am unable to
  determine what the svn revision returned by this command means.
  During my testing this command returned a revision from a month
  ago which was not the HEAD of any of my local branches.

  Also, this revision was never actually added to the version string due
  to a typo in the script.  All it was used for was to reject the
  revision number returned by git svn find-rev HEAD when the revision
  numbers didn't match.

- Populate GIT_COMMIT even when we detect a git repo without any
  svn information.

Reviewers: mehdi_amini, beanz

Reviewed By: beanz

Subscribers: mgorny, llvm-commits

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

llvm-svn: 296829
2017-03-02 22:05:13 +00:00
Peter Collingbourne
41d9b0b540 cmake: Configure the ThinLTO cache directory when using ELF lld or gold.
Differential Revision: https://reviews.llvm.org/D30522

llvm-svn: 296730
2017-03-02 03:01:12 +00:00
Bob Haarman
a41054c917 enable building with LTO on Windows using clang-cl and lld
Summary: With clang-cl gaining support for link-time optimization, we can now enable builds using LTO when using clang-cl and lld on Windows. To do this, we must not pass the -flto flag to the linker; lld-link does not understand it, but will perform LTO automatically when it encounters bitcode files. We also don't pass /Brepro when using LTO - the compiler doesn't generate object files for LTO, so passing the flag would only result in a warning about it being unused.

Reviewers: rnk, ruiu, hans

Reviewed By: hans

Subscribers: mgorny, mehdi_amini, llvm-commits

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

llvm-svn: 296658
2017-03-01 19:22:18 +00:00
Michal Gorny
b85f17369e [Support] Provide linux/magic.h fallback for older kernels
The function for distinguishing local and remote files added in r295768
unconditionally uses linux/magic.h header to provide necessary
filesystem magic numbers. However, in kernel headers predating 2.6.18
the magic numbers are spread throughout multiple include files.
Furthermore, LLVM did not require kernel headers being installed so far.

To increase the portability across different versions of Linux kernel
and different Linux systems, add CMake header checks for linux/magic.h
and -- if it is missing -- the linux/nfs_fs.h and linux/smb.h headers
which contained the numbers previously.

Furthermore, since the numbers are static and the feature does not seem
critical enough to make LLVM require kernel headers at all, add fallback
constants for the case when none of the necessary headers is available.

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

llvm-svn: 295854
2017-02-22 18:09:15 +00:00
Petr Hosek
8c29d6cecb [CMake] Support externalizing debug info on non-Darwin platforms
On other platorms, we use objcopy to export the debug info.

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

llvm-svn: 295481
2017-02-17 19:29:12 +00:00
Chris Bieneman
cae2c4cca8 [CMake] Add variable IOS to iOS toolchain
This is useful for some edge cases where detecting things gets tricky. Specifically LLDB needs this to support iOS because CMake doesn't support running tests using obj-c code.

llvm-svn: 295392
2017-02-17 01:11:41 +00:00
Aditya Nandakumar
b5cce55dd5 [Tablegen] Instrumenting table gen DAGGenISelDAG
To help assist in debugging ISEL or to prioritize GlobalISel backend
work, this patch adds two more tables to <Target>GenISelDAGISel.inc -
one which contains the patterns that are used during selection and the
other containing include source location of the patterns
Enabled through CMake varialbe LLVM_ENABLE_DAGISEL_COV

llvm-svn: 295081
2017-02-14 18:32:41 +00:00
Matthias Braun
63a2ffaff0 config-ix.cmake: Search for CMAKE_XCRUN before using it.
This was previously searched in CMakeLists.txt unconditionally but as of
r294371 it is only searched in some circumstances. Repeating the search
in config-ix.cmake to make this robust and hopefully fix the macOS
Asan+Ubsan jenkins build.

llvm-svn: 294811
2017-02-11 00:14:01 +00:00
Eric Fiselier
db10580e9b [CMake] Fix pthread handling for out-of-tree builds
LLVM defines `PTHREAD_LIB` which is used by AddLLVM.cmake and various projects
to correctly link the threading library when needed. Unfortunately
`PTHREAD_LIB` is defined by LLVM's `config-ix.cmake` file which isn't installed
and therefore can't be used when configuring out-of-tree builds. This causes
such builds to fail since `pthread` isn't being correctly linked.

This patch attempts to fix that problem by renaming and exporting
`LLVM_PTHREAD_LIB` as part of`LLVMConfig.cmake`. I renamed `PTHREAD_LIB`
because It seemed likely to cause collisions with downstream users of
`LLVMConfig.cmake`.

llvm-svn: 294690
2017-02-10 01:59:20 +00:00
Chris Bieneman
a0f94d3065 [CMake] Fix standalone project builds broken in r294514
This patch sets the global property indicating that target registration is complete for standalone sub-project builds.

llvm-svn: 294602
2017-02-09 18:14:12 +00:00
Chris Bieneman
8570a951d6 [CMake] Fix is_llvm_target_library and support out-of-order components
Summary: This patch is required by D28855, and enables us to rely on CMake's ability to handle out of order target dependencies.

Reviewers: mgorny, chapuni, bryant

Subscribers: llvm-commits, jgosnell

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

llvm-svn: 294514
2017-02-08 20:58:37 +00:00
Eric Fiselier
7afb27af72 [CMake] Fix USE_LLVM_SANITIZER configuration for out-of-tree builds.
Summary:
r291918 changed `HandleLLVMOptions.cmake` to add `-fsanitize-blacklist=<llvm-file>` when `LLVM_USE_SANITIZER=Undefined` is specified. This breaks out-of-tree users of `LLVM_USE_SANITIZER` since that file is not present.

This patch fixes the issue by checking if the file exists first.

Reviewers: mgorny, bogner, vitalybuka, krasin

Reviewed By: krasin

Subscribers: llvm-commits

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

llvm-svn: 294367
2017-02-07 22:48:20 +00:00
Chris Bieneman
193c70a24d [CMake] Move ninja job pool options to HandleLLVMOptions
Moving the Ninja job pool configuration settings into the HandleLLVMOptions module will allow standalone builds of LLVM sub-projects to use the LLVM options without needing to re-implement them.

llvm-svn: 294334
2017-02-07 19:06:22 +00:00
Omair Javaid
34390864ad Fix LLDB Android AArch64 GCC debug info build
Committing after fixing suggested changes and tested release/debug builds on 
x86_64-linux and arm/aarch64 builds.

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

llvm-svn: 293850
2017-02-02 01:17:49 +00:00
Reid Kleckner
9ef8b5626d Remove LLVM_CONFIG from config headers
It appears to be dead, and it needlessly caused me to rebuild all of
LLVM when I changed CMAKE_INSTALL_PREFIX.

llvm-svn: 293574
2017-01-31 00:34:23 +00:00
Yichao Yu
43091afc08 CMake is funky on detecting Intel 17 as GCC compatible.
Summary: This adds a fallback in case that the Intel compiler is failed to be detected correctly.

Reviewers: chapuni

Reviewed By: chapuni

Subscribers: llvm-commits, mgorny

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

llvm-svn: 293230
2017-01-26 23:50:18 +00:00
Justin Bogner
681793b361 cmake: Only sanitize use-after-scope if the host compiler supports it
In r292256, we started adding -fsanitize-use-after-scope when using
the address sanitizer, but that flag wasn't always available. This
fixes the config to only add the flag if the host compiler supports
it.

llvm-svn: 292423
2017-01-18 19:01:58 +00:00
Vitaly Buka
4eabe06f6d Enabled -fsanitize-address-use-after-scope for -DLLVM_USE_SANITIZER=Address
Subscribers: mgorny, llvm-commits

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

llvm-svn: 292256
2017-01-17 21:04:23 +00:00
Michal Gorny
b4924fa1d9 [cmake] Update SOVERSION for the new versioning scheme
Update SOVERSION to use just the major version number rather than
major+minor, to match the new versioning scheme where only major is used
to indicate API/ABI version.

Since two-digit SOVERSIONs were introduced post 3.9 branching, this
change does not risk any SOVERSION collisions. In the past,
two-component X.Y SOVERSIONs were shortly used but those will not
interfere with the new ones since the new versions start at 4.

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

llvm-svn: 292255
2017-01-17 21:04:19 +00:00
Mehdi Amini
5fa6e09708 Add a LLVM_USE_LINKER that defines the linker to use when building LLVM
Summary:
This string parameter is passed to -fuse-ld when linking. It can be
an absolute path to your custom linker, otherwise clang will look for
`ld.{name}`.

Reviewers: davide, tejohnson, pcc

Subscribers: llvm-commits, mgorny

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

llvm-svn: 292047
2017-01-15 03:21:30 +00:00
Ivan Krasin
dcd109a82d Fix UBSan bots by blacklisting bits/stl_tree.h.
Summary:
libstdc++ has some undefined behavior in bits/stl_tree.h that
has recently became excercised by some of the LLVM code.
Given that fixing libstdc++ will take years, adding the file
into a blacklist to fix bots seems like a necessity.

Reviewers: vitalybuka

Subscribers: llvm-commits, mgorny

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

llvm-svn: 291918
2017-01-13 17:30:10 +00:00
Rui Ueyama
43a59ed7bc Add -Wl,-color-diagnostics if a linker supports the option.
Differential Revision: https://reviews.llvm.org/D28046

llvm-svn: 291719
2017-01-11 22:55:35 +00:00
Chandler Carruth
9b1fd10d77 Add the 'googlemock' component of Google Test to LLVM's unittest libraries.
I have two immediate motivations for adding this:
1) It makes writing expectations in tests *dramatically* easier. A
   quick example that is a taste of what is possible:

     std::vector<int> v = ...;
     EXPECT_THAT(v, UnorderedElementsAre(1, 2, 3));

   This checks that v contains '1', '2', and '3' in some order. There
   are a wealth of other helpful matchers like this. They tend to be
   highly generic and STL-friendly so they will in almost all cases work
   out of the box even on custom LLVM data structures.

   I actually find the matcher syntax substantially easier to read even
   for simple assertions:

     EXPECT_THAT(a, Eq(b));
     EXPECT_THAT(b, Ne(c));

   Both of these make it clear what is being *tested* and what is being
   *expected*. With `EXPECT_EQ` this is implicit (the LHS is expected,
   the RHS is tested) and often confusing. With `EXPECT_NE` it is just
   not clear. Even the failure error messages are superior with the
   matcher based expectations.

2) When testing any kind of generic code, you are continually defining
   dummy types with interfaces and then trying to check that the
   interfaces are manipulated in a particular way. This is actually what
   mocks are *good* for -- testing *interface interactions*. With
   generic code, there is often no "fake" or other object that can be
   used.

   For a concrete example of where this is currently causing significant
   pain, look at the pass manager unittests which are riddled with
   counters incremented when methods are called. All of these could be
   replaced with mocks. The result would be more effective at testing
   the code by having tighter constraints. It would be substantially
   more readable and maintainable when updating the code. And the error
   messages on failure would have substantially more information as
   mocks automatically record stack traces and other information *when
   the API is misused* instead of trying to diagnose it after the fact.

I expect that #1 will be the overwhelming majority of the uses of gmock,
but I think that is sufficient to justify having it. I would actually
like to update the coding standards to encourage the use of matchers
rather than any other form of `EXPECT_...` macros as they are IMO
a strict superset in terms of functionality and readability.

I think that #2 is relatively rarely useful, but there *are* cases where
it is useful. Historically, I think misuse of actual mocking as
described in #2 has led to resistance towards this framework. I am
actually sympathetic to this -- mocking can easily be overused. However
I think this is not a significant concern in LLVM. First and foremost,
LLVM has very careful and rare exposure of abstract interfaces or
dependency injection, which are the most prone to abuse with mocks. So
there are few opportunities to abuse them. Second, a large fraction of
LLVM's unittests are testing *generic code* where mocks actually make
tremendous sense. And gmock is well suited to building interfaces that
exercise generic libraries. Finally, I still think we should be willing
to have testing utilities in tree even if they should be used rarely. We
can use code review to help guide the usage here.

For a longer and more complete discussion of this, see the llvm-dev
thread here:
http://lists.llvm.org/pipermail/llvm-dev/2017-January/108672.html

The general consensus seems that this is a reasonable direction to start
down, but that doesn't mean we should race ahead and use this
everywhere. I have one test that is blocked on this to land and that was
specifically used as an example. Before widespread adoption, I'm going
to work up some (brief) guidelines as some of these facilities should be
used sparingly and carefully.

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

llvm-svn: 291606
2017-01-10 22:32:26 +00:00
Chandler Carruth
2570691977 [gtest] Detect warning flags using the positive spelling.
Some GCC versions will accept any warning flag name after a '-Wno-',
which would cause us to try to disable warnings with names GCC didn't
understand. This will silently succeed unless there is some other output
from GCC in which case we get weird cc1plus warnings about the warning
name being bogus.

There is still the issue that gtest sets warning flags for building
gtest-all.cc using weird 'add_definitions' and the fact that there is
a GCC version which warns on the variadic macro usage in gtest under
-pedantic, but has no flag analogous to Clang's
-Wgnu-zero-variadic-macro-argumnets to suppress this warning. I haven't
been able to come up with any good solution here. The closest is to turn
off -pedantic for those versions of GCC, but that seems really nasty.
For now, those versinos of GCC aren't warning clean. If anyone is broken
by this, I'll work on CMake logic to detect and disable -pedantic in
these cases.

llvm-svn: 291299
2017-01-06 23:16:00 +00:00
Michal Gorny
a44b476fd0 [cmake] Canonicalize CMake booleans to 0/1 for lit interop
Canonicalize all CMake booleans to 0/1 before passing them to lit, to
ensure that the Python side handles all of them consistently
and correctly. 0/1 is a safe choice of values that trigger the same
boolean interpretation in CMake, Python and C++.

Furthermore, using them without quotes improves the chance Python will
explicitly fail when an incorrect value (such as ON/OFF, TRUE/FALSE,
YES/NO) is accidentally passed, rather than silently misinterpreting
the value.

This replaces a lot of different logics spread around lit site files,
attempting to partially reproduce the boolean logic used in CMake
and usually silently failing when an uncommon value was used instead.
In fact, some of them were never working correctly since different
values were assigned in CMake and checked in Python.

The alternative solution could be to create a common parser for CMake
booleans in lit and use it consistently throughout the site files.
However, it does not seem like the best idea to create redundant
implementation of the same logic and have to follow upstream if it ever
is extended to handle more values.

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

llvm-svn: 291284
2017-01-06 21:33:48 +00:00
Bob Wilson
1d524c0d0d Disable sigaltstack on Apple platforms
Using sigaltstack on Apple platforms is a bad idea. Darwin's backtrace()
function does not work with sigaltstack, and my change in r286851 was
supposed to solve that by using _Unwind_Backtrace instead. I tested that
_Unwind_Backtrace works for crashes but then discovered that it does not
work for assertion failures when using sigaltstack, at least on macOS.
The stack trace shows only the frames on the alternate stack.
I also saw some reports of this happening for crashes, but it fails
consistently for assertion failures. I tried various things to get it to
work but the problem seems to be in _Unwind_Backtrace itself. Disabling
sigaltstack is unfortunate since it would be nice to get backtraces for
stack overflows, but at least this gets us backtraces for the more common
cases. rdar://problem/29662459

llvm-svn: 291206
2017-01-06 02:26:30 +00:00
Chandler Carruth
8ae77dbc0f [gtest] Fix the way we disable a warning for unittests.
I somehow wrote this fix and then lost it prior to commit. Really sorry
about the noise. This should fix some issues with hacking add_definition
to do things with warning flags.

llvm-svn: 291033
2017-01-04 23:40:06 +00:00
Chandler Carruth
43eb155cf2 [gtest] Upgrade googletest to version 1.8.0, minimizing local changes.
This required re-working the streaming support and lit's support for
'--gtest_list_tests' but otherwise seems to be a clean upgrade.

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

llvm-svn: 291029
2017-01-04 23:06:03 +00:00
Zachary Turner
2a893b4054 Fix the MSVC version check.
I'm not sure what determines the minor version, but it appears
that it's possible for a fully updated, release version of
VS2015 with Update 3 can go (at least) as low as 19.00.24213.1.
Updating the compiler version check to account for this so we
don't generate superfluous warnings.

llvm-svn: 290914
2017-01-03 23:12:36 +00:00
Michal Gorny
d561171bdd [cmake] Normalize LLVM_ENABLE_DIA_SDK to fix Windows tests
Attempts to fix Windows build breakage caused by r290818.

llvm-svn: 290832
2017-01-02 20:22:45 +00:00
Michal Gorny
f87de988a8 [cmake] Add LLVM_ENABLE_DIA_SDK option, and expose it in LLVMConfig
Add an explicit LLVM_ENABLE_DIA_SDK option to control building support
for DIA SDK-based debugging. Control its value to match whether DIA SDK
support was found and expose it in LLVMConfig (alike LLVM_ENABLE_ZLIB).

Its value is needed for LLDB to determine whether to run tests requiring
DIA support. Currently it is obtained from llvm/Config/config.h;
however, this file is not available for standalone builds. Following
this change, LLDB will be modified to use the value from LLVMConfig.

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

llvm-svn: 290818
2017-01-02 18:19:35 +00:00
Chandler Carruth
c387751c70 Enable '-Wstring-conversion' and fix some bad asserts that it helped
find.

Notable is the assert in NewGVN which had no effect because of the bug.

llvm-svn: 290400
2016-12-23 01:38:06 +00:00
Reid Kleckner
ae6a0f0719 Pass -Wa,-mbig-obj in 64-bit mingw builds
COFF has a 2**16 section limit, and on Win64, every COMDAT function
creates at least 3 sections: .text, .pdata, and .xdata. For MSVC, we
enable bigobj on a file-by-file basis, but GCC appears to hit the limit
on different files.

Fixes PR25953

llvm-svn: 290358
2016-12-22 19:12:14 +00:00
Reid Kleckner
34418e533c Fix some remaining documentation references to MSVC 2013
MSVC 2015 has been the minimum supported version of VS since October.

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

llvm-svn: 289854
2016-12-15 19:08:02 +00:00
Chris Bieneman
dfd2722185 [CMake] Minor change to symlink generation for LLDB
If OUTPUT_DIR is not specified we can assume the symlink is linking to a file in the same directory, so we can use $<TARGET_FILE_NAME:${target}> to create a relative symlink.

In the case of LLDB, when we build a framework, we are creating symlinks in a different directory than the file we're pointing to, and we don't install those links. To make this work in the build directory we can use $<TARGET_FILE:${target}> instead, which uses the full path to the target.

llvm-svn: 289840
2016-12-15 18:17:07 +00:00
Petr Hosek
1d3d64194c [CMake] Multi-target builtins build
This change enables building builtins for multiple different targets
using LLVM runtimes directory.

To specify the builtin targets to be built, use the LLVM_BUILTIN_TARGETS
variable, where the value is the list of targets.  To pass a per target
variable to the builtin build, you can set BUILTINS_<target>_<variable>
where <variable> will be passed to the builtin build for <target>.

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

llvm-svn: 289491
2016-12-12 23:15:10 +00:00
Kostya Serebryany
12105334f9 [libFuzzer] switch all libFuzzer tests to use -fsanitize-coverage=trace-pc-guard. Support for the previosly used instrumentation will be removed in the following changes
llvm-svn: 289311
2016-12-10 02:26:23 +00:00
Reid Kleckner
aaac9636a8 Remove /Zc:sizedDealloc- from the MSVC build
According to the connect bug
(https://connect.microsoft.com/VisualStudio/feedback/details/1351894),
this was only necessary with pre-release versions of MSVC 2015.

Fixes PR23513

llvm-svn: 289257
2016-12-09 19:20:28 +00:00
Peter Collingbourne
0f18e6d6ae Re-commit r289184, "Support: Use a 64-bit seek in raw_fd_ostream::seek()." with a configure-time check for lseek64.
llvm-svn: 289187
2016-12-09 05:20:43 +00:00
Chris Bieneman
98f9dd59fb [CMake] Add check for HAVE_CRASHREPORTER_INFO
This was also explicitly undef in CMake for some unknown reason.

Hopefully this one won't kill all the bots.

llvm-svn: 288977
2016-12-07 20:55:38 +00:00
Chris Bieneman
636fc9decc [CMake] Add a check for HAVE_CRASHREPORTERCLIENT_H
The CMake build has been hardcoding this to undef forever, we shouldn't have been doing that.

llvm-svn: 288956
2016-12-07 18:53:04 +00:00
Chris Bieneman
c02aeaa9b8 [CMake] Fixing clang standalone build
I broke this in r288770.

llvm-svn: 288829
2016-12-06 17:09:29 +00:00
Chris Bieneman
2716b34915 [CMake] Cleanup TableGen include flags
It is kinda crazy to have llvm/include and llvm/lib/Target in the include path for every tablegen invocation for every tablegen-like tool.

This patch removes those flags from the tablgen function that is called everywhere by instead creating a variable LLVM_TABLEGEN_FLAGS which is setup in the LLVM source directories.

This removes TableGen.cmake's dependency on LLVM_MAIN_SRC_DIR, and LLVM_MAIN_INCLUDE_DIR.

llvm-svn: 288770
2016-12-06 04:45:11 +00:00
Chris Bieneman
1d03c031f7 [CMake] Fix symlink refactor for multi-configuration generators
This fix, while a bit complicated, preserves the reusability while fixing the issues reported on llvm-commits with visual studio generators.

llvm-svn: 288679
2016-12-05 17:02:11 +00:00
Michal Gorny
888fb64023 [cmake] Include component in Sphinx install rules
Include component in install rules for Sphinx targets. Based on
a similar suggestion for other doc targets in D24935.

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

llvm-svn: 288656
2016-12-05 09:15:05 +00:00
Chris Bieneman
bf8065ca98 [CMake] Refactor add_llvm_tool_symlink for reuse
The old implementation of add_llvm_tool_symlink could fail in odd ways when building out of tree. This version solves that problem by not using the LLVM_* variables, and instead reaeding the target's properties.

llvm-svn: 288632
2016-12-05 03:28:03 +00:00
Saleem Abdulrasool
49e0347049 build: allow specifying the component to llvm_install_symlink
Add an optional parameter to `llvm_install_symlink` which allows the symlink
installation to be placed into a specific component rather than the default
value.

llvm-svn: 288600
2016-12-03 22:03:24 +00:00
Peter Collingbourne
1c65e3e9b2 cmake: Set rpath for loadable modules as well as shared libraries.
This fixes a regression introduced by r285714: we weren't setting the
rpath on LLVMgold.so correctly.

Spotted by mark@chromium.org!

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

llvm-svn: 288076
2016-11-28 21:59:14 +00:00
Chris Bieneman
956c69a0f8 [CMake] Apply sandbox profile to target not directory
When LLVM_DEPENDENCY_DEBUGGING=On we should apply the sandbox only on the target, not the directory. This is important for directories that create more than one target, or for nested directories.

llvm-svn: 287415
2016-11-19 01:32:09 +00:00
Yichao Yu
7bcebdc718 Add an option to disable libedit
Summary: This should provide the function similar to `--disable-libedit` with the autotools build system, which seems to be missing from the commit (r200595) that adds this.

Reviewers: pcc, beanz

Subscribers: mgorny, llvm-commits

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

llvm-svn: 287293
2016-11-18 01:25:49 +00:00
Petr Hosek
ad6bd42c19 [CMake] Error when LTO and lld are enabled on Darwin
lld on Darwin does not currently support LTO.

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

llvm-svn: 287256
2016-11-17 20:22:49 +00:00
Pavel Labath
d1b5564292 [cmake] Move LLVM_BUILD_STATIC check to an earlier point
Summary:
The motivation for this is to enable correct detection of dlopen() on Android.
Android does not provide a static version of libdl, so if we add the -static flag
after performing the check, it will succeed even though subsequent link steps
will fail. With this change we correctly detect the absence of libdl in a
LLVM_BUILD_STATIC build on Android.

The link itself still does not succeed because the code does not check the result
of this check properly, but I plan to fix that in a separate change.

Reviewers: beanz

Subscribers: danalbert, mgorny, srhines, tberghammer, llvm-commits

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

llvm-svn: 287220
2016-11-17 11:22:23 +00:00
Chris Bieneman
9dda0e2259 [CMake] [Darwin] Add support for debugging tablegen dependencies
This patch adds an option to the build system LLVM_DEPENDENCY_DEBUGGING. Over time I plan to extend this to do more complex verifications, but the initial patch causes compile errors wherever there is missing a dependency on intrinsics_gen.

Because intrinsics_gen is a compile-time dependency not a link-time dependency, everything that relies on the headers generated in intrinsics_gen needs an explicit dependency.

llvm-svn: 287207
2016-11-17 04:36:59 +00:00
Aaron Ballman
3ad0d1cfda Reverting r285406, which was a temporary workaround to get one of the documentation bots upgraded to something newer than GCC 4.7. This restores the check for GCC 4.8.
llvm-svn: 286822
2016-11-14 13:33:51 +00:00
Mehdi Amini
4ae83cd009 CMake: make LLVM_OPTIMIZED_TABLEGEN friendly with LLVM_EXTERNAL_CLANG_SOURCE_DIR
This is need because of clang-tblgen

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

llvm-svn: 286560
2016-11-11 04:27:59 +00:00
Justin Bogner
9df9449c63 cmake: Don't try to install exports if there aren't any
When using LLVM_DISTRIBUTION_COMPONENTS, it's possible for LLVM's
export list to be empty. If this happens the install(EXPORTS) command
will fail, but since there isn't anything to install anyway we really
just want to skip it.

llvm-svn: 286209
2016-11-08 05:02:18 +00:00
Mandeep Singh Grang
e62d1ca0a9 [CMake] Fix llvm_setup_rpath function
Summary:
Set _install_rpath to CMAKE_INSTALL_RPATH if it is defined, so that eventually
INSTALL_RPATH is set to CMAKE_INSTALL_RPATH.
The "if(NOT DEFINED CMAKE_INSTALL_RPATH)" was missing a corresponding else
clause.
This also cleans up the fix made in r285908.

Patch by Azharuddin Mohammed

Reviewers: john.brawn, sgundapa, beanz

Subscribers: chapuni, mgorny, llvm-commits

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

llvm-svn: 286184
2016-11-08 00:45:05 +00:00
Justin Bogner
f0c30875e0 cmake: When using LLVM_DISTRIBUTION_COMPONENTS, adjust LLVMExports accordingly
This Makes sure we only export targets that we're distributing, since
cmake will fail to import the file otherwise due to missing targets.

llvm-svn: 286024
2016-11-04 21:55:23 +00:00
John Brawn
bdf7cc8cc2 [CMake] Make CMAKE_INSTALL_RPATH work again
r285714 made it so that when CMAKE_INSTALL_RPATH is set _install_rpath is not
set, but that means INSTALL_RPATH gets set to an empty string which isn't what
we want. Fix this by setting INSTALL_RPATH only when _install_rpath is set.

llvm-svn: 285908
2016-11-03 13:55:04 +00:00
Jonas Hahnfeld
c9c3a6dfea [CMake] Disable rpath for UnitTests
This was broken since rL285714.

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

llvm-svn: 285881
2016-11-03 06:58:16 +00:00
Chris Bieneman
6454f88f98 [CMake] Fix rpath construction for out-of-tree builds
This patch was produced in conjunction with Michał Górny. It should resolve the issues that were trying to be solved by D25304.

This moves rpath handling into `llvm_add_library` and `add_llvm_executable` so that it is available to all projects using AddLLVM whether built in-tree or out-of-tree.

llvm-svn: 285714
2016-11-01 17:44:58 +00:00
Justin Bogner
5e2e245a64 cmake: Enable the lto cache when building with -flto=thin on darwin
llvm-svn: 285450
2016-10-28 20:48:47 +00:00
Teresa Johnson
7929c0b31d [cmake] Temporarily revert enforcement of minimum GCC version increase
Summary:
This is temporary, until bot that builds public facing LLVM
documentation is upgraded. It reverts only the cmake change in r284497,
but leaves the doc changes in place to preserve intent.

Reviewers: aaron.ballman

Subscribers: mgorny, llvm-commits

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

llvm-svn: 285406
2016-10-28 15:30:27 +00:00
Justin Bogner
1773e2c387 cmake: Make /usr/share/cmake installable with LLVM_DISTRIBUTION_COMPONENTS
Add a cmake-exports install component and appropriate targets for
LLVM_DISTRIBUTION_COMPONENTS to work with.

llvm-svn: 285030
2016-10-24 21:40:15 +00:00
Teresa Johnson
b21b115cce [docs] Increase minimum supported GCC version for building LLVM to 4.8
Summary:
The RFC proposal sent to increase the minimum required GCC version
to 4.8 received a lot of support. See the following thread:
http://lists.llvm.org/pipermail/llvm-dev/2016-October/105955.html,

This patch implements that by updating the docs. I believe the
references to libstdc++ 4.7 issues can be removed as well, please
let me know if that is not the case or if they should be updated
a different way.

Reviewers: rengolin

Subscribers: llvm-commits

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

llvm-svn: 284497
2016-10-18 17:17:37 +00:00
Michal Gorny
0e3582c71e [cmake] Make LIT_COMMAND configurable and improve fallback support
Make LIT_COMMAND configurable, use source tree only when actually
available and extend the default search to other common executable names
'lit.py' and 'lit', in order to increase uniformity between all LLVM
projects and support using installed lit.

Changing the conditional used to determine whether in-tree or external
lit is being used covers the case when LLVM_MAIN_SRC_DIR is defined but
does not exist (anymore). In this case, the functions falls back to
looking for installed lit rather than attempting to use a non-existing
path. The same conditional is used in clang already.

Making LIT_COMMAND a cache variable in case the source tree variant is
used serves two purposes. Firstly, it increases uniformity between
the two branches since find_program() implicitly makes LIT_COMMAND
a cache variable. Secondly, it allows overriding the lit executable used
to run the tests when the LLVM source tree is provided. Gentoo is
planning to use this to use installed (and byte-compiled) lit instead of
re-compiling it in every LLVM project.

Extending default search is meant to increase uniformity between
different LLVM projects. The 'lit.py' name is already used by a few of
them, and 'lit' is the name used by utils/lit/setup.py when installing.

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

llvm-svn: 283247
2016-10-04 20:25:37 +00:00
Chris Bieneman
09d40ae011 [CMake] Exclude intrinsics_gen from LLVM_COMMON_DEPENDS in LLVMConfig.cmake
CMake requires that all targets expressed as dependencies exist, so we can't have intrinsics_gen in LLVM_COMMON_DEPENDS when it is written out, otherwise projects building out of tree will have CMake errors.

llvm-svn: 283234
2016-10-04 17:44:28 +00:00
Michal Gorny
fb59389817 [cmake] Reintroduce (ldconfig-compatible) SOVERSIONs on shared libraries
Reintroduce versioning of shared libraries via SOVERSION, addressing
the issues with the previous design, since Gentoo is relying
on shared-split install of LLVM. The SOVERSIONs were originally
introduced in r229720 for all libraries, and removed in r252093 in favor
of custom SONAME. As far as I understand, the major concern with the old
versioning was that the used versions were incompatible with ldconfig.

Having considered that, this commit introduce SOVERSIONS with the
following considerations:

1. SOVERSIONs are formed of major & minor version concatenated -- i.e.
for 4.0 its .so.40. This matches the common practice where the first
version number indicates ABI breakage, and therefore fixes the issues
with ldconfig. Additionally, VERSION with the remaining verion
components appended is used, however this is not strictly necessary.

2. The versioning is only applied to libraries with no explicit SONAME
specified -- i.e. it won't apply to libLLVM but only to the split
libraries. It will also apply to libraries installed by the subprojects.

3. The versioning is only done on *nix systems, Darwin excluded. This
matches the current use of SONAME.

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

llvm-svn: 283189
2016-10-04 06:09:18 +00:00
Michal Gorny
738be959dd [cmake] Use separate doctrees to prevent races between Sphinx instances
Use separate doctrees between different Sphinx builders in order to
prevent race condition issues due to multiple Sphinx instances accessing
the same doctree cache in parallel.

Bug: https://llvm.org/bugs/show_bug.cgi?id=23781

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

llvm-svn: 283188
2016-10-04 06:09:14 +00:00
Michal Gorny
45b39d124f Revert r283029 - [cmake] Make LIT_COMMAND configurable and improve fallback support
Revert the change in r283029 (and the fixup in r283033) due to buildbot
breakage. The fixup is ineffective for the bots that do not force clean
build since the wrong value is already cached in CMakeCache.txt.

Reverting it should result in the cache variable being removed
and therefore it should be possible to re-introduce it after all
buildbots build this revision.

llvm-svn: 283036
2016-10-01 13:15:56 +00:00
Michal Gorny
e0e6b48575 [cmake] Fix incorrect default for LIT_COMMAND, from r283029
llvm-svn: 283033
2016-10-01 10:56:58 +00:00
Michal Gorny
38f9c9240a [cmake] Make LIT_COMMAND configurable and improve fallback support
Make LIT_COMMAND configurable, use source tree only when actually
available and extend the default search to other common executable names
'lit.py' and 'lit', in order to increase uniformity between all LLVM
projects and support using installed lit.

Changing the conditional used to determine whether in-tree or external
lit is being used covers the case when LLVM_MAIN_SRC_DIR is defined but
does not exist (anymore). In this case, the functions falls back to
looking for installed lit rather than attempting to use a non-existing
path. The same conditional is used in clang already.

Making LIT_COMMAND a cache variable in case the source tree variant is
used serves two purposes. Firstly, it increases uniformity between
the two branches since find_program() implicitly makes LIT_COMMAND
a cache variable. Secondly, it allows overriding the lit executable used
to run the tests when the LLVM source tree is provided. Gentoo is
planning to use this to use installed (and byte-compiled) lit instead of
re-compiling it in every LLVM project.

Extending default search is meant to increase uniformity between
different LLVM projects. The 'lit.py' name is already used by a few of
them, and 'lit' is the name used by utils/lit/setup.py when installing.

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

llvm-svn: 283029
2016-10-01 09:28:05 +00:00
Michal Gorny
01e7483e2e [OCaml] Install .mli (interface) files
Install the OCaml interface .mli files. Those files were most likely
omitted because they are input files for the compiled .cmi files.
However, installing them is reasonable since -- unlike .cmi files --
they are human-readable.

The issue was originally spotted by @jpdeplaix.

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

llvm-svn: 283028
2016-10-01 09:26:23 +00:00
Joerg Sonnenberger
d74ea32fab GC HAVE_STRTOQ
llvm-svn: 283023
2016-10-01 07:35:08 +00:00
Michal Gorny
51dd7d27dc cmake: Install the OCaml libraries into a more correct path
Add a OCAML_INSTALL_PATH variable that can be used to control
the install path for OCaml libraries. The new variable defaults to
${OCAML_STDLIB_PATH}, i.e. the OCaml library path obtained from
the OCaml compiler. Install libraries into "llvm" subdirectory.

This fixes two issues:

1. OCaml library directories differ between systems, and 'lib/ocaml' is
incorrect e.g. on amd64 Gentoo where OCaml is installed
in 'lib64/ocaml'. Therefore, obtain the library path from the OCaml
compiler using 'ocamlc -where' (which is already used to set
OCAML_STDLIB_PATH), which is the method used commonly in OCaml packages.

2. The top-level directory is reserved for the standard library, and has
precedence over local directory in search path. As a result, OCaml
preferred the files installed along with previous LLVM version over the
source tree when building a new version, resulting in two versions being
mixed during the build. The new layout is used commonly by other OCaml
packages, and findlib is able to find the LLVM libraries successfully.

Bug: https://bugs.gentoo.org/559134
Bug: https://bugs.gentoo.org/559624

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

llvm-svn: 282895
2016-09-30 18:34:23 +00:00
Petr Hosek
4f8f123c96 [CMake] Support symlinks even with LLVM_INSTALL_TOOLCHAIN_ONLY
When LLVM_INSTALL_TOOLCHAIN_ONLY is used and LLVM_TOOLCHAIN_TOOLS
contains a tool which is a symlink, it would be ignored. This already
worked before but got broken in r282510.

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

llvm-svn: 282844
2016-09-30 06:29:28 +00:00
Joerg Sonnenberger
1da18e65b3 GC HAVE_DLERROR.
llvm-svn: 282780
2016-09-29 21:32:30 +00:00
Joerg Sonnenberger
8b77a8502e GC srand48/lrand48/drand48.
llvm-svn: 282779
2016-09-29 21:31:54 +00:00
Joerg Sonnenberger
4094bb2329 GC opendir/readdir/closedir checks.
llvm-svn: 282776
2016-09-29 21:29:57 +00:00
Joerg Sonnenberger
1b77ccf7a5 GC HAVE_SETJMP_H and checks for the content of setjmp.h.
llvm-svn: 282775
2016-09-29 21:28:37 +00:00
Joerg Sonnenberger
15c10a93f1 Check for sysconf(3).
llvm-svn: 282772
2016-09-29 21:18:05 +00:00
Joerg Sonnenberger
89ca5b90ce GC HAVE_MACH_O_DYLD_H.
llvm-svn: 282771
2016-09-29 21:15:57 +00:00
Joerg Sonnenberger
539f3d22ed GC HAVE_UTIME_H.
llvm-svn: 282770
2016-09-29 21:15:23 +00:00
Joerg Sonnenberger
1fe54c8d61 GC HAVE_LIMITS_H.
llvm-svn: 282769
2016-09-29 21:14:34 +00:00
Joerg Sonnenberger
5be6ce6f69 HAVE_UNWIND_BACKTRACE -> HAVE__UNWIND_BACKTRACE
Check for existance and not truth value.

llvm-svn: 282767
2016-09-29 21:07:57 +00:00
Vassil Vassilev
acf2d9e28c [modules] Centralize the module cache.
This reduces the build size from 17G to 1.9G on my machine.

llvm-svn: 282704
2016-09-29 08:14:06 +00:00
Chris Bieneman
4853b82d35 Improve CMake output of host and target triple
Summary:
The previous output was confusing as it would output "Taget triple:
x86_64-unknown-linux-gnu" even when LLVM_HOST_TRIPLE or
LLVM_DEFAULT_TARGET_TRIPLE were set on the CMake command line

Patch by: Alex Richardson!

Reviewers: beanz

Subscribers: Eugene.Zelenko

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

llvm-svn: 282516
2016-09-27 18:08:40 +00:00
Chris Bieneman
0004923bda [CMake] Use if(... IN_LIST ...) instead of list(FIND...)
NFC. This is just a little code cleanup to make things easier to read and understand.

llvm-svn: 282510
2016-09-27 17:47:24 +00:00
Michal Gorny
718c216c41 cmake: Support overriding Sphinx HTML doc install directory
Provide ${PROJECT}_INSTALL_SPHINX_HTML_DIR variables (e.g.
LLVM_INSTALL_SPHINX_HTML_DIR) to override Sphinx HTML doc install
directory.

Bug: https://llvm.org/bugs/show_bug.cgi?id=23780

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

llvm-svn: 282240
2016-09-23 11:09:33 +00:00
Etienne Bergeron
eaf5e9d8ab fix typo in comment [NFC]
llvm-svn: 282091
2016-09-21 17:15:23 +00:00
Chris Bieneman
8478fdd5dd [CMake] Support symlinks with the same name as the binary
This supports creating symlinks to tools in different directories than
the tool is built to. This is useful for the LLDB framework build which
I’m sending patches for shortly.

llvm-svn: 281788
2016-09-16 22:19:19 +00:00
Derek Schuff
56b449af0f Install libLLVM if needed with LLVM_INSTALL_TOOLCHAIN_ONLY
Summary:
When LLVM_LINK_LLVM_DYLIB is set, the libLLVM shared
library needs to be installed in the toolchain.  Without
this chanage LLVM_INSTALL_TOOLCHAIN_ONLY combined with
LLVM_LINK_LLVM_DYLIB results in a broken install.

Patch by Sam Clegg

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

llvm-svn: 281763
2016-09-16 18:50:39 +00:00
Michael Gottesman
3aad9342d7 [cmake] Fix a stale comment from an earlier version of r281085. NFC.
llvm-svn: 281086
2016-09-09 19:48:22 +00:00
Michael Gottesman
9087caae4d [cmake] Export gtest/gtest_main and its dependencies via a special build tree only cmake exports file.
Previously, gtest/gtest_main were not exported via cmake. The intention here was
to ensure that users whom are linking against the LLVM install tree would not
get the gtest/gtest_main targets. This prevents downstream projects that link
against the LLVM build tree (i.e. Swift) from getting this dependency
information in their cmake builds. Without such dependency information, linker
issues can result on linux due to LLVMSupport being put before gtest on the
linker command line.

This commit preserves behavior that we want for the install tree, while adding
support for the build tree by:

1. The special casing for gtest/gtest_main in the add_llvm_library code is
removed in favor of a flag called "BUILDTREE_ONLY". If this is set, then the
library is communicating that it is only meant to be exported into the build
tree and is not meant to be installed or exported via the install tree. This
part is just a tweak to remove the special case, the underlying code is the
same.

2. The cmake code that exports cmake targets for the build tree has special code
to import an additional targets file called
LLVMBuildTreeOnlyExports.cmake. Additionally the extra targets are added to the
LLVMConfig.cmake's LLVM_EXPORTED_TARGETS variable. In contrast, the
"installation" cmake file uses the normal LLVM_EXPORTS_TARGETS as before and
does not include the extra exports file. This is implemented by
defining/undefining variables when performing a configure of the build/install
tree LLVMConfig.cmake files.

llvm-svn: 281085
2016-09-09 19:45:34 +00:00
Aaron Ballman
198204b8e7 Move the ocaml_all target into the Misc folder for cleanliness; NFC.
llvm-svn: 281061
2016-09-09 17:30:59 +00:00
Chris Bieneman
bcf9eddb6b [CMake] Cleanup LLVM_OPTIMIZED_TABLEGEN
This cleanup removes the need for the native support library to have its own target. That target was only needed because makefile builds were tripping over each other if two tablegen targets were building at the same time. This causes problems because the parallel make invocations through CMake can't communicate with each other. This is fixed by invoking make directly instead of through CMake which is how we handle this in External Project invocations.

The other part of the cleanup is to mark the custom commands as USES_TERMINAL. This is a bit of a hack, but we need to ensure that Ninja generators don't invoke multiple tablegen targets in the same build dir in parallel, because that too would be bad.

Marking as USES_TERMINAL does have some downside for Ninja because it results in decreased parallelism, but correct builds are worth the minor loss and LLVM_OPTIMZIED_TABLEGEN is such a huge win, it is worth it.

llvm-svn: 280748
2016-09-06 20:27:07 +00:00
Rafael Espindola
95cefc8ba1 Add an c++ itanium demangler to llvm.
This adds a copy of the demangler in libcxxabi.

The code also has no dependencies on anything else in LLVM. To enforce
that I added it as another library. That way a BUILD_SHARED_LIBS will
fail if anyone adds an use of StringRef for example.

The no llvm dependency combined with the fact that this has to build
on linux, OS X and Windows required a few changes to the code. In
particular:

    No constexpr.
    No alignas

On OS X at least this library has only one global symbol:
__ZN4llvm16itanium_demangleEPKcPcPmPi

My current plan is:

    Commit something like this
    Change lld to use it
    Change lldb to use it as the fallback

    Add a few #ifdefs so that exactly the same file can be used in
    libcxxabi to export abi::__cxa_demangle.

Once the fast demangler in lldb can handle any names this
implementation can be replaced with it and we will have the one true
demangler.

llvm-svn: 280732
2016-09-06 19:16:48 +00:00
Peter Zotov
faa562f2ae [CMake] [OCaml] Allow building OCaml bindings out of tree.
That is, add build system support for building the OCaml bindings
against preinstalled LLVM libraries. This is important for package
managers such as OPAM, because OCaml libraries need to be built
against a specific OCaml compiler installation.

llvm-svn: 280642
2016-09-05 01:42:22 +00:00
Chris Bieneman
6bb874314b [CMake] Revive LLVM_*_DIRS variables
This is a partial revert of r280013. Brad King pointed out these variable names are matching CMake conventions, so we should preserve them.

I've also added a direct mapping of the LLVM_*_DIR variables which we need to make projects support building in and out of tree.

llvm-svn: 280380
2016-09-01 16:43:39 +00:00
Andrey Bokhanko
930b1b4784 [CMake] Fix LLVM_ENABLE_EH and LLVM_ENABLE_RTTI on MSVC
Patch by Johannes Sebastian Mueller-Roemer.

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

llvm-svn: 280371
2016-09-01 14:39:54 +00:00
NAKAMURA Takumi
cb63cfad3e [CMake] Increase stack size to 16MiB for all mingw executables.
llvm-svn: 280303
2016-08-31 22:43:23 +00:00
Chris Bieneman
616b6eef0d [CMake] Make LLVMConfig.cmake variable names match in-tree names
With the runtimes build we're trying to use LLVMConfig.cmake as a way of providing LLVM_* variables that are needed to behave as if the project is building in tree. To make this work we need to rename two variables by dropping the "S" from the end. This makes the variables match the in-tree names.

This renames:
LLVM_INCLUDE_DIRS -> LLVM_INCLUDE_DIR
LLVM_LIBRARY_DIRS -> LLVM_LIBRARY_DIR

The versions ending in S are not used in-tree anywhere. This also cleans up LLVM_LIBRARY_DIR being set to the same value with and without the "S".

llvm-svn: 280013
2016-08-29 21:26:32 +00:00
Chris Bieneman
da6e8b3dc0 cmake: Install CheckAtomic.cmake (needed by lldb)
Summary:
Install CheckAtomic.cmake along with other LLVM modules, therefore making it possible for other projects to use it. This file is needed for LLDB to be built standalone, and installing it was suggested in https://reviews.llvm.org/D23881.

Patch by: Michał Górny

Reviewers: krytarowski, zturner, eugenis, jyknight, labath, beanz

Subscribers: beanz, llvm-commits

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

llvm-svn: 279777
2016-08-25 20:53:00 +00:00
Vitaly Buka
0f32658a09 Fixed comment
llvm-svn: 279718
2016-08-25 03:44:36 +00:00
Vitaly Buka
84f8ed03ef [asan] Disable CreateSigAltStack from Unix/Signals.inc for asan builds
Summary: Asan fails to UnsetAlternateSignalStack if it set by Unix/Signals.inc

Reviewers: kcc

Subscribers: llvm-commits

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

llvm-svn: 279717
2016-08-25 03:32:49 +00:00
Chandler Carruth
b458b5cb8b [CMake/ASan] Skip using libedit if ASan is enabled -- it leaks memory.
Note that you'll have to clear this variable from your CMake cache for
it to take effect.

llvm-svn: 279362
2016-08-20 07:05:13 +00:00
Chris Bieneman
6dfd57cdfc [CMake] Make llvm-config implicit dependency for subprojects
The subproject interface being used for runtime libraries expects that llvm-config is passed into the subproject for consumption. We currently do this for every subproject, so we should expect that all LLVM ExternalProjects depend on llvm-config for the time being.

Eventually I'd like to see the sub-projects using LLVMConfig.cmake instead of the llvm-config binary, but that will take time to roll out.

llvm-svn: 279155
2016-08-18 21:41:21 +00:00
Jonas Hahnfeld
432bf8f81d Remove LLVM_ENABLE_LIBCXXABI
libc++.so is now a linker script that includes -lc++abi if necessary.

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

llvm-svn: 277714
2016-08-04 10:24:48 +00:00
Eugene Zelenko
aef9df0c15 Add LLVM_ENABLE_LLD option to use LLD as C/C++ linker.
Differential revision: https://reviews.llvm.org/D22896

llvm-svn: 277093
2016-07-29 00:46:13 +00:00
Andrew Wilkins
4a2b09a26c [llvm-go] parameterize $GOPATH construction
Summary:
To build llgo, you must currently ensure that llgo
is in the tools/llgo directory, due to a hard-coded
path in llvm-go.

To support the use of LLVM_EXTERNAL_LLGO_SOURCE_DIR,
we introduce a flag to llvm-go that enables the
caller to specify the paths to symlink in the
temporary $GOPATH.

Reviewers: pcc

Subscribers: llvm-commits

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

llvm-svn: 276829
2016-07-27 03:21:51 +00:00
Bruno Cardoso Lopes
e4279b249c [CMAKE] Find ld64 using xcrun
Given similar reasons from r276710, ld64 scrubs DYLD_* environment if
called from the shim executable /usr/bin/ld.

Add support for finding ld64 via xcrun.

This is needed in order to get LIT to have the full path to the ld4
executable.

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

rdar://problem/24300926

llvm-svn: 276781
2016-07-26 18:09:23 +00:00
Justin Bogner
c5e9eef5d6 cmake: When adding lit testsuites, ignore Output directories
With in-tree builds we can get Output directories scattered among our
tests. Recursing into those to find tests doesn't make sense.

Thanks to nlewycky for noticing this!

llvm-svn: 276667
2016-07-25 18:07:14 +00:00
Chandler Carruth
93b744cf6b Add AIX support to Path.inc, Host.h, and CMake.
Patch by Andrew Paprocki!

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

llvm-svn: 276045
2016-07-19 22:46:39 +00:00
Rafael Espindola
2037c03682 Use posix_fallocate instead of ftruncate.
This makes sure that space is actually available. With this change
running lld on a full file system causes it to exit with

failed to open foo: No space left on device

instead of crashing with a sigbus.

llvm-svn: 276017
2016-07-19 20:19:56 +00:00
Michael Gottesman
a1e74f182b [cmake] Create the LLVM_BUILD_UTILS option.
This option is the equivalent option to LLVM_BUILD_TOOLS but for executables
created via add_llvm_utility.

This is a useful tool for improving compile time in situations where LLVM is
used as a library and no testing tools are needed.

It follows the exact same implemention model as LLVM_BUILD_TOOLS.

Since the option is by default set to on, no behavior is changed unless one sets
it from the command line to be false.

llvm-svn: 275007
2016-07-10 02:43:47 +00:00
John Brawn
917b4ac3e1 [CMake] Adjust export_executable_symbols to cope with non-target link libraries
export_executable_symbols looks though the link libraries of the executable in
order to figure out transitive dependencies, but in doing so it assumes that
all link libraries are also targets. This is not true as of r273302, so adjust
it to check if they actually are targets.

llvm-svn: 274546
2016-07-05 13:16:54 +00:00
John Brawn
10ceed9ad4 [CMake] Add LLVM_BUILD_32_BITS to LLVMConfig.cmake
Previously out-of-tree passes could detect if LLVM was built with
LLVM_BUILD_32_BITS by looking for -m32 in LLVM_DEFINITIONS, but as of r271871
it no longer appears there. Resolve this by instead emitting LLVM_BUILD_32_BITS
in LLVMConfig so it can be checked for directly.

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

llvm-svn: 274351
2016-07-01 14:22:52 +00:00
Adrian Prantl
a0611feb1f [CMake] Add an LLVM_ENABLE_MODULE_DEBUGGING flag for building with -gmodules.
This flag is only effective in builds with debug info and modules.
The default is On for Darwin only.

rdar://problem/27019000

llvm-svn: 274244
2016-06-30 17:15:44 +00:00
Adrian Prantl
c47b447e60 Revert "[CMake] Move the -Xclang option before -fmodules-cache-path"
This reverts commit 3db82f646a0890eb7664d0351b5a3c79622e8bef.

Vassil already fixed this and I mechanically undid his fix without looking
too close at what I'm actually doing. Need more coffee.

llvm-svn: 274242
2016-06-30 15:58:36 +00:00
Adrian Prantl
394a78928c [CMake] Move the -Xclang option before -fmodules-cache-path
This fixes a typo introduced in r274196.
Thanks to Vassil Vassilev for noticing!

http://reviews.llvm.org/D21827
rdar://problem/27019000

llvm-svn: 274240
2016-06-30 15:44:35 +00:00
Vassil Vassilev
4ebe903f96 [CMake] -fmodules-local-submodule-visibility is a cc1-only option.
This should fix modules builds on platforms other than Darwin after r274196.

llvm-svn: 274227
2016-06-30 14:17:42 +00:00
Adrian Prantl
18577887ec [CMake] Introduce a LLVM_ENABLE_LOCAL_SUBMODULE_VISIBILITY flag.
On Darwin it is currently impossible to build LLVM with modules
because the Darwin system module map is not compatible with
-fmodules-local-submodule-visibility at this point in time.  This
patch makes the flag optional and off by default on Darwin so it
becomes possible to build LLVM with modules again.

http://reviews.llvm.org/D21827
rdar://problem/27019000

llvm-svn: 274196
2016-06-30 01:46:49 +00:00
Michael Gottesman
e3b79e69c7 [LLVMConfig.cmake] LLVM_CONFIG_EXPORTED_TARGETS => LLVM_EXPORTED_TARGETS.
This matches more closely the rest of the variables in LLVMConfig.cmake which
shed the _CONFIG_ part of their names.

llvm-svn: 274175
2016-06-29 21:58:15 +00:00
Michael Gottesman
e1d501b2af [LLVMConfig.cmake.in] Create a new variable LLVM_CONFIG_EXPORTED_TARGETS that contains the list of all targets exported via LLVMExports.cmake.
llvm-svn: 274140
2016-06-29 17:32:37 +00:00
Michael Gottesman
751d2dc853 [cmake] Port the llvm-config option --build-mode to LLVMConfig.cmake via the variable LLVM_BUILD_TYPE.
This is just a small step in the direction of making LLVMConfig.cmake a complete
replacement for llvm-config.

For those unfamiliar, llvm-config --build-mode prints out CMAKE_BUILD_TYPE. Thus
as one can imagine, LLVM_BUILD_TYPE is @CMAKE_BUILD_TYPE@.

llvm-svn: 273782
2016-06-25 11:31:50 +00:00
Chris Bieneman
3fe6b38cf2 [CMake] Add LLVM runtimes directory
Summary:
There are a few LLVM projects that produce runtime libraries. Ideally
runtime libraries should be built differently than other projects,
specifically they should be built using the just-built toolchain.

There is support for building compiler-rt in this way from the clang
build. Moving this logic into the LLVM build is interesting because it
provides a simpler way to extend the just-built toolchain to include
LLD and the LLVM object file tools.

Once this functionality is better fleshed out and tested we’ll want to
encapsulate it in a module that can be used for clang standalone
builds, and we’ll want to make it the default way to build compiler-rt.

With this patch applied there is no immediate change in the build.
Moving compiler-rt out from llvm/projects into llvm/runtimes enables
the functionality.

This code has a few improvements over the method provided by
LLVM_BUILD_EXTERNAL_COMPILER_RT. Specifically the sub-ninja command is
always invoked, so changes to compiler-rt source files will get built
properly, so this patch can be used for iterative development with
just-built tools.

This first patch only works with compiler-rt. Support for other
runtime projects will be coming in follow-up patches.

Reviewers: chandlerc, bogner

Subscribers: kubabrecka, llvm-commits

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

llvm-svn: 273620
2016-06-23 22:07:21 +00:00
Aaron Ballman
3202ec0278 Default to using the Unicode version of Win32 APIs instead of the ANSI version. This helps to catch instances where a developer accidentally forgets to explicitly specify which version of the API to use and accidentally winds up failing to support non-ASCII characters properly.
llvm-svn: 273599
2016-06-23 19:02:09 +00:00
Sagar Thakur
a4a97086ee [LLVM][MIPS] Introduce 64 bit atomic check in CheckAtomic.cmake
Patch by Nitesh Jain.

Summary: On some target like MIPS32 we need to explicitly link atomic library for 64 bit atomic operations. This module then can be used in LLDB (http://reviews.llvm.org/D20464) or Libcxx (http://reviews.llvm.org/D16613) for explicitly link to atomic library.

Reviewers: chandlerc, beanz
Differential: reviews.llvm.org/D20896
llvm-svn: 273534
2016-06-23 06:39:35 +00:00
Chris Bieneman
7decd11bd4 [CMake] LLVM_BINARY_DIR was not being properly set in LLVMConfig.cmake
LLVMConfig.cmake needs to set LLVM_BINARY_DIR differently based on whether or not it is the build directory or the install directory. The build directory just needs to set the value from the configuration, the install directory needs to set it to the install prefix.

llvm-svn: 273479
2016-06-22 21:01:19 +00:00
Artem Belevich
ae4eccabfc [build] Fixed build break for OCaml bindings.
After r273302 LLVM_SYSTEM_LIBS may have entries that already have
-l prefix and we need to deal with that.

llvm-svn: 273333
2016-06-21 23:10:37 +00:00
Artem Belevich
c49d776c67 [build] Make sure to link main executable with pthreads
Otherwise it gets linked in by one of the dependencies of shared
libraries which may be too late and we end up with weird crashes in
std::call_once().

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

llvm-svn: 273302
2016-06-21 19:34:40 +00:00
Vedant Kumar
c6b8569cc2 Add support for collating profiles for use with code coverage
Differential Revision: http://reviews.llvm.org/D20993

llvm-svn: 272599
2016-06-13 23:33:48 +00:00
Vassil Vassilev
1872258b31 [CMake] Allow LLVM to be embedded and built in a subfolder as part of another project.
Patch by Bertrand Bellenot!

Reviewed by Chris Bieneman and me.

llvm-svn: 272481
2016-06-11 17:20:53 +00:00
Chris Bieneman
5e3b2f93ed [CMake] Removing fallback code for CMake versions before 3.1
This code is dead code now. Out with the old, in with the new!

llvm-svn: 272347
2016-06-09 23:53:22 +00:00
Chris Bieneman
0158e53ab5 [CMake] Cleanup ExternalProject usage of CMake 3.x features
All the ExternalProject features in use here are supported by CMake 3.4.3, so we don't need these version checks anymore.

llvm-svn: 272327
2016-06-09 22:41:36 +00:00
Chris Bieneman
ca114f3116 [CMake] Add LLVM_TOOLS_INSTALL_DIR to LLVMConfig.cmake
This is the more-correct fix to out-of-tree building. AddLLVM.cmake relies on this variable being set, so we should make sure it is set in LLVMConfig.cmake.

llvm-svn: 272279
2016-06-09 17:22:02 +00:00
Chris Bieneman
a52559bdef [CMake] Cleanup version check for 2.8.11
We are always greater than CMake 2.8.11, so we don't need this check.

llvm-svn: 272220
2016-06-08 22:48:12 +00:00
Chris Bieneman
aa7dda9b81 [CMake] Cleanup version check for 2.8.12
Since we're always greater than 2.8.12, we don't need this check anymore.

llvm-svn: 272219
2016-06-08 22:48:01 +00:00