Commit Graph

608 Commits

Author SHA1 Message Date
Nick Kledzik 196d7a77a3 fix typo in error string
llvm-svn: 186996
2013-07-23 22:17:47 +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 d991c50273 [PECOFF] Replace magic numbers with offsetof().
llvm-svn: 186888
2013-07-22 23:02:08 +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 9e69e06cae Rename ReaderCOFF members to follow the LLD coding style.
llvm-svn: 186843
2013-07-22 16:56:34 +00:00
Rui Ueyama 2125da5a0f [PECOFF] Fix use-after-free.
llvm-svn: 186771
2013-07-20 21:00:47 +00:00
Nick Kledzik 91a85457e9 [mach-o] factor out all cputype <-> arch conversions to one table driven location
llvm-svn: 186755
2013-07-20 02:08:23 +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 99f80cf4a7 [PECOFF][Driver] Process "LINK" environment variable.
llvm-svn: 186654
2013-07-19 05:06:20 +00:00
Rui Ueyama 64b29d616b [PECOFF][Driver] Add -defaultlib command line option.
llvm-svn: 186650
2013-07-19 04:11:37 +00:00
Rui Ueyama 5a7bbce587 [PECOFF][Driver] Interpret "LIB" environment variable.
llvm-svn: 186648
2013-07-19 03:27:03 +00:00
Rui Ueyama 2897feb7e0 [PECOFF] Use library search path when looking for a .lib file.
llvm-svn: 186645
2013-07-19 02:18:25 +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 762ae82d57 Add -help option to Darwin Driver. Use grouping in Options table to better format help output
llvm-svn: 186640
2013-07-19 01:02: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
Rui Ueyama 4227022673 [PECOFF] Use replace_extension() instead of doing it myself.
llvm-svn: 186612
2013-07-18 21:38:44 +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
Rafael Espindola 63f699d2b9 Update for llvm API change.
llvm-svn: 186450
2013-07-16 19:44:30 +00:00
Nick Kledzik 4f44eff707 build lld unittests as part of lld-test target
llvm-svn: 186441
2013-07-16 18:46:48 +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 8f7ddf733b [PECOFF][Writer] Replace magic numbers with sizeof().
This is a follow up patch for r186336.

Reviewers: LegalizeAdulthood

CC: silvas, llvm-commits

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

llvm-svn: 186384
2013-07-16 06:21:39 +00:00
Rui Ueyama 5590373024 [PECOFF][Writer] Use defined constants instead of magic numbers.
llvm-svn: 186382
2013-07-16 04:47:02 +00:00
Rui Ueyama aa0307021d [PECOFF] Add default argument to addDir32NBReloc() as the default value 0 is reasonable.
llvm-svn: 186368
2013-07-16 00:03:51 +00:00
Rafael Espindola 66c0a65ba1 Revert "Don't pass llvm::errs() all over the place. Diagnostics always go to stderr."
This reverts commit 185657. It will be used by unit tests.

llvm-svn: 186366
2013-07-15 23:55:07 +00:00
Rui Ueyama eb1e1ace85 [PECOFF][Writer] Follow up patch for r186336.
- Make a const reference instead of copying an object
- Fix a comment

llvm-svn: 186355
2013-07-15 22:20:10 +00:00
Rui Ueyama e6be3d5505 [PECOFF][Writer] s/dyn_cast/cast/ where we don't expect null return value.
llvm-svn: 186353
2013-07-15 22:15:32 +00:00
Rui Ueyama 49a2394095 [PECOFF][Writer] Refactoring: Move private methods below public ones.
llvm-svn: 186352
2013-07-15 21:35:15 +00:00
Rui Ueyama 8ac2ec4043 [PECOFF] Fix comment.
llvm-svn: 186346
2013-07-15 21:00:53 +00:00
Rui Ueyama 341a2b4b5d [PECOFF][Writer] Emit .reloc section.
Emit .reloc section. This is the first step to support DLL creation. The
executable doesn't need .reloc section, but the DLL does.

Reviewers: Bigcheese

CC: llvm-commits

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

llvm-svn: 186336
2013-07-15 18:43:01 +00:00
Rui Ueyama c8a53795ab [PECOFF] Support linking against DLL.
This patch adds a new pass, IdataPass, to transform shared atom references
to real references and to construct the .idata section data. With this patch
lld can produce a working Hello World program by linking it against
kernel32.dll and user32.dll.

Reviewers: Bigcheese

CC: llvm-commits

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

llvm-svn: 186071
2013-07-11 08:46:21 +00:00
Rui Ueyama a3635b7b3b [PECOFF][Writer] Fixed a bug that an empty section is emit to the section header.
llvm-svn: 186066
2013-07-11 05:43:38 +00:00
Rui Ueyama cf68e2a1b1 [PECOFF][Writer] Compute the size of a chunk each time it's added rather than all at once.
Contents of ".reloc" section depends on the addresses of other sections, so
the section cannot be created until all the other sections are created and get
their memory addresses (RVAs). That means that computation of section size
needs to be at least two pass.

Techynically there's no reason to compute it all at once, but instead we can
compute the address of a section as added to the output file. Doing so helps
us to create ".reloc" section.

llvm-svn: 185902
2013-07-09 04:44:18 +00:00
Rui Ueyama d54264c007 Remove redundant #include.
llvm-svn: 185803
2013-07-08 09:39:22 +00:00
Rui Ueyama d769cec6e3 [PECOFF] Use yaml2obj to avoid checking in binary files.
llvm-svn: 185690
2013-07-05 10:41:44 +00:00
Rafael Espindola 305ac7ebe6 Add 'not' to command lines that are expected to fail.
llvm-svn: 185658
2013-07-04 17:08:11 +00:00
Rafael Espindola 2530f67116 Don't pass llvm::errs() all over the place. Diagnostics always go to stderr.
llvm-svn: 185657
2013-07-04 17:06:04 +00:00
Rafael Espindola 611db946c2 Return 0 when processing --help. This matches gnu ld and gold.
llvm-svn: 185655
2013-07-04 16:50:47 +00:00
Rui Ueyama 130a6eb7fa Try to guard a test that requires DEBUG().
This is a follow-up patch for r185524. Being assert enabled does not mean
that DEBUG() is enabled, so we need to check the existence of DEBUG() itself.

llvm-svn: 185619
2013-07-04 09:29:47 +00:00
Rui Ueyama 4eca75df00 [PECOFF][Writer] Fix SizeOfImage header. It should include the first unmapped page.
llvm-svn: 185534
2013-07-03 12:55:56 +00:00
Rui Ueyama 924922235e Guard a test that fails on a Release build.
llvm-svn: 185524
2013-07-03 09:09:13 +00:00
Rui Ueyama 18c67a158b [PECOFF][Writer] Separate AtomChunk from SectionChunk.
The optional data directory header contains addresses to some atoms such
as the import address table in data section. Such fields can naturally
be set by relocation if we make the optional data driectory as an atom.

Currently we assume that atoms are always in a section, so we can't create
a file header with atoms. This patch separates section chunk from atom
chunk, to allow atom-based file header.

llvm-svn: 185521
2013-07-03 08:15:00 +00:00
Rui Ueyama 6c7ac57235 Add "explicit" to ctors where appropriate.
llvm-svn: 185517
2013-07-03 07:32:40 +00:00
Rui Ueyama afa4844d94 [PECOFF] Handle hint field in Hint/Name table in the import library.
A hint is an index of the export pointer table in a DLL, at which
PE/COFF loader starts looking for a symbol name. The import library
comes with hints and symbol pairs, and as long as hints are in sync
with the actual symbol table in DLL, the symbols will be resolved
quickly. So, we shouldn't ignore hints but propagate them to an output.

llvm-svn: 185516
2013-07-03 06:09:33 +00:00
Rui Ueyama 4b862775ea [PECOFF][Writer] Simplifies the COFFBaseDefinedAtom ctor by defining a new class.
llvm-svn: 185515
2013-07-03 05:44:09 +00:00