Commit Graph

539 Commits

Author SHA1 Message Date
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
Rui Ueyama 7be81b2b4d [PECOFF] Moves a utility function to Atoms.cpp to remove duplicate code.
llvm-svn: 184653
2013-06-22 23:14:51 +00:00
Rui Ueyama f8455fab3f Fix unused field warning.
llvm-svn: 184651
2013-06-22 22:12:30 +00:00
Rui Ueyama 829c6e6f41 [PECOFF] Removed unnecessary namespace qualifier.
llvm-svn: 184649
2013-06-22 22:01:54 +00:00
Rui Ueyama 7b7b0b9f7d Removed unnecessary "class" keyword.
llvm-svn: 184589
2013-06-21 19:59:15 +00:00
Rui Ueyama bf402d6643 Removed unnecessary "class" keyword.
llvm-svn: 184585
2013-06-21 19:30:16 +00:00
Rui Ueyama 55fc544e65 Fix typo in include guard.
llvm-svn: 184521
2013-06-21 02:29:54 +00:00
Shankar Easwaran 89488966bd [TargetInfo] Undefined symbols move from ELFTargetInfo to TargetInfo
This change moves the functionality of undefinedSymbols that were created in
ELFTargetInfo into TargetInfo. Looks like MachO/Windows use similiar options
like in ELF for creating undefined symbols when the linker is invoked.

Address comment from Ruiu.

(No change in functionality, except moving the functionality from ELF to
TargetInfo, so that multiple architectures can use the same)

llvm-svn: 184398
2013-06-20 04:27:21 +00:00
Rui Ueyama 991f42c35f [PECOFF] Add a pass to ensure the correct ordering of grouped sections.
Reviewers: shankarke

CC: llvm-commits

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

llvm-svn: 184327
2013-06-19 17:46:57 +00:00
Shankar Easwaran 53caafebdb [ELF] add -u/--undefined option, to define undefined symbols
llvm-svn: 184266
2013-06-19 00:31:09 +00:00
Rui Ueyama 4d654dd7b8 [PECOFF] Extract atom definitions as Atoms.h so that we can use them in other files.
Extract atom definitions as Atoms.h so that we can use them in other files.
Also applied clang-format to Atoms.h.

Reviewers: shankarke

CC: llvm-commits

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

llvm-svn: 184124
2013-06-17 21:19:07 +00:00
Rui Ueyama b24241bae3 [PECOFF] Implement the reader for the import library.
This is the first patch toward full DLL support. With this patch, lld can
read .lib file for a DLL.

Reviewers: Bigcheese

CC: llvm-commits

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

llvm-svn: 184101
2013-06-17 18:43:13 +00:00
Rui Ueyama c444241e41 [Passes][GOT] Split perform() into small predicate functions for readability sake.
Reviewers: shankarke

CC: llvm-commits

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

llvm-svn: 184091
2013-06-17 17:29:46 +00:00
Rui Ueyama d95a155af6 [PECOFF] Connect defined atoms with layout before/after edges.
Reviewers: shankarke

CC: llvm-commits

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

llvm-svn: 184085
2013-06-17 16:59:54 +00:00
Shankar Easwaran f91031efcf [ELF] Add more sections to the default section map.
This change adds functionality to add more sections like .gcc_except_table,
.data.rel.local, .data.rel.ro into the default section map, so that they are
all merged into appropriate output sections.

This also makes c++ static binaries comparable to what you get with the default
linker.

Adds a test for testing the functionality.

llvm-svn: 184071
2013-06-17 02:29:36 +00:00
Rui Ueyama 8d10164326 [lld][PECOFF] Support IMAGE_REL_I386_DIR32 relocation.
With this patch, it can now resolve relocations in the same output file.
"Hello world" program does not still work because call to the DLL routine
is not supported yet.

Reviewers: Bigcheese

CC: llvm-commits

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

llvm-svn: 184063
2013-06-16 17:25:17 +00:00
Rui Ueyama c26eabe32b [lld] Move AtomLayout from ELF to Core so that it can be used by non-ELF writers.
Summary: I'm planning to use AtomLayout in WriterPECOFF.

Reviewers: Bigcheese

CC: llvm-commits

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

llvm-svn: 184062
2013-06-16 17:25:14 +00:00
Rui Ueyama e96044a370 [lld] Move AtomLayout from ELF to ReaderWriter so that it can be used by non-ELF writers.
Reviewers: Bigcheese

CC: llvm-commits

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

llvm-svn: 184061
2013-06-16 17:14:58 +00:00
Shankar Easwaran a97f12e00a [ELF] Add test so that _end value is set appropriately for NMAGIC/OMAGIC executables(Fix comment from espindola)
llvm-svn: 184060
2013-06-16 15:06:18 +00:00
Benjamin Kramer 2b004debde Fix typo in comment. Found by -Wdocumentation.
llvm-svn: 184058
2013-06-16 11:09:47 +00:00
Shankar Easwaran a42a473893 [ELF] add NMAGIC/OMAGIC support
llvm-svn: 184055
2013-06-16 05:06:28 +00:00
Rui Ueyama 4a4079e839 [WinLink] Support /nxcompat command line option.
llvm-svn: 184050
2013-06-16 03:07:08 +00:00
Rui Ueyama 3b0321c182 [PECOFF] Add a test for r184036.
llvm-svn: 184037
2013-06-15 05:20:05 +00:00
Rui Ueyama b95e833278 [PECOFF] Support .lib archive file.
Archive file in Windows has file extension of ".lib" but the file format is
in fact the same as Unix. It's an ar archive holding multiple .obj files.
The existing archive reader can read .lib files.

llvm-svn: 184036
2013-06-15 05:15:41 +00:00
Rui Ueyama 779a714766 [PECOFF] Handle scope of absolute atom correctly.
llvm-svn: 184035
2013-06-15 05:04:07 +00:00
Rui Ueyama 642c1a2968 [PECOFF] Fix build error on Win64.
llvm-svn: 183965
2013-06-14 02:43:30 +00:00
Rui Ueyama ef2c5413a9 [lld][PECOFF] Read relocation entries.
Summary:
COFFReference class is defined to represent relocation information for
COFFDefinedAtom, as ELFReference for ELFDefinedAtom. ReaderCOFF can now
read relocation entries and create COFFReferences accordingly.

I need to make WriterPECOFF to handle the relocation references created by
the reader, but this patch is already big, so I think it's probably better
to get it reviewed now.

Reviewers: Bigcheese

CC: llvm-commits

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

llvm-svn: 183964
2013-06-14 02:30:34 +00:00
Rui Ueyama 78a617f4c1 [PECOFF] Make readSymbolTable a const function.
llvm-svn: 183887
2013-06-13 05:23:47 +00:00
Rui Ueyama 8338716e8d [ARM] Remove isThumb() as it's not used and it's not in the right place.
Architecture specific code should reside in architecture specific directory
not in Atom. Looks like there are no efforts being made at this moment to
support ARM, so let's remove it for now.

Reviewers: Bigcheese

CC: llvm-commits

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

llvm-svn: 183877
2013-06-13 00:26:16 +00:00
Rui Ueyama cc14c02f7f [PECOFF] Define constants for page size and disk sector size.
llvm-svn: 183876
2013-06-12 23:45:32 +00:00
Rui Ueyama 2e3c4025ae [PECOFF] Rename basic.test -> trivial.test.
Because the test does not actually cover basic features.

llvm-svn: 183870
2013-06-12 22:19:05 +00:00
Rui Ueyama 0e17c37c57 [PECOFF] Test for r183705.
llvm-svn: 183853
2013-06-12 19:13:27 +00:00
Rui Ueyama 969e70265a [ELF] Remove unused parameter from ELFReference c'tor.
Reviewers: shankarke

CC: llvm-commits

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

llvm-svn: 183850
2013-06-12 18:21:36 +00:00
Shankar Easwaran ec36f9a734 [test] fix test as the atom name is available only in DEBUG mode
llvm-svn: 183819
2013-06-12 00:46:37 +00:00
Shankar Easwaran 08470c4b6b [ELF][X86_64] Create GOT entries for external TLS symbols properly without Segfaults.
llvm-svn: 183817
2013-06-12 00:32:39 +00:00
Shankar Easwaran 79dbc5b5d1 [ELF] NMAGIC support : Find the BSS section to setup the virtual address of _end.
llvm-svn: 183816
2013-06-12 00:32:35 +00:00
Shankar Easwaran d5ff08ca5f [ELF] TBSS section has to be special cased so that it doesnot occupy memory space
llvm-svn: 183815
2013-06-12 00:32:32 +00:00
Rui Ueyama 9f56df8e43 [Darwin][Driver] Add unit tests.
llvm-svn: 183806
2013-06-11 23:07:43 +00:00
Rafael Espindola 70d0c820ef Include Path.h instead of PathV2.h.
I am about to move PathV2.h to Path.h.

llvm-svn: 183796
2013-06-11 22:17:04 +00:00
Rui Ueyama dd76f067f7 [PECOFF][Writer] Structure of pe32_header was changed.
Change for http://llvm-reviews.chandlerc.com/D952

Reviewers: Bigcheese

CC: llvm-commits

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

llvm-svn: 183789
2013-06-11 21:39:58 +00:00
Rafael Espindola 2fa59a9330 Convert another use of sys::identifyFileType.
No functionality change.

llvm-svn: 183762
2013-06-11 18:12:28 +00:00
Rafael Espindola c1b32686fe Factor duplicated yamlReader creation.
The yaml reader is not specific to any file format. This patch moves
it to TargetInfo and makes validate a non virtual interface so that it
can be constructed from a single location.

The same method will be used to create a reader for llvm bitcode
files.

llvm-svn: 183740
2013-06-11 12:36:05 +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 fe36b40019 [PECOFF] Refactoring: Split FileCOFF c'tor. No functionality change.
Split FileCOFF's constructor into mainly two private methods.
One method is responsible to iterate over symbol tables, and other
method is to atomize defined atoms. This is for readability and
no changes in functionality.

Reviewers: Bigcheese

CC: llvm-commits

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

llvm-svn: 183708
2013-06-10 22:57:49 +00:00
Rui Ueyama 787ee4e099 [PECOFF][Writer] Set required OS version numbers.
llvm-svn: 183705
2013-06-10 22:25:41 +00:00
Rui Ueyama b07cebffb2 [PECOFF] Add comments for symbols.
llvm-svn: 183700
2013-06-10 22:09:21 +00:00
Rui Ueyama e3ee514aa7 [ELF] Refactor File.h.
- Split createAtom() in lib/ReaderWriter/ELF/File.h into small methods.
 - Added comments to code in other methods.

No functionality changes.

Reviewers: shankarke

CC: llvm-commits

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

llvm-svn: 183696
2013-06-10 21:32:44 +00:00
Rafael Espindola 808dfba985 Use the StringRef version of identifyFileType.
llvm-svn: 183670
2013-06-10 15:36:21 +00:00
Rafael Espindola 4cdc6c14ed Use early returns.
No functionality change.

llvm-svn: 183659
2013-06-10 14:27:58 +00:00
Rui Ueyama 9dd08d912d [PECOFF][Driver] Add -heap command line option.
llvm-svn: 183622
2013-06-08 22:59:10 +00:00