summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove unused #includes.Rui Ueyama2015-02-275-5/+0
| | | | llvm-svn: 230726
* Add {read,write}{16,32,64}{le,be} functions.Rui Ueyama2015-02-278-131/+62
| | | | | | | | | | | | | | Nothing wrong with reinterpret_cast<llvm::support::ulittle32_t *>(loc), but that's redundant and not great from readability point of view. The new functions are wrappers for that kind of reinterpet_casts. Surprisingly or unsurprisingly, there was no use of big endian read and write. {read,write}{16,32,64}be have no user. But I think they still worth to be there in the header for completeness. http://reviews.llvm.org/D7927 llvm-svn: 230725
* PECOFF: allow more than one /alternatename for the same symbol.Rui Ueyama2015-02-262-18/+7
| | | | | | | | | | | Previously we have a string -> string map to keep the weak alias symbol mapping. Naturally we can't define more than one weak alias with that data structure. This patch is to allow multiple aliases for the same symbol by changing the map type to string -> set of string map. llvm-svn: 230702
* Give enum an unsigned type to silence -Wmicrosoft clang-cl warningReid Kleckner2015-02-261-1/+1
| | | | llvm-svn: 230687
* [ELF] Reduce the code indentationSimon Atanasyan2015-02-261-11/+10
| | | | | | No functional changes. llvm-svn: 230678
* [Mips] Mark some MipsELFFile member functions as constantSimon Atanasyan2015-02-261-3/+3
| | | | | | No functional changes. llvm-svn: 230677
* Add Example Sub Target.Michael J. Spencer2015-02-266-0/+130
| | | | llvm-svn: 230594
* [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-2210-99/+99
| | | | 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-221-1/+1
| | | | | | | | | | | | | 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-208-8/+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
* 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
OpenPOWER on IntegriCloud