[PATCH] [lld] enable mach-o and native yaml to be intermixed

kledzik at apple.com kledzik at apple.com
Thu Jan 9 14:31:55 PST 2014


Hi ruiu, Bigcheese, shankarke, joey,

The main goal of this patch is to allow "mach-o encoded as yaml" and "native
encoded as yaml" documents to be intermixed.  They are distinguished via 
yaml tags at the start of the document.  This will enable all mach-o test cases
to be written using yaml instead of checking in object files.

The Registry was extend to allow yaml tag handlers to be registered.  The
mach-o Reader adds a yaml tag handler for the tag "!mach-o".  The yaml Reader
adds a yaml tag handler for the tag "!native" and "!archive".  If this
pans out, in the future we may want to add handlers for "!ELF" and "!COFF".

Additionally, this patch fixes some buffer ownership issues.  When parsing
mach-o binaries, the mach-o atoms can have pointers back into the memory 
mapped .o file.  But with yaml encoded mach-o, name and content are ephemeral, 
so a copyRefs parameter was added to cause the mach-o atoms to make their
own copy.

http://llvm-reviews.chandlerc.com/D2529

Files:
  include/lld/ReaderWriter/Reader.h
  include/lld/ReaderWriter/YamlContext.h
  lib/ReaderWriter/MachO/File.h
  lib/ReaderWriter/MachO/MachONormalizedFile.h
  lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp
  lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp
  lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
  lib/ReaderWriter/MachO/MachONormalizedFileYAML.cpp
  lib/ReaderWriter/Reader.cpp
  lib/ReaderWriter/YAML/ReaderWriterYAML.cpp
  test/core/archive-basic.objtxt
  test/core/archive-chain.objtxt
  test/core/archive-tentdef-search.objtxt
  test/darwin/hello-world.objtxt
  test/darwin/native-and-mach-o.objtxt
  unittests/MachOTests/MachONormalizedFileBinaryWriterTests.cpp
  unittests/MachOTests/MachONormalizedFileToAtomsTests.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2529.1.patch
Type: text/x-patch
Size: 29227 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140109/c8c8e70e/attachment.bin>


More information about the llvm-commits mailing list