diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2016-05-12 21:53:34 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2016-05-12 21:53:34 +0000 |
commit | 01f16364084af96b11c7da8337f5c30b71d1f916 (patch) | |
tree | 8b039fba4870ba469b138d2a12a8214a62d2e040 | |
parent | 62cb02eef18f261a09d0a24b770ad82e4f47d000 (diff) | |
download | bcm5719-llvm-01f16364084af96b11c7da8337f5c30b71d1f916.tar.gz bcm5719-llvm-01f16364084af96b11c7da8337f5c30b71d1f916.zip |
Handle thunks in adjustExpr.
This is similar to the other changes this function does. With this all
Relocations.push_back calls look similar.
llvm-svn: 269362
-rw-r--r-- | lld/ELF/Writer.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index e40a5ce8224..1994e24a799 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -69,7 +69,8 @@ private: void scanRelocs(InputSection<ELFT> &C); void scanRelocs(InputSectionBase<ELFT> &S, const Elf_Shdr &RelSec); - RelExpr adjustExpr(SymbolBody &S, bool IsWrite, RelExpr Expr, uint32_t Type); + RelExpr adjustExpr(const elf::ObjectFile<ELFT> &File, SymbolBody &S, + bool IsWrite, RelExpr Expr, uint32_t Type); void createPhdrs(); void assignAddresses(); void assignFileOffsets(); @@ -513,8 +514,11 @@ static RelExpr fromPlt(RelExpr Expr) { } template <class ELFT> -RelExpr Writer<ELFT>::adjustExpr(SymbolBody &Body, bool IsWrite, RelExpr Expr, +RelExpr Writer<ELFT>::adjustExpr(const elf::ObjectFile<ELFT> &File, + SymbolBody &Body, bool IsWrite, RelExpr Expr, uint32_t Type) { + if (Target->needsThunk(Type, File, Body)) + return R_THUNK; bool Preemptible = Body.isPreemptible(); if (Body.isGnuIFunc()) Expr = toPlt(Expr); @@ -614,7 +618,7 @@ void Writer<ELFT>::scanRelocs(InputSectionBase<ELFT> &C, ArrayRef<RelTy> Rels) { continue; bool Preemptible = Body.isPreemptible(); - Expr = adjustExpr(Body, IsWrite, Expr, Type); + Expr = adjustExpr(File, Body, IsWrite, Expr, Type); if (HasError) continue; @@ -679,8 +683,8 @@ void Writer<ELFT>::scanRelocs(InputSectionBase<ELFT> &C, ArrayRef<RelTy> Rels) { continue; } - if (Target->needsThunk(Type, File, Body)) { - C.Relocations.push_back({R_THUNK, Type, Offset, Addend, &Body}); + if (Expr == R_THUNK) { + C.Relocations.push_back({Expr, Type, Offset, Addend, &Body}); continue; } |