Commit Graph

743 Commits

Author SHA1 Message Date
Chris Bieneman 46a65b8c66 Refactoring CMake CrossCompile module.
* put most of the cross-compiling support into a function llvm_create_cross_target_internal.
* when CrossCompile is included it still generates a NATIVE target.
* llvm_create_cross_target function takes a target_name which should match a toolchain.
* llvm_create_cross_target can now be used to target more than one cross-compilation target.

llvm-svn: 232067
2015-03-12 17:33:34 +00:00
Chris Bieneman 3e15eedb2e Doing some cleanup to the iOS toolchain.
* There is no reason to require SDKROOT as an environment variable because we can derive it from xcrun
* Setting CMAKE_RANLIB makes our static archives usable

llvm-svn: 232053
2015-03-12 16:19:16 +00:00
Greg Bedwell 580defbbae Revert "[CMake] Don't pass in MSVC warning flags as definitions"
reverting while I investigate why it broke the sanitizer-windows build.
This reverts commit r231924.

llvm-svn: 231925
2015-03-11 14:57:48 +00:00
Greg Bedwell 8b0d3f1ea4 [CMake] Don't pass in MSVC warning flags as definitions
NFC currently but required as a prerequisite for using
the Microsoft resource compiler in conjunction with
CMake's ninja generator, which knows how to filter flags
appropriately, but not definitions.

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

llvm-svn: 231924
2015-03-11 14:26:29 +00:00
Chris Bieneman da91ceb860 Add new LLVM_OPTIMIZED_TABLEGEN build setting which configures, builds and uses a release tablegen build when LLVM is configured with assertions enabled.
Summary: This change leverages the cross-compiling functionality in the build system to build a release tablegen executable for use during the build.

Reviewers: resistor, rnk

Reviewed By: rnk

Subscribers: rnk, joker.eph, llvm-commits

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

llvm-svn: 231842
2015-03-10 20:48:02 +00:00
Benjamin Kramer 37dce44f73 Drop the hacks used for partial C99 math libraries.
All supported platforms have half-way decent C99 support.

llvm-svn: 231679
2015-03-09 18:35:18 +00:00
Chandler Carruth dc57c481af Teach the LLVM CMake build how to explicitly use libc++abi when using
libc++. This lets me almost self-host on Linux with libc++ and libc++abi
very simply.

Currently, MCJIT and OrcJIT are failing due to uncaught exceptions, and
the Go binding tests are failing to build due to not linking in the
correct C++ standard library.

llvm-svn: 231560
2015-03-07 10:30:34 +00:00
Kostya Serebryany be5e0ed919 [sanitizer/coverage] Add AFL-style coverage counters (search heuristic for fuzzing).
Introduce -mllvm -sanitizer-coverage-8bit-counters=1
which adds imprecise thread-unfriendly 8-bit coverage counters.

The run-time library maps these 8-bit counters to 8-bit bitsets in the same way
AFL (http://lcamtuf.coredump.cx/afl/technical_details.txt) does:
counter values are divided into 8 ranges and based on the counter
value one of the bits in the bitset is set.
The AFL ranges are used here: 1, 2, 3, 4-7, 8-15, 16-31, 32-127, 128+.

These counters provide a search heuristic for single-threaded
coverage-guided fuzzers, we do not expect them to be useful for other purposes.

Depending on the value of -fsanitize-coverage=[123] flag,
these counters will be added to the function entry blocks (=1),
every basic block (=2), or every edge (=3).

Use these counters as an optional search heuristic in the Fuzzer library.
Add a test where this heuristic is critical.

llvm-svn: 231166
2015-03-03 23:27:02 +00:00
Reid Kleckner 446a0d1329 cmake: Use MSVC atomics with clang-cl
llvm-svn: 231022
2015-03-02 22:00:23 +00:00
Chris Bieneman bf2e90a870 Making the SO version major.minor instead of just major because ABI and API change between minor versions.
llvm-svn: 230981
2015-03-02 17:50:13 +00:00
Reid Kleckner 2e3d1e056c Minor follow-ups to r229720 suggested on llvmdev
"svn" patch by Sedat Dilek plus trimming whitespace added in r229720.

llvm-svn: 230773
2015-02-27 18:22:46 +00:00
Zachary Turner 66bc9080d6 [CMake] Fix the clang-cl self host build.
This allows clang-cl to self-host cleanly with no magic setup
steps required.

After this patch, all you have to do is set CC=CXX=clang-cl and
run cmake -G Ninja.

These changes only exist to support C++ features which are
unsupported in clang-cl, so regardless of whether the user
specifies they want to use them, we still have to disable them.

llvm-svn: 230539
2015-02-25 20:42:19 +00:00
Saleem Abdulrasool 5285c12008 build: check if atomic routines are implicitly provided
It is possible for the atomic routines to be provided by the compiler without
requiring any additional libraries.  Check if that is the case before checking
for a library.

Patch by Matt Glazar!

llvm-svn: 230452
2015-02-25 02:38:03 +00:00
Tobias Grosser 2ca0ae2a24 Revert "Raising minimum required CMake version to 2.8.12.2."
This reverts commit r230062.

Debian stable (wheezy) ships still with cmake 2.8.9.

The commit broke my LLVM/Polly buildbot, to my knowledge our only Linux+cmake
buildbot.

llvm-svn: 230343
2015-02-24 16:39:46 +00:00
Chad Rosier 1df9124289 Revert "Revert "Raising minimum required CMake version to 2.8.12.2.""
This reverts commit r230240, which was an accidental commit.

llvm-svn: 230246
2015-02-23 19:34:04 +00:00
Chad Rosier 7c3310694c Revert "Raising minimum required CMake version to 2.8.12.2."
This reverts commit 247aed4710e8befde76da42b27313661dea7cf66.

llvm-svn: 230240
2015-02-23 19:15:08 +00:00
Reid Kleckner e13b76591e cmake: Don't do the libstdc++ version check when clang simulates MSVC
If we're using clang-cl, that's a pretty good indication that we're
going to use MSVC's STL.

This simplifies the clang-cl ninja self-host configuration down to:
CC=clang-cl CXX=clang-cl cmake .. -GNinja

Modified version of zturner's patch:
Differential Revision: http://reviews.llvm.org/D7824

llvm-svn: 230239
2015-02-23 19:07:25 +00:00
Zachary Turner 6b3b4e4086 Remove log statements from config scripts.
The bots seem to be happy now.

llvm-svn: 230164
2015-02-22 07:31:42 +00:00
Zachary Turner 3ddf94ef6b Really fix the build this time.
I was setting the python variable to "@HAVE_DIA_SDK@", which will
always be a string, and will always evaluate to True.

llvm-svn: 230163
2015-02-22 07:13:52 +00:00
Zachary Turner a54b7ddb25 [llvm-pdbdump] Resubmit "Add some tests for llvm-pdbdump".
NOTE: This patch intentionally breaks the build.  It attempts
to resubmit r230083, but with some debug logging in the CMake
and lit config files to determine why certain bots do not
correctly disable the DIA tests when DIA is not available.

After a sufficient number of bots fail, this patch will either
be reverted or, if the cause of the failure becomes obvious,
a fix submitted with the log statements removed.

llvm-svn: 230161
2015-02-22 06:47:32 +00:00
Chris Bieneman e88a396f86 Raising minimum required CMake version to 2.8.12.2.
llvm-svn: 230062
2015-02-20 21:28:18 +00:00
Davide Italiano faafae33fa [Support/Timer] Make GetMallocUsage() aware of jemalloc.
Differential Revision:	D7657
Reviewed by:	shankarke, majnemer

llvm-svn: 229824
2015-02-19 07:27:14 +00:00
Peter Collingbourne 2ba7f7b837 CMake: Fix add_lit_target for the case where a test suite has zero target dependencies.
This can happen with a standalone project containing a test suite with no
internal dependencies.

llvm-svn: 229753
2015-02-18 22:25:35 +00:00
Chris Bieneman 0d9289daa1 Adding install targets for individual LLVM tools and libraries.
Summary:
* add_llvm_tool and add_llvm_library now add install-${name} targets to install specific components
* added installhdrs target to install just the LLVM headers
* The above changes only apply for single-configuration generators (Ninja, Makefiles...), not for multi-configuration generators (Visual Studio, Xcode...)

Reviewers: pete

Reviewed By: pete

Subscribers: pete, llvm-commits

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

llvm-svn: 229727
2015-02-18 19:25:47 +00:00
Chris Bieneman a8a05965d8 Enable standard so versioning for libLLVM.
Summary: This resolves Bugzilla bug 15493.

Reviewers: chapuni, pete

Reviewed By: pete

Subscribers: pete, llvm-commits

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

Conflicts:
	cmake/modules/AddLLVM.cmake

llvm-svn: 229720
2015-02-18 18:52:06 +00:00
Filipe Cabecinhas 3c7469396a Downgrade build system error message to a warning
Instead of requiring MSVC 2013 U4, we simply warn users, since some might
not bt able to immediately upgrade.

llvm-svn: 229598
2015-02-18 01:12:38 +00:00
Filipe Cabecinhas 0c098bfdfd We require MSVC 2013 Update 4 due to previous versions miscompiling ASTMatchers
Previous versions of MSVC 2013 would miscompile ASTMatchers (and/or their
tests). Bump up the requirement and make sure we know about the minor
revision.

Minimum required version found by Michael Edwards!

llvm-svn: 229584
2015-02-17 23:29:00 +00:00
Benjamin Kramer de1a193d24 Update the docs to require at least MSVC 2013.
llvm-svn: 229323
2015-02-15 19:34:17 +00:00
NAKAMURA Takumi 301e190c54 Reapply r229185(cbieneman) -- Raising minimum required Visual Studio version to 2013.
This is based on the discussions on: [LLVMdev] [RFC] Raising LLVM minimum required MSVC version to 2013 for trunk

llvm-svn: 229320
2015-02-15 17:53:10 +00:00
Chandler Carruth edd92948d1 [gold] Consolidate the gold plugin options and actually search for
a gold binary explicitly. Substitute this binary into the tests rather
than just directly executing the 'ld' binary.

This should allow folks to inject a cross compiling gold binary, or in
my case to use a gold binary built and installed somewhere other than
/usr/bin/ld. It should also allow the tests to find 'ld.gold' so that
things work even if gold isn't the default on the system.

I've only stubbed out support in the makefile to preserve the existing
behavior with none of the fancy logic. If someone else wants to add
logic here, they're welcome to do so.

llvm-svn: 229251
2015-02-14 09:43:57 +00:00
NAKAMURA Takumi 3d1b0aa008 Revert r229185, "Raising minimum required Visual Studio version to 2013."
All builders are not ready yet.

llvm-svn: 229199
2015-02-14 00:45:32 +00:00
Chris Bieneman eff99e8ac5 Raising minimum required Visual Studio version to 2013.
This is based on the discussions on: [LLVMdev] [RFC] Raising LLVM minimum required MSVC version to 2013 for trunk

llvm-svn: 229185
2015-02-13 23:24:14 +00:00
Zachary Turner aeedd65c64 Teach llvm_add_library() to find include dirs.
Since header files are not compilation units, CMake does not require
you to specify them in the CMakeLists.txt file.  As a result, unless a
header file is explicitly added, CMake won't know about it, and when
generating IDE-based projects, CMake won't put the header files into
the IDE project.  LLVM currently tries to deal with this in two ways:

  1) It looks for all .h files that are in the project directory, and
     adds those.
  2) llvm_add_library() understands the ADDITIONAL_HEADERS argument,
     which allows one to list an arbitrary list of headers.

This patch takes things one step further.  It adds the ability for
llvm_add_library() to take an ADDITIONAL_HEADER_DIRS argument, which
will specify a list of folders which CMake will glob for header files.
Furthermore, it will glob not only for .h files, but also for .inc
files.

Included in this CL is an update to one of the existing users of
ADDITIONAL_HEADERS to use this new argument instead, to serve as an
illustration of how this cleans up the CMake.

The big advantage of this new approach is that until now, there was no
way for the IDE projects to locate the header files that are in the
include tree.  In other words, if you are in, for example,
lib/DebugInfo/DWARF, the corresponding includes for this project will
be located under include/llvm/DebugInfo/DWARF.  Now, in the
CMakeLists.txt for lib/DebugInfo/DWARF, you can simply write:

  ADDITIONAL_HEADER_DIRS
  ../../include/llvm/DebugInfo/DWARF

as an argument to llvm_add_library(), and all header files will get
added to the IDE project.

Differential Revision: http://reviews.llvm.org/D7460
Reviewed By: Chris Bieneman

llvm-svn: 228670
2015-02-10 05:04:37 +00:00
Zachary Turner 733b849a30 Define HAVE_DIA_SDK on Windows when DIA is present.
This allows all CMake projects, as well as C++ code, to detect if
and when DIA SDK is available for use so that we can enable the
DIA-based PDB reader implementation.

Differential Revision: http://reviews.llvm.org/D7457
Reviewed By: Chandler Carruth

llvm-svn: 228669
2015-02-10 05:04:25 +00:00
Filipe Cabecinhas b36685ee85 Handle LLVM_USE_SANITIZER=Address;Undefined (and the other way around)
Summary:
Handle LLVM_USE_SANITIZER=Address;Undefined to enable ASan and UBSan
If UBSan is compatible with more of the other sanitizers, maybe we should
deal with this in a better way where we allow combining UBSan with any of
the other sanitizers.

Reviewers: samsonov

Subscribers: llvm-commits

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

llvm-svn: 228219
2015-02-04 22:33:31 +00:00
Hans Wennborg 6d12f69363 [CMake] add_llvm_library: don't use .imp suffix for import libraries on Windows (PR22334)
This was added in r188351 to fix a naming conflict between the
profile_rt-static and profile_rt-shared who both ended up in
lib/profile_rt.lib.

The change also affected other libraries (like libclang), and
users are reporting that they find it surprising that there's
no longer a libclang.lib. Since the profile_rt naming conflict
doesn't seem to exist any more, I think we can remove this.

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

llvm-svn: 228049
2015-02-03 22:08:20 +00:00
NAKAMURA Takumi 788550783a [Cygming] Seek also chkstk_ms, or JIT fails with DLL builds. It is fixup for r227519.
llvm-svn: 227574
2015-01-30 13:01:19 +00:00
Chris Bieneman f170d7edb5 Updating iOS.cmake to work with the latest Xcode and iOS 8 SDK.
llvm-svn: 227523
2015-01-30 00:10:47 +00:00
Chris Bieneman b2d7149394 iOS doesn't have histedit.h available. We should gate use of libedit on whether or not this headers exists.
llvm-svn: 227522
2015-01-30 00:10:43 +00:00
Kostya Serebryany 869b8675c8 Add cmake flag LLVM_USE_SANITIZE_COVERAGE
Summary:
When LLVM_USE_SANITIZE_COVERAGE=YES
and one of the sanitizers is used -fsanitize-coverage=3 will be added
to build flag. This will be used to run a coverage-guided fuzzer on various
llvm libraries.

Test Plan: n/a

Reviewers: rnk

Reviewed By: rnk

Subscribers: llvm-commits

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

llvm-svn: 227216
2015-01-27 17:59:28 +00:00
Kuba Brecka a62bbccad0 Reverting r226937: lit: Make MCJIT's supported arch check case insensitive
The r226937 commit causes ASan lit tests to be all skipped on OS X.

llvm-svn: 226979
2015-01-24 01:42:44 +00:00
Reid Kleckner 5f5036a073 lit: Make MCJIT's supported arch check case insensitive
Should make the tests run when using CMake on systems where 'uname -p'
reports "amd64", such as FreeBSD.

Should fix PR21559.

llvm-svn: 226937
2015-01-23 21:11:40 +00:00
Rafael Espindola 19b538450c Don't use -z,defs on FreeBSD.
Looks like environ is defined only in the main binary.

llvm-svn: 226862
2015-01-22 20:57:30 +00:00
Rafael Espindola bb5d09f0e3 Pass -Wl,-z,defs when building shared libraries, but not with the sanitizers.
llvm-svn: 226828
2015-01-22 14:06:51 +00:00
Rafael Espindola 8c8ad37f88 Don't pass -Wl,z,defs for now.
It broke the msan build.

llvm-svn: 226613
2015-01-20 22:08:20 +00:00
Rafael Espindola cb274c0c47 Use -Wl,defs when linking.
ELF linkers by default allow shared libraries to contain undefined references
and it is up to the dynamic linker to look for them.

On COFF and MachO, that is not the case.

This creates a situation where a .so might build on an ELF system, but the build
of the corresponding .dylib or .dll will fail.

This patch changes the cmake build to use -Wl,-z,defs when linking and updates
the dependencies so that -DBUILD_SHARED_LIBS=ON build still works.

llvm-svn: 226611
2015-01-20 21:23:15 +00:00
Peter Zotov 1f00ac9368 [OCaml] Use $CAMLORIGIN, an rpath-$ORIGIN-like mechanism in OCaml.
As a result, installations of LLVM in non-standard locations
will not require passing custom -ccopt -L flags when building
the binary, nor absolute paths would be embedded in the cma/cmxa
files. Additionally, the executables will not require changes
to LD_LIBRARY_PATH, although CAML_LD_LIBRARY_PATH still
has to be set for ocamlc without -custom.

See http://caml.inria.fr/mantis/view.php?id=6642.
Note that the patch is approved, but not merged yet.
It will be released in 4.03 and likely 4.02.

llvm-svn: 225778
2015-01-13 09:47:59 +00:00
Aaron Ballman d2e434218d Reverting r225319; since there is a folder named Examples, attempting to add a target of the same name causes problems for IDEs like Visual Studio.
llvm-svn: 225355
2015-01-07 14:47:12 +00:00
Duncan P. N. Exon Smith 7da04d5805 cmake: Fix 'examples' target after r225319
Add the missing `DEPENDS` keyword.  r225319 did almost the right thing
(I didn't notice the problem with it because `Kaleidoscope-Ch8` wasn't
building at all).

llvm-svn: 225321
2015-01-06 23:52:35 +00:00
Duncan P. N. Exon Smith 34057d0bac cmake: Add 'examples' target
llvm-svn: 225319
2015-01-06 23:42:49 +00:00