diff options
| author | Rui Ueyama <ruiu@google.com> | 2016-03-13 19:48:18 +0000 |
|---|---|---|
| committer | Rui Ueyama <ruiu@google.com> | 2016-03-13 19:48:18 +0000 |
| commit | c4466605d88d5502b478b5321578c520c876f992 (patch) | |
| tree | 2a582f1662d6f38dd6a12e9e1ee2b4678cfa6893 /lld/ELF/OutputSections.cpp | |
| parent | 22b5d1f9013de93f68eb36e9f8804d9bb1651f17 (diff) | |
| download | bcm5719-llvm-c4466605d88d5502b478b5321578c520c876f992.tar.gz bcm5719-llvm-c4466605d88d5502b478b5321578c520c876f992.zip | |
ELF: Redefine canBeDefined as a member function of SymbolBody.
We want to make SymbolBody the central place to query symbol information.
This patch also renames canBePreempted to isPreemptible because I feel that
the latter is slightly better (the former is three words and the latter
is two words.)
llvm-svn: 263386
Diffstat (limited to 'lld/ELF/OutputSections.cpp')
| -rw-r--r-- | lld/ELF/OutputSections.cpp | 33 |
1 files changed, 1 insertions, 32 deletions
diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp index a9236086a92..bd4d9121712 100644 --- a/lld/ELF/OutputSections.cpp +++ b/lld/ELF/OutputSections.cpp @@ -182,7 +182,7 @@ template <class ELFT> void GotSection<ELFT>::writeTo(uint8_t *Buf) { // for detailed description: // ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/mipsabi.pdf // As the first approach, we can just store addresses for all symbols. - if (Config->EMachine != EM_MIPS && canBePreempted(*B)) + if (Config->EMachine != EM_MIPS && B->isPreemptible()) continue; // The dynamic linker will take care of it. uintX_t VA = B->getVA<ELFT>(); write<uintX_t, ELFT::TargetEndianness, sizeof(uintX_t)>(Entry, VA); @@ -882,37 +882,6 @@ template <class ELFT> void OutputSection<ELFT>::sortCtorsDtors() { reassignOffsets(); } -// Returns true if a symbol can be replaced at load-time by a symbol -// with the same name defined in other ELF executable or DSO. -bool elf::canBePreempted(const SymbolBody &Body) { - if (Body.isLocal()) - return false; - - if (Body.isShared()) - return true; - - if (Body.isUndefined()) { - if (!Body.isWeak()) - return true; - - // Ideally the static linker should see a definition for every symbol, but - // shared object are normally allowed to have undefined references that the - // static linker never sees a definition for. - if (Config->Shared) - return true; - - // Otherwise, just resolve to 0. - return false; - } - if (!Config->Shared) - return false; - if (Body.getVisibility() != STV_DEFAULT) - return false; - if (Config->Bsymbolic || (Config->BsymbolicFunctions && Body.IsFunc)) - return false; - return true; -} - static void fill(uint8_t *Buf, size_t Size, ArrayRef<uint8_t> A) { size_t I = 0; for (; I + A.size() < Size; I += A.size()) |

