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
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
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
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
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
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
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
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
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
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
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
If the driver finds a command line option in the form of "@filename", the
option will be replaced with the content of the given file. It's an error
if a response file cannot be read.
llvm-svn: 203875
This results in some simplifications to the code where an OwningPtr had to
be used with the previous api and then ownership moved to a unique_ptr for
the rest of lld.
llvm-svn: 203809
An object whose machine type header value is unknown looks a bit odd but
is valid. If an object contains only machine-type-independent data, you
can leave the type field unspecified. Some files in oldname.lib are such
object files.
llvm-svn: 203752
Clang creates "clang-cl" as a symlink to (or a copy of) "clang" for the MSVC-
compatible driver. This patch is to do the same thing for "link" and "lld".
Differential Revision: http://llvm-reviews.chandlerc.com/D3066
llvm-svn: 203751
MergeCases table should not have an entry for MergeContents because atoms with
MergeContents attribute should never have name. This issue was not caught by a
test because getting a value of 6th element of an array of array actually gets
the first element's value of the next array, and that happened to be a valid
value. Added asserts to catch that error.
llvm-svn: 203322
Summary:
COMDAT_SELECT_SAME_SIZE is a COMDAT type that I presume exist only in COFF.
The semantics of the type is that linker should merge such COMDAT sections if
their sizes are the same. Otherwise it's an error.
Reviewers: Bigcheese, shankarke, kledzik
CC: llvm-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D2996
llvm-svn: 203308
Just like x86 exception handler table, the table for x64 needs to be sorted
so that runtime can binary search on it. Unlike x86, the table entry for x64
has multiple fields, and they need to be sorted according to its BeginAddress
field. This patch also fixes a bug in relocations.
llvm-svn: 202874
C++11. I'm not sure that this is a good idea, but I know some crazy
folks on the core working group who like to live dangerously, and they
should still be able to build LLD. =D
llvm-svn: 202568
It looks like the contents of the table need to be sorted according to its
value, so that the runtime can find the entry by binary search. I'm not 100%
sure if we really have to do that, but at least I can say it's safe to do
because the contents of .sxdata is just a list of exception handlers' RVAs.
llvm-svn: 202550