diff options
| author | Nick Kledzik <kledzik@apple.com> | 2014-01-11 01:07:43 +0000 |
|---|---|---|
| committer | Nick Kledzik <kledzik@apple.com> | 2014-01-11 01:07:43 +0000 |
| commit | 6edd722a2cff95551808ee02e69c8882633f6283 (patch) | |
| tree | 8c61a8d6616a054d236b88ef99023d313fe5aa1e /lld/unittests/MachOTests/MachONormalizedFileBinaryWriterTests.cpp | |
| parent | 976d94b834c08251b240b059700498cb9a5791ec (diff) | |
| download | bcm5719-llvm-6edd722a2cff95551808ee02e69c8882633f6283.tar.gz bcm5719-llvm-6edd722a2cff95551808ee02e69c8882633f6283.zip | |
[mach-o] enable mach-o and native yaml to be intermixed
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".
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.
llvm-svn: 198986
Diffstat (limited to 'lld/unittests/MachOTests/MachONormalizedFileBinaryWriterTests.cpp')
| -rw-r--r-- | lld/unittests/MachOTests/MachONormalizedFileBinaryWriterTests.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lld/unittests/MachOTests/MachONormalizedFileBinaryWriterTests.cpp b/lld/unittests/MachOTests/MachONormalizedFileBinaryWriterTests.cpp index 0f2d8d6f3b9..7670da221a5 100644 --- a/lld/unittests/MachOTests/MachONormalizedFileBinaryWriterTests.cpp +++ b/lld/unittests/MachOTests/MachONormalizedFileBinaryWriterTests.cpp @@ -139,7 +139,7 @@ TEST(BinaryWriterTest, obj_relocs_x86_64) { 0x05, 0xfc, 0xff, 0xff, 0xff, 0x78, 0x56, 0x34, 0x12, 0x48, 0x8b, 0x3d, 0x00, 0x00, 0x00, 0x00 }; - text.content.assign(textBytes, textBytes+sizeof(textBytes)); + text.content = llvm::makeArrayRef(textBytes, sizeof(textBytes)); text.relocations.push_back(makeReloc(0x01, false, true, X86_64_RELOC_BRANCH, 1)); text.relocations.push_back(makeReloc(0x08, false, true, X86_64_RELOC_GOT_LOAD, 1)); text.relocations.push_back(makeReloc(0x0E, false, true, X86_64_RELOC_GOT, 1)); @@ -252,7 +252,7 @@ TEST(BinaryWriterTest, obj_relocs_x86) { 0x00, 0x00, 0x8b, 0xb0, 0xfb, 0xff, 0xff, 0xff, 0x8b, 0x80, 0x11, 0x00, 0x00, 0x00 }; - text.content.assign(textBytes, textBytes+sizeof(textBytes)); + text.content = llvm::makeArrayRef(textBytes, sizeof(textBytes)); text.relocations.push_back(makeReloc(0x01, true, true, GENERIC_RELOC_VANILLA, 0)); text.relocations.push_back(makeReloc(0x06, false, true, GENERIC_RELOC_VANILLA, 0)); text.relocations.push_back(makeScatReloc(0x0c, GENERIC_RELOC_LOCAL_SECTDIFF, 0)); @@ -361,7 +361,7 @@ TEST(BinaryWriterTest, obj_relocs_armv7) { 0xc0, 0xf2, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbf }; - text.content.assign(textBytes, textBytes+sizeof(textBytes)); + text.content = llvm::makeArrayRef(textBytes, sizeof(textBytes)); text.relocations.push_back(makeReloc(0x00, true, true, ARM_THUMB_RELOC_BR22, 2)); text.relocations.push_back(makeScatReloc(0x04, @@ -492,7 +492,7 @@ TEST(BinaryWriterTest, obj_relocs_ppc) { 0x80, 0x42, 0x00, 0x28, 0x80, 0x63, 0x00, 0x28, 0x60, 0x00, 0x00, 0x00 }; - text.content.assign(textBytes, textBytes+sizeof(textBytes)); + text.content = llvm::makeArrayRef(textBytes, sizeof(textBytes)); text.relocations.push_back(makeReloc(0x00, true, true, PPC_RELOC_BR24, 2)); text.relocations.push_back(makeReloc(0x04, true, true, |

