mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
dd99727315
As discussed on llvm-dev I've implemented the first basic steps towards llvm-objcopy/llvm-objtool (name pending). This change adds the ability to copy (without modification) 64-bit little endian ELF executables that have SHT_PROGBITS, SHT_NOBITS, SHT_NULL and SHT_STRTAB sections. Patch by Jake Ehrlich Differential Revision: https://reviews.llvm.org/D33964 llvm-svn: 309643
33 lines
837 B
C++
33 lines
837 B
C++
//===- llvm-objcopy.h -------------------------------------------*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
#ifndef LLVM_OBJCOPY_H
|
|
#define LLVM_OBJCOPY_H
|
|
|
|
#include "llvm/ADT/Twine.h"
|
|
#include "llvm/Support/Error.h"
|
|
|
|
namespace llvm {
|
|
|
|
LLVM_ATTRIBUTE_NORETURN extern void error(Twine Message);
|
|
|
|
// This is taken from llvm-readobj.
|
|
// [see here](llvm/tools/llvm-readobj/llvm-readobj.h:38)
|
|
template <class T> T unwrapOrError(Expected<T> EO) {
|
|
if (EO)
|
|
return *EO;
|
|
std::string Buf;
|
|
raw_string_ostream OS(Buf);
|
|
logAllUnhandledErrors(EO.takeError(), OS, "");
|
|
OS.flush();
|
|
error(Buf);
|
|
}
|
|
}
|
|
|
|
#endif
|