summaryrefslogtreecommitdiffstats
path: root/lld/ELF/Thunks.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [ELF] - Detemplate elf::addSyntheticLocal(). NFC.George Rimar2017-05-161-9/+9
| | | | llvm-svn: 303155
* [ELF] Rename ARM Thunks in anticipation of Range ThunksPeter Smith2017-04-041-31/+26
| | | | | | | | | | | The existing names for the ARM and Thumb Thunks highlight their current use as interworking Thunks. These Thunks can also be used for range extension Thunks where there is no state change. This change makes the name more generic so it is suitable for range extension. Differential Revision: https://reviews.llvm.org/D31605 llvm-svn: 299418
* Compute Config member function return values only once.Rui Ueyama2017-03-171-2/+2
| | | | | | | | | | | We had a few Config member functions that returns configuration values. For example, we had is64() which returns true if the target is 64-bit. The return values of these functions are constant and never change. This patch is to compute them only once to make it clear that they'll never change. llvm-svn: 298168
* [ELF] - Detemplate SymbolBody::getVA and SymbolBody::getPltVA. NFC.George Rimar2017-03-171-9/+9
| | | | llvm-svn: 298071
* [ELF] Detemplate ThunkSection and Thunk classes. NFC.George Rimar2017-03-161-48/+39
| | | | llvm-svn: 297939
* De-template DefinedRegular.Rui Ueyama2017-02-281-1/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D30348 llvm-svn: 296508
* Make InputSection a class. NFC.Rafael Espindola2017-02-231-3/+3
| | | | | | | | | With the current design an InputSection is basically anything that goes directly in a OutputSection. That includes plain input section but also synthetic sections, so this should probably not be a template. llvm-svn: 295993
* Convert InputSectionBase to a class.Rafael Espindola2017-02-231-9/+9
| | | | | | | Removing this template is not a big win by itself, but opens the way for removing more templates. llvm-svn: 295923
* Do not store a computable attributes to Config.Rui Ueyama2017-02-141-2/+2
| | | | llvm-svn: 295031
* [ELF] Use SyntheticSections for ThunksPeter Smith2017-02-011-85/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | Thunks are now implemented by redirecting the relocation to the symbol S, to a symbol TS in a Thunk. The Thunk will transfer control to S. This has the following implications: - All the side-effects of Thunks happen within createThunks() - Thunks are no longer stored in InputSections and Symbols no longer need to hold a pointer to a Thunk - The synthetic Thunk sections need to be merged into OutputSections This implementation is almost a direct conversion of the existing Thunks with the following exceptions: - Mips LA25 Thunks are placed before the InputSection that defines the symbol that needs a Thunk. - All ARM Thunks are placed at the end of the OutputSection of the first caller to the Thunk. Range extension Thunks are not supported yet so it is optimistically assumed that all Thunks can be reused. This is a recommit of r293283 with a fixed comparison predicate as std::merge requires a strict weak ordering. Differential revision: https://reviews.llvm.org/D29327 llvm-svn: 293757
* Revert "[ELF][ARM] Use SyntheticSections for Thunks"Rui Ueyama2017-01-281-93/+85
| | | | | | This reverts commit r293283 because it broke MSVC build. llvm-svn: 293352
* [ELF][ARM] Use SyntheticSections for ThunksPeter Smith2017-01-271-85/+93
| | | | | | | | | | | | | | | | | | | | | | | | Thunks are now implemented by redirecting the relocation to the symbol S, to a symbol TS in a Thunk. The Thunk will transfer control to S. This has the following implications: - All the side-effects of Thunks happen within createThunks() - Thunks are no longer stored in InputSections and Symbols no longer need to hold a pointer to a Thunk - The synthetic Thunk sections need to be merged into OutputSections This implementation is almost a direct conversion of the existing Thunks with the following exceptions: - Mips LA25 Thunks are placed before the InputSection that defines the symbol that needs a Thunk. - All ARM Thunks are placed at the end of the OutputSection of the first caller to the Thunk. Range extension Thunks are not supported yet so it is optimistically assumed that all Thunks can be reused. Differential Revision: https://reviews.llvm.org/D29129 llvm-svn: 293283
* [ELF] Add support for thunks to undefined non-weak symbolsPeter Smith2017-01-041-0/+2
| | | | | | | | | | | | In a shared library an undefined symbol is implicitly imported. If the symbol is called as a function a PLT entry is generated for it. When the caller is a Thumb b.w a thunk to the PLT entry is needed as all PLT entries are in ARM state. This change allows undefined symbols to have thunks in the same way that shared symbols may have thunks. llvm-svn: 290951
* Remove lld/Support/Memory.h.Rui Ueyama2016-12-181-1/+1
| | | | | | | | | | | | I thought for a while about how to remove it, but it looks like we can just copy the file for now. Of course I'm not happy about that, but it's just less than 50 lines of code, and we already have duplicate code in Error.h and some other places. I want to solve them all at once later. Differential Revision: https://reviews.llvm.org/D27819 llvm-svn: 290062
* Move Memory.{h,cpp} to lld/Support so that we can use them from COFF.Rui Ueyama2016-12-081-1/+1
| | | | llvm-svn: 289084
* Split Header into individual fields.Rafael Espindola2016-11-091-1/+1
| | | | | | | | | This is similar to what was done for InputSection. With this the various fields are stored in host order and only converted to target order when writing. llvm-svn: 286327
* Fix some Clang-tidy modernize-use-default and Include What You Use warnings; ↵Eugene Zelenko2016-11-051-8/+12
| | | | | | | | other minor fixes. Differential revision: https://reviews.llvm.org/D26320 llvm-svn: 286030
* Consolidate BumpPtrAllocators.Rui Ueyama2016-10-281-6/+6
| | | | | | | | | | | Previously, we have a lot of BumpPtrAllocators, but all these allocators virtually have the same lifetime because they are not freed until the linker finishes its job. This patch aggregates them into a single allocator. Differential revision: https://reviews.llvm.org/D26042 llvm-svn: 285452
* Sign extend a value before passing it to the Target.Rafael Espindola2016-09-011-1/+2
| | | | | | | | | This is what InputSectionBase<ELFT>::relocate does and we need to be consistent. The other option would be to be more explicit about which relocations are signed and which are not, and sign extend only when appropriated. That would require extending the target interface. llvm-svn: 280366
* Simplify. NFC.Rui Ueyama2016-07-121-5/+3
| | | | | | | Config->Pic is true if (Config->Pie || Config->Shared) is true, so this extra check was redundant. llvm-svn: 275234
* Update comments.Rui Ueyama2016-07-091-5/+11
| | | | llvm-svn: 275003
* Remove Target::writeThunk.Rui Ueyama2016-07-091-6/+11
| | | | | | | | Only MipsThunk were using the function, and the way how it wrote thunk contents was different from ARM thunks. This patch makes them consistent. llvm-svn: 274997
* Make ARM thunks consistent with MIPS in coding style.Rui Ueyama2016-07-091-92/+95
| | | | | | | | Although they are in the same .cpp file, the way they were written were slightly different, so they looked more different than they were. This patch makes their styles consistent. llvm-svn: 274996
* Instantiate Thunk classes instead of the class member functions.Rui Ueyama2016-07-091-4/+4
| | | | llvm-svn: 274994
* Split addThunkARM. NFC.Rui Ueyama2016-07-091-27/+26
| | | | llvm-svn: 274993
* Fix memory leak.Rui Ueyama2016-07-081-13/+19
| | | | | | | | | | Symbol's dtors are not called because they are allocated using BumpPtrAllocators. So, members of std::unique_ptr type are not freed when symbols are deallocated. This patch is to allocate Thunks using BumpPtrAllocators. llvm-svn: 274896
* Recommit R274836 Add Thunk support framework for ARM and MipsPeter Smith2016-07-081-0/+251
| | | | | | | | | | | The TinyPtrVector of const Thunk<ELFT>* in InputSections.h can cause build failures on certain compiler/library combinations when Thunk<ELFT> is not a complete type or is an abstract class. Fixed by making Thunk<ELFT> non Abstract. type or is an abstract class llvm-svn: 274863
* Revert R274836 Add Thunk support framework for ARM and MipsPeter Smith2016-07-081-251/+0
| | | | | | | This seems to be causing a buildbot failure on lld-x86_64-freebsd. Will reproduce locally and fix. llvm-svn: 274841
* Add Thunk support framework for ARM and MipsPeter Smith2016-07-081-0/+251
Generalise the Mips LA25 Thunk code and implement ARM and Thumb interworking Thunks. - Introduce a new module Thunks.cpp to store the Target Specific Thunk implementations. - DefinedRegular and Shared have a ThunkData field to record Thunk. - A Target can have more than one type of Thunk. - Support PC-relative calls to Thunks. - Support Thunks to PLT entries. - Existing Mips LA25 Thunk code integrated. - Support for ARMv7A interworking Thunks. Limitations: - Only one Thunk per SymbolBody, this is sufficient for all currently implemented Thunks. - ARM thunks assume presence of V6T2 MOVT and MOVW instructions. Differential revision: http://reviews.llvm.org/D21891 llvm-svn: 274836
OpenPOWER on IntegriCloud