Commit Graph

701 Commits

Author SHA1 Message Date
Rafael Espindola
6db0df8f76 Don't use -z,defs on FreeBSD.
Looks like environ is defined only in the main binary.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226862 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-22 20:57:30 +00:00
Rafael Espindola
46b1a31681 Pass -Wl,-z,defs when building shared libraries, but not with the sanitizers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226828 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-22 14:06:51 +00:00
Rafael Espindola
3208ab6369 Don't pass -Wl,z,defs for now.
It broke the msan build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226613 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-20 22:08:20 +00:00
Rafael Espindola
e4f11175cb 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226611 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-20 21:23:15 +00:00
Peter Zotov
464a52227c [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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225778 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-13 09:47:59 +00:00
Aaron Ballman
92512386a2 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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225355 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-07 14:47:12 +00:00
Duncan P. N. Exon Smith
a511d71d15 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).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225321 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-06 23:52:35 +00:00
Duncan P. N. Exon Smith
7c659cc405 cmake: Add 'examples' target
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225319 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-06 23:42:49 +00:00
NAKAMURA Takumi
23dc3f4eef [CMake] Silence stderr on "COMMAND ${CMAKE_C_COMPILER} -Wl,--version". It was noisy during configuraion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225260 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-06 09:44:44 +00:00
NAKAMURA Takumi
a108580b07 Reformat.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225259 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-06 09:44:29 +00:00
NAKAMURA Takumi
27c27a0b61 [autoconf] llvm/cmake/modules/Makefile: Make sure to regenerate LLVMConfig.cmake whenever Makefile is updated.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225206 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-05 21:24:36 +00:00
NAKAMURA Takumi
75beb04d36 [autoconf] Export LLVM_LIBDIR_SUFFIX with empty string in LLVMConfig.cmake. tools/llvm-config is also doing so.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225204 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-05 21:14:14 +00:00
Peter Zotov
a2cb627a04 [OCaml] [cmake] Use LLVM_LIBRARY_DIR instead of LLVM_LIBRARY_OUTPUT_INTDIR.
The latter variable is internal.

Original patch by Ramkumar Ramachandra <artagnon@gmail.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224977 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-30 03:24:07 +00:00
Chandler Carruth
f34da85923 [go] Teach the go cmake build functions to funnel the include directories down into the cgo-setup variables of llvm-go.
Summary:
This in turn allows us to use #includes with cgo that rely on CMake
provided include directories which is particularly useful for handling
generated headers that aren't reasonable to put in an "installable"
location.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224962 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-29 22:50:30 +00:00
Chandler Carruth
8f94441e03 [cmake] Push LLVM_LIBDIR_SUFFIX through to the LLVMConfig.cmake file
that is used by other projects to build against LLVM. This will allow
subsequent patches to them to use LLVM_LIBDIR_SUFFIX, both when built as
part of the larger LLVM build an as part of a standalone build against
an installed set of LLVM libraries.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224920 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-29 11:16:23 +00:00
Chandler Carruth
7c150bae21 [cmake] Start making LLVM_LIBDIR_SUFFIX effective by adding it to
*numerous* places where it was missing in the CMake build. The primary
change here is that the suffix is now actually used for all of the lib
directories in the LLVM project's CMake. The various subprojects still
need similar treatment.

This is the first of a series of commits to try to make LLVM's cmake
effective in a multilib Linux installation. I don't think many people
are seriously using this variable so I'm hoping the fallout will be
minimal. A somewhat unfortunate consequence of the nature of these
commits is that until I land all of them, they will in part make the
brokenness of our multilib support more apparant. At the end, things
should actually work.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224919 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-29 11:16:19 +00:00
Peter Zotov
827f4eb6a3 [cmake] Unbreak LLVM-Config.cmake / llvm_expand_dependencies.
The algorithm for sorting libraries in topological order, as
previously implemented, had a few issues:
  * It didn't make any sense.
  * It didn't actually sort libraries in topological order.
  * It hung on some inputs, e.g. "LLVMipo".

This commit replaces the old algorithm with a straightforward port
from llvm-config.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224554 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-18 23:56:52 +00:00
Rafael Espindola
97996ea790 Disable --icf=safe to avoid a bug.
Thanks to Sameer Sahasrabuddhe for the report!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224123 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-12 14:28:19 +00:00
Nico Weber
24d058a523 cmake: Make SVNVersion.inc work on Windows if svn is called svn.bat.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223864 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-10 00:10:21 +00:00
Paul Robinson
ebde7405a7 Make GetSVN.cmake do its VCS queries with native CMake code.
This lets the queries work on Windows as well as Linux.

This does mean make and cmake aren't using the same scripts to do the
queries (again), but at least GetSVN.cmake understands git and git-svn
as well as svn now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223425 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-05 00:50:15 +00:00
Rafael Espindola
838e18116d Also use --icf=safe if we are being linked by gold.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223394 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 22:16:08 +00:00
Rafael Espindola
89f1920565 Detect if the linker is gold and if so always use --gc-sections.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223372 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-04 17:54:35 +00:00
Peter Zotov
0245b12df2 [OCaml] [cmake] Disable OCaml bindings if ctypes >=0.3 is not found.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223195 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-03 03:39:01 +00:00
Reid Kleckner
efcedf94c4 cmake: Remove MAXPATHLEN define as autoconf does not provide it
Presumably it was added to the CMake system when MAXPATHLEN was still
used by code built for Windows. Currently only lib/Support/Path.inc uses
MAXPATHLEN, and it should be available on all Unices.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223139 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-02 18:59:08 +00:00
Peter Zotov
a0a26f222b [OCaml] [cmake] Add CMake buildsystem for OCaml.
Closes PR15325.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223071 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-01 19:50:23 +00:00
Peter Collingbourne
a9ce03858d Teach LLVM about llgo subproject.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222860 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-27 00:15:21 +00:00
Jordan Rose
61fd8ea520 [CMake] Update GetSVN.cmake to use LLVM version control helper scripts.
This allows the logic to work with Git, and also uses the variable names
to match what Clang is actually looking for.

This is a re-application of r190556 and r190808. This changes the interface
of GetSVN.cmake. Clang change to follow.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222391 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-19 22:03:21 +00:00
Eric Fiselier
ad49f982e7 Add support for LLVM_USE_SANITIZER=Thread
Summary: This will help in testing libc++ and libc++abi with tsan.

Reviewers: samsonov

Reviewed By: samsonov

Subscribers: samsonov, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222258 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-18 21:23:38 +00:00
Peter Collingbourne
5b9a46b789 CMake: Use the new USES_TERMINAL option for test suite targets when available.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222181 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-17 22:16:15 +00:00
Eric Fiselier
96c8ba61cb Provide missing definition of uppercase_CMAKE_BUILD_TYPE in HandleLLVMOptions module
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222082 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-15 07:45:31 +00:00
Roman Divacky
89a5f54f1d Use -Wcast-qual in cmake builds, not only autoconfo ones.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221913 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-13 19:45:27 +00:00
Rafael Espindola
b3963d680c Pass PRIVATE to target_link_libraries if using shared libraries.
A shared library (unlike a .a), has its dependencies recorded in the library and
we can pass PRIVATE to target_link_libraries.

This patch then removes some bogus dependencies when using
BUILD_SHARED_LIBS=ON. For example, we go from

build lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/AggressiveAntiDepBreaker.cpp.o:
CXX_COMPILER /home/espindola/llvm/llvm/lib/CodeGen/AggressiveAntiDepBreaker.cpp
|| include/llvm/IR/intrinsics_gen lib/libLLVMSupport.so
lib/libLLVMCore.so lib/libLLVMBitReader.so
lib/libLLVMTransformUtils.so lib/libLLVMInstCombine.so
lib/libLLVMScalarOpts.so lib/libLLVMipa.so lib/libLLVMAnalysis.so
lib/libLLVMMCParser.so lib/libLLVMMC.so lib/libLLVMObject.so
lib/libLLVMTarget.so lib/libLLVMProfileData.so

to

build lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/AggressiveAntiDepBreaker.cpp.o:
CXX_COMPILER /home/espindola/llvm/llvm/lib/CodeGen/AggressiveAntiDepBreaker.cpp
|| include/llvm/IR/intrinsics_gen lib/libLLVMSupport.so
lib/libLLVMCore.so lib/libLLVMTransformUtils.so
lib/libLLVMScalarOpts.so lib/libLLVMAnalysis.so lib/libLLVMMC.so
lib/libLLVMTarget.so

In fact, build.ninja goes from 5231028 bytes to 4896759 bytes.

With this, old verisons of bfd ld (2.24 is OK, 2.23 warns) will print a bogus
warning when building with BUILD_SHARED_LIBS.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221530 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-07 15:33:56 +00:00
Rafael Espindola
3ee42f6e5f Add a LLVM_BUILD_STATIC option to cmake.
Setting it to true causes all executables to be statically linked.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221345 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-05 14:03:58 +00:00
Rafael Espindola
a0ef0e7d0c [cmake] Pass -O3 when linking.
Gold and bfd ld enable misc optimizations. lld ignores the option for now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221097 91177308-0d34-0410-b5e6-96231b3b80d8
2014-11-02 12:14:22 +00:00
Reid Kleckner
57c911e4ab Suppress MSVC's equivalent of -Wshadow warnings
IMO we need to clean up some of these, but the member variable one
(C4458) has false positives on static methods.  It is currently firing
on Twine, which has a static method like:
  struct Twine {
    uintptr_t LHS, RHS;
    static void staticMethod() {
      // warning C4458: declaration of 'LHS' hides class member
      uintptr_t LHS;
      ...
    }
  };

We should fix up clang's -Wshadow and clean it up, and then we can
re-enable some of these MSVC warnings.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221012 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-31 22:55:57 +00:00
Chris Bieneman
4b57390110 EXPORTED_SYMBOL_FILE using mingw and cmake
Summary: This is a fix for the command line syntax error while building LTO when using MinGW.

Patch By: jsroemer

Reviewers: rnk

Reviewed By: rnk

Subscribers: rnk, beanz, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220935 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-30 22:37:58 +00:00
Rui Ueyama
490f286d15 Re-commit r220667.
C++ source given to check_cxx_source_compile should have define "main".


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220669 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-27 08:16:18 +00:00
Rui Ueyama
e975522566 Revert "Include stddef.h before including cxxabi.h" to un-break buildbot
This reverts commit r220665.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220667 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-27 08:03:21 +00:00
Rui Ueyama
baa8acd546 Include stddef.h before including cxxabi.h
On FreeBSD 10.0, size_t needs to be defined before including cxxabi.h.
Currenty HAVE_CXXABI_H is not defined on FreeBSD because of that reason.
This patch teaches cmake and configure how to include it.

http://reviews.llvm.org/D5940



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220665 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-27 07:37:57 +00:00
Peter Collingbourne
bdc3a5b99a Add llvm-go tool.
This tool lets us build LLVM components within the tree by setting up a
$GOPATH that resembles a tree fetched in the normal way with "go get".

It is intended that components such as the Go frontend will be built in-tree
using this tool.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220462 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-23 02:33:23 +00:00
Peter Collingbourne
1496d41753 Do not add -gsplit-dwarf to LLVM_DEFINITIONS.
This would cause the flag to appear in the output of "llvm-config --cppflags",
which should contain only preprocessor flags. The -gsplit-dwarf flag in
particular can cause problems with certain downstream users such as cgo.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220410 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-22 19:49:19 +00:00
Chandler Carruth
14e55b16df Teach lit to filter the host LDFLAGS down from the build system and into
the CGO build environment. This lets things like -rpath propagate down
to the C++ code that is built along side the Go bindings when testing
them.

Patch by Peter Collingbourne, and verified that it works by me.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220252 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-21 00:36:28 +00:00
Rafael Espindola
b9c7f60191 Explain why we don't always use --gc-sections.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220237 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-20 21:37:38 +00:00
NAKAMURA Takumi
7c771b0293 Revert r220174, "Always use -Wl,-gc-sections on our build."
It dropped required functions for plugins with gnu ld 2.20 and 2.21.

  Failing Tests (1):
      LLVM :: Feature/load_module.ll

  Hello: bin/opt: symbol lookup error: lib/LLVMHello.so: undefined symbol: _ZN4llvm11raw_ostream13write_escapedENS_9StringRefEb

  Failing Tests (1):
      Clang :: Frontend/plugins.c

  error: unable to load plugin 'lib/PrintFunctionNames.so': 'lib/PrintFunctionNames.so: undefined symbol: _ZN5clang15PluginASTAction6anchorEv'

I think we should inspect linker's version or behavior to introduce --gc-sections for --export-dynamic.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220198 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-20 12:12:21 +00:00
Rafael Espindola
0ea9c06fe0 Always use -Wl,-gc-sections on our build.
Both bfd ld and gold correctly handle --export-dynamic, so gc-sections is safe even for binaries
that support plugins.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220174 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-19 23:24:46 +00:00
Peter Collingbourne
560e2700e2 Disable ccache for go tests.
Should fix llvm-clang-lld-x86_64-debian-fast bot.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220071 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-17 18:32:36 +00:00
Peter Collingbourne
798ace2e58 Initial version of Go bindings.
This code is based on the existing LLVM Go bindings project hosted at:
https://github.com/go-llvm/llvm

Note that all contributors to the gollvm project have agreed to relicense
their changes under the LLVM license and submit them to the LLVM project.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219976 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-16 22:48:02 +00:00
Alexey Samsonov
fcc00a10e3 Re-land r219354: Use llvm-symbolizer to symbolize LLVM/Clang crash dumps.
In fact, symbolization is now expected to work only on Linux and
FreeBSD/NetBSD, where we have dl_iterate_phdr and can learn the
main executable name without argv0 (it will be possible on BSD systems
after http://reviews.llvm.org/D5693 lands). #ifdef-out the code for
all the rest Unix systems.

Reviewed in http://reviews.llvm.org/D5610


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219534 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-10 22:06:59 +00:00
Alexey Samsonov
aa486d0764 Revert r219354. It seems to break some buildbots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219355 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-08 23:07:59 +00:00
Alexey Samsonov
ee3948fdbe Use llvm-symbolizer to symbolize LLVM/Clang crash dumps.
This change modifies fatal signal handler used in LLVM tools.
Now it attempts to find llvm-symbolizer binary and communicates
with it in order to turn instruction addresses into
function/file/line info entries. This should significantly improve
stack traces readability in Debug builds.

This feature only works on selected platforms (including Darwin
and Linux). If the symbolization fails for some reason, signal
handler will fallback to the original behavior.

Reviewed in http://reviews.llvm.org/D5610


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219354 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-08 22:57:47 +00:00