diff options
author | Chris Bieneman <beanz@apple.com> | 2016-06-27 19:53:53 +0000 |
---|---|---|
committer | Chris Bieneman <beanz@apple.com> | 2016-06-27 19:53:53 +0000 |
commit | 8ff0c113575167809365d2de5f6a204ff9c9c2bb (patch) | |
tree | bcfa2a036127dcd47a729941ec0389ec8022af0c /llvm/lib/ObjectYAML/MachOYAML.cpp | |
parent | f0fa61ffcfc8550f1b4282e456b3763d71b60c76 (diff) | |
download | bcm5719-llvm-8ff0c113575167809365d2de5f6a204ff9c9c2bb.tar.gz bcm5719-llvm-8ff0c113575167809365d2de5f6a204ff9c9c2bb.zip |
[yaml2obj] Remove --format option in favor of YAML tags
Summary:
Our YAML library's handling of tags isn't perfect, but it is good enough to get rid of the need for the --format argument to yaml2obj. This patch does exactly that.
Instead of requiring --format, it infers the format based on the tags found in the object file. The supported tags are:
!ELF
!COFF
!mach-o
!fat-mach-o
I have a corresponding patch that is quite large that fixes up all the in-tree test cases.
Reviewers: rafael, Bigcheese, compnerd, silvas
Subscribers: compnerd, llvm-commits
Differential Revision: http://reviews.llvm.org/D21711
llvm-svn: 273915
Diffstat (limited to 'llvm/lib/ObjectYAML/MachOYAML.cpp')
-rw-r--r-- | llvm/lib/ObjectYAML/MachOYAML.cpp | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/llvm/lib/ObjectYAML/MachOYAML.cpp b/llvm/lib/ObjectYAML/MachOYAML.cpp index 15ff4efb5c3..0a303a6e739 100644 --- a/llvm/lib/ObjectYAML/MachOYAML.cpp +++ b/llvm/lib/ObjectYAML/MachOYAML.cpp @@ -132,34 +132,6 @@ void MappingTraits<MachOYAML::UniversalBinary>::mapping( IO.setContext(nullptr); } -void MappingTraits<MachOYAML::MachFile>::mapping( - IO &IO, MachOYAML::MachFile &MachFile) { - if (!IO.getContext()) { - IO.setContext(&MachFile); - } - if (IO.outputting()) { - if (MachFile.isFat) { - IO.mapTag("!fat-mach-o", true); - MappingTraits<MachOYAML::UniversalBinary>::mapping(IO, MachFile.FatFile); - } else { - IO.mapTag("!mach-o", true); - MappingTraits<MachOYAML::Object>::mapping(IO, MachFile.ThinFile); - } - } else { - if (IO.mapTag("!fat-mach-o")) { - MachFile.isFat = true; - MappingTraits<MachOYAML::UniversalBinary>::mapping(IO, MachFile.FatFile); - } else if (IO.mapTag("!mach-o")) { - MachFile.isFat = false; - MappingTraits<MachOYAML::Object>::mapping(IO, MachFile.ThinFile); - } else { - assert(false && "No tag found in YAML, cannot identify file type!"); - } - } - if (IO.getContext() == &MachFile) - IO.setContext(nullptr); -} - void MappingTraits<MachOYAML::LinkEditData>::mapping( IO &IO, MachOYAML::LinkEditData &LinkEditData) { IO.mapOptional("RebaseOpcodes", LinkEditData.RebaseOpcodes); |