Commit Graph

289 Commits

Author SHA1 Message Date
Rui Ueyama 28d0f60c48 [PECOFF] Fix /manifestuac handling.
uiAccess argument's type is not really boolean. It's string.

llvm-svn: 193171
2013-10-22 17:42:42 +00:00
Rui Ueyama 0ae7b0fe0d [PECOFF] Add /manifestuac command line option.
This option is used for the manifest file too.

llvm-svn: 193145
2013-10-22 04:21:29 +00:00
Rui Ueyama 139ae4c931 [PECOFF] Parse /manifest command line option.
The manifest file is an XML file that conveys some information to the loader,
such as whether the executable needs to run as Administrator or not. This patch
is to parse command line option for manifest file.

Actual XML file generation will be done in a separate patch.

llvm-svn: 193141
2013-10-22 03:49:35 +00:00
Rui Ueyama f3630fe4be Make undefines check into an assertion.
Dead-strip root symbols can be undefined atoms, but should not really be
nonexistent, because dead-strip root symbols should be added to initial
undefined atoms at startup. Whenever you look up its name in the symbol
table, some type of atom will always exist.

llvm-svn: 192831
2013-10-16 19:21:50 +00:00
Rui Ueyama 53f31af7ea Rename path() -> getPath().
Differential Revision: http://llvm-reviews.chandlerc.com/D1853

llvm-svn: 192167
2013-10-08 04:57:08 +00:00
Nick Kledzik 58070025ca fix all EXPECT_EQ(.address) tests
llvm-svn: 192153
2013-10-08 01:27:03 +00:00
Nick Kledzik 7e28e75570 fix test case failing on bot
llvm-svn: 192152
2013-10-08 01:12:35 +00:00
Nick Kledzik 30332b19d3 Supoort mach-o encoded in yaml.
This is the first step in how I plan to get mach-o object files support into 
lld. We need to be able to test the mach-o Reader and Write on systems without 
a mach-o tools. Therefore, we want to support a textual way (YAML) to represent 
mach-o files.

MachONormalizedFile.h defines an in-memory abstraction of the content of mach-o  
files. The in-memory data structures are always native endianess and always
use 64-bit sizes. That internal data structure can then be converted to or
from three different formats: 1) yaml (text) encoded mach-o, 2) binary mach-o
files, 3) lld Atoms.

This patch defines the internal model and uses YAML I/O to implement the 
conversion to and from the model to yaml. The next patch will implement
the conversion from normalized to binary mach-o.

This patch includes unit tests to validate the yaml conversion APIs.

llvm-svn: 192147
2013-10-08 00:43:34 +00:00
Shankar Easwaran a96f3a3da4 [lld][InputGraph] Change the Resolver to use inputGraph
Changes :-

a) Functionality in InputGraph to insert Input elements at any position
b) Functionality in the Resolver to use nextFile
c) Move the functionality of assigning file ordinals to InputGraph
d) Changes all inputs to MemoryBuffers
e) Remove LinkerInput, InputFiles, ReaderArchive

llvm-svn: 192081
2013-10-07 02:47:09 +00:00
Nick Kledzik 0932c004a9 [mach-o] Add support for -mllvm to darwin driver
llvm-svn: 191594
2013-09-28 00:29:33 +00:00
Nick Kledzik 473933b89f [mach-o] switch to use llvm::MachO:: constants
Stop using some locally defined mach-o constants.

llvm-svn: 191581
2013-09-27 22:50:00 +00:00
Rui Ueyama 3c6ee599a2 [PECOFF] Enable input file logging if /debug is given.
llvm-svn: 191469
2013-09-26 22:46:04 +00:00
Rui Ueyama 8db1eddc07 Make Driver::link and LinkingContext::validate return true on success.
This patch inverts the return value of these functions, so that they return
"true" on success and "false" on failure. The meaning of boolean return value
was mixed in LLD; for example, InputGraph::validate() returns true on success.
With this patch they'll become consistent.

CC: llvm-commits

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

llvm-svn: 191341
2013-09-24 23:26:34 +00:00
Rui Ueyama a32150c3c7 [PECOFF] Ignore /verbose and /wx (warnings as errors) options.
llvm-svn: 191317
2013-09-24 17:44:39 +00:00
Rui Ueyama 98f269f9d1 [PECOFF] Add /swaprun:{cd,net} options.
llvm-svn: 191276
2013-09-24 04:20:37 +00:00
Rui Ueyama 0e08d7757b [PECOFF] Ignore /pdbaltpath option.
/PDBALTPATH:<path> is an option to embed a different path for the PDB file to
the binary than the actual PDB file location. Because we don't support PDB
file, we'll just ignore the option for now.

llvm-svn: 191273
2013-09-24 04:04:00 +00:00
Rui Ueyama c583d17a57 [PECOFF] Ignore /pdb option.
llvm-svn: 191269
2013-09-24 03:37:51 +00:00
Rui Ueyama 5ee413eda8 [PECOFF] Ignore /debug option.
llvm-svn: 191268
2013-09-24 03:37:47 +00:00
Rui Ueyama 12c0d773fe Try to fix test failure on buildbot.
llvm-svn: 191259
2013-09-24 00:47:31 +00:00
Rui Ueyama f062c84aac [PECOFF] Add /nodefaultlib command line option.
llvm-svn: 191254
2013-09-24 00:16:27 +00:00
Rui Ueyama 456740c740 [PECOFF] Do not allow space to separate command line option and its value.
We used to support both Windows and Unix style command line options. In Windows
style, an option and its value are separated by ":" (colon). In Unix, separator
is a space. Accepting both styles were convenient, but we can no longer allow
Unix style because I found that can be ambiguous.

For example, /nodefaultlib option takes an optional argument. In Windows style
it's going to be something like "/nodefaultlib:foo". There's no ambiguity what
"foo" means. However, if the option is "/nodefaultlib foo", "foo" can be
interpreted either an optional argument for "/nodefaultlib" or an input file
"foo.obj". We should just stop accepting the non-standard command line style.

llvm-svn: 191247
2013-09-23 23:51:31 +00:00
Rui Ueyama 5c59ab7f3d [PECOFF] Ignore /delay and /delayload options.
These options are to enable DLL delay loading. If enabled, DLL is loaded
at run time by a helper routine when a function in the DLL is actually called
for the first time, instead of making the Windows loader to load all DLLs at
startup time. This should shorten startup delay if an executable have many
imported symbols.

The linker needs to create a "delayed import table" and link delayimp.lib in
which helper functions are defined to support the feature.

For now, we just ignore the options, so that the linker does not complain when
it sees these options. We want to support them in the future.

llvm-svn: 191232
2013-09-23 22:41:46 +00:00
Rui Ueyama 85c821fcb2 [PECOFF] Add more tests for /machine, /base, /stack, /heap and /align.
llvm-svn: 191229
2013-09-23 21:52:01 +00:00
Rui Ueyama 1e0b586f33 [PECOFF] Add comments to unit tests and reorder them if necessary.
llvm-svn: 191228
2013-09-23 21:38:03 +00:00
Rui Ueyama c0a6d43c92 [PECOFF] Add /allowisolation command line option.
llvm-svn: 191227
2013-09-23 21:22:01 +00:00
Rui Ueyama 6907b3df70 [PECOFF] Add /allowbind command line option.
llvm-svn: 191224
2013-09-23 20:44:20 +00:00
Rui Ueyama 9149181ae9 [PECOFF] Add /align command line option.
llvm-svn: 191218
2013-09-23 19:52:35 +00:00
Shankar Easwaran 7915ff34b7 [lld][LinkingContext][ELF] Allow different output file types.
This adds an option --output-filetype that can be set to either
YAML/Native(case insensitive). The linker would create the outputs
associated with the type specified by the user.

Changes all the tests to use the new option.

llvm-svn: 191183
2013-09-23 04:24:15 +00:00
Rui Ueyama 508939428d [PECOFF] Ignore /incremental option.
/incremental is an option to enable incremental linking. We will eventually
want to implement the feature for better performance, but in the meantime,
we want to just ignore the option so that the linker does not output unknown
option error when it sees /incremental option.

llvm-svn: 191063
2013-09-20 00:55:37 +00:00
Rui Ueyama 91a95a590a [PECOFF] Ignore /errorReport command line option.
/errorReport is a command line option to let the linker to report internal
linker error information to Microsoft. For LLD that option doesn't make any
sense, so it just ignores the option.

llvm-svn: 191044
2013-09-19 22:19:40 +00:00
Rui Ueyama 1bddfc1fc7 [PECOFF][Driver] Support /version command line option
llvm-svn: 190986
2013-09-19 02:37:36 +00:00
Rui Ueyama 98896ed1b5 [PECOFF] Add a field for machine type to PECOFFLinkingContext.
So that we can determine what the target architecture is. Adding this
field does not mean that we are going to support non-i386 architectures
soon; there are many things to do to support them, and I'm focusing on
i386 now. But this is the first step toward multi architecture support.

llvm-svn: 190627
2013-09-12 19:46:53 +00:00
Rui Ueyama 81d0d29639 Remove hard-coded leading underscore from entry symbol.
llvm-svn: 190586
2013-09-12 05:09:01 +00:00
Nick Kledzik e773e327d3 Support darwin linker options:
-current_version, -compatibility_version, and -install_name.

Patch by Joe Ranieri

llvm-svn: 190452
2013-09-10 23:55:14 +00:00
Joerg Sonnenberger bd25241e0e Drop the context forceLoadAllArchives() support. Rename the isForceLoad
attribute in LinkerInput to isWholeArchive and use that for deciding
whether library archives should be expanded. Implement the -all_load
option of the Darwin linker using this flag and drop the support for it
in GNU mode.

llvm-svn: 190275
2013-09-08 13:30:14 +00:00
Joerg Sonnenberger 5e235de9d3 Change the parseFile argument from MemoryBuffer pointer to LinkerInput
reference. Move readFile logic into FileNode::createLinkerInput.

llvm-svn: 190253
2013-09-07 17:55:28 +00:00
Rui Ueyama 02c46bdb75 [PECOFF] Add /machine command line option.
llvm-svn: 190121
2013-09-06 04:17:07 +00:00
Shankar Easwaran 2f5d64062b [lld] handle the case of errors from createLinkerInput
This changes the interface of createLinkerInput to use ErrorOr, so that
errors from the linker can be captured.

Also adds a convenience function for error strings to be returned from
file nodes.

llvm-svn: 189871
2013-09-03 22:44:37 +00:00
Shankar Easwaran d26c8e3463 [lld][LinkingContext] Atoms created from command line options should be available in YAML
This adds an API to the LinkingContext for flavors to add Internal files
containing atoms that need to appear in the YAML output as well, when -emit-yaml
switch is used.

Flavors can add more internal files for other options that are needed.

llvm-svn: 189718
2013-08-31 05:27:38 +00:00
Rui Ueyama 5b41201066 [PECOFF] Add /force:unresolved command line option as a synonym of /force.
llvm-svn: 189614
2013-08-29 21:46:47 +00:00
Rui Ueyama 9d52a94cd1 [PECOFF] Make command line options case insensitive to match link.exe's behavior.
llvm-svn: 189505
2013-08-28 20:27:41 +00:00
Rui Ueyama bc839fcd3e [PECOFF] Enable dead-stripping by default to match link.exe behavior.
llvm-svn: 189308
2013-08-27 03:38:18 +00:00
Rui Ueyama 4c3184f3c0 Treat entry point symbol as an undefined atom.
With this patch the entry symbol is treated as an undefined symbol, to force
the resolver to resolve the entry symbol.

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

llvm-svn: 189307
2013-08-27 03:18:11 +00:00
Rui Ueyama c7ef7a8dd7 [PECOFF] Add Support for entry point symbol name
Patch by Jesús Serrano García.

llvm-svn: 189267
2013-08-26 19:55:09 +00:00
Rui Ueyama 72165ec8c3 Separates /fixed (no .reloc section) and /dynamicbase (enable ASLR)
in order to match link.exe's behaviour.

Patch by Ron Ofir.

llvm-svn: 189159
2013-08-24 00:39:10 +00:00
Shankar Easwaran ea68a5d636 [lld][unittests] Change assert to llvm_unreachable
llvm-svn: 189023
2013-08-22 15:23:54 +00:00
Shankar Easwaran 1d76b115a3 [lld][test] fix -Wreturn-type error
llvm-svn: 188988
2013-08-22 05:44:08 +00:00
Shankar Easwaran e44104b001 add InputGraph functionality
llvm-svn: 188958
2013-08-21 22:57:10 +00:00
Hans Wennborg 04632f1f16 [PECOFF] Handle "--" option explicitly
This used to be handled automagically by the option parsing library,
but after LLVM r188314, we should handle it ourselves.

No functionality change, but adds a test.

llvm-svn: 188318
2013-08-13 21:44:44 +00:00
Rui Ueyama 0ca149fce9 Rename TargetInfo -> LinkingContext.
Also change some local variable names: "ti" -> "context" and
"_targetInfo" -> "_context".

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

llvm-svn: 187823
2013-08-06 22:31:59 +00:00
Rui Ueyama 3adc09e9fc Revert "[PECOFF][Driver] Remove quotes from command line arguments."
This reverts commit r187390 because we should not handle argv's quotes ourselves.

In Windows, unlike Unix, quotes are not processed by the shell. Instead the C
startup routine parses it as described in
http://msdn.microsoft.com/en-us/library/a1y7w461.aspx and pass the results to
main(). So, at the time when the control reaches main(), quotes that should be
removed has already been removed.

We still need to handle quotes in the response file and in .drectve section
ourselves. That will be addressed in different patches.

llvm-svn: 187534
2013-07-31 22:13:15 +00:00
Rui Ueyama 85cd10ffa0 [PECOFF][Driver] Remove quotes from command line arguments.
The command line option in .drectve section may be quoted by double
quotes, and if that's the case we have to remove them.

llvm-svn: 187390
2013-07-29 23:32:22 +00:00
Rui Ueyama 28084dc6cd [PECOFF][Driver] Add ".lib" extension to the path given with /defaultlib.
llvm-svn: 187259
2013-07-26 22:22:26 +00:00
Rui Ueyama 3e0bbb4b02 [PECOFF][Driver] Add a library file even if it does not exist.
Missing files will be reported as errors in the later pass, so this patch
does not change the behavior of the LLD linker, but it helps writing unit
tests for the driver.

llvm-svn: 187256
2013-07-26 22:17:08 +00:00
Rui Ueyama 9dcbf8b3f6 [PECOFF][Driver] Fix a bug that -mllvm does not take any arguments.
llvm-svn: 187243
2013-07-26 20:54:36 +00:00
Rui Ueyama f84d3d6187 Remove trailing whitespace.
llvm-svn: 187216
2013-07-26 17:08:12 +00:00
Rui Ueyama dc6983ca13 [PECOFF][Driver] Add /nologo command line option.
llvm-svn: 187162
2013-07-25 22:46:49 +00:00
Rui Ueyama 1e3e8752a8 [PECOFF] Add /failifmismatch option.
llvm-svn: 187095
2013-07-25 01:23:50 +00:00
Rui Ueyama d1d116aa89 [PECOFF] Use Windows style options instead of Unix style as primary options.
LLD still accepts both Unix and Windows style options when it's run as
link.exe. This patch does not change functionality.

llvm-svn: 187086
2013-07-24 23:18:02 +00:00
Rui Ueyama fd50283c3c [PECOFF] Add /include command line option.
The /include command line option is equivalent to Unix --undefined
option, which forces the linker to resolve the given symbol name
as if it's an unresolved symbol in one of its input files. This feature
is used to link an additional object file or a shared library that no
input files refer to.

llvm-svn: 187084
2013-07-24 22:53:23 +00:00
Rui Ueyama a59c5ac16f Avoid using C-style cast and remove unnecessary LL prefix.
llvm-svn: 186960
2013-07-23 17:25:25 +00:00
Rui Ueyama fbf5763708 [PECOFF] Support -tsaware:no command line option.
llvm-svn: 186957
2013-07-23 17:17:19 +00:00
Rui Ueyama 6a41fca856 [PECOFF] Support -fixed command line option to disable base relocations.
llvm-svn: 186911
2013-07-23 01:29:50 +00:00
Rui Ueyama 5443cba6d9 Fix -Wsign-compare warnings.
llvm-svn: 186884
2013-07-22 22:21:39 +00:00
Rui Ueyama 6c655f237e [PECOFF][Driver] Show error message if no input file is given.
llvm-svn: 186882
2013-07-22 22:17:24 +00:00
Rui Ueyama 8e6c8f850d [PECOFF][Driver] Add -base command line option.
llvm-svn: 186739
2013-07-20 00:45:00 +00:00
Rui Ueyama 9f24922bd1 [PECOFF][Driver] Add -libpath command line option.
The logic to search a library from the library paths will be implemented
in a different patch.

llvm-svn: 186644
2013-07-19 01:38:49 +00:00
Nick Kledzik a20a403c1d Check the return value from parse()
llvm-svn: 186630
2013-07-18 23:47:22 +00:00
Nick Kledzik a121053471 Add support for -all_load. Enhance DarwinLdDriverTest unit test test cases to test all options parsed so far
llvm-svn: 186626
2013-07-18 23:13:13 +00:00
Rafael Espindola c97d83dd3b Fix the build with clang and libstdc++4.7.
llvm-svn: 186451
2013-07-16 20:18:13 +00:00
Nick Kledzik 2a709eaa83 Fix Driver tests to check return value of parse(), simplify subclassing, and remove unneeded instance variables
llvm-svn: 186440
2013-07-16 18:45:57 +00:00
Rui Ueyama b0b1d590ab [WinLink] Add /LargeAddressAware command line option.
llvm-svn: 186428
2013-07-16 17:20:38 +00:00
Rui Ueyama cb1c8cce46 Fix broken unittest for GnuLDDriver.
llvm-svn: 186427
2013-07-16 17:17:01 +00:00
Rui Ueyama 4a4079e839 [WinLink] Support /nxcompat command line option.
llvm-svn: 184050
2013-06-16 03:07:08 +00:00
Rui Ueyama 9f56df8e43 [Darwin][Driver] Add unit tests.
llvm-svn: 183806
2013-06-11 23:07:43 +00:00
Rui Ueyama daadcc59ad [WinLink] Add -force command line option to allow undefined symbols.
llvm-svn: 183724
2013-06-11 04:52:14 +00:00
Rui Ueyama 9dd08d912d [PECOFF][Driver] Add -heap command line option.
llvm-svn: 183622
2013-06-08 22:59:10 +00:00
Rui Ueyama eb0cc96e4b [PECOFF][Driver] Add -stack command line option.
llvm-svn: 183604
2013-06-08 03:59:00 +00:00
Rui Ueyama 739730e299 [WinLink][Driver] Add -entry command line option.
llvm-svn: 183034
2013-05-31 19:34:29 +00:00
Rui Ueyama ce42bcc304 [WinLink][Driver] Add support for -subsystem optional OS version number.
llvm-svn: 182988
2013-05-31 06:30:10 +00:00
Rui Ueyama d752c9cc89 Fix typo in file header.
llvm-svn: 182985
2013-05-31 04:46:44 +00:00
Rui Ueyama 7eb1d49a58 [Driver] Add unit tests for GnuLdDriver.
llvm-svn: 182980
2013-05-31 02:12:34 +00:00
Rui Ueyama a21397fb01 [WinLink] Add a test for Windows-style command line options.
llvm-svn: 182971
2013-05-30 23:29:28 +00:00
Rui Ueyama 5f037590de [lld][WinLink] Fix use-after-return and add unit tests.
llvm-svn: 182970
2013-05-30 23:17:58 +00:00
Michael J. Spencer 1eb3b89d92 [Core] Add parallel infrastructure to lld.
Uses ConcRT and PPL on Windows.

llvm-svn: 179397
2013-04-12 18:40:39 +00:00
Michael J. Spencer dfe85483d5 [Driver] Fix symlinked universal driver behavior and add a test.
llvm-svn: 178798
2013-04-04 22:04:16 +00:00
Michael J. Spencer 8af48f3864 [Core] Use LLVM's ErrorOr<T>.
llvm-svn: 172993
2013-01-20 21:27:05 +00:00
Michael J. Spencer aa3aa570dc [Core] Add iterator ranges.
This is based on code by Jeffrey Yasskin. It has been modified to compile
with MSVC and reformated to LLVM style.

llvm-svn: 172512
2013-01-15 06:55:25 +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