Commit Graph

1534 Commits

Author SHA1 Message Date
Rui Ueyama 69a6f0e79a [PECOFF] Avoid C-style cast.
llvm-svn: 204855
2014-03-26 21:10:40 +00:00
Rui Ueyama 9e8ac37d89 [PECOFF] Use RAII object for mutex.
llvm-svn: 204853
2014-03-26 21:08:17 +00:00
Rui Ueyama 664afe94a6 [PECOFF] Use std::mutex.
Use <mutex> instead of "llvm/Support/Mutex.h".

Also change the type of mutex for the context object to recursive mutex, as
the driver could acquire the lock recursively. E.g. If file A has .drectve
section containing /defaultlib:B, the driver tries to parse file B, and if
file B has .drectve section, the driver acquires the lock again.

llvm-svn: 204850
2014-03-26 20:20:53 +00:00
Shankar Easwaran 7ac2a3df64 [core] add SectionGroup support
Review : http://llvm-reviews.chandlerc.com/D3182

llvm-svn: 204830
2014-03-26 16:37:13 +00:00
Michael J. Spencer 876bee8155 [lit] Environment variables get stripped in lit. Manually specify locale.
llvm-svn: 204774
2014-03-26 01:19:07 +00:00
Michael J. Spencer a4f983e258 [lit] Python 3.
llvm-svn: 204773
2014-03-26 00:53:48 +00:00
Rui Ueyama ad386648b8 Remove safeguard from RoundTripYAML pass.
RoundTripYAML pass is removed from the regular execution pass in r204296,
so the safeguard to protect it from OOM error is no longer needed, because
we are sure that the pass is only used for tests, and test files are all
small.

We also want to see RoundTripYAML pass to fail in tests if it fails,
rather than silently skipping failing tests.

llvm-svn: 204772
2014-03-26 00:21:11 +00:00
Rui Ueyama 85093df3bd [PECOFF] Print out command line if we have expanded response files.
If a response file is given via command line, the final command line
arguments will not appear in the log because the actual arguments are
in the given file.

This patch is to show the final command line if /verbose is specified
to help users.

llvm-svn: 204754
2014-03-25 20:40:27 +00:00
Simon Atanasyan e3df81f3ab [Mips] Fix formatting.
llvm-svn: 204607
2014-03-24 14:12:37 +00:00
Simon Atanasyan 1ebfb22638 [Mips] Sort R_MIPS_LO16 / R_MIPS_HI16 / R_MIPS_GOT16 before finding
pairs and calculate AHL addend.

llvm-svn: 204606
2014-03-24 14:09:17 +00:00
Rafael Espindola 016d69d29f Update for llvm change.
llvm-svn: 204585
2014-03-24 05:00:40 +00:00
Simon Atanasyan 6690854109 [Mips] Make the test to be a bit more relaxed to lld YAML output.
llvm-svn: 204541
2014-03-22 06:20:38 +00:00
Rui Ueyama c9411c3357 Use early continues to reduce nesting.
llvm-svn: 204523
2014-03-21 21:46:49 +00:00
Rui Ueyama 83ba74fa3f [PECOFF] Rename link.exe -> lld-link.exe.
Creating the file "link.exe" made some confusion, so it's better to
name it lld-link.exe, as we did for CL (clang-cl.exe).

llvm-svn: 204509
2014-03-21 20:41:48 +00:00
Simon Atanasyan b752d6e18b [Mips] Emit LA25 MIPS stubs to call pic code from non-pic routines.
llvm-svn: 204503
2014-03-21 19:08:02 +00:00
Simon Atanasyan 13985964f4 [Mips] Fix source code formatting. No functional changes.
llvm-svn: 204472
2014-03-21 15:29:07 +00:00
Rui Ueyama b4c358fab8 [PECOFF] Fix possible response file buffer overrun.
Response file is not NUL terminated, so when creating a StringRef for
the buffer contents, we need to pass the buffer size as well as the
pointer pointing to the buffer.

llvm-svn: 204420
2014-03-21 00:48:26 +00:00
Simon Atanasyan 134a8a6311 [Mips] Reduce the number of 'const' casts.
llvm-svn: 204355
2014-03-20 16:26:25 +00:00
Simon Atanasyan df0d62a7cb [Mips] Join two for loops over defined atoms into the single one.
llvm-svn: 204354
2014-03-20 16:26:15 +00:00
Simon Atanasyan 7b571f4ee0 [Mips] Remove the dead code.
llvm-svn: 204353
2014-03-20 16:26:07 +00:00
Simon Atanasyan c452d4f89f [Mips] Remove unused member function argument.
llvm-svn: 204352
2014-03-20 16:25:58 +00:00
Rui Ueyama 6d500da3cc Revert "[ELF] Order DT_NEEDED entries by command line order."
This reverts commit r204291 because it broke buildbots.

llvm-svn: 204317
2014-03-20 06:57:28 +00:00
Rui Ueyama bc6b52e68e Move RoundTrip tests behind LLVM_RUN_ROUNDTRIP_TEST env flag.
If the environment variable is defined and not empty, RoundTrip tests
are run. The reason to move the tests behind the flag is because they
are too slow to enable by default.

LLD linking time on llvm-tblgen improved from 2m7s to 2.3s. About 60x
faster now in this case.

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

llvm-svn: 204296
2014-03-20 02:49:33 +00:00
Michael J. Spencer 05c152b5d1 [gnu-ld] Support -m on non-NetBSD targets.
llvm-svn: 204293
2014-03-20 01:28:36 +00:00
Michael J. Spencer deefb10fd6 [ELF] Order DT_NEEDED entries by command line order.
With this all test-suite tests pass with lld on x86-64 Linux.

llvm-svn: 204291
2014-03-20 01:28:23 +00:00
Rui Ueyama 5f56e9d6cb [PECOFF] Fix parallel read bug.
InputElement::parse() may recursively call WinLinkDriver::parse() to handle
.drectve section contents, and if /defaultlib option exists in the section,
the driver will mutate the input graph to add a new input file to the graph.
So the access to input graph needs to be protected with mutext.

llvm-svn: 204285
2014-03-20 00:06:04 +00:00
Simon Atanasyan 4c5316d0b0 [Mips] Make the test temporary file names self-explanatory.
llvm-svn: 204259
2014-03-19 19:45:59 +00:00
Simon Atanasyan 6210b2ef6b [Mips] Remove unused function.
llvm-svn: 204248
2014-03-19 16:05:32 +00:00
Simon Atanasyan e29132d427 [Mips] Fix handling of R_MIPS_GOT16 relocation and building local part
of GOT.
 * Read addend for R_MIPS_GOT16 relocation.
 * Put only high 16 bits of symbol + addend into GOT entries for
   locally visible symbols.

llvm-svn: 204247
2014-03-19 15:46:25 +00:00
Simon Atanasyan b1ba018ed2 [Mips] Handle R_MIPS_GOT16 relocation for external and local symbols in
a uniform way.

llvm-svn: 204246
2014-03-19 15:46:15 +00:00
Simon Atanasyan 49fa6a41f4 [Mips] Factor out the code creates GOT entry atoms into the two
functions. The first one is for local GOT entries. The second one is for
global GOT entries.

llvm-svn: 204245
2014-03-19 15:46:07 +00:00
Simon Atanasyan a7b553efd1 [Mips] Add 'const' qualifier to the function.
llvm-svn: 204244
2014-03-19 15:46:00 +00:00
Simon Atanasyan c1b62ea310 [Mips] Move AHL addends calculation to the RelocationPass class.
llvm-svn: 204243
2014-03-19 15:45:55 +00:00
Simon Atanasyan d8259fbcc3 [Mips] Move RelocationPass class member function definitions out of the
class.

llvm-svn: 204242
2014-03-19 15:45:49 +00:00
Simon Atanasyan e7e8b26f93 Remove extra semicolon for -Wpedantic.
llvm-svn: 204224
2014-03-19 11:06:07 +00:00
Simon Atanasyan 0edb4bbb4b [PECOFF] Fix -Wsign-compare warning.
llvm-svn: 204223
2014-03-19 11:06:01 +00:00
Simon Atanasyan 0e202224a3 [ELF] Remove unused fields (linking context references).
llvm-svn: 204222
2014-03-19 11:05:55 +00:00
Simon Atanasyan b665ce2c27 Fix warning 'enumeral and non-enumeral type in conditional expression'.
llvm-svn: 204221
2014-03-19 11:05:47 +00:00
Alexey Samsonov 8e6829e436 Remove extra semicolon for -Wpedantic
llvm-svn: 204219
2014-03-19 09:38:31 +00:00
David Majnemer 14b11022b4 [PECOFF] Use richer ways of describing auxiliary symbols
Update all of the unit tests to use the new format.

This depends on D3092.

Reviewers: ruiu

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

llvm-svn: 204215
2014-03-19 04:55:14 +00:00
Rui Ueyama 7ad72ebc5e [PECOFF] Support yet another new type of weak symbol.
COMDAT_SELECT_LARGEST is a COMDAT type that make linker to choose the largest
definition from among all of the definition of a symbol. If the size is the
same, the choice is arbitrary.

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

llvm-svn: 204172
2014-03-18 19:37:50 +00:00
Alexey Samsonov 67dc3e9538 Fix lld build
llvm-svn: 204122
2014-03-18 07:24:10 +00:00
Rui Ueyama a7236598bb [PECOFF] Data type of SectionNumber is now unsigned (r203986).
So we don't need static_cast's to convert it from signed to unsigned.

llvm-svn: 203992
2014-03-15 00:39:12 +00:00
Rui Ueyama 39aa6af23f Remove redundant "virtual" keyword.
llvm-svn: 203903
2014-03-14 07:10:43 +00:00
Rui Ueyama 74af50134b [PECOFF] Handle large objects having more than 32768 sections.
The COFF spec says that the SectionNumber field in the symbol table is 16 bit
signed type, but MSVC treats the field as if it is unsigned.

llvm-svn: 203901
2014-03-14 07:04:01 +00:00
Rui Ueyama aca3c7c6f4 [PECOFF] Fix link order.
LLD fails to link symbol "_main" if the symbol is in a library file and
the library file is given as a bare argument (i.e. not with /defaultlib
option). It's because library files given as bare arguments are processed
before other libraries given with /defaultlib, so when Linker finds msvcrtd
needs a definition for "_main", the file providing the main function has
already been processed and skipped. Linker don't revisit libraries if it's
not given with /defaultlib.

To fix it this patch change the way of command line handling; files end with
".lib" are treated as if they are given with /defaultlib. I don't believe
it's 100% correct behavior but it's better than before.

llvm-svn: 203892
2014-03-14 05:59:16 +00:00
Rui Ueyama ebffa9b4be [PECOFF] Fix arguments passed to lib.exe.
llvm-svn: 203891
2014-03-14 05:04:08 +00:00
Rui Ueyama 516273ba99 [PECOFF] Make WinLinkDriver::parse() and allocate*() functions thread-safe.
Looks like a major cause of instability on Windows is this thread-safety bug.

llvm-svn: 203889
2014-03-14 04:28:38 +00:00
Rui Ueyama f88731f293 [PECOFF] Implement /lib option.
This option is not documented and seems weird, but yeah we need it anyway.

llvm-svn: 203884
2014-03-14 03:06:55 +00:00
Rui Ueyama f020bf7468 [PECOFF] Add one more test for r203875.
This is to make sure that the Windows-style command line tokenizer is
working as expected.

llvm-svn: 203877
2014-03-14 00:44:17 +00:00