diff options
Diffstat (limited to 'lib/Object/ObjectFile.cpp')
-rw-r--r-- | lib/Object/ObjectFile.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/lib/Object/ObjectFile.cpp b/lib/Object/ObjectFile.cpp index cf63b89adc12..101f5dcc0821 100644 --- a/lib/Object/ObjectFile.cpp +++ b/lib/Object/ObjectFile.cpp @@ -1,9 +1,8 @@ //===- ObjectFile.cpp - File format independent object file ---------------===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // @@ -57,21 +56,19 @@ uint64_t ObjectFile::getSymbolValue(DataRefImpl Ref) const { return getSymbolValueImpl(Ref); } -std::error_code ObjectFile::printSymbolName(raw_ostream &OS, - DataRefImpl Symb) const { +Error ObjectFile::printSymbolName(raw_ostream &OS, DataRefImpl Symb) const { Expected<StringRef> Name = getSymbolName(Symb); if (!Name) - return errorToErrorCode(Name.takeError()); + return Name.takeError(); OS << *Name; - return std::error_code(); + return Error::success(); } uint32_t ObjectFile::getSymbolAlignment(DataRefImpl DRI) const { return 0; } bool ObjectFile::isSectionBitcode(DataRefImpl Sec) const { - StringRef SectName; - if (!getSectionName(Sec, SectName)) - return SectName == ".llvmbc"; + if (Expected<StringRef> NameOrErr = getSectionName(Sec)) + return *NameOrErr == ".llvmbc"; return false; } @@ -128,6 +125,7 @@ ObjectFile::createObjectFile(MemoryBufferRef Object, file_magic Type) { case file_magic::macho_universal_binary: case file_magic::windows_resource: case file_magic::pdb: + case file_magic::minidump: return errorCodeToError(object_error::invalid_file_type); case file_magic::elf: case file_magic::elf_relocatable: @@ -151,6 +149,10 @@ ObjectFile::createObjectFile(MemoryBufferRef Object, file_magic Type) { case file_magic::coff_import_library: case file_magic::pecoff_executable: return createCOFFObjectFile(Object); + case file_magic::xcoff_object_32: + return createXCOFFObjectFile(Object, Binary::ID_XCOFF32); + case file_magic::xcoff_object_64: + return createXCOFFObjectFile(Object, Binary::ID_XCOFF64); case file_magic::wasm_object: return createWasmObjectFile(Object); } |