summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/ELF/X86_64
Commit message (Collapse)AuthorAgeFilesLines
* Remove the old ELF linker.Rafael Espindola2016-02-2819-1390/+0
| | | | | | I think it is clear by now that the new linker is viable. llvm-svn: 262158
* Add File::kind's for all subclasses of File.Pete Cooper2016-01-143-3/+5
| | | | | | | | | | | | This is to enable isa<> support for any files which need it. It will be used in an upcoming patch to differentiate MachOFile from other implicitly generated files. Reviewed by Lang Hames. Differential Revision: http://reviews.llvm.org/D16103 llvm-svn: 257830
* Set the folder for libraries to 'lld libraries'. NFC.Pete Cooper2016-01-072-2/+2
| | | | | | | | | | | | In a UI such as XCode, LLVM source files are in 'libraries' while clang files are in 'clang libraries'. This change moves the lld source to 'lld libraries' to make code browsing easier. It should be NFC as the build itself is still the same, just the structure in a UI differs. llvm-svn: 257001
* Simplify Pass::perform to take a SimpleFile& instead of unique_ptr<SimpleFile>&David Blaikie2015-06-191-10/+10
| | | | | | | | None of the implementations replace the SimpleFile with some other file, they just modify the SimpleFile in-place, so a direct reference to the file is sufficient. llvm-svn: 240167
* [lld] Allow LLD passes to return error codes.Lang Hames2015-06-191-1/+2
| | | | llvm-svn: 240147
* [ELF/x86_64] Fix initial-exec TLS accessAdhemerval Zanella2015-06-177-16/+122
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current approach for initial-exec in ELF/x86_64 is to create a GOT entry and change the relocation to R_X86_64_PC32 to be handled as a GOT offfset. However there are two issues with this approach: 1. the R_X86_64_PC32 is not really required since the GOT relocation will be handle dynamically and 2. the TLS symbols are not being exported externally and then correct realocation are not being applied. This patch fixes the R_X86_64_GOTTPOFF handling by just emitting a R_X86_64_TPOFF64 dynamically one; it also sets R_X86_64_TPOFF64 to be handled by runtime one. For second part, the patches uses a similar strategy used for aarch64, by reimplementing buildDynamicSymbolTable from X86_64ExecutableWriter and adding the TLS symbols in the dynamic symbol table. Some tests had to be adjusted due the now missing R_X86_64_PC32 relocation. With this test the simple testcase: * t1.c: __thread int t0; __thread int t1; __thread int t2; __thread int t3; * t0.c: extern __thread int t0; extern __thread int t1; extern __thread int t2; extern __thread int t3; __thread int t4; __thread int t5; __thread int t6; __thread int t7; int main () { t0 = 1; t1 = 2; t2 = 3; t3 = 4; t4 = 5; t5 = 6; t6 = 7; t7 = 8; printf ("%i %i %i %i\n", t0, t1, t2, t3); printf ("%i %i %i %i\n", t4, t5, t6, t7); return 0; } Shows correct output for x86_64. llvm-svn: 239908
* Revert unrelated chunk committed by accident in r236334.Davide Italiano2015-05-011-1/+1
| | | | | | | The change is likely to be correct, but unrelated to the aforementioned commit and needs a test to gets shipped. Sorry. llvm-svn: 236336
* [ELF] Fix test for .init_array.Davide Italiano2015-05-011-1/+1
| | | | | | | | Change the test so that it tests the right functionality. Also put a description with the code from which the test was generated. Reported by Simon Atanasysan. llvm-svn: 236334
* ELF: Remove redundant namespace qualifiers.Rui Ueyama2015-04-142-2/+2
| | | | llvm-svn: 234938
* ELF: Inline ELFReader typedefs which are used only once.Rui Ueyama2015-04-141-5/+2
| | | | llvm-svn: 234862
* ELF: Remove ELFT and LinkingContext template parameters from ELFReader.Rui Ueyama2015-04-142-4/+3
| | | | | | | | | | | | | | | | | | | Previously, ELFReader takes three template arguments: EFLT, LinkingContextT and FileT. FileT is itself templated. So it was a bit complicated. Maybe too much. Most architectures don't actually need to be parameterized for ELFT. For example, x86 is always ELF32LE and x86-64 is ELF64LE. However, because ELFReader requires a ELFT argument, we needed to parameterize a class even if not needed. This patch removes the parameter from the class. So now we can de-templatize such classes (I didn't do that in this patch, though). This patch also removes ContextT parameter since it didn't have to be passed as a template argument. llvm-svn: 234853
* ELF: Define ELF{32,64}{LE,BE} types and use them everywhere.Rui Ueyama2015-04-145-30/+5
| | | | llvm-svn: 234823
* ELF: s/ELFTy/ELFT/ for consistency.Rui Ueyama2015-04-131-3/+3
| | | | llvm-svn: 234790
* Remove redundant parentheses.Rui Ueyama2015-04-101-3/+3
| | | | llvm-svn: 234558
* Remove redundant virtual on member functions marked 'override'.David Blaikie2015-04-081-1/+1
| | | | llvm-svn: 234419
* [ELF] Remove redundant GOTFile classesSimon Atanasyan2015-04-082-20/+7
| | | | llvm-svn: 234397
* [ELF] Do not save a reference to GOTFile instance in xxxWriter classesSimon Atanasyan2015-04-082-13/+10
| | | | | | | | It's a follow-up to r234347. We do not need to keep a reference to `GOTFile` instance in a xxxWriter class after ownership is transferred to the caller of the `createImplicitFiles` method. llvm-svn: 234396
* [ELF] Remove unused xxxWriter class fieldsSimon Atanasyan2015-04-071-3/+2
| | | | llvm-svn: 234357
* [ELF] Remove redundant override methods which just call base class functionsSimon Atanasyan2015-04-072-8/+0
| | | | llvm-svn: 234356
* Merge MutableFile with SimpleFile.Rui Ueyama2015-04-071-1/+1
| | | | | | | | SimpleFile is the only derived class of MutableFile. This patch reduces the height of class hierarchy by removing MutableFile class. llvm-svn: 234354
* [ELF] Simplify adding default atomsSimon Atanasyan2015-04-072-8/+0
| | | | | | | | | | | | | | | | | | | | | Now 'writer' creates an instance of `RuntimeFile` in the constructor, then populates the file in the virtual function `addDefaultAtoms`, then pass owning of this file to the caller of virtual function `createImplicitFiles`. First, we do not need to keep an instance of `RuntimeFile` so long. It is enough to create the file, right after that populate it and pass the owning. Second, relationship between `createImplicitFiles` and `addDefaultAtoms` is complicated. The `createImplicitFiles` might call `addDefaultAtoms`, overridden version of `addDefaultAtoms` might call base class `addDefaultAtoms`, and overridden version of `createImplicitFiles` might call base class `createImplicitFiles` as well as `addDefaultAtoms`. The patch solves both problems above. It creates and populates runtime files right in the createImplicitFiles(), removes `addDefaultAtoms` at all and does not keep references to runtime files in class fields. llvm-svn: 234347
* Replace the `createImplicitFiles` method return type with `void`Simon Atanasyan2015-04-062-5/+3
| | | | | | | All instances of the `createImplicitFiles` always return `true` and this return value is used nowhere. llvm-svn: 234205
* [ELF] Use override keyword instead of virtualSimon Atanasyan2015-04-062-7/+7
| | | | | | No functional changes. llvm-svn: 234162
* ELF: Use short variable names in <Arch>RelocationHandlers.cpp.Rui Ueyama2015-04-041-15/+15
| | | | | | | | Functions in the files are hard to read because of line wrapping. Use shorter names for local variables so that the lines fit within 80 columns. llvm-svn: 234087
* ELF: Merge ELFTargets.h with ELFLinkingContext.h.Rui Ueyama2015-04-042-2/+0
| | | | | | | | These functions are "constructors" of the LinkingContexts. We already have auxiliary classes and functions for ELFLinkingContext in the header. They fall in the same category. llvm-svn: 234082
* ELF: Return TargetRelocationHandler instead of <ArcH>TargetRelocationHandler.Rui Ueyama2015-04-041-1/+1
| | | | | | | | | | getRelocationHandler is a public interface to get an instance of TargetRelocationHandler. We don't use any member function other than applyRelocations to a returned instance. Returning a base class instance suffices here. (If a return type is a derived class, it looks like we were using derived classes features.) llvm-svn: 234081
* ELF: Remove ELF{Object,DSO}Reader alias templates.Rui Ueyama2015-04-041-3/+2
| | | | | | | | | | Because of the previous change (r234074), ELFObjectReader became just an alias for ELFReader. We can replace all occurrences of ELFObjectReader with ELFReader. In this patch, I also replaced ELFDSOReader to remove the alias template. llvm-svn: 234076
* ELF: Remove <Arch>ELFReader.h. NFC.Rui Ueyama2015-04-032-31/+8
| | | | | | | | | | | <Arch>ELFReader.h contains only a few typedefs. The typedefs are used only by one class in <Arch>TargetHandler.h. Thus, the headers don't worth to be independent files. Since MipsELFReader.h contains code other than the boilerplate, I didn't touch that file in this patch. llvm-svn: 234056
* ELF: Fix header file dependencies.Rui Ueyama2015-04-031-1/+1
| | | | | | | <Arch>TargetHandler.h and <ArcH>RelocationHandler.h include each other. This patch breaks the circular dependencies. llvm-svn: 234050
* ELF: Pass file types instead of type traits to ELFObjectReader.Rui Ueyama2015-04-031-10/+2
| | | | | | | | All <Arch>ELFFileCreateFileTraits structs are the same except its file type. That means that we don't need to pass the type traits. Instead, we can only pass file types. By doing this, we can remove copy-pasted boilerplates. llvm-svn: 234047
* ELF: Remove partial class definitions of <Arch>LinkingContexts.Rui Ueyama2015-04-032-2/+4
| | | | | | | | | | | | | What we are doing in ELFTarget.h was dubious. In the file, we define partial classes of <Arch>LinkingContexts to declare only static member functions. We have different (complete) class definitions in other files. They would conflict if they exist in the same compilation unit (because the ones defined in ELFTarget.h has only static member functions). I don't think this was valid C++. http://reviews.llvm.org/D8797 llvm-svn: 234039
* ELF: Remove <Arch>ELFFileCreateELFTraits::result_type.Rui Ueyama2015-04-021-4/+2
| | | | | | | | result_type is always ErrorOr<unique_ptr<File>>, and since the type traits is for instantiating ELF files, it's unlikely that we want to return something else. This patch removes that type. llvm-svn: 233948
* ELF: Remove {AArch64,X86,X86_64}ELFFile because they are empty.Rui Ueyama2015-04-023-38/+2
| | | | llvm-svn: 233897
* ELF: Replace empty classes with typedefs.Rui Ueyama2015-04-021-15/+3
| | | | llvm-svn: 233896
* ELF: Remove a template parameter from ELF{Object,DOS}Reader constructors.Rui Ueyama2015-04-022-3/+3
| | | | | | | | | There is one-to-one correspondence between ELF machine type and a LinkingContext. We passed them as separate arguments to the constructor. This patch is to teach the LinkingContexts about their machine types, so that we don't need to pass that data as separate arguments. llvm-svn: 233894
* ELF: Move registerRelocationNames() from TargetHandler to ↵Rui Ueyama2015-04-024-17/+16
| | | | | | | | | | | | | | | | | | | | | <Arch>ELFLinkingContext. registerRelocationNames() function is called to register all known ELF relocation types to the central registry. Since we have separate LinkingContext class for each ELF machine type, we need to call the function for each LinkingContext. However, the function belonged to TargetHandler instead of LinkingContext. So we needed to do ctx.getTargetHandler().registerRelocationNames(). This patch removes that redundant getTargetHandler call by moving the function from TargetHandler to LinkingContext. Conceptually this patch is small, but in reality it's not that small. It's because the same code is copied to each architecture. Most of this patch is just repetition. We need to merge them, but that cannot be done in this patch. llvm-svn: 233883
* ELF: Move x86-64-only function from DefaultLayout to X86_64TargetLayout.Rui Ueyama2015-04-021-2/+31
| | | | | | | | Also removed some over-generalization added in r232866, such as making a function take two parameters and pass two equivalent arguments to the function. llvm-svn: 233882
* ELF: x86, x86-64, ARM, AArch64: Remove architecture name prefixes from class ↵Rui Ueyama2015-04-026-19/+14
| | | | | | members. llvm-svn: 233873
* ELF: Remove <Arch>TargetHandler::kindString.Rui Ueyama2015-04-012-11/+8
| | | | | | | | | | | | | <Arch>TargetHandler::kindString is a static member variable containg a list of names of relocation types. The member is used only by one function, registerRelocationNames, so they don't have to be a static member. This patch makes the visibility of the data narrower by making them file-scoped variables in small files. llvm-svn: 233867
* Use llvm::make_unique.Rui Ueyama2015-04-011-2/+1
| | | | llvm-svn: 233863
* Use C++ non-static member initialization.Rui Ueyama2015-04-011-7/+5
| | | | llvm-svn: 233859
* ELF: Remove TargetHandlerBase by merging it with TargetHandler.Rui Ueyama2015-04-014-4/+5
| | | | | | | | | | | | | | | | | | | In r233772, I removed an empty class, DefaultTargetHandler, from the class hierarchy by merging the class with TargetHandler. I then found that TargetHandler and its base class, TargetHandlerBase, are also almost the same. We need to go deeper. In this patch, I merged TargetHandlerBase with TargetHandler. The only difference between them is the existence (or absense) of a pure virtual function registerRelocationName(). I added that function to the (new) TargetHandler. One more thing is that TargetHandler was templated for no reason. I made it non-templated class. llvm-svn: 233773
* ELF: Remove dead class that does nothing in class hierarchy.Rui Ueyama2015-03-311-3/+1
| | | | | | | | | | | | | | DefaultTargetHandler is the base class of all <Arch>TargetHandler classes, and it's the only derived class of TargetHandler class. TargetHandler and DefaultTargetHandler are actually the same. They define the same set of pure virtual functions. DefaultTargetHandler is a useless class in the class hierarchy -- it shouldn't have been added in the first place. This patch makes all <Arch>TargetHandler classes directly derive from TargetHandler and removes DefaultTargetHandler. llvm-svn: 233772
* ELF: Remove TargetHandler::getTargetLayout.Rui Ueyama2015-03-311-4/+0
| | | | | | | Only MIPS used that member function, and by removing the use of the function, I removed a static_cast. Seems like it's a win. llvm-svn: 233748
* Replace *(uniqueptr.get()) with *uniqueptr.Rui Ueyama2015-03-311-2/+2
| | | | | | | Apparently they are copy-pastes. They need to be merged, or otherwise they will diverge needlessly as I did in r233723... llvm-svn: 233741
* Rename identifiers starting with an underscore and a uppercase letter.Rui Ueyama2015-03-311-12/+12
| | | | | | | Identifiers starting with _[A-Z] is reserved for the language. User programs shouldn't use such identifiers. llvm-svn: 233737
* Rename all caps class names.Rui Ueyama2015-03-272-4/+4
| | | | | | | We have GOTAtom and PLTAtom classes because GOT or PLT are acronyms. "Dynamic offset table" or "dynamic" are not acronyms. llvm-svn: 233401
* Rename ELFLinkingContext instances "ctx" intead of "context".Rui Ueyama2015-03-274-20/+17
| | | | llvm-svn: 233344
* Use llvm::make_unique.Rui Ueyama2015-03-262-6/+6
| | | | llvm-svn: 233319
* Remove duplicate code and empty classes.Rui Ueyama2015-03-262-19/+2
| | | | llvm-svn: 233316
OpenPOWER on IntegriCloud