diff options
| author | Rui Ueyama <ruiu@google.com> | 2016-02-02 06:08:08 +0000 |
|---|---|---|
| committer | Rui Ueyama <ruiu@google.com> | 2016-02-02 06:08:08 +0000 |
| commit | 6d3874b99559f9f65144b310f72377d54f8dc5da (patch) | |
| tree | 266d70102cc3c49d152b7c2fb2ced8262ad5f5a7 | |
| parent | 1ac1338ac8a88e6d14ddb2d5654df48e5e66f781 (diff) | |
| download | bcm5719-llvm-6d3874b99559f9f65144b310f72377d54f8dc5da.tar.gz bcm5719-llvm-6d3874b99559f9f65144b310f72377d54f8dc5da.zip | |
ELF: Move copy relocation handler to one place. NFC.
llvm-svn: 259467
| -rw-r--r-- | lld/ELF/Writer.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index 4a839e11688..c99d1ed207b 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -293,16 +293,23 @@ void Writer<ELFT>::scanRelocs( continue; } + // If a symbol in a DSO is referenced directly instead of through GOT, + // we need to create a copy relocation for the symbol. + if (auto *B = dyn_cast_or_null<SharedSymbol<ELFT>>(Body)) { + if (B->NeedsCopy) + continue; + if (Target->needsCopyRel(Type, *B)) { + B->NeedsCopy = true; + B->setUsedInDynamicReloc(); + Out<ELFT>::RelaDyn->addReloc({&C, &RI}); + continue; + } + } + bool NeedsGot = false; bool NeedsPlt = false; if (Body) { - if (auto *E = dyn_cast<SharedSymbol<ELFT>>(Body)) { - if (E->NeedsCopy) - continue; - if (Target->needsCopyRel(Type, *Body)) - E->NeedsCopy = true; - } NeedsPlt = Target->needsPlt(Type, *Body); if (NeedsPlt) { if (Body->isInPlt()) |

