Revert "Hopefully one last commit to fix this patch, addresses string reference"
Summary: This reverts commit 56beec1b1cfc6d263e5eddb7efff06117c0724d2. Revert "Quick fix to D32609, it seems .o files are not transferred in all cases." This reverts commit 7652eecd29cfdeeab7f76f687586607a99ff4e36. Revert "Update llvm-readobj -coff-resources to display tree structure." This reverts commit 422b62c4d302cfc92401418c2acd165056081ed7. Reviewers: zturner Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D32958 llvm-svn: 302397
This commit is contained in:
@@ -19,7 +19,6 @@
|
||||
#include "llvm/Object/COFF.h"
|
||||
#include "llvm/Object/Error.h"
|
||||
#include "llvm/Object/ObjectFile.h"
|
||||
#include "llvm/Support/BinaryStreamReader.h"
|
||||
#include "llvm/Support/COFF.h"
|
||||
#include "llvm/Support/Endian.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
@@ -160,7 +159,8 @@ void COFFObjectFile::moveSymbolNext(DataRefImpl &Ref) const {
|
||||
Expected<StringRef> COFFObjectFile::getSymbolName(DataRefImpl Ref) const {
|
||||
COFFSymbolRef Symb = getCOFFSymbol(Ref);
|
||||
StringRef Result;
|
||||
if (std::error_code EC = getSymbolName(Symb, Result))
|
||||
std::error_code EC = getSymbolName(Symb, Result);
|
||||
if (EC)
|
||||
return errorCodeToError(EC);
|
||||
return Result;
|
||||
}
|
||||
@@ -1591,44 +1591,3 @@ std::error_code BaseRelocRef::getRVA(uint32_t &Result) const {
|
||||
Result = Header->PageRVA + Entry[Index].getOffset();
|
||||
return std::error_code();
|
||||
}
|
||||
|
||||
#define RETURN_IF_ERROR(X) \
|
||||
if (auto EC = errorToErrorCode(X)) \
|
||||
return EC;
|
||||
|
||||
ErrorOr<ArrayRef<UTF16>> ResourceSectionRef::getDirStringAtOffset(uint32_t Offset) {
|
||||
BinaryStreamReader Reader = BinaryStreamReader(BBS);
|
||||
Reader.setOffset(Offset);
|
||||
uint16_t Length;
|
||||
RETURN_IF_ERROR(Reader.readInteger(Length));
|
||||
ArrayRef<UTF16> RawDirString;
|
||||
// Strings are stored as 2-byte aligned unicode characters but readFixedString
|
||||
// assumes byte string, so we double length.
|
||||
RETURN_IF_ERROR(Reader.readArray(RawDirString, Length));
|
||||
return RawDirString;
|
||||
}
|
||||
|
||||
ErrorOr<ArrayRef<UTF16>>
|
||||
ResourceSectionRef::getEntryNameString(const coff_resource_dir_entry &Entry) {
|
||||
return getDirStringAtOffset(Entry.Identifier.getNameOffset());
|
||||
}
|
||||
|
||||
ErrorOr<const coff_resource_dir_table &>
|
||||
ResourceSectionRef::getTableAtOffset(uint32_t Offset) {
|
||||
const coff_resource_dir_table *Table = nullptr;
|
||||
|
||||
BinaryStreamReader Reader(BBS);
|
||||
Reader.setOffset(Offset);
|
||||
RETURN_IF_ERROR(Reader.readObject(Table));
|
||||
assert(Table != nullptr);
|
||||
return *Table;
|
||||
}
|
||||
|
||||
ErrorOr<const coff_resource_dir_table &>
|
||||
ResourceSectionRef::getEntrySubDir(const coff_resource_dir_entry &Entry) {
|
||||
return getTableAtOffset(Entry.Offset.value());
|
||||
}
|
||||
|
||||
ErrorOr<const coff_resource_dir_table &> ResourceSectionRef::getBaseTable() {
|
||||
return getTableAtOffset(0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user