summaryrefslogtreecommitdiffstats
path: root/lld/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* [ELF][x86-64] Make the X86_64LinkingContext and X86_64TargetHandler derivable.Michael J. Spencer2015-02-263-14/+21
| | | | llvm-svn: 230593
* Remove unused variables.Michael J. Spencer2015-02-251-4/+1
| | | | llvm-svn: 230578
* [ELF][x86] Detemplatify ELFT. There's only a single valid instantiation.Michael J. Spencer2015-02-256-56/+64
| | | | llvm-svn: 230574
* [ELF][X86_64] Handle R_X86_64_PC64 relocationDavide Italiano2015-02-251-0/+11
| | | | | | | Differential Revision: D7820 Reviewed by: shankarke, ruiu llvm-svn: 230465
* [ELF] Create a map from Reference to Symbol.Shankar Easwaran2015-02-233-24/+36
| | | | | | | | | | | In LLD's model, symbol is a property of the node (atom) and not a property of edge (reference). Prior to this patch, we stored the symbol in the reference. From post-commit comments, it seemed better to create a map from the reference to the symbol instead and use this mapping wherever desired. Address comments from Ruiu/Simon Atanasyan. llvm-svn: 230273
* [ELF][Writer] Use llvm::StringMap insteadShankar Easwaran2015-02-231-1/+1
| | | | | | Cleanup. llvm-svn: 230219
* [ELF] Add comments in the ELF readerShankar Easwaran2015-02-233-7/+18
| | | | | | Address review comments from Ruiu, and add some more TODO's. llvm-svn: 230218
* [ELF] Add section group/COMDAT support.Shankar Easwaran2015-02-238-29/+143
| | | | | | | | | | | | | | | | | | | | | | | | | | SHF_GROUP: Group Member Sections ---------------------------------- A section which is part of a group, and is to be retained or discarded with the group as a whole, is identified by a new section header attribute: SHF_GROUP This section is a member (perhaps the only one) of a group of sections, and the linker should retain or discard all or none of the members. This section must be referenced in a SHT_GROUP section. This attribute flag may be set in any section header, and no other modification or indication is made in the grouped sections. All additional information is contained in the associated SHT_GROUP section. SHT_GROUP: Section Group Definition ------------------------------------- Represents a group section. The section group's sh_link field identifies a symbol table section, and its sh_info field the index of a symbol in that section. The name of that symbol is treated as the identifier of the section group. More information: https://mentorembedded.github.io/cxx-abi/abi/prop-72-comdat.html Added a lot of extensive tests, that tests functionality. llvm-svn: 230195
* [ELF] Add .gnu.linkonce support.Shankar Easwaran2015-02-234-12/+136
| | | | | | | | | | | | | When the GNU linker sees two input sections with the same name, and the name starts with ".gnu.linkonce.", the linker will only keep one copy and discard the other. Any section whose name starts with “.gnu.linkonce.” is a COMDAT section. Some architectures like Hexagon use this section to store floating point constants, that need be deduped. This patch adds gnu.linkonce functionality to the ELFReader. llvm-svn: 230194
* [Core,MachO,Test] Remove trailing whitespace.Shankar Easwaran2015-02-2211-100/+100
| | | | llvm-svn: 230192
* [ELF] Add symbol to ELFReference.Shankar Easwaran2015-02-223-21/+28
| | | | | | | | | Relocation handling need more information about the Symbol that we are creating references for. No change in functionality. llvm-svn: 230191
* [Core] Fix handling of Section Groups.Shankar Easwaran2015-02-221-9/+0
| | | | | | | | | There is code(added by me) in the YAMLReader which isn't correct when it handles references for section groups. The test case was also checking for wrong outputs. This fixes the bug and the testcase so that they check for proper outputs. llvm-svn: 230190
* [ELF][X86_64] R_X86_64_16 relocation supportShankar Easwaran2015-02-222-0/+13
| | | | llvm-svn: 230189
* Switch to use override, fixes -Winconsistent-missing-override on LLD.Chandler Carruth2015-02-221-3/+2
| | | | llvm-svn: 230166
* [ELF] Teach GNU Driver about --stats.Davide Italiano2015-02-223-2/+18
| | | | | | | | | | | | | This is mainly for back-compatibility with GNU ld. Ideally --stats should be a general option in LinkingContext, providing individual stats for every pass in the linking process. In the GNU driver, a better wording could be used, but there's no need to change it for now. Differential Revision: D7657 Reviewed by: ruiu llvm-svn: 230157
* [ELF] Remove FIXME(s) that are already fixed.Shankar Easwaran2015-02-211-4/+2
| | | | | | | | FIXME code was left around in few places where its already been taken care of. This removes the FIXME's that are not needed. llvm-svn: 230139
* [ELF][Writer] Use Path to create AtomSection.Shankar Easwaran2015-02-212-21/+32
| | | | | | | | | Now since the correct file path for atoms is available and not clobbered, commit r222309 which was reverted previously can be added back. No change in functionality. llvm-svn: 230138
* [ELF] Fix References being ignored.Shankar Easwaran2015-02-211-2/+2
| | | | | | | | The ELFReader was skipping references for sections that contained relocations. This fixes the bug. llvm-svn: 230127
* PECOFF: Temporarily add a lock to un-break buildbot.Rui Ueyama2015-02-201-0/+4
| | | | | | | | | | | | Looks like there's a threading issue in the COFF reader which makes buildbot unstable. Probability of crash varies depending on the number of input. If we are linking a big executalbe, LLD almost always crash. This patch temporarily adds a lock to guard the reader so that LLD doesn't crash. I'll investigate and fix the issue as soon as possible because this patch has negative performance impact. llvm-svn: 230086
* Remove YAML/Native round-trip passes.Rui Ueyama2015-02-2015-151/+0
| | | | | | | | | | | | | | | | | | | | The round-trip passes were introduced in r193300. The intention of the change was to make sure that LLD is capable of reading end writing such file formats. But that turned out to be yet another over-designed stuff that had been slowing down everyday development. The passes ran after the core linker and before the writer. If you had an additional piece of information that needs to be passed from front-end to the writer, you had to invent a way to save the data to YAML/Native. These passes forced us to do that even if that data was not needed to be represented neither in an object file nor in an executable/DSO. It doesn't make sense. We don't need these passes. http://reviews.llvm.org/D7480 llvm-svn: 230069
* [Mach-O] Remove redundant allocatorJean-Daniel Dupas2015-02-201-2/+1
| | | | llvm-svn: 230007
* Driver: Fix an incorrect use of llvm::NoneJustin Bogner2015-02-201-1/+1
| | | | | | This function returns a bool, so llvm::None doesn't make sense here. llvm-svn: 229997
* LinkerScript: Remove leaks in the parserDavid Majnemer2015-02-201-33/+36
| | | | | | | | | | | LinkerScript AST nodes are never destroyed which means that their std::vector members will never be destroyed. Instead, allocate the operand list itself in the Parser's BumpPtrAllocator. This ensures that the storage will be destroyed along with the nodes when the Parser is destroyed. llvm-svn: 229967
* PECOFF: Fix base relocation for ImageBase.Rui Ueyama2015-02-201-1/+7
| | | | | | | | | | | | | | This is yet another edge case of base relocation for symbols. Absolute symbols are in general not target of base relocation because absolute atom is a way to point to a specific memory location. In r229816, I removed entries for absolute atoms from the base relocation table (so that they won't be fixed by the loader). However, there was one exception -- ImageBase. ImageBase points to the start address of the current image in memory. That needs to be fixed up at load time. This patch is to treat the symbol in a special manner. llvm-svn: 229961
* Fix heap-buffer-overflow bugs identified by the Address SanitizerGreg Fitzgerald2015-02-192-0/+5
| | | | | | Differential Revision: http://reviews.llvm.org/D7733 llvm-svn: 229912
* [Mach-O] Rename enum typename for consistency. NFCJean-Daniel Dupas2015-02-194-18/+18
| | | | | | | Typename shouldn't mix camel case and underscore. Thanks to Rui for the remark. llvm-svn: 229848
* PECOFF: Fix base relocation for an absolute symbol.Rui Ueyama2015-02-191-0/+2
| | | | | | | | | | | | Previously we wrongly emitted a base relocation entry for an absolute symbol. That made the loader to rewrite some instruction operands with wrong values only when a DLL is not loaded at the default address. That caused a misterious crash of some executable. Absolute symbols will of course never change value wherever the binary is loaded to memory. We shouldn't emit base relocations for absolute symbols. llvm-svn: 229816
* PECOFF: Fix symbol aliasesRui Ueyama2015-02-181-13/+17
| | | | | | | | | | | | | | | | | | | | Weak aliases defined using /alternatename command line option were getting wrong RVAs in the final output because of wrong atom ordinal. Alias atoms were assigned large ordinals than any other regular atoms because they were instantiated after other atoms and just got new (larger) ordinals. Atoms are sorted by its file and atom ordinals in the order pass. Alias atoms were located after all other atoms in the same file. An alias atom's ordinal needs to be smaller than its alias target but larger than the atom appeared before the target -- so that the alias is located between the two. Since an alias has no size, the alias target will be located at the same location as the alias. In this patch, I made a gap between two regular atoms so that we can put aliases after instantiating them (without re-numbering existing atoms). llvm-svn: 229762
* Fix use-after-free bug identified by the Address SanitizerGreg Fitzgerald2015-02-181-3/+1
| | | | | | | | | atomContent's memory is freed at the end of the stack frame, but it is referenced by the atom pushed into _definedAtoms. Differential Revision: http://reviews.llvm.org/D7732 llvm-svn: 229749
* [ELF] Demangle: don't expose raw info when getter is available.Davide Italiano2015-02-182-2/+2
| | | | | | | Differential Revision: D7693 Reviewed by: shankarke llvm-svn: 229635
* [Mips] Replace a magic number by enumerationSimon Atanasyan2015-02-161-1/+1
| | | | | | No functional changes. llvm-svn: 229453
* [Mips] Read GP0 value from .MIPS.options sectionSimon Atanasyan2015-02-161-5/+37
| | | | llvm-svn: 229442
* [Mips] Show error if MIPS_REGINFO section has invalid sizeSimon Atanasyan2015-02-161-3/+3
| | | | llvm-svn: 229441
* [Mips] Factor out the code to search section by type and flags into theSimon Atanasyan2015-02-161-18/+31
| | | | | | | | separate functions No functional changes. llvm-svn: 229440
* MSVC no longer requires the explicit cast operation to obtain a function ↵Aaron Ballman2015-02-161-7/+2
| | | | | | pointer from this capture-less lambda. NFC. llvm-svn: 229426
* Update ARM and x86 ArchHandler to check switch completeness. NFCJean-Daniel Dupas2015-02-153-17/+25
| | | | | | Define an explicit type for arch specific reference kinds to make sure all cases are covered in switch statements. llvm-svn: 229314
* Break some test. Revert until I got a proper fixJean-Daniel Dupas2015-02-142-76/+72
| | | | llvm-svn: 229249
* Update ARM and x86 ArchHandler to match 64bits counterparts. NFCJean-Daniel Dupas2015-02-142-72/+76
| | | | | | | | | | | | | | | | | | Summary: Define an explicit type for arch specific reference kind and use it in switch statement to make the compiler emit warnings if some case is not cover. It will help to catch such errors when we add new mach-o reference kind. Reviewers: shankarke, kledzik Reviewed By: shankarke Subscribers: shankarke, aemerson, llvm-commits Projects: #lld Differential Revision: http://reviews.llvm.org/D7612 llvm-svn: 229246
* [ELF] Replace std::set with StringSet.Shankar Easwaran2015-02-132-15/+7
| | | | | | | | | Wrap functionality was using a std::set to record symbols that need to be wrapped. This changes the implementation to use a StringSet instead. No change in functionality. llvm-svn: 229165
* Remove file not used anywhere.Jean-Daniel Dupas2015-02-131-31/+0
| | | | llvm-svn: 229109
* Using 'isa' instead of 'dyn_cast'Jean-Daniel Dupas2015-02-131-1/+1
| | | | llvm-svn: 229107
* ELF/AArch64: Add support for checking for ABS32 overflowWill Newton2015-02-131-5/+14
| | | | | | | Add support for checking overflow when applying a R_AARCH64_ABS32 relocation and add a test to ensure it behaves correctly. llvm-svn: 229072
* Remove unused parameters.Rui Ueyama2015-02-136-20/+12
| | | | llvm-svn: 229055
* Remove class that really does nothing.Rui Ueyama2015-02-134-15/+2
| | | | llvm-svn: 229030
* PECOFF: Fix dummy symbol table in executable.Rui Ueyama2015-02-121-0/+4
| | | | | | | | | | | If the name field of a symbol table entry is all zero, it's interpreted as it's pointing to the beginning of the string table. The first four bytes of the string table is the size field, so dumpbin dumps that number as an ASCIZ string. This patch fills a dummy value to name field. llvm-svn: 228971
* [ELF] Insert wrap symbols into a set.Shankar Easwaran2015-02-121-2/+3
| | | | | | | Symbols specified by --wrap was being inserted into a vector, change this to insert into a set, so that we have unique entries. llvm-svn: 228968
* PECOFF: Don't parse files in .drectve asynchronously.Rui Ueyama2015-02-121-8/+4
| | | | | | | | | Looks like there's a race condition around here that caused LLD to crash on Windows. Currently we are parsing libraries specified by .drectve section asynchronously, and something is wrong in that process. Disable the feature for now to make buildbots happy. llvm-svn: 228955
* [ELF][Cleanup] Remove unused functionShankar Easwaran2015-02-121-4/+0
| | | | | | We can add this function when we really have a need. llvm-svn: 228907
* [ELF] Support --wrap optionShankar Easwaran2015-02-124-3/+75
| | | | | | | | | | | | | | | | | | | | | | | | Use a wrapper function for symbol. Any undefined reference to symbol will be resolved to "__wrap_symbol". Any undefined reference to "__real_symbol" will be resolved to symbol. This can be used to provide a wrapper for a system function. The wrapper function should be called "__wrap_symbol". If it wishes to call the system function, it should call "__real_symbol". Here is a trivial example: void * __wrap_malloc (size_t c) { printf ("malloc called with %zu\n", c); return __real_malloc (c); } If you link other code with this file using --wrap malloc, then all calls to "malloc" will call the function "__wrap_malloc" instead. The call to "__real_malloc" in "__wrap_malloc" will call the real "malloc" function. llvm-svn: 228906
* [ELF] Add LinkingContext to the ELFReader.Shankar Easwaran2015-02-1228-175/+182
| | | | | | | | | | | | | | | This adds the LinkingContext parameter to the ELFReader. Previously the flags in that were needed in the Context was passed to the ELFReader, this made it very hard to access data structures in the LinkingContext when reading an ELF file. This change makes the ELFReader more flexible so that required parameters can be grabbed directly from the LinkingContext. Future patches make use of the changes. There is no change in functionality though. llvm-svn: 228905
OpenPOWER on IntegriCloud