Commit Graph

1031 Commits

Author SHA1 Message Date
Rui Ueyama 5c2ed5f154 Delete unused constructor.
llvm-svn: 194364
2013-11-11 05:03:31 +00:00
Shankar Easwaran 29ffee7af9 [cleanup] remove readFile and replace with getBuffer.
no functionality change.

llvm-svn: 194360
2013-11-11 02:13:30 +00:00
Shankar Easwaran ba470fa875 [InputGraph] remove unused functions.
llvm-svn: 194359
2013-11-11 01:03:49 +00:00
Rui Ueyama 78d1acb3af [ELF] Un-break undef-from-main-dso.test on MSVC 2012.
The result of sizeof(SymbolTable<ELFT>::SymbolEntry) in DynamicSymbolTable
<ELFT>::write() was different from the same expression in RelocationTable
<ELFT>::write(), although the same template parameters were passed. They were
40 and 32, respectively. As a result, the same vector was treated as a
vector of 40 byte values in some places and a vector of 32 values in other
places. That caused an weird issue, resulting in collapse of the rela.dyn
section.

I suspect that this is a padding size calculation bug in MSVC 2012, but I
may be wrong. Reordering the fields to eliminate padding seems to fix the
issue.

llvm-svn: 194349
2013-11-10 07:48:33 +00:00
Rui Ueyama 980c6d518e Remove empty namespace.
llvm-svn: 194322
2013-11-09 05:57:20 +00:00
Nick Kledzik 00a15d9428 [mach-o] Use LEB128 stuff from llvm/Support. No functionality change.
llvm-svn: 194305
2013-11-09 01:00:51 +00:00
Nick Kledzik 29f749eef8 [mach-o] reduce duplicate source code by using a templated method. No functionality change.
llvm-svn: 194299
2013-11-09 00:07:28 +00:00
Nick Kledzik 1b30228994 [mach-o] revert gunk added to test cases to debug build bot failures
llvm-svn: 194292
2013-11-08 23:18:51 +00:00
Nick Kledzik 705cbc1733 [mach-o] fix uninitialized variable
llvm-svn: 194290
2013-11-08 23:00:26 +00:00
Nick Kledzik 5eb9bfc863 [mach-o] add debugging to help explain one build bot failure
llvm-svn: 194280
2013-11-08 21:43:28 +00:00
Michael J. Spencer b8ab9f52ca Add explictly exported atoms and export R_*_COPY'ed atoms.
llvm-svn: 194278
2013-11-08 21:04:20 +00:00
Nick Kledzik d0784941fe [mach-o] fix memory ownership in test case
llvm-svn: 194187
2013-11-07 02:56:53 +00:00
Nick Kledzik 3c686e3561 add debug logging to help figure out why some tests fail on some build bots
llvm-svn: 194186
2013-11-07 01:27:47 +00:00
Nick Kledzik 471c00cfcb Hopefully fix latent bug where lldCore dependency on lldYAML was not in CMake files
llvm-svn: 194177
2013-11-06 22:56:42 +00:00
Nick Kledzik f3e89cb802 [mach-o] fix EXPECT_EQ types
llvm-svn: 194173
2013-11-06 22:20:56 +00:00
Nick Kledzik 020fa7f080 [mach-o] add llvm_unreachable
llvm-svn: 194172
2013-11-06 22:18:09 +00:00
Nick Kledzik 020a49c95d [mach-o] fix DEBUG_WITH_TYPE to compile without warnings in non-debug case
llvm-svn: 194171
2013-11-06 21:57:52 +00:00
Nick Kledzik 143b5e8237 [mach-o] make unspecifiedPageZeroSize const to fix VC++ error
llvm-svn: 194169
2013-11-06 21:47:37 +00:00
Nick Kledzik e34182f396 [mach-o] binary reader and writer
This patch adds support for converting normalized mach-o to and from binary
mach-o. It also changes WriterMachO (which previously directly wrote a 
mach-o binary given a set of Atoms) to instead do it in two steps. The first 
step uses normalizedFromAtoms() to convert Atoms to normalized mach-o, and the
second step uses writeBinary() which to generate the mach-o binary file.  

llvm-svn: 194167
2013-11-06 21:36:55 +00:00
Nick Kledzik 3df8104eee rename local variable to avoid shadowing warning
llvm-svn: 194166
2013-11-06 21:30:15 +00:00
Rui Ueyama 41b99dce59 [PECOFF] Rename getSectionAlignment -> getSectionDefaultAlignment.
These fields are for /align option. Section alignment can be set per-section
basis with /section option too. In order to avoid name conflicts, rename the
existing identifiers to become more specific. No functionality change.

llvm-svn: 194160
2013-11-06 19:30:14 +00:00
Rui Ueyama 108b371373 [PECOFF] Add /section option.
/section command line option is to set/reset attributes of the Characteristics
field in the section header. You can set non-default values with this option.
You can make .data section executable with this, for example.

This patch implements the parser of the command line option. The code to use
the parsed values will be committed in a separate patch.

llvm-svn: 194133
2013-11-06 07:31:55 +00:00
Rui Ueyama 67b277c34f [PECOFF] Make /disallowlib an alias for /nodefaultlib.
I'm not sure if it is really an alias for /nodefaultlib, but I can say that
they are at least similar. Making it an alias would be better than ignoring it.

llvm-svn: 194131
2013-11-06 05:48:45 +00:00
Rui Ueyama 589276cd25 [PECOFF] Do not expose _noDefaultLibs. No functionality change.
llvm-svn: 194130
2013-11-06 05:17:00 +00:00
Rui Ueyama 249c7b335e [PECOFF] Do not add the same library to the input graph more than once.
/defaultlib options can be specified implicitly via the .drectve section, and
it's pretty common that multiple object files add the same library, such as
user32.lib, to the input. We shouldn't add the same library multiple times.

llvm-svn: 194129
2013-11-06 05:13:20 +00:00
Rui Ueyama e1c30a4e04 Undef a local macro after use.
llvm-svn: 194128
2013-11-06 04:47:19 +00:00
Rui Ueyama d213a9ed3c [PECOFF] Do not wrap the linker internal file with an archive file.
We wrapped the linker internal file with a virtual archive file, so that the
linker internal file was linked only when it's actually used. This was to avoid
__ImageBase being included to the resulting executable. __ImageBase used to
occupy four bytes when emitted to executable.

And then it turned out that the implementation of __ImageBase was wrong -- it
shouldn't have been a regular atom but an absolute atom. Absolute atoms point
to some memory location, but they don't occupy disk space themselves. So it
wouldn't increase executable size (except the symbol table.) That means that
it's OK to link the linker internal file unconditionally.

So this patch does that, removing the wrapper archive file. Doing this
simplifies the code.

llvm-svn: 194127
2013-11-06 04:30:55 +00:00
Rui Ueyama c13f43f4f9 [PECOFF] Ignore /disallowlib.
msvcrt.lib contains "/disallowlib" command line option in its .drectve section.
I couldn't spot any documentation for the option. Ignore it for now so that we
can link the library without error.

llvm-svn: 194114
2013-11-06 00:44:10 +00:00
Rui Ueyama 7e77a294dc [PECOFF] Report error if there's unknown flag in .drectve
Errors in .drectve section were silently ignored. This patch fixes the issue.

llvm-svn: 194110
2013-11-05 23:53:15 +00:00
Rui Ueyama aa1335990f Remove extraneous parentheses.
llvm-svn: 194089
2013-11-05 18:43:10 +00:00
Rui Ueyama c1800beb55 Remove unnecessary namespace qualifier.
llvm-svn: 194037
2013-11-05 01:37:40 +00:00
Rafael Espindola 75c2ae9664 Replace ErrorOr<void> with error_code.
It was never transporting any value in addition to the error_code.

llvm-svn: 194028
2013-11-05 00:09:36 +00:00
Simon Atanasyan 8ef39b53e5 [ELF] Fix typo in the expression calculates an absolute atom offset.
Patch reviewed by Shankar Easwaran.

llvm-svn: 194010
2013-11-04 19:40:02 +00:00
Rui Ueyama 5efbc6379e [PECOFF] Fix the test to run.
llvm-svn: 194003
2013-11-04 19:01:57 +00:00
Rui Ueyama f23b27a837 [PECOFF] Add a test for the resource file.
llvm-svn: 193982
2013-11-04 05:17:54 +00:00
Rui Ueyama 2c717faa19 [ELF] Allow colons in the path.
This patch should fix the test when it runs on Windows, by allowing drive
letter separator (colon) in the path. Now all LLD ELF tests passed on MSVC
2012 32-bit. Hooray!

llvm-svn: 193978
2013-11-04 04:30:37 +00:00
Rui Ueyama 1c392a5611 [ELF] Simplify SectionTable::getSymbolTableIndex. No functionality change.
MSVC 2012 raises an error in the lambda passed to vector::find_if, while it
seems valid code. Rewrote without high-order functions.

llvm-svn: 193975
2013-11-04 03:24:14 +00:00
Rui Ueyama 0a5802a260 [ELF] Add missing -target option.
llvm-svn: 193974
2013-11-04 03:08:55 +00:00
Rafael Espindola 3c4739cc11 Update test now that llvm-nm prints the correct value.
llvm-svn: 193913
2013-11-02 05:21:29 +00:00
Rui Ueyama 329211bbb7 [ELF] One more file for missing -target option.
llvm-svn: 193911
2013-11-02 03:55:51 +00:00
Rui Ueyama 2ccdfb219d [ELF] Add missing -target options.
These tests assume that the created objects are for x86_64. These tests
failed on non-x86_64 environments, such as 32 bit Windows.

llvm-svn: 193910
2013-11-02 03:50:03 +00:00
Rui Ueyama d19d0bc5d2 [MachO] Fix uninitialized field bug found on Windows.
n_desc field in MachO string table was not initialized. On Unix,
test/darwin/hello-world.objtxt did not fail because I think an nlist object
is always allocated to a fresh heap initialized with zeros. On Windows,
uninitialized fields are filled with 0xCC when compiled with /GZ. Because
of that the test was failing on Windows.

llvm-svn: 193909
2013-11-02 03:35:45 +00:00
Rui Ueyama e4aaa335dd Single-quotes to quote parentheses.
On Windows, neither "(" nor ")" are shell special characters, so -\( is passed
as-is to LLD. Because of that this test was failing on Windows.

llvm-svn: 193905
2013-11-02 02:07:37 +00:00
Rui Ueyama 9625b5435b Fix test on 32 bit.
This patch adds "-target x86_64" to the command line. Without this option,
a 32 bit object file would be created on 32 bit machine, resulting in test
failure.

llvm-svn: 193904
2013-11-02 01:55:42 +00:00
Rui Ueyama 450f422b49 [PECOFF] Remove unnecessary assertion.
Bugs that would be caught by this assertion would also be caught by
RoundTripYAMLPass test. We've enabled the pass for PECOFF, so we can remove
this.

llvm-svn: 193886
2013-11-01 21:11:43 +00:00
Rui Ueyama aa5b4dc868 Remove duplicate calls of pm.add() for RoundTrip tests.
llvm-svn: 193885
2013-11-01 21:05:42 +00:00
Rui Ueyama c74157ca30 Remove redundant std::move().
llvm-svn: 193883
2013-11-01 20:40:33 +00:00
Rui Ueyama 31e44e964d Whitespace
llvm-svn: 193882
2013-11-01 19:54:29 +00:00
Rui Ueyama c9752fa66d [PECOFF] Enable RoundTrip{YAML,Native}Pass.
llvm-svn: 193881
2013-11-01 19:52:37 +00:00
Rui Ueyama 1d1debf126 [PECOFF] Change data directory atom structure.
The data directory in the PE/COFF header consisted of list of data directory
atoms. This patch changes it -- now there's only one data directory entry that
contains former data directories. That's easier to handle in the writer as well
as to write to/read from YAML/Native files. The main purpose of this refactoring
is to enable RoundTrip tests for PE/COFF.

There's no functionality change.

llvm-svn: 193854
2013-11-01 05:51:15 +00:00