summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter
Commit message (Collapse)AuthorAgeFilesLines
...
* ELF: Add a standard method for unknown relocation errorsWill Newton2014-12-0919-64/+63
| | | | | | | | | | | | | | | | | | | At present each TargetRelocationHandler generates a pretty similar error string and calls llvm_unreachable() when encountering an unknown relocation. This is not ideal for two reasons: 1. llvm_unreachable disappears in release builds but we still want to know if we encountered a relocation we couldn't handle in release builds. 2. Duplication is bad - there is no need to have a per-architecture error message. This change adds a test for AArch64 to test whether or not the error message actually works. The other architectures have not been tested but they compile and check-lld passes. llvm-svn: 223782
* [mach-o] fix leak in atoms -> normalizedNick Kledzik2014-12-051-0/+17
| | | | llvm-svn: 223530
* [mach-o] Switch MachOFile and MachODylibFile to use BumpPtr in lld::FileNick Kledzik2014-12-051-28/+24
| | | | llvm-svn: 223529
* [mach-o] Pass vectors by reference and name empty vector.Nick Kledzik2014-12-051-5/+8
| | | | llvm-svn: 223527
* [PECOFF] Fix exported symbols in an import library.Rui Ueyama2014-12-051-0/+2
| | | | | | | | | | | | | | | | | Looks like if you have symbol foo in a module-definition file (.def file), and if the actual symbol name to match that export description is _foo@x (where x is an integer), the exported symbol name becomes this. - foo in the .dll file - foo@x in the .lib file I have checked in a few fixes recently for exported symbol name mangling. I haven't found a simple rule that governs all the mangling rules. There may not ever exist. For now, this is a patch to improve .lib file compatibility. llvm-svn: 223524
* ELF: Use ELF reloc .def files to reduce duplicationWill Newton2014-12-056-330/+32
| | | | | | Tested with check-lld with no regressions. llvm-svn: 223462
* Remove extra semicolon.Rui Ueyama2014-12-041-1/+1
| | | | llvm-svn: 223411
* Fix a bunch of -Winconsistent-missing-override warnings.Eric Christopher2014-12-041-7/+7
| | | | llvm-svn: 223400
* Revert "Rewrite InputGraph's Group"Rui Ueyama2014-12-042-50/+1
| | | | | | | | This reverts commit r223330 because it broke Darwin and ELF linkers in a way that we couldn't have caught with the existing test cases. llvm-svn: 223373
* [ELF] Adjust ELF header entry symbol value if this symbol is microMIPS encodedSimon Atanasyan2014-12-045-25/+39
| | | | | | | To find an AtomLayout object for the given symbol I replace the `Layout::findAtomAddrByName` method by `Layout::findAtomLayoutByName` method. llvm-svn: 223359
* [PECOFF] Improve /export compatibility.Rui Ueyama2014-12-042-29/+46
| | | | | | | | | | | | | | | | | | | | | Looks like the rule of /export is more complicated than I was thinking. If /export:foo, for example, is given, and if the actual symbol name in an object file is _foo@<number>, we need to export that symbol as foo, not as the mangled name. If only /export:_foo@<number> is given, the symbol is exported as _foo@<number>. If both /export:foo and /export:_foo@<number> are given, they are considered as duplicates, and the linker needs to choose the unmangled name. The basic idea seems that the linker needs to export a symbol with the same name as given as /export. We exported mangled symbols. This patch fixes that issue. llvm-svn: 223341
* Rewrite InputGraph's GroupRui Ueyama2014-12-042-1/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The aim of this patch is to reduce the excessive abstraction from the InputGraph. We found that even a simple thing, such as sorting input files (Mach-O) or adding a new file to the input file list (PE/COFF), is nearly impossible with the InputGraph abstraction, because it hides too much information behind it. As a result, we invented complex interactions between components (e.g. notifyProgress() mechanism) and tricky code to work around that limitation. There were many occasions that we needed to write awkward code. This patch is a first step to make it cleaner. As a first step, this removes Group class from the InputGraph. The grouping feature is now directly handled by the Resolver. notifyProgress is removed since we no longer need that. I could have cleaned it up even more, but in order to keep the patch minimum, I focused on Group. SimpleFileNode class, a container of File objects, is now limited to have only one File. We shold have done this earlier. We used to allow putting multiple File objects to FileNode. Although SimpleFileNode usually has only one file, the Driver class actually used that capability. I modified the Driver class a bit, so that one FileNode is created for each input File. We should now probably remove SimpleFileNode and directly store File objects to the InputGraph in some way, because a container that can contain only one object is useless. This is a TODO. Mach-O input files are now sorted before they are passe to the Resolver. DarwinInputGraph class is no longer needed, so removed. PECOFF still has hacky code to add a new file to the input file list. This will be cleaned up in another patch. llvm-svn: 223330
* [PECOFF] Improve compatibility of /export option.Rui Ueyama2014-12-041-0/+10
| | | | llvm-svn: 223326
* [PECOFF] Fix a bug in /export option handler.Rui Ueyama2014-12-031-7/+10
| | | | | | | | | | | | | | | | | | | /export option can be given multiple times to specify multiple symbols to be exported. /export accepts both decorated and undecorated name. If you give both undecorated and decorated name of the same symbol to /export, they are resolved to the same symbol. In this case, we need to de-duplicate the exported names, so that we don't have duplicated items in the export symbol table in a DLL. We remove duplicate items from a vector. The bug was there. Because we had pointers pointing to elements of the vector, after an item is removed, they would point wrong elements. This patch is to remove these pointers. Added a test for that case. llvm-svn: 223200
* [mach-o] Fix TrieEdge leakNick Kledzik2014-12-021-5/+6
| | | | | | | | In PR21682 Jean-Daliel Dupas found a leak in the trie builder and suggested a fix was to use a list instead of SmallVector so that the list elements could be allocated in the BumpPtrAllocator. llvm-svn: 223104
* [mach-o] add support for arm64 compact unwind infoNick Kledzik2014-12-021-11/+68
| | | | | | | Tim previously added generic compact unwind processing and x86_64 support. This patch adds arm64 support. llvm-svn: 223103
* [ELF] Fix layout of output sections.Shankar Easwaran2014-11-301-2/+6
| | | | | | | | | The AtomSections were improperly merging sections from various input files. This patch fixes the problem, with an updated test that was provided by Simon. Thanks to Simon Atanasyan for catching this issue. llvm-svn: 222982
* [ELF] Rename align2 to alignment.Shankar Easwaran2014-11-307-61/+61
| | | | | | No change in functionality. llvm-svn: 222975
* [ELF] Fix creation of segments.Shankar Easwaran2014-11-301-3/+15
| | | | | | | Linker was creating a separate output segment in some cases if input sections had huge alignments. This patch fixes the issue. llvm-svn: 222974
* [ELF] Create input and output section namesShankar Easwaran2014-11-305-26/+58
| | | | | | No change in functionality. llvm-svn: 222973
* [ELF] Rename MergedSection to OutputSection.Shankar Easwaran2014-11-304-102/+95
| | | | | | No change in functionality. llvm-svn: 222972
* Rename R_AARCH64_TLSDESC_ADR_PAGE to R_AARCH64_TLSDESC_ADR_PAGE21Will Newton2014-11-261-1/+1
| | | | llvm-svn: 222823
* Fix comment in AArch64 ELF backendWill Newton2014-11-261-1/+1
| | | | llvm-svn: 222814
* Use SafelyCloseFileDescriptor instead of close.Rui Ueyama2014-11-261-7/+2
| | | | | | | | Opening a file using openFileForWrite and closing it using close was asymmetric. It also had a subtle portability problem (details are described in the commit message for r219189). llvm-svn: 222802
* [PECOFF] Properly close a file descriptor.Rui Ueyama2014-11-261-0/+7
| | | | | | | | This was basically benign resource leak on Unix, but on Windows it could cause builds to fail because opened file descriptor prevents other processes from moving or removing the file. llvm-svn: 222799
* [PECOFF] Create an empty PDB file if debug option is enabled.Rui Ueyama2014-11-252-3/+57
| | | | | | | | | | | | | | | | There are many build files in the wild that depend on the fact that link.exe produces a PDB file if /DEBUG option is given. They fail if the file is not created. This patch is to make LLD create an empty (dummy) file to satisfy such build targets. This doesn't do anything other than "touching" the file. If a target depends on the content of the PDB file, this workaround is no help, of course. Otherwise this patch should help build some stuff. llvm-svn: 222773
* Silence a -Wcast-qual warningDavid Majnemer2014-11-221-1/+1
| | | | llvm-svn: 222598
* [Mips] Use endian::read() for relocation addendum readingSimon Atanasyan2014-11-211-3/+5
| | | | llvm-svn: 222574
* [Mips] Simplify the code calculates HI16/LO16 relocationsSimon Atanasyan2014-11-201-15/+3
| | | | | | No functional changes. llvm-svn: 222470
* [Mips] Remove duplicated relocation calculation routinesSimon Atanasyan2014-11-201-20/+8
| | | | | | No functional changes. llvm-svn: 222469
* [Mips] Remove unused function argumentSimon Atanasyan2014-11-201-2/+2
| | | | | | No functional changes. llvm-svn: 222468
* [Mips] Use endian::read/write function to load/save MIPS32 instructionsSimon Atanasyan2014-11-201-39/+41
| | | | | | No functional changes. llvm-svn: 222467
* [mach-o] fix whitespaceNick Kledzik2014-11-201-3/+3
| | | | llvm-svn: 222457
* [mach-o] use reference with "auto" to prevent copiesNick Kledzik2014-11-201-3/+3
| | | | | | Patch by Jean-Daniel Dupas llvm-svn: 222455
* [PECOFF] Sort export table properly.Rui Ueyama2014-11-201-4/+5
| | | | | | | | | | | | | | Export table entries need to be sorted in ASCII-betical order, so that the loader can find an entry for a function by binary search. We sorted the entries by its mangled names. That can be different from their exported names. As a result, LLD produces incorrect export table, from which the loader complains that a function that actually exists in a DLL cannot be found. This patch fixes that issue. llvm-svn: 222452
* [Mips] Configure GOTPLT entries in the corresponding constructorSimon Atanasyan2014-11-201-6/+8
| | | | | | No functional changes. llvm-svn: 222415
* Revert "[ELF] Sectionkey should also contain path."Shankar Easwaran2014-11-191-18/+14
| | | | | | | | This reverts commit r222309. Reverting because of failures on darwin bot. llvm-svn: 222332
* Revert "[ELF] Rename MergedSection to OutputSection."Shankar Easwaran2014-11-194-95/+102
| | | | | | | | | This reverts commit r222310. Not sure which commit is the cause of the failure on the darwin bot. Will need to revert my changes and commit one change at a time. llvm-svn: 222330
* Revert "[ELF] Create input and output section names"Shankar Easwaran2014-11-195-61/+26
| | | | | | | | This reverts commit r222311. Reverting because of failure in the darwin bot. llvm-svn: 222329
* Revert "[ELF] Fix creation of segments."Shankar Easwaran2014-11-191-15/+3
| | | | | | | | This reverts commit r222312. There looks to be an intermittent failure in the darwin buildbot. llvm-svn: 222326
* [Mips] Remove unnecessary debug logging codeSimon Atanasyan2014-11-191-43/+0
| | | | | | No functional changes llvm-svn: 222325
* [Mips] Configure PLT and LA25 entries in the corresponding constructorsSimon Atanasyan2014-11-191-24/+24
| | | | | | No functional changes. llvm-svn: 222324
* [Mips] Inline the configurePLTReference methodSimon Atanasyan2014-11-191-9/+2
| | | | | | No functional changes. llvm-svn: 222323
* [Mips] Remove redundant const_castSimon Atanasyan2014-11-191-1/+1
| | | | | | No functional changes. llvm-svn: 222322
* [Mips] Make the function return type constant pointerSimon Atanasyan2014-11-191-2/+2
| | | | | | No functional changes. llvm-svn: 222321
* [Mips] Move setup of LLD_R_MIPS_STO_PLT relocation to the getPLTEntry() routineSimon Atanasyan2014-11-191-20/+5
| | | | | | No functional changes. llvm-svn: 222320
* [ELF] Handle ctors/dtors sectionsShankar Easwaran2014-11-192-21/+4
| | | | | | | | Move functionality from MIPS target to DefaultLayout. No change in functionality. llvm-svn: 222313
* [ELF] Fix creation of segments.Shankar Easwaran2014-11-191-3/+15
| | | | | | | Linker was creating a separate output segment in some cases if input sections had huge alignments. This patch fixes the issue. llvm-svn: 222312
* [ELF] Create input and output section namesShankar Easwaran2014-11-196-28/+63
| | | | | | No change in functionality. llvm-svn: 222311
* [ELF] Rename MergedSection to OutputSection.Shankar Easwaran2014-11-194-102/+95
| | | | | | No change in functionality. llvm-svn: 222310
OpenPOWER on IntegriCloud