Commit Graph

981 Commits

Author SHA1 Message Date
Rui Ueyama 39233f252b [PECOFF] File extension is case-insensitive on Windows.
llvm-svn: 193797
2013-10-31 20:06:48 +00:00
Rui Ueyama bad4565be0 Revert "[PECOFF] Add atoms to the PassManager file"
This reverts commit r193479.

The atoms are already added to the file, so re-adding them caused the YAML
writer to write the same atoms twice. That made the YAML reader to fail with
"duplicate atom name" error.

This is not the only error we've got for RoundTripYAMLPass for PECOFF, so we
cannot enable the test yet. More fixes will come.

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

llvm-svn: 193762
2013-10-31 16:59:49 +00:00
Rui Ueyama 7a1ac04fe2 Use StringRef::startswith_lower().
llvm-svn: 193712
2013-10-30 20:33:51 +00:00
Michael J. Spencer 5fbce5bd56 [ELF] Implement minimal support for .eh_frame_hdr.
llvm-svn: 193662
2013-10-30 00:02:04 +00:00
Rui Ueyama 5c8d4dd73f [PECOFF] Suppress startup message of background processes.
llvm-svn: 193646
2013-10-29 19:52:44 +00:00
Shankar Easwaran b1ffd99b6a [FileToMutable] Garbage collect unused private member
llvm-svn: 193588
2013-10-29 05:33:52 +00:00
Shankar Easwaran 51bfb820cc [test] Fix a test failure, this test is only applicable in debug mode
llvm-svn: 193586
2013-10-29 05:26:49 +00:00
Shankar Easwaran 2bc24928d3 [PassManager] add ReaderWriter{Native,YAML} to the Driver.
Enable this for the following flavors

a) core
b) gnu
c) darwin

Its disabled for the flavor PECOFF. Convenient markers are added with FIXME
comments in the Driver that would be removed and code removed from each flavor.

llvm-svn: 193585
2013-10-29 05:12:14 +00:00
Rui Ueyama 3aca58f135 Fix spelling.
llvm-svn: 193584
2013-10-29 04:54:50 +00:00
Rui Ueyama 90173df289 [PECOFF] Fix __ImageBase symbol.
__ImageBase is an absolute symbol whose address is the same as the image base
address. What we did before this patch was to create __ImageBase symbol as a
symbol whose *contents* (not location) is the image base address, which is
clearly wrong.

llvm-svn: 193565
2013-10-29 00:33:34 +00:00
Rui Ueyama 6ecc4383fb Fix comment.
llvm-svn: 193557
2013-10-28 23:34:41 +00:00
Rui Ueyama 446cc3cc58 [PECOFF] Set section name for BSS atoms.
This change has no effect now, but will be needed to emit BSS atoms
to .bss section.

llvm-svn: 193556
2013-10-28 23:26:33 +00:00
Nick Kledzik 58ea44993b [MachO] pointer align linker generated (non)lazy pointers
llvm-svn: 193551
2013-10-28 22:48:33 +00:00
Chandler Carruth 9204c8319d Rather than rendering an argument to a std::string (which is primarily
intended for debugging and diagnostic output), just inspect the spelling
to check for specific prefixes in drectve section flags.

In addition to being significantly cheaper and not relying on
a debugging interface, this also avoids creating a temporary string and
binding it to StringRef variable. We then went on to access it after the
memory had been deallocated.

This bug too was caught by ASan. I love ASan so much. =]

llvm-svn: 193487
2013-10-27 00:10:43 +00:00
Chandler Carruth 50e5b3298c Use equals_lower() rather than creating a temporary string with lower().
More important than any performance concerns, the code was dropping the
temporary string on the floor after assigning it to a StringRef, and
then used the StringRef later. Caught by running the LLD tests under
ASan.

llvm-svn: 193486
2013-10-26 23:53:06 +00:00
Shankar Easwaran fe0b80b321 [ELF][test] Remove default section names for known contentTypes.
llvm-svn: 193483
2013-10-26 19:38:42 +00:00
Shankar Easwaran 6775518254 [ELF] Fix RO/RW note sections.
llvm-svn: 193482
2013-10-26 19:38:39 +00:00
Shankar Easwaran b0022c00a3 [X86_64] Fix the atom that need to be exported.
llvm-svn: 193481
2013-10-26 19:38:37 +00:00
Shankar Easwaran 5afd25dcac [X86] Add more relocation types.
llvm-svn: 193480
2013-10-26 19:38:35 +00:00
Shankar Easwaran 8ad2dee6d6 [PECOFF] Add atoms to the PassManager file
llvm-svn: 193479
2013-10-26 19:38:33 +00:00
Shankar Easwaran 53bae6fa66 [PECOFF] Add COFF relocations to encode/decode to/from YAML files
llvm-svn: 193478
2013-10-26 19:38:31 +00:00
Shankar Easwaran 3176d61332 [PECOFF] Add dataDirectoryEntry as a recognized ContentType
llvm-svn: 193477
2013-10-26 19:38:29 +00:00
Shankar Easwaran 3cbcd28119 [Darwin] Fix Reference to nullptr.
On discussing this with Nick, it looks like the StubAtoms
that contain a lazyImmediate reference kind should be null
and the location needs to be fixed up later with some value
that is an offset into the __LINKEDIT segment.

The drawback is that it allows yaml files with references
that expect a target to be considered without one.

This results in bad yaml files that would need to be handled
in the YAML Reader.

Inorder to fix this, the Stub Atoms use a dummy target such
as itself.

llvm-svn: 193476
2013-10-26 19:38:26 +00:00
Rui Ueyama 863931c990 [PECOFF] Parse /merge command line option.
/merge:<from>=<to> option makes the linker to combine "from" section to "to"
section. This patch is to parse the option. The actual feature will be
implemented in a subsequent patch.

llvm-svn: 193454
2013-10-26 00:46:57 +00:00
Michael J. Spencer 707f591fa0 [ELF] Implement .{init,fini}_array ordering.
llvm-svn: 193451
2013-10-25 23:59:06 +00:00
Rui Ueyama 8870301763 [PECOFF] Fix use-after-return.
llvm-svn: 193446
2013-10-25 22:59:40 +00:00
Rui Ueyama 1b64561013 [PECOFF] Fix XML output bug.
We really need a test for the manifest file output, but because it depends
on external commands (CVTRES.EXE and RC.EXE), it's not very easy to write it.

llvm-svn: 193445
2013-10-25 22:36:21 +00:00
Rui Ueyama b96752ad96 [PECOFF] Do not create a temporary std::string.
llvm-svn: 193444
2013-10-25 22:31:56 +00:00
Rui Ueyama a694171f34 Make sure the string is NUL-terminated.
The internal byte array of the SmallString filled by createTemporaryFile() is
not guaranteed to be NUL-terminated. We need to call c_str() to handle it
safely.

llvm-svn: 193442
2013-10-25 22:19:54 +00:00
Rui Ueyama edc9a2036f Fix spelling.
llvm-svn: 193440
2013-10-25 21:52:34 +00:00
Rui Ueyama 89d4681b81 Put missing license header.
llvm-svn: 193435
2013-10-25 20:58:12 +00:00
Rui Ueyama d334b1a326 [PECOFF] Fix doublequote escaping.
llvm-svn: 193424
2013-10-25 18:12:51 +00:00
Rui Ueyama af8cc282ab [PECOFF] Output error message to diagnostics.
llvm-svn: 193387
2013-10-25 00:58:44 +00:00
Rui Ueyama 0145c56306 [PECOFF] Handle edge case where no section alignment is specified.
llvm-svn: 193385
2013-10-25 00:54:13 +00:00
Rui Ueyama 7616ab4960 Concatenate strings at compile time.
llvm-svn: 193384
2013-10-25 00:12:09 +00:00
Michael J. Spencer 28c7a21b29 [ELF] Refactor x86-64 relocation pass.
This renames the GOTPLTPass to RelocationPass and refactors it to better
represent the different types of relocations.

llvm-svn: 193379
2013-10-24 22:46:48 +00:00
Rui Ueyama 5d32d96f91 [PECOFF] Fix spelling in manifest XML.
llvm-svn: 193375
2013-10-24 22:08:19 +00:00
Michael J. Spencer 2fd6c7d91c [ELF][x86-64] Generate PLT for R_*_32S relocs.
llvm-svn: 193369
2013-10-24 21:00:25 +00:00
Rui Ueyama 671c8013ed Revert "r193300 - [PassManager] add ReaderWriter{Native, YAML} to the Driver"
The patch have completely broken COFF port and disabled many tests.
This also reverts r193302 (comment fix).

llvm-svn: 193362
2013-10-24 18:22:16 +00:00
Shankar Easwaran 986730303f Fix Comments.
llvm-svn: 193302
2013-10-24 04:28:14 +00:00
Shankar Easwaran d772d8a928 [Driver] Change UniversalDriver to use TD file.
Easier to add new options such as -version, and easy to parse.

Now displays a help message with -help

llvm-svn: 193301
2013-10-24 04:23:02 +00:00
Shankar Easwaran 89c2d8faca [PassManager] add ReaderWriter{Native,YAML} to the Driver.
Disable tests to be run with REQUIRES: disable. Note disable is not added to the
config by the test runner Mkaefiles, so essentially disables the test.

Code changes would be required to fix these tests :-

test/darwin/hello-world.objtxt
test/elf/check.test
test/elf/phdr.test
test/elf/ppc.test
test/elf/undef-from-main-dso.test
test/elf/X86_64/note-sections-ro_plus_rw.test
test/pecoff/alignment.test
test/pecoff/base-reloc.test
test/pecoff/bss-section.test
test/pecoff/drectve.test
test/pecoff/dynamic.test
test/pecoff/dynamicbase.test
test/pecoff/entry.test
test/pecoff/hello.test
test/pecoff/imagebase.test
test/pecoff/importlib.test
test/pecoff/lib.test
test/pecoff/multi.test
test/pecoff/reloc.test
test/pecoff/weak-external.test

llvm-svn: 193300
2013-10-24 03:30:03 +00:00
Rui Ueyama b32b95d814 [PECOFF] Support embedding resource file into executable.
Instead of making the linker to create a manifest XML file in the same
directory as the resulting binary, you can embed the XML as a part of
resource into the executable.

In order to do that, the linker first creates a resource script file containing
the XML file, compile it into a binary resource file with RC.EXE, and then
convert it to a COFF file with CVTRES.EXE.

llvm-svn: 193298
2013-10-24 01:39:43 +00:00
Rui Ueyama 99d7013ef2 Run layout-transitivity test only when debugging is enabled.
Because it depends on "-mllvm -debug" flag, the test fails in Release build.

llvm-svn: 193271
2013-10-23 21:15:48 +00:00
Rui Ueyama 1e6d8ac59b Remove unused variable.
llvm-svn: 193266
2013-10-23 20:31:55 +00:00
Rui Ueyama c05fa0beab Disable layout-transitivity test on FreeBSD for now.
llvm-svn: 193259
2013-10-23 18:22:26 +00:00
Rui Ueyama 5beafa8b9f [PECOFF] Resource file extension is .res, not .rc.
This patch won't change LLD's behavior because it's a temporary file and
LLD does not use the file extension to determine file type. But using the
correct file extension is a good thing.

llvm-svn: 193211
2013-10-22 23:58:38 +00:00
Rui Ueyama af589f70d0 [PECOFF] Emit the side-by-side manifest file.
llvm-svn: 193207
2013-10-22 22:58:07 +00:00
Rui Ueyama 9041c3bd5b [PECOFF] Add /manifestdependency command line option.
llvm-svn: 193201
2013-10-22 21:39:04 +00:00
Rui Ueyama 9a02765bc3 [PECOFF] Add /manifestfile command line option.
/manifestfile:<path> specifies an alternative manifest file output path.
Default is "<output-path>.manifest" where <output-path> is the executable's
path.

llvm-svn: 193195
2013-10-22 20:53:07 +00:00