diff options
author | Nick Kledzik <kledzik@apple.com> | 2014-01-11 05:07:43 +0400 |
---|---|---|
committer | Nick Kledzik <kledzik@apple.com> | 2014-01-11 05:07:43 +0400 |
commit | 6edd722a2cff95551808ee02e69c8882633f6283 (patch) | |
tree | 8c61a8d6616a054d236b88ef99023d313fe5aa1e /lld/test/darwin/native-and-mach-o.objtxt | |
parent | 976d94b834c08251b240b059700498cb9a5791ec (diff) |
[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/test/darwin/native-and-mach-o.objtxt')
-rw-r--r-- | lld/test/darwin/native-and-mach-o.objtxt | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/lld/test/darwin/native-and-mach-o.objtxt b/lld/test/darwin/native-and-mach-o.objtxt new file mode 100644 index 000000000000..3f356f5d8598 --- /dev/null +++ b/lld/test/darwin/native-and-mach-o.objtxt @@ -0,0 +1,44 @@ +# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t && \ +# RUN: llvm-nm %t | FileCheck %s +# +# Test a mix of atoms and mach-o both encoded in yaml +# + +--- !native +defined-atoms: + - name: _main + type: code + scope: global + content: [ 55, 48, 89, E5, 30, C0, E8, 00, + 00, 00, 00, 31, C0, 5D, C3 ] + references: + - offset: 7 + kind: X86_64_RELOC_BRANCH + target: _foo + +undefined-atoms: + - name: _foo + + +--- !mach-o +arch: x86_64 +file-type: MH_OBJECT +sections: + - segment: __TEXT + section: __text + type: S_REGULAR + attributes: [ S_ATTR_PURE_INSTRUCTIONS ] + address: 0 + content: [ 0xC3 ] +global-symbols: + - name: _foo + type: N_SECT + scope: [ N_EXT ] + sect: 1 + desc: [ ] + value: 0 + +... + +# CHECK: {{[0-9a-f]+}} T _foo +# CHECK: {{[0-9a-f]+}} T _main |