diff options
| author | Rui Ueyama <ruiu@google.com> | 2016-02-02 05:55:28 +0000 |
|---|---|---|
| committer | Rui Ueyama <ruiu@google.com> | 2016-02-02 05:55:28 +0000 |
| commit | 1ac1338ac8a88e6d14ddb2d5654df48e5e66f781 (patch) | |
| tree | fb22fb995060ffe8c8dd1b49031a08d9cf9c2465 | |
| parent | 1f092213c1a0c3019d3860c81518605a28818d8b (diff) | |
| download | bcm5719-llvm-1ac1338ac8a88e6d14ddb2d5654df48e5e66f781.tar.gz bcm5719-llvm-1ac1338ac8a88e6d14ddb2d5654df48e5e66f781.zip | |
ELF: Move code for MIPS local GOT entries to one place. NFC.
llvm-svn: 259466
| -rw-r--r-- | lld/ELF/Writer.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index 24e5fb458e3..4a839e11688 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -284,14 +284,19 @@ void Writer<ELFT>::scanRelocs( Out<ELFT>::RelaDyn->addReloc({&C, Rel}); } - bool NeedsGot = false; - bool NeedsMipsLocalGot = false; - bool NeedsPlt = false; + // MIPS has a special rule to create GOTs for local symbols. if (Config->EMachine == EM_MIPS && needsMipsLocalGot(Type, Body)) { - NeedsMipsLocalGot = true; // FIXME (simon): Do not add so many redundant entries. Out<ELFT>::Got->addMipsLocalEntry(); - } else if (Body) { + if (Body) + Body->setUsedInDynamicReloc(); + continue; + } + + bool NeedsGot = false; + bool NeedsPlt = false; + + if (Body) { if (auto *E = dyn_cast<SharedSymbol<ELFT>>(Body)) { if (E->NeedsCopy) continue; @@ -335,14 +340,13 @@ void Writer<ELFT>::scanRelocs( // relocation too because that case is possible for executable file // linking only. continue; - if (NeedsGot || NeedsMipsLocalGot) { + if (NeedsGot) { // MIPS ABI has special rules to process GOT entries // and doesn't require relocation entries for them. // See "Global Offset Table" in Chapter 5 in the following document // for detailed description: // ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/mipsabi.pdf - if (NeedsGot) - Body->setUsedInDynamicReloc(); + Body->setUsedInDynamicReloc(); continue; } if (Body == Config->MipsGpDisp) |

