Commit Graph

858 Commits

Author SHA1 Message Date
Shankar Easwaran bafdf7be83 [lld][Darwin] Fix unused field warning.
This field would eventually be used.

llvm-svn: 192084
2013-10-07 03:18:33 +00:00
Shankar Easwaran 18318e32a9 [lld][inputgraph] Fix build failure on Darwin/Windows
llvm-svn: 192083
2013-10-07 03:06:04 +00:00
Shankar Easwaran d8ce00360d [lld] Add FileArchive
Fix adding a missed file in the previous commit.

llvm-svn: 192082
2013-10-07 02:55:42 +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
Michael J. Spencer d419dbcc48 [ELF] Fix uninitalized value.
llvm-svn: 191924
2013-10-03 19:25:34 +00:00
Michael J. Spencer cf80ed03bc [Core] Fix unstable sort for unordered atoms.
llvm-svn: 191867
2013-10-03 01:26:48 +00:00
Michael J. Spencer c80f88a94e [Core] Fix heap overflow in LayoutPass.
Found this with asan. Code assumes that find doesn't return end, thus if
both atoms didn't have followon roots it would still compare their positions.

llvm-svn: 191865
2013-10-02 23:21:07 +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
Rui Ueyama e9d2396c88 Add a comment to ReaderCOFF::parseFile.
llvm-svn: 191583
2013-09-27 22:55:25 +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 053d9313f2 Re-submit [PECOFF] Add a test for the import table.
llvm-svn: 191580
2013-09-27 22:48:06 +00:00
Michael J. Spencer 102f82a74e [ELF] Handle copy relocations for PC32.
This will eventually need to be refactored to better handle COPY relocations,
as other relocations can also generate them. I'm not yet sure the exact
circumstances in which they are needed yet.

llvm-svn: 191567
2013-09-27 21:30:27 +00:00
Michael J. Spencer 3b36473007 [ELF] Mark STT_GNU_IFUNC symbols as code.
llvm-svn: 191566
2013-09-27 21:30:04 +00:00
Rui Ueyama a7ec3898d6 Revert "[PECOFF] Add a test for the import table."
This reverts r191469 because the original patch this one depends on (r191472)
was reverted.

llvm-svn: 191479
2013-09-27 01:26:53 +00:00
Rui Ueyama 9eb1432a99 [PECOFF] Add a test for the import table.
llvm-svn: 191475
2013-09-27 00:56:37 +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
Michael J. Spencer 32a3f9ee29 [ELF] Add COPY relocations.
llvm-svn: 191467
2013-09-26 22:09:16 +00:00
Michael J. Spencer 4355bb9d22 [Core] Add type and size to SharedLibraryAtom.
llvm-svn: 191466
2013-09-26 22:08:43 +00:00
Michael J. Spencer 4d628347b1 [ELF] Fix use after free.
llvm-svn: 191403
2013-09-25 22:12:14 +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 27c88dab08 [PECOFF] Fix /? option and add a test for the flag.
llvm-svn: 191320
2013-09-24 17:59:30 +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 ad54b049ef Expand auto to improve code readability.
llvm-svn: 191272
2013-09-24 03:44:19 +00:00
Rui Ueyama b7297d695e [PECOFF] Use macro for the repeating pattern of the Driver code.
llvm-svn: 191271
2013-09-24 03:37:56 +00:00
Rui Ueyama a7bcad4613 [PECOFF] Remove redundant comments.
llvm-svn: 191270
2013-09-24 03:37:53 +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 2721aa4065 [PECOFF] Simplify WinLinkOptions.td.
llvm-svn: 191223
2013-09-23 20:36:39 +00:00
Rui Ueyama 724d75b2c8 [PECOFF] Add one more test for r191218
llvm-svn: 191221
2013-09-23 20:24:12 +00:00
Ron Ofir b7d3e6b76b [lld][PECOFF] Fix data directory entry RVA of base relocations section
Summary:
This patch changes WriterPECOFF to actually write down the address instead of ignoring it.
Also, it changes the order of adding the BaseReloc chunk as otherwise the address wasn't set yet.

I think a better way of doing it would be to change DataDirectoryAtom to create a Reference
instead of using a number, and to change IdataPass accordingly, but I'm not sure how to do that.

Reviewers: ruiu

Reviewed By: ruiu

CC: llvm-commits

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

llvm-svn: 191220
2013-09-23 20:21:24 +00:00
Rui Ueyama 9149181ae9 [PECOFF] Add /align command line option.
llvm-svn: 191218
2013-09-23 19:52:35 +00:00
Rui Ueyama c532036aeb Whitespace and extra parentheses.
llvm-svn: 191217
2013-09-23 19:52:31 +00:00
Ron Ofir 41dcb848a7 [lld][PECOFF] Calculate SizeOfHeaders field instead of using a hard-coded value
Summary: This patch changes WritePECOFF to calculate the value of the SizeOfHeaders PE header field instead of just using 512.

Reviewers: rui314, ruiu

Reviewed By: ruiu

CC: llvm-commits, ruiu

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

llvm-svn: 191212
2013-09-23 18:08:51 +00:00
Shankar Easwaran e67ba51791 [lld][ELF] Remove invalid comment
llvm-svn: 191207
2013-09-23 16:28:23 +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
Ron Ofir 5403eaecc0 [lld][WinLink] Fix typo
llvm-svn: 191079
2013-09-20 09:13:53 +00:00
Rui Ueyama eb0434e9ae Fallback to the default stringize function to show some meaningful error message.
GNU LD driver only understood no_such_file_or_directory error and was showing
just "Unknown Error" for any other type of error. With this patch, the driver
now prints file name and error message string by default.

llvm-svn: 191070
2013-09-20 03:32:27 +00:00
Rui Ueyama 391ffdf70e Generalize errStr() function so that it can handle any type of errors.
llvm-svn: 191069
2013-09-20 03:18:58 +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 9f5f635e7f Remove extraneous parentheses.
llvm-svn: 191061
2013-09-20 00:33:34 +00:00