summaryrefslogtreecommitdiffstats
path: root/lld/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* Use __cxa_demangle on FreeBSD to fix buildbots.Rui Ueyama2014-10-212-3/+3
| | | | llvm-svn: 220326
* Assume cxxabi.h exists on FreeBSDRui Ueyama2014-10-212-2/+6
| | | | | | | HAVE_CXXABI_H is not defined on FreeBSD but the system actually has the header. CMake test fails because the header depends on size_t. llvm-svn: 220315
* [Gnu] Move certain options to a different group.Shankar Easwaran2014-10-211-5/+11
| | | | | | The -mllvm option is not specific to LTO. llvm-svn: 220263
* [ELF] Remove duplicate code.Shankar Easwaran2014-10-2111-337/+122
| | | | | | | The base class ELFObjectReader/ELFDSOReader implement the canParse functionaity with this change. llvm-svn: 220261
* [PECOFF] Look for decorated entry symbol name.Rui Ueyama2014-10-211-1/+5
| | | | | | | Entry symbol name can be decorated. When we look for _WinMain, we also have to look for _WinMain@16. llvm-svn: 220259
* [ELF] Implement demangle.Shankar Easwaran2014-10-203-6/+55
| | | | | | | This adds functionality in the GNU flavor to demangle symbols when undefined symbols are displayed to the user. llvm-svn: 220184
* [ELF] Check for target architecture.Shankar Easwaran2014-10-2012-25/+157
| | | | | | | | | | The canParse function for all the ELF subtargets check if the input files match the subtarget. There were few mismatches in the input files that didnt match the subtarget for which the link was being invoked, which also acts as a test for this change. llvm-svn: 220182
* [ELF] Make updateReferenceForMergeStringAccess virtual.Shankar Easwaran2014-10-201-3/+3
| | | | | | | The ELF subtargets would usually want to override the function updateReferenceForMergeStringAccess. Allow this by making it virtual. llvm-svn: 220180
* [ELF] Fix functionality of merging similar strings.Shankar Easwaran2014-10-201-29/+44
| | | | | | | | For PC relative accesses, negative addends were to be ignored. The linker was not ignoring it and would fail with an assert. This fixes the issue and is able to get Helloworld working. llvm-svn: 220179
* [ELF][Cleanup] Remove unused code.Shankar Easwaran2014-10-191-9/+1
| | | | | | | | The old code was used as a workaround to fix how relocations are calculated for sections with SHF_MERGE|SHF_STRINGS attribute. This patch removes the erroneous code. llvm-svn: 220159
* Fix display of files processed by the linker.Shankar Easwaran2014-10-181-1/+3
| | | | | | | | | | This fixes the way archive members are displayed when the linker is used with a flag to show all the files that it processes. When an archive file member is read, we need to show the archive filename and the member. llvm-svn: 220144
* Sort include files according to convention.Shankar Easwaran2014-10-1850-114/+20
| | | | llvm-svn: 220131
* [ELF] Add Readers for all the ELF subtargets.Shankar Easwaran2014-10-1863-169/+756
| | | | | | | | | This would permit the ELF reader to check the architecture that is being selected by the linking process. This patch also sorts the include files according to LLVM conventions. llvm-svn: 220129
* Hardcode the list of ELF targets here rather than using a glob.Richard Smith2014-10-181-8/+6
| | | | | | | | The code was making non-portable assumptions about the exact string returned by the glob (possibly by the shell?); this is more robust and matches what is done everywhere else. llvm-svn: 220117
* [mach-o] keep Windows library happy.Tim Northover2014-10-181-1/+1
| | | | | | &v[v.size()] may be invalid C++. llvm-svn: 220115
* [PECOFF] Emit x64 delay-import wrapper functionRui Ueyama2014-10-174-10/+71
| | | | | | | | | | | Previously we supported x86 only. This patch is to support x64. The array of pointers to delay-loaded functions points the DLL delay loading function at start-up. When a function is called for the first time, the delay loading function gets called and then rewrite the function pointer array. llvm-svn: 220096
* lld/lib/Core/Error.cpp: Appease g++-4.7, corresponding to LLVM r210687.NAKAMURA Takumi2014-10-171-0/+2
| | | | llvm-svn: 220039
* [CMake] lld: Introduce ${cmake_2_8_12_INTERFACE} onto each ↵NAKAMURA Takumi2014-10-1713-13/+15
| | | | | | | target_link_libraries. [PR20254] FIXME: Dependencies should be reorganized. llvm-svn: 220000
* [mach-o] Fix crash when -all_load used with dylibsNick Kledzik2014-10-161-18/+8
| | | | | | | | | | | -all_load tells the darwin linker to immediately load all members of all archives. The code do that used reinterpret_cast<> instead of dyn_cast<>. If the file was a dylib, the reinterpret_cast<> turned a pointer to a dylib into a pointer to an archive...boom. Added test case to reproduce the crash, simplified the code and used dyn_cast<>. llvm-svn: 219990
* [mach-o] update __eh_frame handling for Nick's suggestionsTim Northover2014-10-164-11/+22
| | | | | | | First, add a comment to support more variation in FDE formats. Second, refactor fde -> function handling into a separate function living in the ArchHandler. llvm-svn: 219959
* [mach-o] Add support for upward linkingNick Kledzik2014-10-166-15/+53
| | | | | | | | To deal with cycles in shared library dependencies, the darwin linker supports marking specific link dependencies as "upward". An upward link is when a lower level library links against a higher level library. llvm-svn: 219949
* [PECOFF] Support delay-load import table for x86Rui Ueyama2014-10-165-8/+112
| | | | | | | | | | This patch creates the import address table and sets its address to the delay-load import table. This also creates wrapper functions for __delayLoadHelper2. x86 only for now. llvm-svn: 219948
* [mach-o] avoid overly clever std::find_ifTim Northover2014-10-157-16/+56
| | | | | | | The bots were complaining (possibly because of a lack of traits on the iterator I was trying to use). No functional change. llvm-svn: 219843
* [mach-o] make __unwind_info defer to __eh_frame when necessary.Tim Northover2014-10-159-47/+184
| | | | | | | | | | | | Not all situations are representable in the compressed __unwind_info format, and when this happens the entry needs to point to the more general __eh_frame description. Just x86_64 implementation for now. rdar://problem/18208653 llvm-svn: 219836
* [macho] Create references from __eh_frame FDEs to their function.Tim Northover2014-10-157-1/+135
| | | | | | | | | | | | | We'll also need references back to the CIE eventually, but for now making sure we can work out what an FDE is referring to is enough. The actual kind of reference needs to be different between architectures, probably because of MachO's chronic shortage of relocation types but I don't really want to know in case I find out something that distresses me even more. rdar://problem/18208653 llvm-svn: 219824
* Use isa<> and cast<> instead of definition().Rui Ueyama2014-10-141-5/+3
| | | | | | No functionality change intended. llvm-svn: 219727
* Remove dead code.Rui Ueyama2014-10-141-42/+34
| | | | | | | | | | | Because we use cast<> at the beginning of this function, it will abort there if a given atom is not a DefinedAtom. In the switch statement, we checked if a given atom is a DefinedAtom again by evaluating definition() == Atom::definitionRegular. This was always true. So we can remove the outer switch statement. llvm-svn: 219724
* Use isa<> instead of checking return value of definition().Rui Ueyama2014-10-142-2/+2
| | | | | | | definition() is supposed to be used through isa, dyn_cast or cast. It's better to not call that directly. llvm-svn: 219723
* Use llvm::make_unique.Rui Ueyama2014-10-143-14/+12
| | | | llvm-svn: 219709
* [mach-o] Add Pass to create are shim Atoms for ARM interworking.Nick Kledzik2014-10-149-13/+367
| | | | | | | | | | | | | | | Arm code has two instruction encodings "thumb" and "arm". When branching from one code encoding to another, you need to use an instruction that switches the instruction mode. Usually the transition only happens at call sites, and the linker can transform a BL instruction in BLX (or vice versa). But if the compiler did a tail call optimization and a function ends with a branch (not branch and link), there is no pc-rel BX instruction. The ShimPass looks for pc-rel B instructions that will need to switch mode. For those cases it synthesizes a shim which does the transition, then modifies the original atom with the B instruction to target to the shim atom. llvm-svn: 219655
* Reapply [ELF] Only mark as DT_NEEDED libs that are strictly necessary (r219353)Rafael Auler2014-10-0911-36/+49
| | | | | | | | | | | | | | | | | | | | When committed in r219353, this patch originally caused problems because it was not tested in debug build. In such scenarios, Driver.cpp adds two additional passes. These passes serialize all atoms via YAML and reads it back. Since the patch changed ObjectAtom to hold a new reference, the serialization was removing the extra data. This commit implements r219853 in another way, similar to the original MIPS way, by using a StringSet that holds the names of all copied atoms instead of directly holding a reference to the copied atom. In this way, this commit is simpler and eliminate the necessity of changing the DefinedAtom hierarchy to hold a new data. Reviewers: shankarke http://reviews.llvm.org/D5713 llvm-svn: 219449
* [PECOFF] Refactor _imp_ symbol generator.Rui Ueyama2014-10-091-21/+28
| | | | | | | | We are going to have another type of jump table for the delay-load import table. In order to prepare for that, we want to factor out the function handling the jump table. No functionality change. llvm-svn: 219446
* [PECOFF] Remove another use of is64 to support non-Intel architectureRui Ueyama2014-10-091-19/+30
| | | | llvm-svn: 219438
* [PECOFF] Emit ModuleHandle field in delay-import table.Rui Ueyama2014-10-092-3/+22
| | | | | | | | Previously the field was not set. The field should be pointing to a placeholder where the DLL delay-loader writes the base address of a DLL. llvm-svn: 219415
* [PECOFF] Emit the delay-import tableRui Ueyama2014-10-094-5/+89
| | | | | | | | | | | This is a partial patch to emit the delay-import table. With this, LLD is now able to emit the table that llvm-readobj can read and dump. The table lacks a few fields, such as the address of HMODULE, the import address table, etc. They'll be added in subsequent patches. llvm-svn: 219384
* [ELF] Fix uninitialized variablesRafael Auler2014-10-092-4/+6
| | | | | | | Properly initialize _exportDynamic in ELFLinkingContext and an ELF_Sym object created in CRuntimeFile with default values. llvm-svn: 219380
* [mach-o] Use default for min OS version when not specified on command line.Nick Kledzik2014-10-091-0/+20
| | | | | | This matches the current darwin linker. llvm-svn: 219376
* Revert "[ELF] Only mark as DT_NEEDED libs that are strictly necessary"Rui Ueyama2014-10-0914-57/+41
| | | | | | This reverts commit r219353 because that seems to break buildbots. llvm-svn: 219369
* [ELF] Only mark as DT_NEEDED libs that are strictly necessaryRafael Auler2014-10-0814-41/+57
| | | | | | | | | | | | | | | | | | | | | Enhances the creation of an ELF dynamic executable by avoiding recording unnecessary shared libraries as NEEDED to load a program. To do this, we must keep track of not only symbols that were referenced but also of COPY relocations, which steal the symbol from a shared library but does not store from which lib this symbol came from. To fix this, this commit changes ObjectSymbol to store the original library from which this symbol came. With this information, we are able to build a list of the exact shared libraries that must be marked as DT_NEEDED, instead of blindly marking all shared libraries as needed. This logic originally came from the MIPS backend with some adaptation. Reviewers: atanasyan, shankar.easwaran http://reviews.llvm.org/D5574 llvm-svn: 219353
* [ELF] [X86_64] Update TODO.rst list wrt r218633Rafael Auler2014-10-081-6/+2
| | | | | | | | | | | Updates the remaining tasks in the X86_64 ELF lld backend after the commit that handles general dynamic TLS relocations. Reviewer: shankarke http://reviews.llvm.org/D5673 llvm-svn: 219350
* [ELF] Fix inclusion of weak symbols in the dynamic symbol tableRafael Auler2014-10-084-19/+62
| | | | | | | | | | | | | | | | | This commit implements in the X86_64 ELF lld backend yet another feature that was only available in the MIPS backend. However, this patch changes generic ELF classes to make it trivial for other ELF backends to use this logic too. When creating a dynamic executable that has dynamic relocations against weak undefined symbols, these symbols must be exported to the dynamic symbol table to seek a possible resolution at run time. A common use case is the __gmon_start__ weak glibc undefined symbol. Reviewer: shankarke http://reviews.llvm.org/D5571 llvm-svn: 219349
* [PECOFF] Simplify IdataPass. No functionality change.Rui Ueyama2014-10-082-5/+5
| | | | llvm-svn: 219348
* [PECOFF] Remember DLL names given with /delayload option.Rui Ueyama2014-10-081-0/+1
| | | | | | This is a step toward full support of /delayload. llvm-svn: 219344
* Use llvm::StringSwitch.Rui Ueyama2014-10-081-19/+16
| | | | llvm-svn: 219341
* [ELF] Implement --export-dynamic/-ERafael Auler2014-10-084-9/+30
| | | | | | | | | | | | | | | | | When creating a dynamic executable and receiving the -E flag, the linker should export all globally visible symbols in its dynamic symbol table. This commit also moves the logic that exports symbols in the dynamic symbol table from OutputELFWriter to the ExecutableWriter class. It is not correct to leave this at OutputELFWriter because DynamicLibraryWriter, another subclass of OutputELFWriter, already exports all symbols, meaning we can potentially end up with duplicated symbols in the dynamic symbol table when creating shared libs. Reviewers: shankarke http://reviews.llvm.org/D5585 llvm-svn: 219334
* Fix typo in commentRui Ueyama2014-10-081-1/+1
| | | | llvm-svn: 219326
* Revert "[ELF][AllArchs] Fix includes"Shankar Easwaran2014-10-0825-53/+53
| | | | | | This reverts commit e137dd93e1291a2d2fa7f41c8f8bcdb59c8b3225. llvm-svn: 219313
* [ELF][AllArchs] Fix includesShankar Easwaran2014-10-0825-53/+53
| | | | llvm-svn: 219278
* Add support to print version.Shankar Easwaran2014-10-088-1/+96
| | | | | | | | | | | | | | | | | | | Summary: Add support in the universal driver to print the lld version and the repository version. Test Plan: A driver test is added Reviewers: kledzik, ruiu Reviewed By: ruiu Subscribers: llvm-commits Projects: #lld Differential Revision: http://reviews.llvm.org/D5641 llvm-svn: 219277
* [mach-o] Support fat archivesNick Kledzik2014-10-084-39/+76
| | | | | | | | | | | | | | mach-o supports "fat" files which are a header/table-of-contents followed by a concatenation of mach-o files (or archives of mach-o files) built for different architectures. Previously, the support for fat files was in the MachOReader, but that only supported fat .o files and dylibs (not archives). The fix is to put the fat handing into MachOFileNode. That way any input file kind (including archives) can be fat. MachOFileNode selects the sub-range of the fat file that matches the arch being linked and creates a MemoryBuffer for just that subrange. llvm-svn: 219268
OpenPOWER on IntegriCloud