From 4da9ff9fcfe8987472dc894489597bd338aac85e Mon Sep 17 00:00:00 2001 From: Hans Wennborg Date: Thu, 16 May 2019 12:08:34 +0000 Subject: Revert r360876 "[Object] Change object::SectionRef::getContents() to return Expected" It broke the Clang build, see llvm-commits thread. > Expected> may be better but use Expected for now. > > Follow-up of D61781. llvm-svn: 360878 --- llvm/lib/Object/ELFObjectFile.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'llvm/lib/Object/ELFObjectFile.cpp') diff --git a/llvm/lib/Object/ELFObjectFile.cpp b/llvm/lib/Object/ELFObjectFile.cpp index c0ac7a357f8..cc1eeefec26 100644 --- a/llvm/lib/Object/ELFObjectFile.cpp +++ b/llvm/lib/Object/ELFObjectFile.cpp @@ -377,13 +377,12 @@ ELFObjectFileBase::getPltAddresses() const { } if (!Plt || !RelaPlt || !GotPlt) return {}; - Expected PltContents = Plt->getContents(); - if (!PltContents) { - consumeError(PltContents.takeError()); + StringRef PltContents; + if (Plt->getContents(PltContents)) return {}; - } - auto PltEntries = MIA->findPltEntries(Plt->getAddress(), - arrayRefFromStringRef(*PltContents), + ArrayRef PltBytes((const uint8_t *)PltContents.data(), + Plt->getSize()); + auto PltEntries = MIA->findPltEntries(Plt->getAddress(), PltBytes, GotPlt->getAddress(), Triple); // Build a map from GOT entry virtual address to PLT entry virtual address. DenseMap GotToPlt; -- cgit v1.2.3