Commit Graph

1071 Commits

Author SHA1 Message Date
Adrian Prantl
c49768f972 [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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274244 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-30 17:15:44 +00:00
Adrian Prantl
39952bd72b 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274242 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-30 15:58:36 +00:00
Adrian Prantl
640d4fdf46 [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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274240 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-30 15:44:35 +00:00
Vassil Vassilev
4112128cf7 [CMake] -fmodules-local-submodule-visibility is a cc1-only option.
This should fix modules builds on platforms other than Darwin after r274196.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274227 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-30 14:17:42 +00:00
Adrian Prantl
03503146ee [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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274196 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-30 01:46:49 +00:00
Michael Gottesman
c6364a51da [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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274175 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-29 21:58:15 +00:00
Michael Gottesman
8682068a61 [LLVMConfig.cmake.in] Create a new variable LLVM_CONFIG_EXPORTED_TARGETS that contains the list of all targets exported via LLVMExports.cmake.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274140 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-29 17:32:37 +00:00
Michael Gottesman
0a04f70a4b [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@.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273782 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-25 11:31:50 +00:00
Chris Bieneman
f444c52628 [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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273620 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-23 22:07:21 +00:00
Aaron Ballman
22a6a1136d 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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273599 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-23 19:02:09 +00:00
Sagar Thakur
7c2609ae10 [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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273534 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-23 06:39:35 +00:00
Chris Bieneman
d8b7c9f4db [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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273479 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-22 21:01:19 +00:00
Artem Belevich
38ae857b16 [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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273333 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-21 23:10:37 +00:00
Artem Belevich
1e67d66d5e [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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273302 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-21 19:34:40 +00:00
Vedant Kumar
d1714dc208 Add support for collating profiles for use with code coverage
Differential Revision: http://reviews.llvm.org/D20993

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272599 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-13 23:33:48 +00:00
Vassil Vassilev
62bc28788b [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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272481 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-11 17:20:53 +00:00
Chris Bieneman
6c347f62cf [CMake] Removing fallback code for CMake versions before 3.1
This code is dead code now. Out with the old, in with the new!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272347 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-09 23:53:22 +00:00
Chris Bieneman
22f7a63da6 [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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272327 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-09 22:41:36 +00:00
Chris Bieneman
08b0a6d0ed [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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272279 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-09 17:22:02 +00:00
Chris Bieneman
c923d84c1f [CMake] Cleanup version check for 2.8.11
We are always greater than CMake 2.8.11, so we don't need this check.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272220 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08 22:48:12 +00:00
Chris Bieneman
091ea8a7a1 [CMake] Cleanup version check for 2.8.12
Since we're always greater than 2.8.12, we don't need this check anymore.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272219 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08 22:48:01 +00:00
Justin Bogner
578e573655 cmake: Simplify add_lit_testsuites
cmake 3.4 introduced LIST_DIRECTORIES to glob recurse, which can be
used to simplify this code greatly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272217 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08 22:36:37 +00:00
Chris Bieneman
0fd0a998e1 [CMake] Cleanup uses of USES_TERMINAL
Now that we are on CMake 3.4.3 we no longer need a version check around this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272211 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08 22:19:25 +00:00
Chris Bieneman
e06e7e3e9f [CMake] Fixing a typo
This was called out on the list a long time ago and just got pointed out to me again. Need to fix it before I forget.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272201 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08 21:22:03 +00:00
Chris Bieneman
eb5b5d9f14 [CMake] Support overriding binary install directory
This patch adds a new option LLVM_TOOLS_INSTALL_DIR which allows customizing the location executables and symlinks get installed to. This adds the functionality provided by autoconf's --bindir flag.

This patch is based on patches from and collaboration with Tony Kelman, and replaces http://reviews.llvm.org/D20934.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272200 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-08 21:19:26 +00:00
Chris Bieneman
aa009a7c66 Revert "Use CMAKE_INSTALL_BINDIR instead of hardcoding bin for tools install paths"
This reverts commit 0dc5a55f66.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272033 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-07 18:04:37 +00:00
Chris Bieneman
0dc5a55f66 Use CMAKE_INSTALL_BINDIR instead of hardcoding bin for tools install paths
Summary:
This allows customizing the location executables and symlinks get installed to,
as with --bindir in autotools.

Reviewers: loladiro, beanz

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272031 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-07 18:01:16 +00:00
NAKAMURA Takumi
80d87f6ff3 LLVM_BUILD_32_BITS: Add -m32 with CMAKE_C*_FLAGS. [CMP0056]
With CMP0056, try_compile() uses also CMAKE_EXE_LINKER_FLAG.
It caused mismatch between CMAKE_CXX_FLAGS and CMAKE_EXE_LINKER_FLAGS, to fail to examine CXX_SUPPORTS_CXX11 with -m32.

FYI, before this, try_compile() tries without -m32 regardless of LLVM_BUILD_32_BITS.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271871 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-06 05:54:55 +00:00
Justin Bogner
dec5f39566 cmake: Fix color diags under ninja if the compiler is "AppleClang"
Apparently cmake differentiates between Clang and AppleClang, and we
fail to color our diagnostics if you have the latter. Fix that.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271442 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-01 23:29:26 +00:00
Ismail Donmez
6803422ad6 Since some time clang itself figures out the default for ms-compatibility-version and uses it. Trying to figure it out during build is redundant and also will not work when the environment variable VSINSTALLDIR is not defined (which is not defined if you don't install whole Visual Studio but use Visual C++ Build Tools package).
Tested by bootstrapping clang with clang-cl.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270860 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 15:52:23 +00:00
John Brawn
f653fb8714 Add auto-exporting of symbols from tools so that plugins work on Windows
The problem with plugins on Windows is that when building a plugin DLL it needs
to explicitly link against something (an exe or DLL) if it uses symbols from
that thing, and that thing must explicitly export those symbols. Also there's a
limit of 65535 symbols that can be exported. This means that currently plugins
only work on Windows when using BUILD_SHARED_LIBS, and that doesn't work with
MSVC.

This patch adds an LLVM_EXPORT_SYMBOLS_FOR_PLUGINS option, which when enabled
automatically exports from all LLVM tools the symbols that a plugin could want
to use so that a plugin can link against a tool directly. Plugins can specify
what tool they link against by using PLUGIN_TOOL argument to llvm_add_library.
The option can also be enabled on Linux, though there all it should do is
restrict the set of symbols that are exported as by default all symbols are
exported.

This option is currently OFF by default, as while I've verified that it works
with MSVC, linux gcc, and cygwin gcc, I haven't tried mingw gcc and I have no
idea what will happen on OSX. Also unfortunately we can't turn on
LLVM_ENABLE_PLUGINS when the option is ON as bugpoint-passes needs to be
loaded by both bugpoint.exe and opt.exe which is incompatible with this
approach. Also currently clang plugins don't work with this approach, which
will be fixed in future patches.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270839 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 11:16:43 +00:00
Steven Wu
c1beab651a Revert "[CMake] LINK_LIBS need to be public for Darwin dylib targets"
This reverts r270723. This commit breaks greendragon.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270820 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-26 04:35:35 +00:00
Chris Bieneman
fdd7755743 [CMake] LINK_LIBS need to be public for Darwin dylib targets
This should actually address PR27855. This results in adding references to the system libs inside generated dylibs so that they get correctly pulled in when linking against the dylib.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270723 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-25 17:08:43 +00:00
Kevin Enderby
866cdd590d Add the printing the Mach-O (__LLVM,__bundle) xar archive file section "verbosely"
to llvm-objdump. This section is created with -fembed-bitcode option.

This requires the use of libxar and the Cmake and lit support were crafted by
Chris Bieneman!

rdar://26202242


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270491 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-23 21:34:12 +00:00
Richard Smith
b074e2826f Add a configure-time check for the existence of sigaltstack. It seems that some
systems provide a <signal.h> that doesn't declare it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270278 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-20 21:26:00 +00:00
Richard Smith
f77c43d1f3 Reinstate r269992 (reverting r270267), but restricted to cases where glibc is
the C standard library implementation in use.

This works around a glibc bug in the backtrace() function where it fails to
produce a backtrace on x86_64 if libgcc / libunwind is statically linked.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270276 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-20 21:18:12 +00:00
Chris Bieneman
bf0e75a50e Revert "Work around a glibc bug: backtrace() spuriously fails if..."
This commit has been breaking the FreeBSD bots:
http://lab.llvm.org:8011/builders/lld-x86_64-freebsd

This reverts commit r269992.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270267 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-20 20:15:17 +00:00
Richard Smith
cf44b366f9 Work around a glibc bug: backtrace() spuriously fails if
- glibc is dynamically linked, and
 - libgcc_s is unavailable (for instance, another library is being used to
   provide the compiler runtime or libgcc is statically linked), and
 - the target is x86_64.

If we run backtrace() and it fails to find any stack frames, try using
_Unwind_Backtrace instead if available.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269992 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-18 22:26:36 +00:00
Chris Bieneman
9e1d5770bf [CMake] Add some extra variables to LLVMConfig.cmake.in
Compiler-RT needs LLVM_LIBRARY_DIR, LLVM_BINARY_DIR.

Setting these in LLVMConfig.cmake will allow Compiler-RT to not need to run llvm-config as long as the LLVMConfig.cmake module is in the CMake module path.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269104 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-10 19:45:17 +00:00
Justin Bogner
2fae05b357 cmake: Avoid continue, apparently that's new
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268812 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-06 22:22:25 +00:00
Justin Bogner
47b984c792 CMake: generate check targets for lit suites without their own lit.cfgs
Currently our cmake generates targets like check-llvm-unit and
check-llvm-transforms-loopunroll-x86, but not check-llvm-transforms or
check-llvm-transforms-adce. This is because the search for test suites
only lists the ones with a custom lit.cfg or lit.local.cfg.

Instead, we can do something a little smarter - any directory under
test that isn't called Inputs or inside a directory called Inputs is a
test suite.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268806 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-06 21:57:30 +00:00
Chris Bieneman
6a6b44f90f Remove LLVM_ENABLE_TIMESTAMPS
Summary:
As per the discussion on LLVM-dev this patch proposes removing LLVM_ENABLE_TIMESTAMPS.

The only complicated bit of this patch is the Windows support. On windows we used to log an error if /INCREMENTAL was passed to the linker when timestamps were disabled.

With this change since timestamps in code are always disabled we will always compile on windows with /Brepro unless /INCREMENTAL is specified, and we will log a warning when /INCREMENTAL is specified to notify the user that the build will be non-deterministic.

See: http://lists.llvm.org/pipermail/llvm-dev/2016-May/098990.html

Reviewers: bogner, silvas, rnk

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268670 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-05 19:57:03 +00:00
Filipe Cabecinhas
2fd54348ae Unify XDEBUG and EXPENSIVE_CHECKS (into the latter), and add an option to the cmake build to enable them.
Summary:
Historically, we had a switch in the Makefiles for turning on "expensive
checks". This has never been ported to the cmake build, but the
(dead-ish) code is still around.

This will also make it easier to turn it on in buildbots.

Reviewers: chandlerc

Subscribers: jyknight, mzolotukhin, RKSimon, gberry, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268050 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-29 15:22:48 +00:00
Tobias Grosser
b5a82b6983 cmake: Fix grammar
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268038 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-29 13:03:40 +00:00
Richard Smith
ab6ed6481e When building with LLVM_ENABLE_MODULES, put the module cache into the build
directory. This is important for build bots to avoid filling up /tmp.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266571 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-17 20:58:01 +00:00
Mehdi Amini
3ab0c4fc7e Add SVN version to libLLVMLTO
Summary: For Incremental LTO, we need to make sure that an old
cache entry is not used when incrementally re-linking with a new
libLTO.
Adding a global LLVM_REVISION in llvm-config.h would for to
rebuild/relink the world for every "git pull"/"svn update".
So instead only libLTO is made dependent on the VCS and will
be rebuilt (and the dependent binaries relinked, i.e. as of
today: libLTO.dylib and llvm-lto).

Reviewers: beanz

Subscribers: llvm-commits

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

From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266523 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-16 07:33:14 +00:00
Alex Denisov
b677706043 Replace hardcoded comment at 'lit.site.cfg.in'
At the moment almost every lit.site.cfg.in contains two lines comment:

## Autogenerated by LLVM/Clang configuration.
# Do not edit!

The patch adds variable LIT_SITE_CFG_IN_HEADER, that is replaced from 
configure_lit_site_cfg with the note and some useful information.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266515 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-16 06:47:41 +00:00
Richard Smith
43ef70d524 Update and fix LLVM_ENABLE_MODULES:
1) We need to add this flag prior to adding any other, in case the user has
specified a -fmodule-cache-path= flag in their custom CXXFLAGS. Such a flag
causes -Werror builds to fail, and thus all config checks fail, until we add
the corresponding -fmodules flag. The modules selfhost bot does this, for
instance.

2) Delete module maps that were putting .cpp files into modules.

3) Enable -fmodules-local-submodule-visibility, to get proper module
visibility rules applied across submodules of the same module. Disable
-fmodules for C builds, since that flag is not available there.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266502 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-16 00:48:58 +00:00
Chris Bieneman
908d3d5297 [CMake] Make llvm_ExternalProject always call the build action
This makes it so that when running 'ninja test-suite' from the top-level LLVM ninja build it *always* re-runs the ninja command in the test-suite directory.

This mechanism is required because the top-level ninja file doesn't have a view into the subdirectory dependency tree, so it can't know what, if anything, needs to be rebuilt.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265863 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-08 22:46:04 +00:00
Jeroen Ketema
e6557575bb [CMake] Check for sys/types.h in config-ix.cmake
`sys/types.h` has a related define in `config.h.cmake`, but was never
checked for in CMake. Sync this.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265648 91177308-0d34-0410-b5e6-96231b3b80d8
2016-04-07 08:36:13 +00:00
Chris Bieneman
9610a42e59 [CMake] Provide the ability to skip stripping when generating dSYMs
For debugging it is useful to be able to generate dSYM files but not strip the executables. This change adds the ability to skip stripping by setting LLVM_EXTERNALIZE_DEBUGINFO_SKIP_STRIP=On.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265041 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-31 20:03:19 +00:00
Reid Kleckner
564787f18e [cmake] Instead of testing char16_t for MSVC compat, directly ask cl.exe its version
Credit to Aaron Ballman for thinking of this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264886 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-30 18:19:39 +00:00
Reid Kleckner
db91435d44 [cmake] Add -fms-compatibility-version=19 when clang-cl gives errors about char16_t
What we are really trying to do here is to figure out if we are using
the 2015 STL. Unfortunately, so far as I know the MSVC STL does not
define a version macro that we can check directly. Instead I wrote a
check to see if char16_t works.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264881 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-30 17:30:26 +00:00
Reid Kleckner
f3ba4d1f7a [cmake] Allow EH usage with clang-cl
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264880 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-30 17:28:21 +00:00
Saleem Abdulrasool
c31c2a434f cmake: include what you use
Add a missing include.  This is important in the case HandleLLVMOptions is
included prior to the missing CheckCXXSourceCompiles or CheckCXXCompilerFlag
which includes CheckCXXSourceCompiles.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262949 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-08 18:56:00 +00:00
Chris Bieneman
7c1ba5c1c1 [CMake] Refactor add_llvm_implicit_projects to be reusable
This adds llvm_add_implicit_projects which takes a project name and is wrapped by add_llvm_implicit_projects.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262948 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-08 18:43:28 +00:00
NAKAMURA Takumi
dbdf4107cb Revert r130657, "Windows/DynamicLibrary.inc: Clean up ELM_Callback. We may check the decl instead of the versions of individual libraries."
We may assume the type of 1st argument as PCSTR in PENUMLOADED_MODULES_CALLBACK. PSTR was in the ancient mingw32.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262810 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-07 00:13:09 +00:00
Reid Kleckner
06ff4ba325 [cmake] Check the compiler version first
Otherwise users get messages from CheckAtomic about missing libatomic
instead of a sensible message that says "use GCC 4.7 or newer".

I structured the change along the lines of HandleLLVMStdlib.cmake, so
that the standalone build of Clang still gets the compiler version
check.

Reviewers: beanz

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262491 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-02 16:42:56 +00:00
Rafael Espindola
93ed620d27 Refactor duplicated code for linking with pthread.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262344 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-01 15:54:40 +00:00
Renato Golin
59e23fa211 [CMAKE] Update build on recent Haiku
This patch updates cmake build scripts to build on Haiku. It adds Haiku x86_64 to config.guess.
Please consider reviewing.

Pathc by Jérôme Duval.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262038 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-26 17:01:45 +00:00
Justin Bogner
f801d8b322 cmake: Simplify the iOS.cmake toolchain
- Remove a comment that was clearly copy pasted from Android.cmake and
  isn't relevant.
- Remove the toolchain's sensitivity to the environment. It's less
  error prone to just allow users to set CMAKE_OSX_SYSROOT if they
  want to use a custom SDK.
- Stop explicitly setting -mios-version-min to the default value. It
  just adds needless complexity.

This makes building the native tablegen work for me even when SDKROOT
is set in the environment (or passed in as -DCMAKE_OSX_SYSROOT).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260763 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-12 23:36:05 +00:00
Andrew Wilkins
724b31e65d Avoid linking LLVM component libraries with libLLVM
Patch by Jack Howarth.

When linking to libLLVM, don't also link to the component
libraries that constitute libLLVM.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260641 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-12 01:42:43 +00:00
Reid Kleckner
575b993830 Disable MSVC 2015's warning about zero extending after ~ and others
Very often in LLVM we have APIs that take a bitwidth and a uint64_t that
we pass immediates such as ~0U to. Consider APInt, Constant, and
MachineInstrBuilder::addImm. Fixing all uses of these APIs to manually
extend their arguments to uint64_t doesn't seem worth it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260416 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-10 19:25:51 +00:00
Reid Kleckner
e2ec6e3306 Revert "Turn on LLVM_ENABLE_PLUGINS by default on Windows"
This reverts r260262, it broke some LLVM tests (bugpoint).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260339 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-10 01:06:37 +00:00
Ehsan Akhgari
9a6bc9b9dc Turn on LLVM_ENABLE_PLUGINS by default on Windows
Reviewers: rnk

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260262 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-09 19:37:27 +00:00
Justin Bogner
5835d8e044 cmake: Use "set" instead of "option" for LLVM_ENABLE_LTO
Apparently option is for bools and cmake-gui will display this
strangely with option.

Pointed out by edward-san - thanks!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260154 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-08 21:55:19 +00:00
Justin Bogner
1d15d57f1e cmake: Accept "thin" or "full" as arguments to -DLLVM_ENABLE_LTO
Mehdi suggested in a review of r259766 that it's also useful to easily
set the type of LTO. Augment the cmake variable to support that.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260143 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-08 21:01:24 +00:00
Niels Ole Salscheider
891198c2e4 Install cmake files to lib/cmake/llvm
This is the right location for platform-specific files.

On some distributions (e. g. Exherbo), a package can be installed for several
architectures in parallel, but the architecture-independent files are shared.
Therefore, we must not install architecture-dependent files (like the CMake
config and export files) to share/.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259821 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-04 20:08:19 +00:00
Justin Bogner
125c5460fd cmake: Add a flag to enable LTO
This adds -DLLVM_ENABLE_LTO, rather than forcing people to manually
add -flto to the various _FLAGS variables.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259766 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-04 07:28:30 +00:00
Chris Bieneman
caeade4234 Remove autoconf support
Summary:
This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html

"I felt a great disturbance in the [build system], as if millions of [makefiles] suddenly cried out in terror and were suddenly silenced. I fear something [amazing] has happened."
- Obi Wan Kenobi

Reviewers: chandlerc, grosbach, bob.wilson, tstellarAMD, echristo, whitequark

Subscribers: chfast, simoncook, emaste, jholewinski, tberghammer, jfb, danalbert, srhines, arsenm, dschuff, jyknight, dsanders, joker.eph, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258861 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-26 21:29:08 +00:00
Aaron Ballman
8cee0bdf84 Reapplying r256836 with a fix for MSVC 14 support.
Enable more strict standards conformance in MSVC for rvalue casting and string literal type conversion to non-const types. Also enables generation of intrinsics for more functions.

Patch by Alexander Riccio


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258687 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-25 14:17:39 +00:00
Reid Kleckner
0fdcaf7ce8 [cmake] Disable manifest generation when LLD is the linker
Running mt.exe to make the manifest is really slow. Disabling manifest
generation doesn't seem to break anything.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258581 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-22 23:27:13 +00:00
Owen Anderson
cf2a93b691 Strip local symbols when using externalized debug info.
When we build LLVM with externalized debug info, all debugging and
symbolication related data is extracted into dSYM files prior to
stripping. As such, there is no need to preserve local symbols in LLVM
binaries after dSYM creation.

This shrinks libLLVM.dylib from 58MB to 55MB on my system.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258566 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-22 22:07:24 +00:00
Andrew Wilkins
93083d4986 tools/llvm-config: improve shared library support
Summary:

This is a re-commit of r257003, which was reverted,
along with the fixes from http://reviews.llvm.org/D15986.

r252532 added support for reporting the monolithic library
when LLVM_BUILD_LLVM_DYLIB is used. This would only be done
if the individual components were not found, and the dynamic
library is found.

This diff extends this as follows:
 - If LLVM_LINK_LLVM_DYLIB is set, then prefer the shared
   library, even if all component libraries exist.
 - Two flags, --link-shared and --link-static are introduced
   to provide explicit guidance. If --link-shared is passed
   and the shared library does not exist, an error results.

Additionally, changed the expected shared library names from
(e.g.) LLVM-3.8.0 to LLVM-3.8. The former exists only in an
installation (and then only in CMake builds I think?), and not
in the build tree; this breaks usage of llvm-config during
builds, e.g. by llvm-go.

Reviewers: DiamondLovesYou, beanz

Subscribers: llvm-commits

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258283 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-20 04:03:09 +00:00
Nico Weber
b73878a88c Reenable -Wexpansion-to-defined.
I think I fixed all instances of this in the codebase
(r258202, 258200, 258190).  Also, the suppression didn't
have an effect on bots using make anyways, and it looks
like many bots still use configure/make bots.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258210 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-19 22:46:33 +00:00
Nico Weber
d45a9597c8 Fix bootstrap -Werror builds after clang r258128
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258181 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-19 20:52:17 +00:00
Geoff Berry
73c7b058de [cmake] Fix add_version_info_from_vcs git svn version bug.
Summary:
add_version_info_from_vcs was setting SVN_REVISION to the last fetched
svn revision when using git svn instead of the svn revision
corresponding to HEAD.  This leads to conflicts with the definition of
SVN_REVISION in SVNVersion.inc generated by GetSVN.cmake when HEAD is
not the most recently fetched svn revision.

Use 'git svn info' to determine SVN_REVISION when git svn is being used
instead (as is done in GetSVN.cmake).

Reviewers: beanz

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@258148 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-19 17:36:02 +00:00
Chris Bieneman
9bbc2e7624 [CMake] Need to install VersionFromVCS.cmake as part of LLVM's CMake modules
This is required to support clang --version detecting the clang repository information.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257909 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-15 17:49:46 +00:00
NAKAMURA Takumi
f597c0b9ef [autoconf] Install VersionFromVCS.cmake, too. clang/CMakeLists.txt requires it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257856 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-15 02:13:04 +00:00
Chris Bieneman
92f6aec271 [CMake] Add support for populating LLVM_REPOSITORY from CMake.
Autoconf does this in the GetRepositoryPath script, CMake's VersionFromVCS does grab the SVN_REVISION, but doesn't populate the repository URL.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257826 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-14 22:44:29 +00:00
Axel Naumann
98079ab3f1 Explicitly enable OBJECT library "target".
With this, one can build a lib from the objects of other libs:
set(SOURCES
  $<TARGET_OBJECTS:obj.clingInterpreter>
  $<TARGET_OBJECTS:obj.clingMetaProcessor>
  $<TARGET_OBJECTS:obj.clingUtils>
  )

Reviewed by Chris Bieneman - thanks!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257459 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-12 07:44:58 +00:00
Andrew Wilkins
a04a818402 Revert r257003
This revision breaks llvm-config if you set
BUILD_SHARED_LIBS=on in a CMake build. Backing
out until the fix is ready to land.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257457 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-12 07:23:58 +00:00
Andrew Wilkins
ecd5a90fab tools/llvm-config: improve shared library support
Summary:
r252532 added support for reporting the monolithic library
when LLVM_BUILD_LLVM_DYLIB is used. This would only be done
if the individual components were not found, and the dynamic
library is found.

This diff extends this as follows:
 - If LLVM_LINK_LLVM_DYLIB is set, then prefer the shared
   library, even if all component libraries exist.
 - Two flags, --link-shared and --link-static are introduced
   to provide explicit guidance. If --link-shared is passed
   and the shared library does not exist, an error results.

Additionally, changed the expected shared library names from
(e.g.) LLVM-3.8.0 to LLVM-3.8. The former exists only in an
installation (and then only in CMake builds I think?), and not
in the build tree; this breaks usage of llvm-config during
builds, e.g. by llvm-go.

Reviewers: DiamondLovesYou, beanz

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257003 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-07 00:18:56 +00:00
Nico Weber
d8f6d5cdd7 Make WinCOFFObjectWriter.cpp's timestamp writing not use ENABLE_TIMESTAMPS
LLVM_ENABLE_TIMESTAMPS controls if timestamps are embedded into llvm's
binaries. Turning it off is useful for deterministic builds.

r246905 made it so that the define suddenly also controls if the binaries that
the llvm binaries _create_ embed timestamps or not – but this shouldn't be a
configure-time option. r256203/r256204 added a driver option to toggle this on
and off, so this patch now passes this driver option in LLVM_ENABLE_TIMESTAMPS
builds so that if LLVM_ENABLE_TIMESTAMPS is set, the build of LLVM is
deterministic – but the built clang can still write timestamps into other
executables when requested.

This also allows removing some of the test machinery added in r292012 to work
around this problem.

See PR24740 for background.
http://reviews.llvm.org/D15783


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256958 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-06 19:05:19 +00:00
Aaron Ballman
a0048af204 Reverting r256836; it causes a build bot failure: http://lab.llvm.org:8011/builders/lldb-x86-win7-msvc/builds/14050/steps/build/logs/stdio
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256837 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-05 14:35:01 +00:00
Aaron Ballman
2498e944fc Enable more strict standards conformance in MSVC for rvalue casting and string literal type conversion to non-const types. Also enables generation of intrinsics for more functions.
Patch by Alexander Riccio

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256836 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-05 14:24:01 +00:00
Nico Weber
5a39c0c83b win: Pass /W4 in front of all the -wd flags.
This should fix many many -Wunused-parameter warnings in self-host builds on
Windows after r255382.  cl.exe doesn't care about the order of /W4 and
/wd flags, but clang-cl currently does (just like -Wno-foo -Wall order
matters for clang).  We might want to change how clang-cl behaves in
the future, but until then this change makes self-host builds much more
silent.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256315 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-23 02:38:31 +00:00
Andy Gibbs
02fd5dfa7c Revert r254592 (virtual dtor in SCEVPredicate).
Clang has better diagnostics in this case.  It is not necessary therefore
to change the destructor to avoid what is effectively an invalid warning
in gcc.  Instead, better handle the warning flags given to the compiler.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255905 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-17 16:43:53 +00:00
Sumanth Gundapaneni
cce559871a Install runtime dlls in the INSTALL_DIR/bin directory. NFC
One of the earlier patches updated the cmake rule to install the
runtime dlls in INSTALL_DIR/lib which is not correct. This patch
updates the rule to install CMake's RUNTIME in bin directory
Differential Revision: http://reviews.llvm.org/D15505


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255781 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-16 17:07:15 +00:00
Chris Bieneman
f6aeea168a [CMake] Add LLVM_BUILD_INSTRUMENTED option to enable building with -fprofile-instr-generate
This is the first step in supporting PGO data generation via CMake. I've marked the option as advanced and experimental until it is fleshed out further.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255298 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-10 21:19:07 +00:00
Chris Bieneman
5fb71e1116 [CMake] Ignore externalizing debuginfo for unit tests
If you externalize debug info for unit tests the test runner finds the mach-o inside the dsym bundle and tries to execute it as a test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255056 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-08 21:51:48 +00:00
Aaron Ballman
c4724f60d7 Silence all C4592 warnings with MSVC 2015 Update 1. This warning produces false positives that Microsoft says will be fixed in Update 2. Until this produces reliable diagnostics, it is safe to disable the diagnostic -- the compiler is not doing anything different than it previously did aside from issuing the diagnostic.
(Note, this silences at least one false positive in LLVM with FeatureBitset uses.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254915 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-07 15:44:34 +00:00
Chris Bieneman
d8b19eb290 [CMake] Fixing bots
CMake calls to set_property with APPEND string need to have a leading space.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254659 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-03 22:55:36 +00:00
Chris Bieneman
2ffa666bec [CMake] set_target_properties doesn't append link flags
This fixes a bug introduced in r254627, and another occurance of the same bug in this file.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254657 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-03 22:51:08 +00:00
Chris Bieneman
208ed9b5fb [CMake] Removing an unnecessary layer of variable indirection
This prevents passthrough variables from having values.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254641 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-03 19:47:04 +00:00
Chris Bieneman
0123bc6bea [CMake] Add option LLVM_EXTERNALIZE_DEBUGINFO
Summary: This adds support for generating dSYM files and stripping debug info from executables and dylibs. It also supports passing -object_path_lto to the linker to generate dSYMs for LTO builds.

Reviewers: bogner, friss

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254627 91177308-0d34-0410-b5e6-96231b3b80d8
2015-12-03 18:45:39 +00:00
Pavel Labath
1b6b889f9c Fix non-PIC build after 253959
CMAKE_EXE_LINKER_FLAGS is a string. Appending a flag using list(APPEND) introduces an extra
semicolon which breaks stuff. Change this to append the value in the same way that everyone else
seems to be doing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253968 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-24 09:46:01 +00:00
Chris Bieneman
f92fdc8e93 [CMake] When disabling PIC, also pass -fno-pie when linking if it is supported.
Building clang with -fno-pie generates slightly faster code. In my not-very-rigorous testing I saw about a 4% speed up using the clang test-suite sources.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253959 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-24 08:04:59 +00:00
Chris Bieneman
b856f91ff4 [CMake] export_executable_symbols also needs to add -rdynamic to the linker flags on Darwin
Without -rdynamic LLVM built with LTO fails to pass "check" due to loadable modules failing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253944 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-24 00:58:58 +00:00
Chris Bieneman
16a72ba921 NFC. Fixing my consistently incorrect spelling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253936 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-23 23:34:09 +00:00
Yaron Keren
0358673908 Unbreak build on OpenBSD by not adding -Wl,-z,defs to linker flags.
This is similar to the fix for FreeBSD in r226862. Without this patch,
the build aborts when linkling libLTO.so, complaining about undefined
references to assert2, cxa_atexit, etc.

Patch by Stefan Kempf!

http://reviews.llvm.org/D14236



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253769 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-21 06:33:54 +00:00
Chris Bieneman
d43d18c48b [CMake] Fix handling of passing through semi-colon separated lists.
When passing around CMake arguments as lists of arguments any arguments containing lists need to have their semi-colons escaped otherwise CMake will split the arguments in the middle.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253719 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-20 22:08:49 +00:00
Reid Kleckner
e96fd6deb0 Don't search for third party libraries while using MSan
On the average user's system, those libraries will not be compiled with
MSan. Prior to this change, the LLVM test suite was full of false
positives from calls from third party libraries to MSan interceptors
like strlen.

We can remove this check if MSan ever grows a suppression mechanism
similar to TSan's.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253526 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-19 00:05:21 +00:00
Chris Bieneman
8fa8f201ac [CMake] Support -fvisibility-inlines-hidden when LLVM_ENABLE_PIC=Off
I'm unaware of any reasons why -fvisibility-inlines-hidden would depend on PIC, and since autoconf supports this flag without PIC, we should support it in CMake too.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253517 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-18 22:49:26 +00:00
NAKAMURA Takumi
b8e1ed86a5 LLVM_ENABLE_MODULES: No need to set -fcxx-modules in trunk, just -fmodules.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252996 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-13 01:26:31 +00:00
Chris Bieneman
ab31dd0add [CMake] Fixing passthrough for variables starting with the sub-project name
This allows TEST_SUITE variables to be passed from the top-level CMake into the external project.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252810 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-11 21:54:31 +00:00
Chris Bieneman
1b5e5350e1 [CMake] Make llvm_install_library_symlink respect LLVM_LIBDIR_SUFFIX.
This is required to support multilib install targets, and addresses a regression introduced in r252093.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252749 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-11 16:19:39 +00:00
Chris Bieneman
7f75644664 [CMake] Add support for building the llvm test-suite as part of an LLVM build using clang and lld
Summary:
This patch adds a new CMake module for working with ExternalProjects. This wrapper for ExternalProject supports using just-built tools and can hook up dependencies properly so that projects get cleared out.

The example usage here is for the llvm test-suite. In this example, the test-suite is setup as dependent on clang and lld if they are in-tree. If the clang or lld binaries change the test-suite is re-configured, cleaned, and rebuilt.

This cleanup and abstraction wrapping ExternalProject can be extended and applied to other runtime libraries like compiler-rt and libcxx.

Reviewers: samsonov, jroelofs, rengolin, jmolloy

Subscribers: jmolloy, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252747 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-11 16:14:03 +00:00
Andrew Wilkins
cf6b336cdc [cmake] move SONAME handling to llvm_add_library
Summary:
Move handling of the SONAME option from add_llvm_library
to llvm_add_library, so that it can be used in sub-projects.
In particular, this makes it possible to have consistently
named shared libraries for LLVM, Clang and LLDB.

Also, base the SONAME and symlinks on the output name
by extracting the OUTPUT_NAME property, rather than assuming
it is the same as the target name.

Reviewers: beanz

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252669 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-10 23:19:21 +00:00
Ramkumar Ramachandra
a407ebde72 AddLLVM: squelch CMP0007 by not adding empty elements to list
When configuring various llvm projects that use AddLLVM.cmake, this warning is
emitted many times, flooding the screen:

Policy CMP0007 is not set: list command no longer ignores empty elements.

The fix is removing an extra semicolon.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252628 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-10 18:26:34 +00:00
Chris Bieneman
61dbca10ea [CMake] Bug 25059 - CMake libllvm.so.$MAJOR.$MINOR shared object name not compatible with ldconfig
Summary:
This change makes the CMake build system generate libraries for Linux and Darwin matching the makefile build system.

Linux libraries follow the pattern lib${name}.${MAJOR}.${MINOR}.so so that ldconfig won't pick it up incorrectly.

Darwin libraries are not versioned.

Note: On linux the non-versioned symlink is generated at install-time not build time. I plan to fix that eventually, but I expect that is good enough for the purposes of fixing this bug.

Reviewers: loladiro, tstellarAMD

Subscribers: axw, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252093 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-04 23:11:12 +00:00
Tom Stellard
7ba0c20d4c llvm-config: Add --has-rtti option
Summary:
This prints NO if LLVM was built with -fno-rtti or an equivalent flag
and YES otherwise.  The reasons to add -has-rtti rather than adding -fno-rtti
to --cxxflags are:

1. Building LLVM with -fno-rtti does not always mean that client
applications need this flag.

2. Some compilers have a different flag for disabling rtti, and the
compiler being used to build LLVM may not be the compiler being used to
build the application.

Reviewers: echristo, chandlerc, beanz

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252075 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-04 20:57:43 +00:00
David Blaikie
432845f7db Revert parts accidentally included in r251823
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251826 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-02 20:05:54 +00:00
David Blaikie
5c6a6f6ad5 StringRef-ify DiagnosticInfoSampleProfile::Filename
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251823 91177308-0d34-0410-b5e6-96231b3b80d8
2015-11-02 20:01:13 +00:00
Chris Bieneman
d334a86a9f [CMake] Fixing dependency issue with parallel make when building with LLVM_OPTIMIZED_TABLEGEN.
Patch by Alex Wang

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251138 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-23 19:48:17 +00:00
Manuel Klimek
b217a9a460 Fix add_llvm_external_project.
r250835 unintentionally discarded the optional parameter to the
add_llvm_external_project() macro that may point to a path when the said
path is different from ${name}. This should fix it by passing ${ARGN} on
to add_llvm_subdirectory(). The problem manifests itself with e.g.
add_llvm_external_project(clang-tools-extra extra) from
clang/tools/CMakeLists.txt

Patch by Luchesar V. Iliev.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251001 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-22 08:31:46 +00:00
Chris Bieneman
e5b90ccacc [CMake] Refactor subdirectory inclusion code to take a project name.
Summary:
This refactoring makes some of the code used to control including subdirectories parameterized so it can be re-used elsewhere.

Specifically I want to re-use this code in clang to be able to turn off specific tool subdirectories.

Reviewers: chapuni, filcab, bogner, Bigcheese

Subscribers: emaste, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250835 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-20 16:42:58 +00:00
Chris Bieneman
26751e1575 [CMake] Cleaning up and generalizing the LLVMInstallSymlink script so that it can be used for libraries too.
In order to resolve PR25059, we're going to need to be able to generate symlinks to libraries manually, so I need this code to be reusable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250573 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-16 23:17:13 +00:00
Eric Fiselier
9403b88ae6 Split -pedantic and -Wno-long-long into two separate flags so libc++ can remove -pedantic
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250255 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-13 23:51:58 +00:00
Pawel Bylica
31b39734f1 cmake: Avoid leading space in LLVM_DEFINITIONS.
Summary: Unnecessary space at the beginning of LLVM_DEFINITIONS in cmake shared files can break projects that use the variable.

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250025 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-12 10:42:03 +00:00
Chris Bieneman
60cdaf2949 [CMake] Parallel make breaks on native tablegen
Patch by Alex Wang

This patch resolves a parallelization issue that occurs when native tablegen targets are built at the same time. They both try to build libSupport and clobber each other causing the builds to fail.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249911 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-09 22:26:04 +00:00
Reid Kleckner
1f7789545d Enable gtest SEH when building with clang-cl
Clang supports SEH well enough that this should work out of the box.  If
it doesn't, we'll hear about it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249766 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-08 22:44:39 +00:00
David Blaikie
36fd6e33c9 Revert "Enable -Wdeprecated in the cmake build now that LLVM (& Clang, Polly, and LLD) are -Wdeprecated clean"
This reverts commit r248963.

Seems there's some standard libraries (and libcxxabi implementations)
that aren't -Wdeprecated clean... hrm.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248972 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-01 00:44:21 +00:00
David Blaikie
7d40f6ea2b Enable -Wdeprecated in the cmake build now that LLVM (& Clang, Polly, and LLD) are -Wdeprecated clean
This particularly helps enforce the C++ Rule of 5 (for new move ops this
is already an error, but for a type only using C++98 features (copy
ctor/assign, dtor) it is only deprecated, not invalid)

Applying the flag for any GCC compatible compiler - GCC doesn't warn on
the Rule of 5 cases that C++11 deprecates, but it doesn't have other
false positives so far as I could see (compiling with GCC 4.8 didn't
produce any -Wdeprecated warnings I could spot).

Reviewers: aaron.ballman

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248963 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-30 23:36:12 +00:00
John Brawn
1cbae49b80 [CMake] Make the bindir and libdir arguments to set_output_directory optional
When building a plugin against an installed LLVM toolchain using
add_llvm_loadable_module (in the documented manner) doesn't work as nothing sets
the *_OUTPUT_INTDIR variables causing an error when set_output_directory is
called. Making those arguments optional (causing the default output directory
to be used) fixes this.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248911 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-30 15:20:51 +00:00
John Brawn
0d59ae6369 [CMake] Adjust the variables set by LLVMConfig.cmake
When using LLVMConfig.cmake from an installed toolchain in order to build a
loadable pass using add_llvm_loadable_module LLVM_ENABLE_PLUGINS and
LLVM_PLUGIN_EXT must be set. Also make LLVM_DEFINITIONS be set to what it
actually is.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248884 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-30 10:34:06 +00:00
John Brawn
a933c2a939 [CMake] Move the setting of LLVM_COMPILER_IS_GCC_COMPATIBLE to a separate file
Currently LLVM_COMPILER_IS_GCC_COMPATIBLE is set as a side-effect of determining
the stdlib to use in HandleLLVMStdlib, which causes problems when attempting to
use AddLLVM from an installed LLVM toolchain, as HandleLLVMStdlib is not used.
Move the setting of this variable into DetermineGCCCompatible and include that
from both AddLLVM and HandleLLVMStdlib.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248798 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-29 14:33:58 +00:00
Chris Bieneman
907451c6d6 [CMake] Adding ALWAYS_GENERATE option to symlink utility functions.
This implements the behavior required for clang symlinks which should be always generated.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248039 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-18 21:08:32 +00:00
Chris Bieneman
f8d6e92d57 [CMake] More cleanup of installing symlinks.
In order to support building clang out-of-tree the install_symlink script needs to be installed, and it needs to be found by searching the CMAKE_MODULE_PATH.

This change renames install_symlink -> LLVMInstallSymlink so it doesn't conflict with naming from other projects, and adds searching behavior in AddLLVM.cmake

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248009 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-18 17:39:58 +00:00
Chris Bieneman
2334ac1e4c [CMake] More refactoring of symlink creation.
This refactoring is to enable clang to re-use this code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247850 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-16 20:49:59 +00:00
Chris Bieneman
5d1cac1aa2 [CMake] Rename target->dest as per feedback from Chapuni on http://reviews.llvm.org/D12864
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247658 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-15 02:15:53 +00:00
Chris Bieneman
2ec309f7d1 [CMake] Refactor and cleanup generating and installing symlinks to tools.
Summary: This change generalizes symlink generation and makes symlinks to tools obey LLVM_TOOLCHAIN_TOOLS. It makes it so that if you exclude llvm-ar from LLVM_TOOLCHAIN_TOOLS you don't end up with broken symlinks to llvm-lib and llvm-ranlib in your install.

Reviewers: bogner, chapuni, rafael

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247632 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-14 23:09:06 +00:00
Jordan Rose
1aa8d7ccfb [CMake] s/LLVM_SOURCE_DIR/LLVM_MAIN_SRC_DIR/
Fix-up for r247305 to use the right variable. There's another use of
LLVM_SOURCE_DIR in this file that is probably also questionable, but it's
for Windows so I'm going to leave it alone.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247311 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 17:55:02 +00:00
Chris Bieneman
a37234f8c4 [CMake] Allow LLVM_TOOLCHAIN_TOOLS to be overridden
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247306 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 17:23:32 +00:00
Jordan Rose
a72d302556 [CMake] Fix Xcode build with LLVM_ENABLE_OBJLIB.
This amends chapuni's r246156 to handle an Xcode quirk, one even called out
in the CMake documentation:

    Some native build systems may not like targets that have only object files,
    so consider adding at least one real source file to any target that
    references $<TARGET_OBJECTS:objlib>.

I've limited the scope of this hack to Xcode for now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247305 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 17:18:51 +00:00
Aaron Ballman
377dd664cb Silencing C4141 warnings that were introduced en masse because __forceinline cannot be combined with inline in MSVC without triggering this diagnostic. This is safe to disable because clang will catch instances of the issue with -Wduplicate-decl-specifier, so we are not losing diagnostic coverage.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247275 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-10 12:53:40 +00:00
Joseph Tremoulet
22c3d9db50 [CMake] Flag recursive cmake invocations for cross-compile
Summary:
Cross-compilation uses recursive cmake invocations to build native host
tools.  These recursive invocations only forward a fixed set of
variables/options, since the native environment is generally the default.
This change adds -DLLVM_TARGET_IS_CROSSCOMPILE_HOST=TRUE to the recursive
cmake invocations, so that cmake files can distinguish these recursive
invocations from top-level ones, which can explain why expected options
are unset.

LLILC will use this to avoid trying to generate its build rules in the
crosscompile native host target (where it is not needed), which would fail
if attempted because LLILC requires a cmake variable passed on the command
line, which is not forwarded in the recursive invocation.

Reviewers: rnk, beanz

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247151 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-09 14:57:06 +00:00
NAKAMURA Takumi
7341392080 [CMake][CMP0051] Avoid for user of objlib to use llvm_update_compile_flags().
$<TARGET_OBJECTS> shouldn't require compile flags. Flags are set in obj.${name}.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246984 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-08 07:42:06 +00:00
Andrew Wilkins
f5148ebe0a [cmake] rework LLVM_LINK_LLVM_DYLIB option handling
Summary:
This diff attempts to address the concerns raised in
http://reviews.llvm.org/D12488.

We introduce a new USE_SHARED option to llvm_config,
which, if set, causes the target to be linked against
libLLVM.

add_llvm_utility now uniformly disables linking against
libLLVM. These utilities are not intended for distribution,
and this keeps the option handling more centralised.

llvm-shlib is now processes before any other "tools"
subdirectories, ensuring the libLLVM target is defined
before its dependents.

One main difference from what was requested: llvm_config
does not prune LLVM_DYLIB_COMPONENTS from the components
passed into explicit_llvm_config. This is because the "all"
component does something special, adding additional
libraries (namely libLTO). Adding the component libraries
after libLLVM should not be a problem, as symbols will be
resolved in libLLVM first.

Finally, I'm not really happy with the
DISABLE_LLVM_LINK_LLVM option, but I'm not sure of a
better way to get the following:
 - link all tools and shared libraries to libLLVM if
   LLVM_LINK_LLVM_DYLIB is set
 - some way of explicitly *not* doing so for utilities
   and libLLVM itself
Suggestions for improvement here are particularly welcome.

Reviewers: beanz

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246918 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-05 08:27:33 +00:00
NAKAMURA Takumi
11caed9e12 [CMake] Don't use OBJLIB on Xcode.
I got a few reports it didn't work.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246629 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-02 10:11:26 +00:00
Justin Bogner
06fdb30196 cmake: Error instead of warning and dropping invalid LLVM_USE_SANITIZER
Currently, if you call cmake with a typo in an LLVM_USE_SANITIZER
value, there's a cmake warning and the build goes on with no
sanitizers at all. This isn't a good behaviour, since cmake warnings
are fairly easy to miss and the resulting behaviour is that it looks
like the build is sanitizer clean.

Upgrade these warnings to errors so misconfigurations are more
obvious.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246531 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-01 05:45:07 +00:00
Andrew Wilkins
10add60748 Enable linking tools, shared libraries against libLLVM
Summary:
Three closely related changes, to have a mode in which we link all
executables and shared libraries against libLLVM. 

1. Add a new LLVM_LINK_LLVM_DYLIB cmake option, which, when ON, will link
   executables and shared libraries against libLLVM. For this to work, it
   is necessary to also set LLVM_BUILD_LLVM_DYLIB and LLVM_DYLIB_EXPORT_ALL.

   It is not strictly necessary to set LLVM_DISABLE_LLVM_DYLIB_ATEXIT, but
   we also default to OFF in this mode, or tools tend to misbehave (e.g.
   stdout may not flush on exit when output is buffered.)

   llvm-config and Tablegen do not use libLLVM, as they are dependencies of
   libLLVM.

2. Modify llvm-go to take a new flag, "linkmode=component-libs|dylib".
   Depending on which one is passed (default is component-libs), we link
   with the individual libraries or libLLVM respectively. We pass in dylib
   when LLVM_LINK_LLVM_DYLIB is ON.

3. Fix LLVM_DYLIB_EXPORT_ALL on Linux, and expand the symbols exported to
   actually export all. Don't strip leading underscore from symbols on Linux,
   and make sure we get all exported symbols and weak-with-default symbols
   ("W" in nm output). Without these changes, passes won't load because
   the "Annotate..." symbols defined in lib/Support/Valigrind.cpp are not
   found.

Testing:
 - Ran default build ("ninja") with LLVM, clang, compiler-rt, llgo, lldb.
 - Ran "check", "check-clang", "check-tsan", "check-libgo" targets. I've
   never had much success with LLDB tests, and llgoi is currently broken
   so check-llgo fails for an unrelated reason.
 - Ran "lldb" to ensure it loads.

Reviewers: chandlerc, beanz, pcc, rnk

Subscribers: rnk, chapuni, sylvestre.ledru, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246527 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-01 03:14:31 +00:00
NAKAMURA Takumi
87a13599bb [CMake] Fix build on MSVC in r246156.
add_windows_version_resource_file() affects ALL_FILES. OBJLIB shouldn't have *.obj as SOURCES.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246241 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-28 00:36:58 +00:00
NAKAMURA Takumi
68027c4618 [CMake] OBJLIB-ize *-tblgen.
This improves dependency chain of;

  (LLVMSupport && LLVMTableGen) && (*.cpp in *-tblgen) && (linking *-tblgen)

with;

  (LLVMSupport && LLVMTableGen && *.cpp) && (linking *-tblgen)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246156 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-27 16:10:47 +00:00
Reid Kleckner
2140b798ec [cmake] Pass /manifest:no to the linker when asan is enabled
This is a workaround for PR24476.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245945 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-25 16:06:40 +00:00
NAKAMURA Takumi
fcaa24c56d [CMake] add_llvm_external_project: Just warn about nonexistent directories.
These entries were generated accidentally.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245783 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-22 05:11:02 +00:00
NAKAMURA Takumi
44c617819c [CMake] Make LLVM_EXTERNAL_*_SOURCE_DIR consistent against older buildsites.
If corresponding in-tree subdirectory exists, just ignore LLVM_EXTERNAL* stuff.
Otherwise, set LLVM_TOOL_*_BUILD ON/OFF properly according to LLVM_EXTERNAL_*.

This makes easier to walk among old revisions *without* deleteing CMakeCache.txt.

Before r242059, LLVM_EXTERNAL_* was working like;

  if(EXISTS ${*_SOURCE_DIR}/CMakeLists.txt)
    set(*_BUILD ON CACHE)
    if(*_BUILD is ON)
      add_subdirectory(*_SOURCE_DIR)
    endif()
  endif()

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245782 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-22 04:53:52 +00:00
Dan Liew
299db164f5 Filter libraries that are not installed out of CMake exports (currently
gtest and gtest_main) when generating ``Makefile.llvmbuild``.

Libraries that are not installed should not be exported because they
won't be available from an install tree.  Rather than filtering out the
gtest libraries in cmake/modules/Makefile, simply teach llvm-build to
filter out libraries that will not be installed from its generated list
of exported libraries.

Note that LLVMBUILD_LIB_DEPS_* are used during our own CMake build
process so we cannot filter LLVMBUILD_LIB_DEPS_gtest* out in llvm-build.
We must leave this gtest filter logic in cmake/modules/Makefile.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245718 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-21 18:10:57 +00:00
Dan Liew
fe112c27a2 llvm-build: Adopt generation of LLVM_LIBS_TO_EXPORT. Patch by
Brad King.

Move `LLVM_LIBS_TO_EXPORT` over to Makefile.llvmbuild and generate it
from `llvm-build` using the same logic used to export the dependencies
of these libraries.  This avoids depending on `llvm-config`.

This refactoring was originally motivated by issue #24154 due to commit
r243297 (Fix `llvm-config` to emit the linker flag for the combined
shared object, 2015-07-27) changing the output of `llvm-config --libs`
to not have the individual libraries when we configure with
`--enable-shared`.  That change was reverted by r244108 but this
refactoring makes sense on its own anyway.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245717 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-21 18:10:55 +00:00
Yaron Keren
3f1c66ca7d Disable Visual C++ 2013 Debug mode assert on null pointer in some STL algorithms,
such as std::equal on the third argument. This reverts previous workarounds.

Predefining _DEBUG_POINTER_IMPL disables Visual C++ 2013 headers from defining
it to a function performing the null pointer check. In practice, it's not that
bad since any function actually using the nullptr will seg fault. The other
iterator sanity checks remain enabled in the headers.

Reviewed by Aaron Ballmanþ and Duncan P. N. Exon Smith.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245711 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-21 17:31:03 +00:00