summaryrefslogtreecommitdiffstats
path: root/lld/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* PECOFF: make dumpbin tool happy.Rui Ueyama2015-02-121-8/+17
| | | | | | | | | | | | | | | | | | | | | The dumpbin tool in the MSVC toolchain cannot handle an executable created by LLD if the executable contains a long section name. In PE/COFF, a section name is stored to a section table entry. Because the section name field in the table is only 8 byte long, a name longer than that is stored to the string table and the offset in the string table is stored to the section table entry instead. In order to look up a string from the string table, tools need to handle the symbol table, because the string table is defined as it immediately follows the symbol table. And seems the dumpbin doesn't like zero-length symbol table. This patch teaches LLD how to emit a dummy symbol table. The dummy table has one dummy entry in it. llvm-svn: 228900
* Remove unused parameter.Rui Ueyama2015-02-112-5/+3
| | | | llvm-svn: 228887
* [ELF][ARM] Fix veneer symbol names in Release buildDenis Protivensky2015-02-111-8/+4
| | | | | | | The fix is for r228680. This makes tests also work. llvm-svn: 228837
* GNU: Rename parseZOption because it actually parses only -z max-page-size.Rui Ueyama2015-02-101-3/+3
| | | | llvm-svn: 228753
* GNU: Add --no-export-dynamic command line option.Rui Ueyama2015-02-102-2/+5
| | | | llvm-svn: 228749
* Driver: move non-positional parameters out of switch. NFC.Rui Ueyama2015-02-101-198/+172
| | | | llvm-svn: 228743
* GNU: Use StringRef::empty instead of a boolean flag.Rui Ueyama2015-02-101-8/+2
| | | | | | | This local variable name did not follow the style guide, and it is not actually needed. llvm-svn: 228722
* Driver: use hasArg instead of getLastArg if return value is not used.Rui Ueyama2015-02-101-14/+14
| | | | llvm-svn: 228717
* [ELF][ARM] Add veneer generation to branch instructionsDenis Protivensky2015-02-101-2/+187
| | | | | | | | | | When calling ARM code from Thumb and vice versa, a veneer that switches instruction set should be generated. Added veneer generation for ARM_JUMP24 ARM_THM_JUMP24 instructions. Differential Revision: http://reviews.llvm.org/D7502 llvm-svn: 228680
* Driver: Replace switch cases with ifs.Rui Ueyama2015-02-101-330/+272
| | | | | | | | | | | We used to do like this instead of putting all command line processing code within one gigantic switch statement. It is converted to a switch in r188958, which introduced InputGraph. In this patch I roll that change back. Now all "break"s are removed, and the nesting is one level shallow. llvm-svn: 228646
* [ELF] Implement --strip-all/-sDavide Italiano2015-02-084-2/+15
| | | | | | | Differential Revision: D7489 Reviewed by: shankarke llvm-svn: 228533
* Remove unused parameter.Rui Ueyama2015-02-073-3/+3
| | | | llvm-svn: 228476
* PECOFF: Move error check for invalid command line combination to validateImpl.Rui Ueyama2015-02-062-6/+6
| | | | llvm-svn: 228461
* Use make_unique.Rui Ueyama2015-02-0613-31/+28
| | | | llvm-svn: 228453
* Remove unused #include.Rui Ueyama2015-02-061-1/+0
| | | | llvm-svn: 228450
* ELF: Split OrderPass::compareInitFini for readability. NFC.Rui Ueyama2015-02-061-18/+15
| | | | llvm-svn: 228449
* [Revert] [ELF] Determine default search directories from ContextShankar Easwaran2015-02-062-10/+13
| | | | | | | It looks like the Driver manages search path for each Target lld would support on the Gnu flavor. llvm-svn: 228440
* [ELF][TODO] Update TODO.Shankar Easwaran2015-02-061-1/+3
| | | | llvm-svn: 228380
* [Cleanup] Remove member functions added to support nostdlibShankar Easwaran2015-02-062-11/+9
| | | | | | No change in functionality. llvm-svn: 228379
* [ELF] Remove stray semicolonShankar Easwaran2015-02-061-1/+0
| | | | llvm-svn: 228378
* [ELF] Speedup creating program headers.Shankar Easwaran2015-02-061-4/+14
| | | | | | | | | | After the total number of program headers are determined, virtual addresses and file offsets need not be reassigned for sections whose virtual addresses and fileoffsets remained the same. This doesnot change any functionality. llvm-svn: 228377
* [Core] Remove roundTripPass() function.Shankar Easwaran2015-02-062-21/+5
| | | | | | | | | | | | Use the environment variable "LLD_RUN_ROUNDTRIP_TEST" in the test that you want to disable, as RUN: env LLD_RUN_ROUNDTRIP_TEST= <run> This was a patch that I made, but I find this a better way to accomplish what we want to do. llvm-svn: 228376
* [ELF] Fix -nostdlib option.Shankar Easwaran2015-02-062-4/+10
| | | | | | | | | Only search library directories explicitly specified on the command line. Library directories specified in linker scripts (including linker scripts specified on the command line) are ignored. llvm-svn: 228375
* Add methods to get archive file name from member file.Rui Ueyama2015-02-051-1/+2
| | | | | | | | | | | | | | Previously we only have File::path() to get the path name of a file. If a file was a member of an archive file, path() returns a concatenated string of the file name in the archive and the archive file name. If we wanted to get a file name or an archive file name, we had to parse that string. That's of course not good. This patch adds new member functions, archivePath and memberPath, to File. http://reviews.llvm.org/D7447 llvm-svn: 228352
* Cleanup. NFC.Rui Ueyama2015-02-052-9/+9
| | | | | | | Make customOrder pareamter mandatory because the argument is always passed. llvm-svn: 228342
* MachO: Move LayoutPass to MachO directory.Rui Ueyama2015-02-057-15/+134
| | | | | | | | | | | | | | | | | | | | | | The real user of the LayoutPass is now only Mach-O, so move that pass out of the common directory to Mach-O directory. "Core" architecture were using the LayoutPass. I modified that to use a simple OrderPass. I think no one actually have authority what feature should be in Core and what's not, but I believe the LayoutPass is not very suitable for Core. Before more code starts depending on the complex pass, it's better to remove that from Core. I could have simplified that pass because Mach-O is the only user of the LayoutPass. For example, the second parameter of the LayoutPass constructor can be converted from optional to mandatory. I didn't do that in this patch to keep it simple. I'll do in a followup patch. http://reviews.llvm.org/D7311 llvm-svn: 228341
* PECOFF: Fix I386_DIR32 relocation to an absolute symbolRui Ueyama2015-02-051-2/+6
| | | | | | | | | | | | | Previously, we incorrectly added the image base address to an absolute symbol address (that calculation doesn't make any sense) if an IMAGE_REL_I386_DIR32 relocation is applied to an absolute symbol. This patch fixes the issue. With this fix, we can link Bochs using LLD. (Choosing Bochs has no special meaining -- I just picked it up as a test program and found it didn't work.) This also fixes one of the issues we currently have to link Chromium using LLD. llvm-svn: 228279
* [ELF] Dont discard sections in the input file.Shankar Easwaran2015-02-051-10/+4
| | | | | | The reader was discarding certain types of sections from the input file. llvm-svn: 228268
* [ELF] Dont release ownership of MemoryBuffer.Shankar Easwaran2015-02-052-2/+2
| | | | | | MemoryBuffer is being released too early. ELFFile owns MemoryBuffer. llvm-svn: 228260
* Add a comment to Lexer::canContinueNumber.Rui Ueyama2015-02-041-0/+1
| | | | llvm-svn: 228201
* Early return. NFC.Rui Ueyama2015-02-041-16/+15
| | | | llvm-svn: 228106
* Style cleanup in compareByPosition().Davide Italiano2015-02-041-7/+2
| | | | | | | | Differential Revision: D7394 Reported by: ruiu Reviewed by: ruiu llvm-svn: 228094
* Simplify large switches.Rui Ueyama2015-02-041-54/+5
| | | | | | | | | | This may be a little bit inefficient than the original code but that should be okay as this is not really in a performance critical pass. http://reviews.llvm.org/D7393 llvm-svn: 228077
* Avoid two function calls of file() when not needed. Davide Italiano2015-02-031-2/+5
| | | | | | Reported by: ruiu llvm-svn: 228069
* ELF: Support INPUT linker script directiveRui Ueyama2015-02-032-20/+29
| | | | | | | | | | INPUT directive is a variant of GROUP in the sense that that specifies a list of input files. The only difference is whether the entire file list is wrapped with a --start-group/--end-group or not. http://reviews.llvm.org/D7390 llvm-svn: 228060
* Make ELFLinkingContext own LinkerScript buffersRafael Auler2015-02-032-17/+19
| | | | | | | | | | | | | | Currently, no one owns script::Parser buffers, but yet ELFLinkingContext gets updated with StringRef pointers to data inside Parser buffers. Since this buffer is locally owned inside GnuLdDriver::evalLinkerScript(), as soon as this function finishes, all pointers in ELFLinkingContext that comes from linker scripts get invalid. The problem is that we need someone to own linker scripts data structures and, since ELFLinkingContext transports references to linker scripts data, we can simply make it also own all linker scripts data. Differential Revision: http://reviews.llvm.org/D7323 llvm-svn: 227975
* [lld][ARM] Add relocations to perform function callsDenis Protivensky2015-02-031-12/+294
| | | | | | | | | | Added relocations to perform function calls with and without passing arguments. ARM-only, Thumb-only and mixed mode code generations are supported. Only simple veneers (direct instruction modification) are supported as ARM-Thumb interwork. Differential Revision: http://reviews.llvm.org/D7223 llvm-svn: 227961
* ELF: Improve linker script unit tests.Rui Ueyama2015-02-031-5/+4
| | | | | | | This patch is to enable to write unit tests for linker script with less boilerplate code. llvm-svn: 227902
* [ELF] Implement action for OUTPUT linker script commandDavide Italiano2015-02-021-3/+3
| | | | | | Reviewed by: ruiu, shankarke llvm-svn: 227787
* [ELF] Support for parsing OUTPUT command in LinkerScriptDavide Italiano2015-02-021-0/+30
| | | | | | | Differential Revision: D7326 Reviewed by: rafaelauler, shankarke, ruiu llvm-svn: 227786
* [ELF] Determine default search directories from Context.Shankar Easwaran2015-02-022-13/+11
| | | | | | | | Target specific LinkingContext's determine the default search directory. No change in functionality. llvm-svn: 227784
* Remove trailing whitespace introduced in r227709.Davide Italiano2015-02-011-1/+1
| | | | | | Reported by: shankarke llvm-svn: 227710
* [ELF] Don't compare an atom with itself in compareByPosition().Davide Italiano2015-02-011-0/+4
| | | | | | | | | | | | This caused some tests to fail on FreeBSD, and Mac OS X. Some std::sort() implementations will check for strict-weak-ordering by comparing with the same element, or will compare an element to itself for 1-element sequence. Take care of this case. Thanks to chandlerc for explaning that to me. Reviewed by: ruiu llvm-svn: 227709
* [ELF] Implement semantic action for ENTRY linker script command.Davide Italiano2015-02-011-0/+2
| | | | | | Reviewed by: shankarke, ruiu llvm-svn: 227708
* [ELF] Set order of ctors/dtors sectionShankar Easwaran2015-02-011-0/+2
| | | | llvm-svn: 227707
* [ELF] got/got.plt sections are handled as typeGOTShankar Easwaran2015-02-011-2/+0
| | | | | | | The .got and .got.plt sections are already handled as typeGOT. There is no need to handle these atoms whose contentType is typeData. llvm-svn: 227706
* Implement semantic action for SEARCH_DIR linker script commandRafael Auler2015-01-311-2/+7
| | | | | | | | | | | | This is needed, among others by the FreeBSD kernel linker script. Patch by Davide Italiano! Reviewers: ruiu, rafaelauler Differential Revision: http://reviews.llvm.org/D7220 llvm-svn: 227694
* Remove dead code.Rui Ueyama2015-01-311-12/+0
| | | | llvm-svn: 227671
* ELF: Don't use LayoutPass.Rui Ueyama2015-01-317-101/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously we applied the LayoutPass to order atoms and then apply elf::ArrayOrderPass to sort them again. The first pass is basically supposed to sort atoms in the normal fashion (which is to sort symbols in the same order as the input files). The second pass sorts atoms in {init,fini}_array.<priority> by priority. The problem is that the LayoutPass is overkill. It analyzes references between atoms to make a decision how to sort them. It's slow, hard to understand, and above all, it doesn't seem that we need its feature for ELF in the first place. This patch remove the LayoutPass from ELF pass list. Now all reordering is done in elf::OrderPass. That pass sorts atoms by {init,fini}_array, and if they are not in the special section, they are ordered as the same order as they appear in the command line. The new code is far easier to understand, faster, and still able to create valid executables. Unlike the previous layout pass, elf::OrderPass doesn't count any attributes of an atom (e.g. permissions) except its position. It's OK because the writer takes care of them if we have to. This patch changes the order of final output, although that's benign. Tests are updated. http://reviews.llvm.org/D7278 llvm-svn: 227666
* GNU LD option export-dynamic can accept single dash flag.Davide Italiano2015-01-301-1/+1
| | | | | | | Differential Revision: D7044 Reviewed by: ruiu llvm-svn: 227631
OpenPOWER on IntegriCloud