Commit Graph

49 Commits

Author SHA1 Message Date
Nico Weber 4b6d9ac392 Make lld cmake not compute commit revision twice
r354605 moved LLD to the unified revision handling introduced in
rL353268 / r352729 and removed uses of LLD_REPOSITORY_STRING and
LLD_REVISION_STRING.

After this change, we no longer compute the (now-unused) values
of these two variables.

Since this removes the only use of llvm/utils/GetRepositoryPath,
remove that too (it's redundant with the system added in r354605).

While here, also remove LLD_VERSION_MAJOR and LLD_VERSION_MINOR.
Their uses were removed in r285163.

Also remove LLD_VERSION from Version.inc which as far as I can
tell has been unused since the file was added in r219277.

No behavior change.

Differential Revision: https://reviews.llvm.org/D72803
2020-01-16 09:55:36 -05:00
Jonas Devlieghere a5359b1b07 [CMake] Don't set Python_ADDITIONAL_VERSIONS
Until recently, Python_ADDITIONAL_VERSIONS was used to limit LLVM's
Python support to 2.7. Now that both LLVM and LLDB both support Python
3, there's no longer a need to put an arbitrary limit on this.

However, instead of removing the variable, r365692 expanded the list,
which has the (presumably unintentional) side-effect of expression
preference for Python 3.

Instead, as Michal proposed in the original code review, we should just
not set the list at all, and let CMake pick whatever Python interpreter
you have in your path.

This patch removes the Python_ADDITIONAL_VERSIONS variable in llvm,
clang and lld. I've also updated the docs with the default behavior and
how to force a different Python version to be used.

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

llvm-svn: 366447
2019-07-18 15:17:42 +00:00
Sam Clegg c94d393ad5 [WebAssembly] Initial wasm linker implementation
This linker backend is still a work in progress but is
enough to link simple programs including linking against
library archives.

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

llvm-svn: 318539
2017-11-17 18:14:09 +00:00
Rui Ueyama 3f851704c1 Move new lld's code to Common subdirectory.
New lld's files are spread under lib subdirectory, and it isn't easy
to find which files are actually maintained. This patch moves maintained
files to Common subdirectory.

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

llvm-svn: 314719
2017-10-02 21:00:41 +00:00
Martell Malone 894dbbe8eb LLD: Introduce a GNU LD style driver for COFF
When building COFF programs many targets such as mingw prefer
to have a gnu ld frontend. Rather then having a fully fledged
standalone driver we wrap a shim around the LINK driver.

Extra tests were provided by mstorsjo

Reviewers: mstorsjo, ruiu

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

llvm-svn: 312926
2017-09-11 17:02:59 +00:00
Eric Fiselier 927edebd04 Dummy commit to trigger CMake reconfiguration and unbreak Sphinx build
llvm-svn: 302130
2017-05-04 08:32:33 +00:00
Michal Gorny da7ceb5e1b [cmake] Support running tests in stand-alone builds
Add the CMake bits necessary to run lld tests (and unittests) when
building stand-alone. The code is based on the equivalent code in clang,
and includes:

1. checking for Python, searching for lit and necessary LLVM test tools
(FileCount and not),

2. building LLVM test tools (FileCount and not) from LLVM sources if
they are not installed,

3. building gtest libraries from LLVM sources,

4. adjusting dependencies so that test targets depend only on those LLVM
targets that are available for a particular variant of stand-alone
build.

With this patch, I am able to successfully run 1002 (+10 unsupported)
lit tests on Gentoo using installed LLVM.

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

llvm-svn: 293630
2017-01-31 14:10:20 +00:00
Michal Gorny 30dc91a707 [cmake] Fix -rpath-link in stand-alone build
Set LLVM_LIBRARY_OUTPUT_INTDIR as expected by llvm_setup_rpath() macro
when doing stand-alone builds. This is required to pass correct
-rpath-link when linking shared libraries, and therefore ensure that
the linker can find dependency libraries correctly during the build.

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

llvm-svn: 293078
2017-01-25 19:33:14 +00:00
Michal Gorny 47132e5cab [cmake] Obtain LLVM_CMAKE_PATH from llvm-config
Use the new --cmakedir option to obtain LLVM_CMAKE_PATH straight from
llvm-config instead of reconstructing it locally.

llvm-svn: 291502
2017-01-09 23:17:10 +00:00
Petr Hosek f367a2a52b [CMake] Add install target for the lld tool
This is necessary for the distribution targets which assume that
each component has an install target. This also moves the CMake
macros into a separate file akin to other LLVM projects.

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

llvm-svn: 290391
2016-12-23 00:22:47 +00:00
Saleem Abdulrasool f1af26ddf2 build: add support for standalone lld build
Enable building lld as a standalone project. This is motivated by the desire to
package lld for inclusion in a linux distribution. This allows building lld
against an existing paired llvm installation. Now that lld is usable on x86_64,
it makes sense to revive this configuration to allow distributions to package
it.

llvm-svn: 289421
2016-12-12 05:47:40 +00:00
Rui Ueyama 3178b80067 Inline a trivial CMakeLists.txt.
llvm-svn: 262574
2016-03-03 01:56:23 +00:00
Pete Cooper 69b18f4703 Set CMake ADDITIONAL_HEADER_DIRS on libraries with headers in /include. NFC.
In a UI such as XCode, it can group the headers for a library with that library.
This is done in the CMakeLists.txt for the library itself by setting the path(s)
as ADDITIONAL_HEADER_DIRS.

LLVM already does this for all of its libraries, so just adding this to lld to
make things easier.  Should be NFC.

llvm-svn: 257002
2016-01-07 00:14:09 +00:00
Pete Cooper f154b678c6 Set the folder for libraries to 'lld libraries'. NFC.
In a UI such as XCode, LLVM source files are in 'libraries' while clang
files are in 'clang libraries'.

This change moves the lld source to 'lld libraries' to make code browsing easier.

It should be NFC as the build itself is still the same, just the structure in a
UI differs.

llvm-svn: 257001
2016-01-07 00:14:04 +00:00
Chris Bieneman 03c48b01bf [CMake] Don't include the lld test directory if LLVM_INCLUDE_TESTS is Off
This matches the behavior of LLVM and Clang.

llvm-svn: 249050
2015-10-01 18:17:47 +00:00
Michael J. Spencer 84487f1174 [ELF2] Add a new ELF linker based on the new PE/COFF linker.
Differential Revision: http://reviews.llvm.org/D11188

llvm-svn: 243161
2015-07-24 21:03:07 +00:00
Michael J. Spencer bae540e945 Revert ELF port. Posting to mailing list.
llvm-svn: 242118
2015-07-14 04:49:48 +00:00
Michael J. Spencer 8a4145411f Initial ELF port.
This is a direct port of the new PE/COFF linker to ELF.

It can take a single object file and generate a valid executable that executes at the first byte in the text section.

llvm-svn: 242088
2015-07-13 23:48:06 +00:00
Rui Ueyama 411c636081 COFF: Add a new PE/COFF port.
This is an initial patch for a section-based COFF linker.

The patch has 2300 lines of code including comments and blank lines.
Before diving into details, you want to start from reading README
because it should give you an overview of the design.

All important things are written in the README file, so I write
summary here.

- The linker is already able to self-link on Windows.

- It's significantly faster than the existing implementation.
  The existing one takes 5 seconds to link LLD on my machine,
  while the new one only takes 1.2 seconds, even though the new
  one is not multi-threaded yet. (And a proof-of-concept multi-
  threaded version was able to link it in 0.5 seconds.)

- It uses much less memory (250MB vs. 2GB virtual memory space
  to self-host).

- IMHO the new code is much simpler and easier to read than
  the existing PE/COFF port.

http://reviews.llvm.org/D10036

llvm-svn: 238458
2015-05-28 19:09:30 +00:00
Chandler Carruth 5ad16c2ad0 Move the 'linker-script-test' binary to the tools directory.
The canonical LLVM directory arrangement places binaries in the 'utils/'
tree when they are used as part of building the project. For example,
the tblgen binaries are built out of 'utils/' trees.

Tools which are not used by any other part of the build, including
testing utilities, are just in the 'tools' directory. For example, in
Clang we have 'c-index-test' which is exactly the same kind of thing as
'linker-script-test'.

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

llvm-svn: 231973
2015-03-11 22:05:49 +00:00
Shankar Easwaran 60aa7985cc [CMake] Cleanup
llvm-svn: 230731
2015-02-27 04:39:16 +00:00
Michael J. Spencer b6396eaef9 Suppress 'warning C4062: enumerator X in switch of enum Y is not handled' from system header.
llvm-svn: 230422
2015-02-25 01:30:13 +00:00
Greg Fitzgerald 57c29ad223 add_lld_library -> add_llvm_library
* Works better for shared libraries (sets PRIVATE instead of INTERFACE)
* Fixes http://llvm.org/bugs/show_bug.cgi?id=22269
* Also, use build-target names instead of component names

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

From: Greg Fitzgerald <garious@gmail.com>
llvm-svn: 226702
2015-01-21 21:26:27 +00:00
Greg Fitzgerald cedca2f057 Remove CMake standalone build configuration
Differential Revision: http://reviews.llvm.org/D6898

llvm-svn: 225704
2015-01-12 21:41:10 +00:00
Chandler Carruth 24e9773fc5 [multilib] Teach LLD's CMake build to use LLVM_LIBDIR_SUFFIX which
allows it to support multilib suffixed hosts using lib64, etc. This
variable is now available both in the direct LLVM build and from the
LLVMConfig.cmake file used by standalone builds.

llvm-svn: 224925
2014-12-29 12:11:30 +00:00
Zachary Turner 392b715caf Disable warning 4530 for MSVC builds.
We compile with exceptions off for LLVM and all other LLVM
subprojects, so this brings parity to LLD and disables this
warning.

Reviewed by: Rui Ueyama

llvm-svn: 223131
2014-12-02 17:57:54 +00:00
Shankar Easwaran c3550f9231 Add support to print version.
Summary: Add support in the universal driver to print the lld version and the
repository version.

Test Plan: A driver test is added

Reviewers: kledzik, ruiu

Reviewed By: ruiu

Subscribers: llvm-commits

Projects: #lld

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

llvm-svn: 219277
2014-10-08 03:47:51 +00:00
Reid Kleckner f00daf15f0 Add support for building Sphinx documentation when being built inside LLVM source tree and using CMake.
Patch by Dan Liew <daniel.liew@imperial.ac.uk>!

llvm-svn: 206662
2014-04-18 21:59:05 +00:00
Chandler Carruth 620b89017e [C++1y] Don't error if the user is enabling C++1y, which is *newer* than
C++11. I'm not sure that this is a good idea, but I know some crazy
folks on the core working group who like to live dangerously, and they
should still be able to build LLD. =D

llvm-svn: 202568
2014-03-01 03:18:56 +00:00
NAKAMURA Takumi 9cd9ad6b9d [CMake] Introduce cmake_policy(CMP0022) for target_link_libraries(INTERFACE|PRIVATE).
For now, use both keywords, INTERFACE and PRIVATE via the variable,
  - ${cmake_2_8_12_INTERFACE}
  - ${cmake_2_8_12_PRIVATE}

They could be cleaned up when we introduce 2.8.12.

llvm-svn: 202239
2014-02-26 06:45:11 +00:00
NAKAMURA Takumi 23850261c6 [CMake] Declare cmake_minimum_required() unconditionally.
llvm-svn: 202235
2014-02-26 06:27:59 +00:00
NAKAMURA Takumi b31e03007a [CMake] add_lld_library: link_system_libs is not needed any more. LLVMSupport may provide dependencies to system libs.
llvm-svn: 201967
2014-02-23 04:43:45 +00:00
NAKAMURA Takumi 4162034bb5 [CMake] Apply llvm_update_compile_flags() in add_lld_library().
Sorry for the breakage.

llvm-svn: 200306
2014-01-28 10:45:37 +00:00
Alp Toker c544d5b7e8 Get lld building with MSVC2013
llvm-svn: 194481
2013-11-12 15:14:33 +00:00
Hans Wennborg 2391fddfc7 CMake: Support the LLVM_INSTALL_TOOLCHAIN_ONLY flag
llvm-svn: 189157
2013-08-24 00:24:15 +00:00
Hans Wennborg 306db8f3fa CMake: Don't look for llvm-tblgen when building outside LLVM tree
Previously, the CMake build would look for llvm-tblgen to determine
if a directory is an LLVM build or install directory. Since we don't
want to include llvm-tblgen in the install, look for llvm-config instead,
and use that to find llvm-tblgen.

(This is the lld equivalent of Clang r189127.)

llvm-svn: 189128
2013-08-23 18:18:13 +00:00
Rui Ueyama fe81cf8f91 [lld] Allow flags other than -std= in CMAKE_CXX_FLAGS. Also simplify the IF conditions.
llvm-svn: 181822
2013-05-14 19:53:41 +00:00
Michael J. Spencer d4eb47c110 Add VTune as an optional external dependency and add task tracking.
llvm-svn: 178940
2013-04-06 00:56:40 +00:00
Michael J. Spencer a55e37f477 Add basic linker script parsing.
llvm-svn: 176309
2013-03-01 00:03:36 +00:00
Chandler Carruth 8b95c03fca Allow the LLD CMake build to work with -std=gnu++0x and -std=gnu++11 as
well as c++0x and c++11. This can be especially useful when building
with GCC in C++11 mode.

llvm-svn: 172897
2013-01-19 09:41:42 +00:00
Michael J. Spencer c4048062e5 [CMake] Don't add flags this late and don't force libc++. Error if we know the compiler doesn't support c++11.
llvm-svn: 171596
2013-01-05 04:16:52 +00:00
Michael J. Spencer 800de03813 [Core][ErrorOr] Add support for user error data.
llvm-svn: 170483
2012-12-19 00:51:07 +00:00
Michael J. Spencer db1450800a [CMake] Fix external llvm build. It needs to know where llvm-tblgen is.
llvm-svn: 169794
2012-12-10 23:52:34 +00:00
Nick Kledzik bb963dfb7e Factor out core linking options from Platform in a new ResolverOptions
class.  Change Resolver to no longer use Platform.  Core linking
now issues errors directly.  We need to factor that out later.

Rework how Darwin executable writer finds "main" atom.  It now
adds to core linking an Atom  which has a Reference to "main".  

llvm-svn: 155060
2012-04-18 21:55:06 +00:00
Michael J. Spencer 510b6f28b2 Disable /Za on Windows. It breaks C++11 ;/.
llvm-svn: 153588
2012-03-28 18:48:47 +00:00
Michael J. Spencer e753cbc685 Fix MSVC incompatibilities.
llvm-svn: 152389
2012-03-09 05:27:43 +00:00
Benjamin Kramer 398ecd6200 Use the old -std=c++0x flag for compatibility with pre-2011 versions of GCC.
llvm-svn: 152355
2012-03-09 00:23:07 +00:00
Nick Kledzik 1a6615dc88 Sources now require C++11 to build.
Add first linker pass (StubsPass) which looks for calls to shared library
symbols and replaces them with calls to a StubAtom.  On ELF system, a "stub"
is a PLT entry.  Added a simple test case.

Pass a Platform object to YAML reader and writer for converting fixup kinds 
between names and values.

Change output of Resolver to be a File object instead of a vector of Atoms.
Thus, passes operate on a File instead of just Atoms.

Rework how to walk through a File's Atoms. Now iterator based instead of 
a method that visits each atom.  

llvm-svn: 152269
2012-03-08 00:18:30 +00:00
Michael J. Spencer 773a8fb6ab Initial commit. Code by Nick Kledzik. Cleanups and build system by me.
llvm-svn: 146844
2011-12-18 08:27:59 +00:00