1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00

Initial add for MachO support for yaml2obj

Adding the initial files for adding MachO support to yaml2obj. Passing a MachO file will result in an error.

I will be implementing obj2yaml and yaml2obj for MachO in parallel so that one can be used to test the other.

llvm-svn: 269244
This commit is contained in:
Chris Bieneman 2016-05-11 22:07:48 +00:00
parent 80178ca710
commit 7ae0bc028f
4 changed files with 30 additions and 1 deletions

View File

@ -9,4 +9,5 @@ add_llvm_tool(yaml2obj
yaml2obj.cpp
yaml2coff.cpp
yaml2elf.cpp
yaml2macho.cpp
)

View File

@ -0,0 +1,23 @@
//===- yaml2macho - Convert YAML to a Mach object file --------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
///
/// \file
/// \brief The Mach component of yaml2obj.
///
//===----------------------------------------------------------------------===//
#include "yaml2obj.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
int yaml2macho(llvm::yaml::Input &YIn, llvm::raw_ostream &Out) {
errs() << "yaml2obj: Mach-O not implemented yet!\n";
return 1;
}

View File

@ -42,7 +42,8 @@ static cl::opt<std::string>
// library.
enum YAMLObjectFormat {
YOF_COFF,
YOF_ELF
YOF_ELF,
YOF_MACHO
};
cl::opt<YAMLObjectFormat> Format(
@ -51,6 +52,7 @@ cl::opt<YAMLObjectFormat> Format(
cl::values(
clEnumValN(YOF_COFF, "coff", "COFF object file format"),
clEnumValN(YOF_ELF, "elf", "ELF object file format"),
clEnumValN(YOF_MACHO, "macho", "Mach-O object file format"),
clEnumValEnd));
cl::opt<unsigned>
@ -102,6 +104,8 @@ int main(int argc, char **argv) {
Convert = yaml2coff;
else if (Format == YOF_ELF)
Convert = yaml2elf;
else if (Format == YOF_MACHO)
Convert = yaml2macho;
else {
errs() << "Not yet implemented\n";
return 1;

View File

@ -20,5 +20,6 @@ class Input;
}
int yaml2coff(llvm::yaml::Input &YIn, llvm::raw_ostream &Out);
int yaml2elf(llvm::yaml::Input &YIn, llvm::raw_ostream &Out);
int yaml2macho(llvm::yaml::Input &YIn, llvm::raw_ostream &Out);
#endif