Commit Graph

518 Commits

Author SHA1 Message Date
Rui Ueyama bf4ddeb97c Style fix.
llvm-svn: 288113
2016-11-29 04:22:57 +00:00
Rui Ueyama c910bc7e19 Simplify "missing argument" error message.
llvm-svn: 288112
2016-11-29 04:17:31 +00:00
Rui Ueyama e5e407beb4 Add comments.
llvm-svn: 288111
2016-11-29 04:17:30 +00:00
Rui Ueyama bd2a812ff0 Print error message header in red.
llvm-svn: 288110
2016-11-29 04:09:08 +00:00
Rui Ueyama bf9523f549 [COFF] Add DebugInfoCodeView dependency
rL287555 introduces a link error when building with BUILD_SHARED_LIBS:

  undefined reference to llvm::codeview::CVSymbolDumper::dump(),
  and more...

The functions are available in libDebugInfoCodeView, from LLVM.

Patch by Visoiu Mistrih Francis!

llvm-svn: 287837
2016-11-23 22:58:25 +00:00
Rui Ueyama 24625fd9b2 Dump not only type records but symbol records.
llvm-svn: 287723
2016-11-22 23:51:34 +00:00
Rui Ueyama be939b3ff6 Do plumbing work for CodeView debug info.
Previously, we discarded .debug$ sections. This patch adds them to
files so that PDB.cpp can access them.

This patch also adds a debug option, /dumppdb, to dump debug info
fed to createPDB so that we can verify that valid data has been passed.

llvm-svn: 287555
2016-11-21 17:22:35 +00:00
Chris Bieneman aeb30257c5 [CMake] NFC. Updating CMake dependency specifications
This patch updates a couple places where add_dependencies was being explicitly called to add dependencies on intrinsics_gen to instead use the DEPENDS named parameter. This cleanup is needed for a patch I'm working on to add a dependency debugging mode to the build system.

llvm-svn: 287205
2016-11-17 04:36:35 +00:00
Rui Ueyama c91f716643 PDB: Add "* Linker *" module.
The added module contains nothing, but it is still useful as a test
to ensure that we are emitting modules that can be read back.

llvm-svn: 287071
2016-11-16 01:10:46 +00:00
Rui Ueyama c3dcf99441 [COFF] Fix manifest resource file creation on Windows.
createManifestRes was generating a MemoryBuffer from a TemporaryFile,
keeping the data but removing the file, before passing the file path
to CVTRES.exe, leading to the following error:

  CVTRES : fatal error CVT1101: cannot open 'C:\Users\user\AppData\
  Local\Temp\lld-output-resource-bfee19.res' for reading

With this, we instead create a new TemporaryFile before passing it to cvtres.

Patch from Rudy Pons!

llvm-svn: 287034
2016-11-15 21:25:20 +00:00
Rui Ueyama f83806a8ad Identify object files compiled with cl.exe /GL.
Object files compiled with cl.exe /GL contain intermediate code for LTO.
We can't (and don't want to) interpret such code, but we should print
out a user-friendly error message.

Differential Revision: https://reviews.llvm.org/D26647

llvm-svn: 286921
2016-11-15 01:01:51 +00:00
Vitaly Buka 4cf112c6f2 Fix heap-use-after-free coff::createPDB
Summary:
getInputSections returns std::vector by value and ArrayRef
pointed to destroyed temporarily.

Reviewers: ruiu

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D26630

llvm-svn: 286880
2016-11-14 20:21:41 +00:00
Rui Ueyama 09e0b5f2c9 Emit Section Contributions.
Differential Revision: https://reviews.llvm.org/D26211

llvm-svn: 286684
2016-11-12 00:00:51 +00:00
Mehdi Amini c1edf566b9 Prevent at compile time converting from Error::success() to Expected<T>
This would trigger an assertion at runtime otherwise.

Differential Revision: https://reviews.llvm.org/D26482

llvm-svn: 286562
2016-11-11 04:29:25 +00:00
Davide Italiano c520e18ce0 [lld/COFF] Don't round alignment if it's already a power-of-two.
This matches link.exe behaviour.

Differential Revision:  https://reviews.llvm.org/D26372

llvm-svn: 286553
2016-11-11 02:53:48 +00:00
Reid Kleckner f47c3bb8db Make the .idata$4 and .idata$5 import lib sections 8 bytes on x64
The MSVC linker relies on this invariant to produce a valid import
table. More ASan tests pass in a stage 2 build now. They still fail when
using LLD since there are no PDBs for the dynamic ASan runtime.

llvm-svn: 286499
2016-11-10 20:38:58 +00:00
Rui Ueyama 6294a240dc Fix -Wcast-qual warnings.
llvm-svn: 286001
2016-11-04 17:41:29 +00:00
Rui Ueyama 20df4ecf4f Re-commit r285607: Emit Section Map stream."
Removed some test fields that overspecified test conditions.

llvm-svn: 285638
2016-10-31 21:09:21 +00:00
Rui Ueyama e7b54c2ea5 Revert r285607: Emit Section Map stream.
That change broke buildbots.

llvm-svn: 285618
2016-10-31 18:50:13 +00:00
Rui Ueyama 86a1ef388b Emit Section Map stream.
This is how we use DbiStreamBuilder::addSectionMap.

Differential Revision: https://reviews.llvm.org/D26113

llvm-svn: 285607
2016-10-31 17:40:40 +00:00
Chris Bieneman 62113e854a [CMake] Add missing dependency on intrinsics_gen
COFF/InputFiles.h includes LTOModule.h which transitively relies on Attributes.inc.

llvm-svn: 284444
2016-10-18 00:50:39 +00:00
Hans Wennborg cb8f2ef644 LTO: Don't follow lazy references when seeing new definitions in the combined LTO object
Following the lazy reference might bring in an object file that depends
on bitcode files that weren't part of the LTO step.

Differential Revision: https://reviews.llvm.org/D25461

llvm-svn: 283989
2016-10-12 09:00:06 +00:00
Rui Ueyama 9f66f8277d Re-submit r283825: Add section header stream to PDB.
It was reverted because the change that depends on was reverted.
Now it was submitted as r283925, so we can submit this as well.

llvm-svn: 283926
2016-10-11 19:45:07 +00:00
Rui Ueyama 9aa4ab6f9b Revert "Add section header stream to PDB." because it depends on r283823.
The change this patch depends on was reverted.

llvm-svn: 283837
2016-10-11 01:01:40 +00:00
Rui Ueyama 55505954fe Add section header stream to PDB.
Differential Revision: https://reviews.llvm.org/D25357

llvm-svn: 283825
2016-10-10 23:44:10 +00:00
Rui Ueyama 1343fac3ca Add an empty DBI stream.
llvm-svn: 283504
2016-10-06 22:52:01 +00:00
Rui Ueyama 8d3fb5da7b Add exact number of streams for reserved stream #s.
llvm-svn: 283397
2016-10-05 22:08:58 +00:00
Rui Ueyama d381c9842b Add an empty IPI stream.
With this, "llvm-pdbdump yaml -ipi-stream" prints out an IPI stream.
Previously it crashed because it can't handle the case where IPI
stream doesn't exist.

llvm-svn: 283392
2016-10-05 21:37:25 +00:00
Mehdi Amini ec4fb5ba97 Use StringRef in StringSaver API (NFC)
llvm-svn: 283290
2016-10-05 01:32:41 +00:00
Rui Ueyama ab8e88b686 Remove unused parameter.
I do not fully understand how to use these classes yet, but
seems like these arguments are not used, since without them
all tests still pass. In order to simplify the situation,
I'll remove them now.

llvm-svn: 283174
2016-10-04 01:03:03 +00:00
Rui Ueyama c79ecdd876 Use StringSwtich::Cases for multiple choices.
llvm-svn: 282964
2016-09-30 22:01:25 +00:00
Rui Ueyama 129795497d Change for LLVM upstream change r282944.
llvm-svn: 282945
2016-09-30 20:53:45 +00:00
Rui Ueyama 5c82eeaf23 Change for LLVM change r282940.
llvm-svn: 282942
2016-09-30 20:39:04 +00:00
Martin Storsjo 63762b58c0 [COFF] Add support for IMAGE_REL_ARM_SECREL
Handle this in the exact same way as IMAGE_REL_AMD64_SECREL
and IMAGE_REL_I386_SECREL.

Differential revision: https://reviews.llvm.org/D24608

llvm-svn: 282531
2016-09-27 19:27:17 +00:00
Rui Ueyama 3e9d6bbad6 Create FileOutputBuffer lazily.
So that it is clear that FileOutputBuffer does not depend on
PDB file builder. Eventually we will have to to get the file size
info from the file builder to create a file with the exact size.
NFC.

llvm-svn: 282454
2016-09-26 23:53:55 +00:00
Rui Ueyama bb542b3f0c Partially fill Info stream with proper values.
llvm-svn: 281795
2016-09-16 22:51:17 +00:00
Ismail Donmez e7174ffcd8 Fix shared library build
llvm-svn: 281728
2016-09-16 14:10:23 +00:00
Rui Ueyama b28c6d495d Use functions in DebugInfoPDB to create dummy PDB file.
I don't think we are creating valid PDB file here,
but it is okay because we have never created valid PDBs before.

llvm-svn: 281704
2016-09-16 04:32:33 +00:00
Rui Ueyama 1d99ab3925 Create PDB.h and move code to remove unnecessary #includes.
llvm-svn: 281670
2016-09-15 22:24:51 +00:00
Rui Ueyama 7f38299919 Use SuperBlock struct defined in MSFCommon.h.
llvm-svn: 281643
2016-09-15 18:55:18 +00:00
Saleem Abdulrasool 88f6407542 COFF: make builds more reproducible
Change the way we calculate the build id to use MD5 to give reproducible build
ids. Previously we would generate random bytes for the build id GUID.

llvm-svn: 281079
2016-09-09 19:26:03 +00:00
Rui Ueyama fa12b8bd1a Remove temoprary files.
Previously, we created temporary files using llvm::sys::fs::createTemporaryFile
and removed them using llvm::FileRemover. This is error-prone as it is easy to
forget creating FileRemover instances after creating temporary files.
There is actually a temporary file leak bug.

This patch introduces a new class, TemporaryFile, to manage temporary files
in the RAII style.

Differential Revision: https://reviews.llvm.org/D24176

llvm-svn: 280510
2016-09-02 17:34:17 +00:00
Ivan Krasin 8baccc2f19 Fix UBSan bot by not passing NULL into memcpy src.
Summary:
UBSan complains like the following:
tools/lld/COFF/Writer.cpp:97:15: runtime error: null pointer passed as argument 2, which is declared to never be null

The reason is that the vector could be empty.

Reviewers: rsmith

Subscribers: Eugene.Zelenko, kcc

Differential Revision: https://reviews.llvm.org/D24050

llvm-svn: 280259
2016-08-31 17:23:05 +00:00
Saleem Abdulrasool dcbf2cbfca COFF: disambiguate make_unique (NFC)
This disambiguates `llvm::make_unqiue` and `std::make_unique` for the Windows
buildbots.

llvm-svn: 280014
2016-08-29 21:33:01 +00:00
Saleem Abdulrasool 8fcff934ba COFF: add beginnings of debug directory creation
The IMAGE_FILE_HEADER structure contains a (RVA, size) to an array of
COFF_DEBUG_DIRECTORY records. Each one of these records contains an RVA to a OMF
Debug Directory. These OMF debug directories are derived into newer types such
as PDB70, PDB20, etc. This constructs a PDB70 structure which will allow us to
associate a GUID with a build to actually tie debug information.

llvm-svn: 280012
2016-08-29 21:20:46 +00:00
Saleem Abdulrasool 9f8bc029bd COFF: hoist a local variable
Create a local variable for the rdata section.  NFC.

llvm-svn: 279407
2016-08-21 23:05:43 +00:00
Saleem Abdulrasool 15f6f6cb97 COFF: reorder the table construction
Reorder the table setup to mirror the indices corresponding to them.  This means
that the table values are filled out as per the enumeration ordering.  Doing so
makes it easier to identify a particular table.  NFC.

llvm-svn: 278199
2016-08-10 04:37:56 +00:00
Saleem Abdulrasool a2cca7e2b4 COFF: handle /debugtype option
Add the support infrastructure for the /debugtype option which takes a comma
delimited list of debug info to generate. The defaults are based on other
options potentially (/driver or /profile). This sets up the infrastructure to
allow us to emit RSDS records to get "build id" equivalents on COFF (similar to
binutils).

llvm-svn: 278056
2016-08-08 22:02:44 +00:00
Benjamin Kramer df8f196f9a Unpollute the global namespace. lld edition.
llvm-svn: 277926
2016-08-06 13:52:37 +00:00
Saleem Abdulrasool fd063e796f COFF ARM: Apply an existing offset in MOV32T relocations
Don't blindly OR in the new value, but clear the existing one, since it can be
nonzero. Read out the existing value before, and add into the desired offset.
(The add is done outside of the applyMOV, to handle potential overflow between
the two.)

Patch by Martin Storsjö!

llvm-svn: 277846
2016-08-05 18:20:31 +00:00