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