- Jun 29, 2015
-
-
Chandler Carruth authored
method to get a SymbolBody and into the callers, and kill now dead includes. This removes the need to have the SymbolBody definition when we're defining the inline method and makes it a better inline method. That was the only reason for a lot of header includes here. Removing these and using forward declarations actually uncovers a bunch of cross-header dependencies that I've fixed while I'm here, and will allow me to introduce some *important* inline code into Chunks.h that requires the definition of ObjectFile. No functionality changed at this point. Differential Revision: http://reviews.llvm.org/D10789 llvm-svn: 240982
-
Rui Ueyama authored
The previous logic to find default entry name or subsystem does not seem correct (i.e. was not compatible with MSVC linker). Previously, default entry name was inferred from CRT functions and user-defined entry functions. Subsystem was inferred from CRT functions. Default entry name and subsystem are now inferred based on the following table. Note that we no longer use CRT functions to infer them. Entry name Subsystem main mainCRTStartup console wmain wmainCRTStartup console WinMain WinMainCRTStartup windows wWinMain wWinMainCRTStartup windows llvm-svn: 240922
-
Rui Ueyama authored
Usually dllexported symbols are defined with 'extern "C"', so identifying them is easy. We can just do hash table lookup to look up exported symbols. However, C++ non-member functions are also allowed to be exported, and they can be specified with unmangled name. So, if /export:foo is given, we need to look up not only "foo" but also its all mangled names. In MSVC mangling scheme, that means that we need to look up any symbol which starts with "?foo@@Y". In this patch, we scan the entire symbol table to search for a mangled symbol. The symbol table is a DenseMap, and that doesn't support table lookup by string prefix. This is of course very inefficient. But that should be probably OK because the user should always add 'extern "C"' to dllexported symbols. llvm-svn: 240919
-
- Jun 27, 2015
-
-
Chandler Carruth authored
StringRefs. This uses the LLVM hashing rather than the standard library and a closed addressed hash table rather than chaining. This improves the Windows self-link of LLD by 4.4% (averaged over 10 runs, with well under 1% of variance on each). There is still some room to improve here. Two things I clearly see in the profile: 1) This is one of the biggest stress tests for the LLVM hashing code. It actually consumes something like 3-4% of the link time after the change. 2) The way that StringRef keys are handled in the DenseMap interface is pretty suboptimal. We pay the price of checking for empty and tombstone keys when we could only possibly be looking for a normal key. But fixing this requires invasive API changes. So there is still some headroom here. Differential Revision: http://reviews.llvm.org/D10684 llvm-svn: 240871
-
Rui Ueyama authored
llvm-svn: 240846
-
- Jun 26, 2015
-
-
Peter Collingbourne authored
This flag can be used to produce a map file, which is essentially a list of objects linked into the final output file together with the RVAs of their symbols. Because our format differs from MSVC's we expose it as a separate flag. Differential Revision: http://reviews.llvm.org/D10773 llvm-svn: 240812
-
- Jun 25, 2015
-
-
Rui Ueyama authored
The change I made in r240620 was not correct. If a symbol foo is defined, and if you use __imp_foo, __imp_foo symbol is automatically defined as a pointer (not just an alias) to foo. Now that we need to create a chunk for automatically-created symbols. I defined LocalImportChunk class for them. llvm-svn: 240622
-
- Jun 24, 2015
-
-
Rui Ueyama authored
Previously, we added files in directive sections to the symbol table as we read the sections, so the link order was depth-first. That's not compatible with MSVC link.exe nor the old LLD. This patch is to queue files so that new files are added to the end of the queue and processed last. Now addFile() doesn't parse files nor resolve symbols. You need to call run() to process queued files. llvm-svn: 240483
-
- Jun 21, 2015
-
-
Rui Ueyama authored
llvm-svn: 240229
-
- Jun 19, 2015
-
-
Rui Ueyama authored
In this linker model, adding an undefined symbol may trigger chain reactions. It may trigger a Lazy symbol to read a new file. A new file may contain a directive section, which may contain various command line options. Previously, we didn't handle chain reactions well. We visited /include'd symbols only once, so newly-added /include symbols were ignored. This patch fixes that bug. Now, the symbol table is versioned; every time the symbol table is updated, the version number is incremented. We repeat adding undefined symbols until the version number does not change. It is guaranteed to converge -- the number of undefined symbol in the system is finite, and adding the same undefined symbol more than once is basically no-op. llvm-svn: 240177
-
- Jun 18, 2015
-
-
Rui Ueyama authored
llvm-svn: 240031
-
Rui Ueyama authored
Previously, LLD couldn't find a default entry point if it's defined by a library. llvm-svn: 239982
-
- Jun 13, 2015
-
-
Rafael Espindola authored
llvm-svn: 239671
-
- Jun 12, 2015
-
-
Davide Italiano authored
llvm-svn: 239641
-
- Jun 09, 2015
-
-
Rui Ueyama authored
llvm-svn: 239418
-
- Jun 08, 2015
-
-
Rui Ueyama authored
llvm-svn: 239289
-
- Jun 06, 2015
-
-
Peter Collingbourne authored
Differential Revision: http://reviews.llvm.org/D10285 llvm-svn: 239212
-
- Jun 03, 2015
-
-
Rui Ueyama authored
llvm-svn: 238901
-
- Jun 01, 2015
-
-
Peter Collingbourne authored
This implementation is known to work in very simple cases (see new test case). Differential Revision: http://reviews.llvm.org/D10115 llvm-svn: 238777
-
Rui Ueyama authored
Previously, this feature was implemented using a special type of undefined symbol, in addition to an intricate way to make the resolver read a virtual file containing that renaming symbols. Now the feature is directly handled by the symbol table. The symbol table has a function, rename(), to rename symbols, whose definition is 4 lines long. Symbol renaming is naturally modeled using Symbol and SymbolBody. llvm-svn: 238696
-
- May 31, 2015
-
-
Rui Ueyama authored
It does not involve notions of virtual archives or virtual files, nor store a list of undefined symbols somewhere else to consume them later. We did that before. In this patch, undefined symbols are just added to the symbol table, which now can be done in very few lines of code. llvm-svn: 238681
-
Rui Ueyama authored
Previously the main linker routine is just a non-member function. We store some context information to the Config object. This patch makes it belong to Driver. llvm-svn: 238677
-
Rui Ueyama authored
`main` is not the only main function in Windows. You can choose one from these four -- {w,}{WinMain,main}. There are four different entry point functions for them, {w,}{WinMain,main}CRTStartup, respectively. The linker needs to choose the right one depending on which `main` function is defined. llvm-svn: 238667
-
- May 29, 2015
-
-
Peter Collingbourne authored
The new mechanism is less code, and fixes the case where all inputs are archives. Differential Revision: http://reviews.llvm.org/D10136 llvm-svn: 238618
-
- May 28, 2015
-
-
Rui Ueyama authored
This is an initial patch for a section-based COFF linker. The patch has 2300 lines of code including comments and blank lines. Before diving into details, you want to start from reading README because it should give you an overview of the design. All important things are written in the README file, so I write summary here. - The linker is already able to self-link on Windows. - It's significantly faster than the existing implementation. The existing one takes 5 seconds to link LLD on my machine, while the new one only takes 1.2 seconds, even though the new one is not multi-threaded yet. (And a proof-of-concept multi- threaded version was able to link it in 0.5 seconds.) - It uses much less memory (250MB vs. 2GB virtual memory space to self-host). - IMHO the new code is much simpler and easier to read than the existing PE/COFF port. http://reviews.llvm.org/D10036 llvm-svn: 238458
-