diff options
Diffstat (limited to 'lld/test/mach-o/Inputs')
23 files changed, 484 insertions, 0 deletions
diff --git a/lld/test/mach-o/Inputs/PIE.yaml b/lld/test/mach-o/Inputs/PIE.yaml new file mode 100644 index 00000000000..0463154fcf2 --- /dev/null +++ b/lld/test/mach-o/Inputs/PIE.yaml @@ -0,0 +1,6 @@ +--- !mach-o +arch: x86_64 +file-type: MH_DYLIB +install-name: /usr/lib/libSystem.B.dylib +exports: + - name: dyld_stub_binder diff --git a/lld/test/mach-o/Inputs/arm-interworking.yaml b/lld/test/mach-o/Inputs/arm-interworking.yaml new file mode 100644 index 00000000000..b2165a92814 --- /dev/null +++ b/lld/test/mach-o/Inputs/arm-interworking.yaml @@ -0,0 +1,83 @@ +--- !mach-o +arch: armv7 +file-type: MH_OBJECT +flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ] +sections: + - segment: __TEXT + section: __text + type: S_REGULAR + attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ] + alignment: 2 + address: 0x0000000000000000 + content: [ 0xFE, 0xFF, 0xFF, 0xEB, 0x02, 0x00, 0x00, 0xFA, + 0xFC, 0xFF, 0xFF, 0xEB, 0xFB, 0xFF, 0xFF, 0xFA, + 0x1E, 0xFF, 0x2F, 0xE1, 0x1E, 0xFF, 0x2F, 0xE1 ] + relocations: + - offset: 0x0000000C + type: ARM_RELOC_BR24 + length: 2 + pc-rel: true + extern: true + symbol: 4 + - offset: 0x00000008 + type: ARM_RELOC_BR24 + length: 2 + pc-rel: true + extern: true + symbol: 3 + - offset: 0x00000004 + type: ARM_RELOC_BR24 + length: 2 + pc-rel: true + extern: false + symbol: 1 + - offset: 0x00000000 + type: ARM_RELOC_BR24 + length: 2 + pc-rel: true + extern: false + symbol: 1 + - segment: __DATA + section: __data + type: S_REGULAR + attributes: [ ] + address: 0x0000000000000018 + content: [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ] + relocations: + - offset: 0x00000004 + type: ARM_RELOC_VANILLA + length: 2 + pc-rel: false + extern: false + symbol: 1 + - offset: 0x00000000 + type: ARM_RELOC_VANILLA + length: 2 + pc-rel: false + extern: true + symbol: 3 +local-symbols: + - name: _d2 + type: N_SECT + sect: 2 + value: 0x0000000000000018 +global-symbols: + - name: _a1 + type: N_SECT + scope: [ N_EXT ] + sect: 1 + value: 0x0000000000000000 + - name: _a2 + type: N_SECT + scope: [ N_EXT ] + sect: 1 + value: 0x0000000000000014 +undefined-symbols: + - name: _t1 + type: N_UNDF + scope: [ N_EXT ] + value: 0x0000000000000000 + - name: _t2 + type: N_UNDF + scope: [ N_EXT ] + value: 0x0000000000000000 diff --git a/lld/test/mach-o/Inputs/arm-shims.yaml b/lld/test/mach-o/Inputs/arm-shims.yaml new file mode 100644 index 00000000000..8baebef17d8 --- /dev/null +++ b/lld/test/mach-o/Inputs/arm-shims.yaml @@ -0,0 +1,60 @@ +--- !mach-o +arch: armv7 +file-type: MH_OBJECT +flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ] +sections: + - segment: __TEXT + section: __text + type: S_REGULAR + attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ] + alignment: 2 + address: 0x0000000000000000 + content: [ 0x00, 0xBF, 0xFF, 0xF7, 0xFE, 0xEF, 0xFF, 0xF7, + 0xFB, 0xBF, 0x00, 0x00, 0x00, 0xF0, 0x20, 0xE3, + 0xFA, 0xFF, 0xFF, 0xFA, 0xF9, 0xFF, 0xFF, 0xEA ] + relocations: + - offset: 0x00000014 + type: ARM_RELOC_BR24 + length: 2 + pc-rel: true + extern: true + symbol: 3 + - offset: 0x00000010 + type: ARM_RELOC_BR24 + length: 2 + pc-rel: true + extern: true + symbol: 3 + - offset: 0x00000006 + type: ARM_THUMB_RELOC_BR22 + length: 2 + pc-rel: true + extern: true + symbol: 2 + - offset: 0x00000002 + type: ARM_THUMB_RELOC_BR22 + length: 2 + pc-rel: true + extern: true + symbol: 2 +global-symbols: + - name: _a2 + type: N_SECT + scope: [ N_EXT ] + sect: 1 + value: 0x000000000000000C + - name: _t2 + type: N_SECT + scope: [ N_EXT ] + sect: 1 + desc: [ N_ARM_THUMB_DEF ] + value: 0x0000000000000000 +undefined-symbols: + - name: _a1 + type: N_UNDF + scope: [ N_EXT ] + value: 0x0000000000000000 + - name: _t1 + type: N_UNDF + scope: [ N_EXT ] + value: 0x0000000000000000 diff --git a/lld/test/mach-o/Inputs/cstring-sections.yaml b/lld/test/mach-o/Inputs/cstring-sections.yaml new file mode 100644 index 00000000000..eb227f29f8f --- /dev/null +++ b/lld/test/mach-o/Inputs/cstring-sections.yaml @@ -0,0 +1,25 @@ +--- !mach-o +arch: x86_64 +file-type: MH_OBJECT +flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ] +has-UUID: false +OS: unknown +sections: + - segment: __TEXT + section: __objc_methname + type: S_CSTRING_LITERALS + attributes: [ ] + address: 0x0000000000000000 + content: [ 0x61, 0x62, 0x63, 0x00 ] + - segment: __TEXT + section: __objc_classname + type: S_CSTRING_LITERALS + attributes: [ ] + address: 0x0000000000000006 + content: [ 0x61, 0x62, 0x63, 0x00 ] + - segment: __TEXT + section: __cstring + type: S_CSTRING_LITERALS + attributes: [ ] + address: 0x000000000000000A + content: [ 0x61, 0x62, 0x63, 0x00 ] diff --git a/lld/test/mach-o/Inputs/got-order.yaml b/lld/test/mach-o/Inputs/got-order.yaml new file mode 100644 index 00000000000..6059a452834 --- /dev/null +++ b/lld/test/mach-o/Inputs/got-order.yaml @@ -0,0 +1,53 @@ +--- !mach-o +arch: x86_64 +file-type: MH_OBJECT +flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ] +sections: + - segment: __TEXT + section: __text + type: S_REGULAR + attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ] + address: 0x0000000000000000 + content: [ 0x55, 0x48, 0x89, 0xE5, 0x48, 0x8B, 0x0D, 0x00, + 0x00, 0x00, 0x00, 0x48, 0x8B, 0x05, 0x00, 0x00, + 0x00, 0x00, 0x8B, 0x00, 0x03, 0x01, 0x48, 0x8B, + 0x0D, 0x00, 0x00, 0x00, 0x00, 0x03, 0x01, 0x5D, + 0xC3 ] + relocations: + - offset: 0x00000019 + type: X86_64_RELOC_GOT_LOAD + length: 2 + pc-rel: true + extern: true + symbol: 2 + - offset: 0x0000000E + type: X86_64_RELOC_GOT_LOAD + length: 2 + pc-rel: true + extern: true + symbol: 1 + - offset: 0x00000007 + type: X86_64_RELOC_GOT_LOAD + length: 2 + pc-rel: true + extern: true + symbol: 3 +global-symbols: + - name: _main + type: N_SECT + scope: [ N_EXT ] + sect: 1 + value: 0x0000000000000000 +undefined-symbols: + - name: _bar + type: N_UNDF + scope: [ N_EXT ] + value: 0x0000000000000000 + - name: _foo + type: N_UNDF + scope: [ N_EXT ] + value: 0x0000000000000000 + - name: _zazzle + type: N_UNDF + scope: [ N_EXT ] + value: 0x0000000000000000 diff --git a/lld/test/mach-o/Inputs/got-order2.yaml b/lld/test/mach-o/Inputs/got-order2.yaml new file mode 100644 index 00000000000..faddeda924d --- /dev/null +++ b/lld/test/mach-o/Inputs/got-order2.yaml @@ -0,0 +1,11 @@ +--- !mach-o +arch: x86_64 +file-type: MH_DYLIB +install-name: /usr/lib/libfoobar.dylib +exports: + - name: _bar + - name: _zazzle + - name: _foo + - name: _aaa + - name: _fff + - name: _zzz diff --git a/lld/test/mach-o/Inputs/hello-world-arm64.yaml b/lld/test/mach-o/Inputs/hello-world-arm64.yaml new file mode 100644 index 00000000000..31de71ef494 --- /dev/null +++ b/lld/test/mach-o/Inputs/hello-world-arm64.yaml @@ -0,0 +1,8 @@ +--- !mach-o +arch: arm64 +file-type: MH_DYLIB +install-name: /usr/lib/libSystem.B.dylib +exports: + - name: _fprintf + - name: ___stdoutp + - name: dyld_stub_binder diff --git a/lld/test/mach-o/Inputs/hello-world-armv6.yaml b/lld/test/mach-o/Inputs/hello-world-armv6.yaml new file mode 100644 index 00000000000..0b29f65ab12 --- /dev/null +++ b/lld/test/mach-o/Inputs/hello-world-armv6.yaml @@ -0,0 +1,7 @@ +--- !mach-o +arch: armv6 +file-type: MH_DYLIB +install-name: /usr/lib/libSystem.B.dylib +exports: + - name: _printf + - name: dyld_stub_binder diff --git a/lld/test/mach-o/Inputs/hello-world-armv7.yaml b/lld/test/mach-o/Inputs/hello-world-armv7.yaml new file mode 100644 index 00000000000..4e26120fe21 --- /dev/null +++ b/lld/test/mach-o/Inputs/hello-world-armv7.yaml @@ -0,0 +1,7 @@ +--- !mach-o +arch: armv7 +file-type: MH_DYLIB +install-name: /usr/lib/libSystem.B.dylib +exports: + - name: _printf + - name: dyld_stub_binder diff --git a/lld/test/mach-o/Inputs/hello-world-x86.yaml b/lld/test/mach-o/Inputs/hello-world-x86.yaml new file mode 100644 index 00000000000..dbec62b77f3 --- /dev/null +++ b/lld/test/mach-o/Inputs/hello-world-x86.yaml @@ -0,0 +1,7 @@ +--- !mach-o +arch: x86 +file-type: MH_DYLIB +install-name: /usr/lib/libSystem.B.dylib +exports: + - name: _printf + - name: dyld_stub_binder diff --git a/lld/test/mach-o/Inputs/hello-world-x86_64.yaml b/lld/test/mach-o/Inputs/hello-world-x86_64.yaml new file mode 100644 index 00000000000..7840d5c1932 --- /dev/null +++ b/lld/test/mach-o/Inputs/hello-world-x86_64.yaml @@ -0,0 +1,8 @@ +--- !mach-o +arch: x86_64 +file-type: MH_DYLIB +install-name: /usr/lib/libSystem.B.dylib +exports: + - name: _fprintf + - name: dyld_stub_binder + - name: ___stdoutp diff --git a/lld/test/mach-o/Inputs/interposing-section.yaml b/lld/test/mach-o/Inputs/interposing-section.yaml new file mode 100644 index 00000000000..45966b6870c --- /dev/null +++ b/lld/test/mach-o/Inputs/interposing-section.yaml @@ -0,0 +1,6 @@ +--- !mach-o +arch: x86_64 +file-type: MH_DYLIB +install-name: /usr/lib/libSystem.B.dylib +exports: + - name: _open diff --git a/lld/test/mach-o/Inputs/lazy-bind-x86_64-2.yaml b/lld/test/mach-o/Inputs/lazy-bind-x86_64-2.yaml new file mode 100644 index 00000000000..50a97bc9c09 --- /dev/null +++ b/lld/test/mach-o/Inputs/lazy-bind-x86_64-2.yaml @@ -0,0 +1,8 @@ +--- !mach-o +arch: x86_64 +file-type: MH_DYLIB +install-name: /usr/lib/libfoo.dylib +compat-version: 2.0 +current-version: 3.4 +exports: + - name: _foo diff --git a/lld/test/mach-o/Inputs/lazy-bind-x86_64-3.yaml b/lld/test/mach-o/Inputs/lazy-bind-x86_64-3.yaml new file mode 100644 index 00000000000..2f61cc0cda1 --- /dev/null +++ b/lld/test/mach-o/Inputs/lazy-bind-x86_64-3.yaml @@ -0,0 +1,8 @@ +--- !mach-o +arch: x86_64 +file-type: MH_DYLIB +install-name: /usr/lib/libbaz.dylib +compat-version: 3.0 +current-version: 4.5 +exports: + - name: _baz diff --git a/lld/test/mach-o/Inputs/lazy-bind-x86_64.yaml b/lld/test/mach-o/Inputs/lazy-bind-x86_64.yaml new file mode 100644 index 00000000000..7e6cd9007bf --- /dev/null +++ b/lld/test/mach-o/Inputs/lazy-bind-x86_64.yaml @@ -0,0 +1,8 @@ +--- !mach-o +arch: x86_64 +file-type: MH_DYLIB +install-name: /usr/lib/libbar.dylib +compat-version: 1.0 +current-version: 2.3 +exports: + - name: _bar diff --git a/lld/test/mach-o/Inputs/linker-as-ld.yaml b/lld/test/mach-o/Inputs/linker-as-ld.yaml new file mode 100644 index 00000000000..0463154fcf2 --- /dev/null +++ b/lld/test/mach-o/Inputs/linker-as-ld.yaml @@ -0,0 +1,6 @@ +--- !mach-o +arch: x86_64 +file-type: MH_DYLIB +install-name: /usr/lib/libSystem.B.dylib +exports: + - name: dyld_stub_binder diff --git a/lld/test/mach-o/Inputs/re-exported-dylib-ordinal.yaml b/lld/test/mach-o/Inputs/re-exported-dylib-ordinal.yaml new file mode 100644 index 00000000000..1941b407de2 --- /dev/null +++ b/lld/test/mach-o/Inputs/re-exported-dylib-ordinal.yaml @@ -0,0 +1,21 @@ +--- !mach-o +arch: x86_64 +file-type: MH_DYLIB +flags: [ MH_TWOLEVEL ] +install-name: /junk/libfoo.dylib +sections: + - segment: __TEXT + section: __text + type: S_REGULAR + attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ] + address: 0x0000000000000F9A + content: [ 0x55, 0x48, 0x89, 0xE5, 0x5D, 0xC3 ] +global-symbols: + - name: _foo + type: N_SECT + scope: [ N_EXT ] + sect: 1 + value: 0x0000000000000F9A +dependents: + - path: /junk/libbar.dylib + kind: LC_REEXPORT_DYLIB diff --git a/lld/test/mach-o/Inputs/re-exported-dylib-ordinal2.yaml b/lld/test/mach-o/Inputs/re-exported-dylib-ordinal2.yaml new file mode 100644 index 00000000000..5aaf8c1b1bc --- /dev/null +++ b/lld/test/mach-o/Inputs/re-exported-dylib-ordinal2.yaml @@ -0,0 +1,18 @@ +--- !mach-o +arch: x86_64 +file-type: MH_DYLIB +flags: [ MH_TWOLEVEL ] +install-name: /junk/libbar.dylib +sections: + - segment: __TEXT + section: __text + type: S_REGULAR + attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ] + address: 0x0000000000000F9A + content: [ 0x55, 0x48, 0x89, 0xE5, 0x5D, 0xC3 ] +global-symbols: + - name: _bar + type: N_SECT + scope: [ N_EXT ] + sect: 1 + value: 0x0000000000000F9A diff --git a/lld/test/mach-o/Inputs/re-exported-dylib-ordinal3.yaml b/lld/test/mach-o/Inputs/re-exported-dylib-ordinal3.yaml new file mode 100644 index 00000000000..43ba07c73a7 --- /dev/null +++ b/lld/test/mach-o/Inputs/re-exported-dylib-ordinal3.yaml @@ -0,0 +1,19 @@ +--- !mach-o +arch: x86_64 +file-type: MH_DYLIB +flags: [ MH_TWOLEVEL ] +install-name: /usr/lib/libSystem.B.dylib +sections: + - segment: __TEXT + section: __text + type: S_REGULAR + attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ] + address: 0x0000000000000000 + content: [ 0x55 ] + +global-symbols: + - name: dyld_stub_binder + type: N_SECT + scope: [ N_EXT ] + sect: 1 + value: 0x0000000000000000 diff --git a/lld/test/mach-o/Inputs/unwind-info-simple-arm64.yaml b/lld/test/mach-o/Inputs/unwind-info-simple-arm64.yaml new file mode 100644 index 00000000000..5f7ae50717b --- /dev/null +++ b/lld/test/mach-o/Inputs/unwind-info-simple-arm64.yaml @@ -0,0 +1,13 @@ +--- !mach-o +arch: arm64 +file-type: MH_DYLIB +install-name: /usr/lib/libc++.dylib +exports: + - name: __Unwind_Resume + - name: __ZTIl + - name: __ZTIi + - name: ___cxa_end_catch + - name: ___cxa_begin_catch + - name: ___cxa_allocate_exception + - name: ___cxa_throw + - name: ___gxx_personality_v0 diff --git a/lld/test/mach-o/Inputs/use-simple-dylib.yaml b/lld/test/mach-o/Inputs/use-simple-dylib.yaml new file mode 100644 index 00000000000..9081bcf7693 --- /dev/null +++ b/lld/test/mach-o/Inputs/use-simple-dylib.yaml @@ -0,0 +1,58 @@ +--- !mach-o +arch: x86_64 +file-type: MH_DYLIB +flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ] +has-UUID: false +OS: unknown +sections: + - segment: __TEXT + section: __text + type: S_REGULAR + attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ] + alignment: 4 + address: 0x0000000000000000 + content: [ 0xCC, 0xC3, 0x90, 0xC3, 0x90, 0x90, 0xC3, 0x90, + 0x90, 0x90, 0xC3, 0x90, 0x90, 0x90, 0x90, 0xC3, + 0x31, 0xC0, 0xC3 ] +local-symbols: + - name: _myStatic + type: N_SECT + sect: 1 + value: 0x000000000000000B + - name: _myVariablePreviouslyKnownAsPrivateExtern + type: N_SECT + scope: [ N_PEXT ] + sect: 1 + desc: [ N_SYMBOL_RESOLVER ] + value: 0x0000000000000011 +global-symbols: + - name: _myGlobal + type: N_SECT + scope: [ N_EXT ] + sect: 1 + value: 0x0000000000000001 + - name: _myGlobalWeak + type: N_SECT + scope: [ N_EXT ] + sect: 1 + desc: [ N_WEAK_DEF ] + value: 0x0000000000000002 + - name: _myHidden + type: N_SECT + scope: [ N_EXT, N_PEXT ] + sect: 1 + value: 0x0000000000000004 + - name: _myHiddenWeak + type: N_SECT + scope: [ N_EXT, N_PEXT ] + sect: 1 + desc: [ N_WEAK_DEF ] + value: 0x0000000000000007 + - name: _myResolver + type: N_SECT + scope: [ N_EXT ] + sect: 1 + desc: [ N_SYMBOL_RESOLVER ] + value: 0x0000000000000010 + +install-name: libspecial.dylib diff --git a/lld/test/mach-o/Inputs/write-final-sections.yaml b/lld/test/mach-o/Inputs/write-final-sections.yaml new file mode 100644 index 00000000000..ed434917f2c --- /dev/null +++ b/lld/test/mach-o/Inputs/write-final-sections.yaml @@ -0,0 +1,20 @@ +--- !mach-o +arch: x86_64 +file-type: MH_DYLIB +flags: [ ] +install-name: /usr/lib/libSystem.B.dylib +sections: + - segment: __TEXT + section: __text + type: S_REGULAR + attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ] + address: 0x0000000000000000 + content: [ 0x55 ] + +global-symbols: + - name: dyld_stub_binder + type: N_SECT + scope: [ N_EXT ] + sect: 1 + value: 0x0000000000000000 + diff --git a/lld/test/mach-o/Inputs/wrong-arch-error.yaml b/lld/test/mach-o/Inputs/wrong-arch-error.yaml new file mode 100644 index 00000000000..304c872375e --- /dev/null +++ b/lld/test/mach-o/Inputs/wrong-arch-error.yaml @@ -0,0 +1,24 @@ +# RUN: not lld -flavor darwin -arch x86_64 -r %s 2> %t.err +# RUN: FileCheck %s < %t.err + +--- !mach-o +arch: x86 +file-type: MH_OBJECT +flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ] +has-UUID: false +OS: unknown +sections: + - segment: __TEXT + section: __text + type: S_REGULAR + attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ] + alignment: 4 + address: 0x0000000000000000 + content: [ 0xC3 ] + +global-symbols: + - name: _bar + type: N_SECT + scope: [ N_EXT ] + sect: 1 + value: 0x0000000000000000 |

