Commit Graph

588 Commits

Author SHA1 Message Date
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
Rui Ueyama 2fa2a727bb Removed unused friend declaration.
llvm-svn: 185420
2013-07-02 11:13:43 +00:00
Rui Ueyama 9319db2ce9 [PECOFF][Writer] Set SizeOfInitializedData file header.
llvm-svn: 185310
2013-07-01 08:06:48 +00:00
Rui Ueyama 60c7481654 [PECOFF][Writer] Add setter methods that sets the import address table location to file header.
llvm-svn: 185309
2013-07-01 07:59:17 +00:00
Rui Ueyama da513290de [PECOFF][Writer] Do not emit the empty section as Windows loader rejects such executable.
llvm-svn: 185308
2013-07-01 07:32:12 +00:00
Rui Ueyama 8ebfad76bc [PECOFF][Writer] Amend the comment about DLL linking.
llvm-svn: 185307
2013-07-01 07:25:30 +00:00
Rui Ueyama 39a2c197cf [PECOFF][Writer] Fix buildbot failure on x86_64-win7.
llvm-svn: 185285
2013-06-30 14:14:44 +00:00
Rui Ueyama 7d4720e5cd [PECOFF][Reader] Create a jump table for functions exported by DLL.
llvm-svn: 185283
2013-06-30 13:33:36 +00:00
Rui Ueyama 3628b6a7c6 Move a function into assert() so that GCC won't complain that the
function is not used in release build.

llvm-svn: 185248
2013-06-29 04:28:51 +00:00
Rui Ueyama 3bad6dd278 Remove extra ';'
llvm-svn: 185247
2013-06-29 04:28:44 +00:00
Rui Ueyama e9dd5f98cf [PECOFF][Writer] Fix wrong section header.
llvm-svn: 185205
2013-06-28 20:10:36 +00:00
Rui Ueyama 95609be563 [PECOFF][Writer] Remove duplicated code by moving it to parent class.
llvm-svn: 185200
2013-06-28 19:59:54 +00:00
Rui Ueyama e5fdfdc07b [PECOFF][Writer] Define COFFBaseDefinedAtom as the base class of COFF defined atoms.
In order to support linking against DLL, the linker needs to create defined
atoms for jump tables and etc. Because such atoms are not read from a file,
they lack some information such as an ordinal. With this patch, COFFDefinedAtom
is split into two classes; one is the base class of all COFF defined atoms, and
another is a concrete class for atoms read from file. More classes inheriting
COFFBaseDefinedAtom will be added for jump tables and etc.

llvm-svn: 185195
2013-06-28 19:08:57 +00:00
Rui Ueyama 0a00836bb7 Add include guard.
llvm-svn: 185134
2013-06-28 04:52:40 +00:00
Rui Ueyama 11ccc91f0a [PECOFF][Writer] Support DIR32NB and REL32 relocation types.
llvm-svn: 185133
2013-06-28 04:40:52 +00:00
Rui Ueyama 4251055a66 [PECOFF][Writer] Fix a bug that the contents of .data and .rdata were swapped.
llvm-svn: 185130
2013-06-28 04:15:37 +00:00
Rui Ueyama fed750ff3b [PECOFF][Writer] Skip ".debug$S" section in the input object file.
llvm-svn: 185129
2013-06-28 04:06:49 +00:00
Rui Ueyama d059f360a3 [PECOFF][Writer] Use a constant instead of a magic number.
llvm-svn: 185128
2013-06-28 03:52:41 +00:00
Rui Ueyama 1a54aad50b [PECOFF][Writer] Templatize connectAtomsWithLayoutEdge()
Templatize connectAtomsWithLayoutEdge() so that it can handle other types of
defined atoms.

llvm-svn: 185125
2013-06-28 03:41:07 +00:00
Rui Ueyama ee8b55d6a8 [PECOFF][Writer] Fix DLLCharacteristic flag in image header.
llvm-svn: 185102
2013-06-27 21:03:44 +00:00
Shankar Easwaran 2302bd5568 [lld] rename member variable name.
This renames variable name to reflect initial undefined symbols that are
defined by the linker -u option.

This doesnot change any functionality in lld, and updates code to reflect
Nick's comment.

llvm-svn: 184682
2013-06-24 03:22:51 +00:00