Commit Graph

221 Commits

Author SHA1 Message Date
Nick Kledzik 77afc71426 [mach-o] Fix initial live atoms with -dead_strip
When -dead_strip is used with -exported_symbols_list the initial set of
live atoms are those in the export list.

llvm-svn: 216213
2014-08-21 20:25:50 +00:00
Chad Rosier 69e2881070 [AArch64] Initial ELF/AArch64 Support
This patch adds the initial ELF/AArch64 support to lld. Only a basic "Hello
World" app has been successfully tested for both dynamic and static compiling.

Differential Revision: http://reviews.llvm.org/D4778
Patch by Daniel Stewart <stewartd@codeaurora.org>!

llvm-svn: 215544
2014-08-13 13:16:38 +00:00
Rui Ueyama bff29b78b5 [PECOFF] Fix /profile option.
/profile implies /fixed:no -- so we had to *enable* base
relocations rather than disabling it.

llvm-svn: 215389
2014-08-11 21:31:07 +00:00
Rui Ueyama 55a6e762ee [PECOFF] Add /profile command line option.
llvm-svn: 213984
2014-07-25 22:28:49 +00:00
Rui Ueyama 7c60a98f16 [PECOFF] Add the entry point file at the right place.
The entry point file needs to be processed after all other
object files and before all .lib files. It was processed
after .lib files. That caused an issue that the entry point
function was not resolved from the standard library files.

llvm-svn: 213804
2014-07-23 21:41:20 +00:00
Rui Ueyama a27bb08e73 [PECOFF] Fix entry point functions selection
On Windows there are four "main" functions -- main, wmain, WinMain,
or wWinMain. Their parameter types are diffferent. The standard
library provides four different entry functions (i.e.
{w,}{WinMain,main}CRTStartup) for them. You need to use the right
entry routine for your "main" function.

If you give an /entry option, the specified name is used
unconditionally.

Otherwise, the linker needs to select the right one based on
user-supplied entry point function. This can be done after the
linker reads all the input files.

This patch moves the code to determine the entry point function
from the driver to a virtual input file. It also implements the
correct logic for the entry point function selection.

llvm-svn: 213713
2014-07-23 00:57:57 +00:00
Rui Ueyama 31fd9d09b2 [PECOFF] Invoke cvtres.exe in the driver.
Previously we invoked cvtres.exe for each compiled Windows
resource file. The generated files were then concatenated
and embedded to the executable.

That was not the correct way to merge compiled Windows
resource files. If you just concatenate generated files,
only the first file would be recognized and the rest would
be ignored as trailing garbage.

The right way to merge them is to call cvtres.exe with
multiple input files. In this patch we do that in the
Windows driver.

llvm-svn: 212763
2014-07-10 20:53:37 +00:00
Rafael Espindola c2199ecf1e Update for llvm api change.
llvm-svn: 212407
2014-07-06 17:43:22 +00:00
Iain Sandoe 9734a53cf0 Fix build of DriverTests for config & make.
This adjusts the USED library list following recent changes in the object
file heirarchy.

llvm-svn: 212400
2014-07-06 11:28:56 +00:00
Tim Northover d30a1f2cb2 MachO: rename _outputFileType to avoid shadowing parent field.
llvm-svn: 211367
2014-06-20 15:59:00 +00:00
Rafael Espindola 6400ed4e75 Refer to error_code with an std prefix.
llvm-svn: 210820
2014-06-12 20:42:12 +00:00
Rafael Espindola 54427ccef3 include system_error directly.
llvm-svn: 210801
2014-06-12 17:15:58 +00:00
Rafael Espindola 1675d51eac Run llvm/utils/sort_includes.py in a few files.
This will reduce the noise in a followup patch.

llvm-svn: 210800
2014-06-12 17:12:28 +00:00
Rafael Espindola 7264b0bf29 Uses #include "..." instead of #include <...> for llvm headers.
llvm-svn: 210799
2014-06-12 17:08:11 +00:00
Rafael Espindola 4956850fdc replace llvm::error_code with std::error_code.
llvm-svn: 210781
2014-06-12 14:04:54 +00:00
Rafael Espindola 28db74b2f0 Fix test build on windows.
llvm-svn: 210714
2014-06-11 22:23:45 +00:00
Rui Ueyama e05d380486 Move Simple.h and Alias.h to include/Core.
Because the files in Core actually depend on these files.

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

llvm-svn: 210710
2014-06-11 21:47:51 +00:00
Iain Sandoe c4d9bedcfc Initial set of Makefiles
This provides support for the autoconfing & make build style.
The format, style and implementation follows that used within the llvm and clang projects.

TODO: implement out-of-source documentation builds.
llvm-svn: 210177
2014-06-04 09:54:07 +00:00
Rui Ueyama 551aacd6bc Add observers to Input Graph
Make it possible to add observers to an Input Graph, so that files
returned from an Input Graph can be examined before they are
passed to Resolver.

To implement some PE/COFF features we need to know all the symbols
that *can* be solved, including ones in archive files that are not
yet to be read.

Currently, Resolver only maintains a set of symbols that are
already read. It has no knowledge on symbols in skipped files in
an archive file.

There are many ways to implement that. I chose to apply the
observer pattern here because it seems most non-intrusive. We don't
want to mess up Resolver with architecture specific features.
Even in PE/COFF, the feature that needs this mechanism is minor.
So I chose not to modify Resolver, but add a hook to Input Graph.

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

llvm-svn: 208753
2014-05-14 05:31:54 +00:00
Rui Ueyama 1127fe4704 [PECOFF] DLL extension can be omitted in .def file.
llvm-svn: 208428
2014-05-09 16:35:26 +00:00
Rui Ueyama 3608609339 Expand nested input elements.
Previously only the toplevel elements were expanded by expandElements().
Now we recursively call getReplacements() to expand input elements even
if they are in, say, in a group.

llvm-svn: 208144
2014-05-06 23:52:19 +00:00
Rui Ueyama 2fa41d1817 Add a test for notifyProgress().
llvm-svn: 208123
2014-05-06 19:26:21 +00:00
Rui Ueyama aa30ccffa8 Remove unused variable.
llvm-svn: 208121
2014-05-06 19:11:39 +00:00
Rui Ueyama b51711b356 Fix copypaste error.
llvm-svn: 208120
2014-05-06 19:05:14 +00:00
Rui Ueyama b12dcb6095 s/My/Test/ as these classes are for tests.
llvm-svn: 208119
2014-05-06 19:01:56 +00:00
Rui Ueyama fd5c70d0ec Make the test even more readable.
llvm-svn: 208118
2014-05-06 18:58:24 +00:00
Rui Ueyama 48a1727e6f Simplify unit test code.
llvm-svn: 208116
2014-05-06 18:41:12 +00:00
Rui Ueyama d976941704 Remove meaningless return value in test.
llvm-svn: 208112
2014-05-06 18:27:37 +00:00
Rui Ueyama 27169ce309 Replace copypasta with function calls to make tests intelligible.
llvm-svn: 208111
2014-05-06 18:24:27 +00:00
Rui Ueyama 1fe682cf37 Don't return value rather than always returning true.
addInputElement() never fails, and no one checks its return value
except tests. Let's simplify the signature.

llvm-svn: 208109
2014-05-06 17:33:14 +00:00
Rui Ueyama b340f0117c Remove a method that no one is using.
llvm-svn: 208101
2014-05-06 16:22:04 +00:00
Rui Ueyama 8620d933f4 Remove operator[] that was used only in tests.
llvm-svn: 208020
2014-05-06 00:50:46 +00:00
Rui Ueyama f33946d51d [PECOFF] Allow multiple directives in one module-definition file.
I'm a bit surprised that I have not implemented this yet. This is
definitely needed to handle real-world module definition files.
This patch contains a unit test for r207294.

llvm-svn: 207297
2014-04-26 00:25:02 +00:00
Rui Ueyama 409ac186bb [PECOFF] Add /IMPLIB command line option.
This option is to override the default import file path.

llvm-svn: 207175
2014-04-25 03:35:13 +00:00
Rui Ueyama 0e32610fb5 [PECOFF] Better handling of /OPT option.
Previously LLD would fail if /OPT:icf, /OPT:lbr or such are specified,
because these command line flags would be handled as unknown ones. We
rather want LLD to ignore these known but yet-to-be-implemented options
for now.

Added tests for the driver as well.

llvm-svn: 206863
2014-04-22 03:57:07 +00:00
Rui Ueyama 311a162f26 [PECOFF] Win64 DLL entry function name is _DllMainCRTStartup.
Unlike Win32/x86, it has no "@12" suffix.

llvm-svn: 206648
2014-04-18 21:05:59 +00:00
Rui Ueyama 28da676709 [PECOFF] Ignore /ignore option.
/ignore:<number> is a linker option to disable warning specified by
the number. We ignore the option because it does not make sense for
LLD.

llvm-svn: 206636
2014-04-18 19:49:24 +00:00
Rui Ueyama 38cf6ddc30 [PECOFF] Support /manifestuac:NO.
If the value for /manifestuac is "NO", LLD will create a manifest XM
file but won't emit <trustinfo> element.

llvm-svn: 206633
2014-04-18 19:43:07 +00:00
Rui Ueyama 327db80dd5 [ELF] Support --defsym=<symbol>=<symbol>.
Currently LLD supports --defsym only in the form of
--defsym=<symbol>=<integer>, where the integer is interpreted as the
absolute address of the symbol. This patch extends it to allow other
symbol name to be given as an RHS value. If a RHS value is a symbol
name, the LHS symbol will be defined as an alias for the RHS symbol.

Internally, a LHS symbol is represented as a zero-size defined atom
who has an LayoutAfter reference to an undefined atom, whose name is
the RHS value. Everything else is already implemented -- Resolver
will resolve the undefined symbol, and the layout pass will layout
the two atoms at the same location. Looks like it's working fine.

Note that GNU LD supports --defsym=<symbol>=<symbol>+<addend>. That
feature is out of scope of this patch.

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

llvm-svn: 206417
2014-04-16 20:58:57 +00:00
Rui Ueyama feab78785b [ELF] Unit tests for -o and --noinhibit-exec.
llvm-svn: 205735
2014-04-07 20:52:48 +00:00
Rui Ueyama 595026e071 [ELF] Accept "-rpath=<foo>" as well as "-rpath <foo>".
llvm-svn: 205694
2014-04-06 21:23:24 +00:00
Rui Ueyama c141c8c59a [ELF] Fix driver bug.
GNU LD-comptaible driver wrongly requires a space after '=' for a few
options such as "-init=<symbol>" or "-entry=<symbol>". This patch is
to fix that bug and add a few tests for it.

llvm-svn: 205693
2014-04-06 21:15:05 +00:00
Rui Ueyama 7088e3470c [ELF] Add a test for -rpath.
llvm-svn: 205663
2014-04-05 02:15:23 +00:00
Rui Ueyama ac0f7ca3a8 [ELF] Fix --soname option.
Currently LLD accepts only "-soname <string>", but all the following
options are actually valid.

  --soname=foo
  --soname foo
  -soname=foo
  -soname foo
  -h foo

This patch fixes that issue.

llvm-svn: 205662
2014-04-05 02:07:04 +00:00
Rui Ueyama e36fbea175 [ELF] Diagnose malformed --dynsym option.
llvm-svn: 205654
2014-04-04 22:36:30 +00:00
Rui Ueyama 8bd093b1e5 Rename getInputGraph() and getNextFile().
Seems getSomething() is more common naming scheme than just a noun
to get something, so renaming these members.

Differential Revision: http://llvm-reviews.chandlerc.com/D3285

llvm-svn: 205589
2014-04-04 00:14:04 +00:00
Rui Ueyama fb44f5e278 Fix comments.
llvm-svn: 205568
2014-04-03 21:06:23 +00:00
Rui Ueyama b0e3b66fa5 Remove ordinals from Input Graph elements.
An ordinal is set to each child of Input Graph, but no one actually
uses it. The only piece of code that gets ordinaly values is
sortInputElements in InputGraph.cpp, but it does not actually do
anything -- we assign ordinals in increasing order just before
calling sort, so when sort is called it's already sorted. It's no-op.
We can simply remove it. No functionality change.

Differential Revision: http://llvm-reviews.chandlerc.com/D3270

llvm-svn: 205501
2014-04-03 02:21:44 +00:00
Rui Ueyama 88c8599de9 Remove unused fields/member functions from unit test.
llvm-svn: 205469
2014-04-02 21:49:27 +00:00
Rui Ueyama d33a3d8892 Remove unused include.
llvm-svn: 205466
2014-04-02 21:39:44 +00:00