diff options
| author | Peter Smith <peter.smith@linaro.org> | 2017-01-27 13:10:16 +0000 |
|---|---|---|
| committer | Peter Smith <peter.smith@linaro.org> | 2017-01-27 13:10:16 +0000 |
| commit | 5191c6f9456f893ff6160b83b6a5d816c0535fff (patch) | |
| tree | ee04436fc242d7c458f47b4090a40aae3a5ed6be /lld/ELF/Writer.cpp | |
| parent | 810055ee232cd1c60714a14bdd13dde17590bc53 (diff) | |
| download | bcm5719-llvm-5191c6f9456f893ff6160b83b6a5d816c0535fff.tar.gz bcm5719-llvm-5191c6f9456f893ff6160b83b6a5d816c0535fff.zip | |
[ELF][ARM] Use SyntheticSections for Thunks
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
Diffstat (limited to 'lld/ELF/Writer.cpp')
| -rw-r--r-- | lld/ELF/Writer.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index 3ed91fd51a0..6e53fbfb462 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -1027,6 +1027,12 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() { if (In<ELFT>::Iplt && !In<ELFT>::Iplt->empty()) In<ELFT>::Iplt->addSymbols(); + // Some architectures use small displacements for jump instructions. + // It is linker's responsibility to create thunks containing long + // jump instructions if jump targets are too far. Create thunks. + if (Target->NeedsThunks) + createThunks<ELFT>(OutputSections); + // Now that we have defined all possible symbols including linker- // synthesized ones. Visit all symbols to give the finishing touches. for (Symbol *S : Symtab<ELFT>::X->getSymbols()) { @@ -1072,12 +1078,6 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() { fixHeaders(); } - // Some architectures use small displacements for jump instructions. - // It is linker's responsibility to create thunks containing long - // jump instructions if jump targets are too far. Create thunks. - if (Target->NeedsThunks) - createThunks<ELFT>(OutputSections); - // Fill other section headers. The dynamic table is finalized // at the end because some tags like RELSZ depend on result // of finalizing other sections. |

