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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269244 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Bieneman 2016-05-11 22:07:48 +00:00
parent bf924c1084
commit e05aeff019
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