summaryrefslogtreecommitdiffstats
path: root/lld/test/mach-o
diff options
context:
space:
mode:
Diffstat (limited to 'lld/test/mach-o')
-rw-r--r--lld/test/mach-o/Inputs/PIE.yaml6
-rw-r--r--lld/test/mach-o/Inputs/arm-interworking.yaml83
-rw-r--r--lld/test/mach-o/Inputs/arm-shims.yaml60
-rw-r--r--lld/test/mach-o/Inputs/cstring-sections.yaml25
-rw-r--r--lld/test/mach-o/Inputs/got-order.yaml53
-rw-r--r--lld/test/mach-o/Inputs/got-order2.yaml11
-rw-r--r--lld/test/mach-o/Inputs/hello-world-arm64.yaml8
-rw-r--r--lld/test/mach-o/Inputs/hello-world-armv6.yaml7
-rw-r--r--lld/test/mach-o/Inputs/hello-world-armv7.yaml7
-rw-r--r--lld/test/mach-o/Inputs/hello-world-x86.yaml7
-rw-r--r--lld/test/mach-o/Inputs/hello-world-x86_64.yaml8
-rw-r--r--lld/test/mach-o/Inputs/interposing-section.yaml6
-rw-r--r--lld/test/mach-o/Inputs/lazy-bind-x86_64-2.yaml8
-rw-r--r--lld/test/mach-o/Inputs/lazy-bind-x86_64-3.yaml8
-rw-r--r--lld/test/mach-o/Inputs/lazy-bind-x86_64.yaml8
-rw-r--r--lld/test/mach-o/Inputs/linker-as-ld.yaml6
-rw-r--r--lld/test/mach-o/Inputs/re-exported-dylib-ordinal.yaml21
-rw-r--r--lld/test/mach-o/Inputs/re-exported-dylib-ordinal2.yaml18
-rw-r--r--lld/test/mach-o/Inputs/re-exported-dylib-ordinal3.yaml19
-rw-r--r--lld/test/mach-o/Inputs/unwind-info-simple-arm64.yaml13
-rw-r--r--lld/test/mach-o/Inputs/use-simple-dylib.yaml58
-rw-r--r--lld/test/mach-o/Inputs/write-final-sections.yaml20
-rw-r--r--lld/test/mach-o/Inputs/wrong-arch-error.yaml24
-rw-r--r--lld/test/mach-o/PIE.yaml16
-rw-r--r--lld/test/mach-o/arm-interworking.yaml86
-rw-r--r--lld/test/mach-o/arm-shims.yaml65
-rw-r--r--lld/test/mach-o/cstring-sections.yaml26
-rw-r--r--lld/test/mach-o/got-order.yaml69
-rw-r--r--lld/test/mach-o/hello-world-arm64.yaml12
-rw-r--r--lld/test/mach-o/hello-world-armv6.yaml10
-rw-r--r--lld/test/mach-o/hello-world-armv7.yaml11
-rw-r--r--lld/test/mach-o/hello-world-x86.yaml11
-rw-r--r--lld/test/mach-o/hello-world-x86_64.yaml15
-rw-r--r--lld/test/mach-o/interposing-section.yaml11
-rw-r--r--lld/test/mach-o/lazy-bind-x86_64.yaml31
-rw-r--r--lld/test/mach-o/linker-as-ld.yaml11
-rw-r--r--lld/test/mach-o/re-exported-dylib-ordinal.yaml67
-rw-r--r--lld/test/mach-o/unwind-info-simple-arm64.yaml17
-rw-r--r--lld/test/mach-o/use-simple-dylib.yaml62
-rw-r--r--lld/test/mach-o/write-final-sections.yaml25
-rw-r--r--lld/test/mach-o/wrong-arch-error.yaml25
41 files changed, 523 insertions, 531 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
diff --git a/lld/test/mach-o/PIE.yaml b/lld/test/mach-o/PIE.yaml
index 2e50951a454..24f8773cbd2 100644
--- a/lld/test/mach-o/PIE.yaml
+++ b/lld/test/mach-o/PIE.yaml
@@ -1,10 +1,13 @@
-# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t && \
+# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s \
+# RUN: %p/Inputs/PIE.yaml -o %t && \
# RUN: llvm-objdump -macho -private-headers %t | FileCheck %s
#
-# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -pie -o %t\
+# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s \
+# RUN: %p/Inputs/PIE.yaml -pie -o %t\
# RUN: && llvm-objdump -macho -private-headers %t | FileCheck %s
#
-# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -no_pie -o %t\
+# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s \
+# RUN: %p/Inputs/PIE.yaml -no_pie -o %t\
# RUN: && llvm-objdump -macho -private-headers %t \
# RUN: | FileCheck --check-prefix=CHECK_NO_PIE %s
#
@@ -31,13 +34,6 @@ global-symbols:
sect: 1
value: 0x0000000000000000
---- !mach-o
-arch: x86_64
-file-type: MH_DYLIB
-install-name: /usr/lib/libSystem.B.dylib
-exports:
- - name: dyld_stub_binder
-
...
# CHECK: MH_MAGIC_64 {{[0-9a-zA-Z _]+}} TWOLEVEL PIE
diff --git a/lld/test/mach-o/arm-interworking.yaml b/lld/test/mach-o/arm-interworking.yaml
index f7e04e65c9f..c2883024b5b 100644
--- a/lld/test/mach-o/arm-interworking.yaml
+++ b/lld/test/mach-o/arm-interworking.yaml
@@ -1,4 +1,5 @@
-# RUN: lld -flavor darwin -arch armv7 -r -print_atoms %s -o %t | FileCheck %s \
+# RUN: lld -flavor darwin -arch armv7 -r -print_atoms %s \
+# RUN: %p/Inputs/arm-interworking.yaml -o %t | FileCheck %s \
# RUN: && lld -flavor darwin -arch armv7 -dylib -print_atoms \
# RUN: %p/Inputs/libSystem.yaml %t -o %t2 | FileCheck %s \
# RUN: && macho-dump --dump-section-data %t2 | FileCheck -check-prefix=CODE %s
@@ -126,89 +127,6 @@ undefined-symbols:
scope: [ N_EXT ]
value: 0x0000000000000000
---- !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/arm-shims.yaml b/lld/test/mach-o/arm-shims.yaml
index 68a401ca78e..f051474e764 100644
--- a/lld/test/mach-o/arm-shims.yaml
+++ b/lld/test/mach-o/arm-shims.yaml
@@ -1,4 +1,5 @@
-# RUN: lld -flavor darwin -arch armv7 %s -dylib %p/Inputs/libSystem.yaml -o %t
+# RUN: lld -flavor darwin -arch armv7 %s %p/Inputs/arm-shims.yaml \
+# RUN: -dylib %p/Inputs/libSystem.yaml -o %t
# RUN: macho-dump --dump-section-data %t | FileCheck %s
#
# Test b from arm to thumb or vice versa has shims added.s
@@ -66,68 +67,6 @@ undefined-symbols:
scope: [ N_EXT ]
value: 0x0000000000000000
-
---- !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/cstring-sections.yaml b/lld/test/mach-o/cstring-sections.yaml
index 940f048b5c6..433dffcf62d 100644
--- a/lld/test/mach-o/cstring-sections.yaml
+++ b/lld/test/mach-o/cstring-sections.yaml
@@ -27,32 +27,6 @@ sections:
address: 0x000000000000000A
content: [ 0x61, 0x62, 0x63, 0x00, 0x6A, 0x6B, 0x6C, 0x00 ]
---- !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/got-order.yaml b/lld/test/mach-o/got-order.yaml
index fbbc4e0397f..fcaa61cbc23 100644
--- a/lld/test/mach-o/got-order.yaml
+++ b/lld/test/mach-o/got-order.yaml
@@ -1,4 +1,5 @@
-# RUN: lld -flavor darwin -arch x86_64 %s -o %t %p/Inputs/libSystem.yaml
+# RUN: lld -flavor darwin -arch x86_64 %s %p/Inputs/got-order.yaml \
+# RUN: %p/Inputs/got-order2.yaml -o %t %p/Inputs/libSystem.yaml
# RUN: llvm-objdump -bind %t | FileCheck %s
#
# Test that GOT slots are sorted by name
@@ -57,72 +58,6 @@ undefined-symbols:
type: N_UNDF
scope: [ N_EXT ]
value: 0x0000000000000000
-
---- !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
-
---- !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/hello-world-arm64.yaml b/lld/test/mach-o/hello-world-arm64.yaml
index a0555e9cc42..a05940a6710 100644
--- a/lld/test/mach-o/hello-world-arm64.yaml
+++ b/lld/test/mach-o/hello-world-arm64.yaml
@@ -1,4 +1,4 @@
-# RUN: lld -flavor darwin -arch arm64 %s -o %t
+# RUN: lld -flavor darwin -arch arm64 %s %p/Inputs/hello-world-arm64.yaml -o %t
# RUN: llvm-nm -m -n %t | FileCheck %s
#
# Test that arm64 hello-world can be linked into a mach-o executable
@@ -88,16 +88,6 @@ undefined-symbols:
value: 0x0000000000000000
...
---- !mach-o
-arch: arm64
-file-type: MH_DYLIB
-install-name: /usr/lib/libSystem.B.dylib
-exports:
- - name: _fprintf
- - name: ___stdoutp
- - name: dyld_stub_binder
-...
-
# CHECK: {{[0-9a-f]+}} (__TEXT,__text) external _main
# CHECK: (undefined) external ___stdoutp (from libSystem)
# CHECK: (undefined) external _fprintf (from libSystem)
diff --git a/lld/test/mach-o/hello-world-armv6.yaml b/lld/test/mach-o/hello-world-armv6.yaml
index 746ee094da6..8a9edeeddba 100644
--- a/lld/test/mach-o/hello-world-armv6.yaml
+++ b/lld/test/mach-o/hello-world-armv6.yaml
@@ -1,4 +1,4 @@
-# RUN: lld -flavor darwin -arch armv6 %s -o %t
+# RUN: lld -flavor darwin -arch armv6 %s %p/Inputs/hello-world-armv6.yaml -o %t
# RUN: llvm-nm -m %t | FileCheck %s
#
# Test that armv6 (arm) hello-world can be linked into a mach-o executable
@@ -57,14 +57,6 @@ undefined-symbols:
type: N_UNDF
scope: [ N_EXT ]
value: 0x0000000000000000
-
---- !mach-o
-arch: armv6
-file-type: MH_DYLIB
-install-name: /usr/lib/libSystem.B.dylib
-exports:
- - name: _printf
- - name: dyld_stub_binder
...
# CHECK: {{[0-9a-f]+}} (__TEXT,__text) external _main
diff --git a/lld/test/mach-o/hello-world-armv7.yaml b/lld/test/mach-o/hello-world-armv7.yaml
index bfc03c382a0..d53d37638dc 100644
--- a/lld/test/mach-o/hello-world-armv7.yaml
+++ b/lld/test/mach-o/hello-world-armv7.yaml
@@ -1,4 +1,4 @@
-# RUN: lld -flavor darwin -arch armv7 %s -o %t
+# RUN: lld -flavor darwin -arch armv7 %s %p/Inputs/hello-world-armv7.yaml -o %t
# RUN: llvm-nm -m -n %t | FileCheck %s
#
# Test that armv7 (thumb) hello-world can be linked into a mach-o executable
@@ -71,15 +71,6 @@ undefined-symbols:
value: 0x0000000000000000
...
---- !mach-o
-arch: armv7
-file-type: MH_DYLIB
-install-name: /usr/lib/libSystem.B.dylib
-exports:
- - name: _printf
- - name: dyld_stub_binder
-...
-
# CHECK: {{[0-9a-f]+}} (__TEXT,__text) external [Thumb] _main
# CHECK: (undefined) external _printf (from libSystem)
# CHECK: (undefined) external dyld_stub_binder (from libSystem)
diff --git a/lld/test/mach-o/hello-world-x86.yaml b/lld/test/mach-o/hello-world-x86.yaml
index de453ed1ac4..27f3511addc 100644
--- a/lld/test/mach-o/hello-world-x86.yaml
+++ b/lld/test/mach-o/hello-world-x86.yaml
@@ -1,4 +1,4 @@
-# RUN: lld -flavor darwin -arch i386 %s -o %t
+# RUN: lld -flavor darwin -arch i386 %s %p/Inputs/hello-world-x86.yaml -o %t
# RUN: llvm-nm -m %t | FileCheck %s
#
# Test that i386 hello-world can be linked into a mach-o executable
@@ -55,15 +55,6 @@ undefined-symbols:
type: N_UNDF
scope: [ N_EXT ]
value: 0x0000000000000000
-
---- !mach-o
-arch: x86
-file-type: MH_DYLIB
-install-name: /usr/lib/libSystem.B.dylib
-exports:
- - name: _printf
- - name: dyld_stub_binder
-
...
# CHECK: {{[0-9a-f]+}} (__TEXT,__text) external _main
diff --git a/lld/test/mach-o/hello-world-x86_64.yaml b/lld/test/mach-o/hello-world-x86_64.yaml
index 83d4fcb3260..eba31867b26 100644
--- a/lld/test/mach-o/hello-world-x86_64.yaml
+++ b/lld/test/mach-o/hello-world-x86_64.yaml
@@ -1,7 +1,9 @@
-# RUN: lld -flavor darwin -arch x86_64 %s -o %t
+# RUN: lld -flavor darwin -arch x86_64 %s %p/Inputs/hello-world-x86_64.yaml \
+# RUN: -o %t
# RUN: llvm-nm -m -n %t | FileCheck %s
#
-# RUN: lld -flavor darwin -arch x86_64 %s -dead_strip -o %t2
+# RUN: lld -flavor darwin -arch x86_64 %s %p/Inputs/hello-world-x86_64.yaml \
+# RUN: -dead_strip -o %t2
# RUN: llvm-nm -m -n %t2 | FileCheck %s
#
# Test that x86_64 hello-world can be linked into a mach-o executable
@@ -109,15 +111,6 @@ undefined-symbols:
scope: [ N_EXT ]
value: 0x0000000000000000
---- !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
-
...
# CHECK: {{[0-9a-f]+}} (__TEXT,__text) external _main
diff --git a/lld/test/mach-o/interposing-section.yaml b/lld/test/mach-o/interposing-section.yaml
index 856d4b91f3d..2ac28f03795 100644
--- a/lld/test/mach-o/interposing-section.yaml
+++ b/lld/test/mach-o/interposing-section.yaml
@@ -1,4 +1,5 @@
-# RUN: lld -flavor darwin -arch x86_64 %s -dylib -o %t %p/Inputs/libSystem.yaml
+# RUN: lld -flavor darwin -arch x86_64 %s %p/Inputs/interposing-section.yaml \
+# RUN: -dylib -o %t %p/Inputs/libSystem.yaml
# RUN: llvm-objdump -private-headers %t | FileCheck %s
#
# RUN: lld -flavor darwin -arch x86_64 %s -r -o %t1
@@ -62,14 +63,6 @@ undefined-symbols:
type: N_UNDF
scope: [ N_EXT ]
value: 0x0000000000000000
-
---- !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/lazy-bind-x86_64.yaml b/lld/test/mach-o/lazy-bind-x86_64.yaml
index 54d787ce91b..1b4699feed3 100644
--- a/lld/test/mach-o/lazy-bind-x86_64.yaml
+++ b/lld/test/mach-o/lazy-bind-x86_64.yaml
@@ -1,6 +1,8 @@
# REQUIRES: x86
-# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t \
+# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s \
+# RUN: %p/Inputs/lazy-bind-x86_64.yaml %p/Inputs/lazy-bind-x86_64-2.yaml \
+# RUN: %p/Inputs/lazy-bind-x86_64-3.yaml -o %t \
# RUN: %p/Inputs/libSystem.yaml
# RUN: llvm-objdump -lazy-bind %t | FileCheck %s
# RUN: llvm-nm -m %t | FileCheck --check-prefix=CHECK-NM %s
@@ -63,33 +65,6 @@ undefined-symbols:
scope: [ N_EXT ]
value: 0x0000000000000000
---- !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
-
---- !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
-
---- !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/linker-as-ld.yaml b/lld/test/mach-o/linker-as-ld.yaml
index 2dd1f79818e..f0bf189876a 100644
--- a/lld/test/mach-o/linker-as-ld.yaml
+++ b/lld/test/mach-o/linker-as-ld.yaml
@@ -1,7 +1,8 @@
# REQUIRES: system-linker-mach-o
#
# RUN: mkdir -p %t.dir && cp `which lld` %t.dir/ld \
-# RUN: && %t.dir/ld -arch x86_64 -macosx_version_min 10.8 %s -o %t \
+# RUN: && %t.dir/ld -arch x86_64 -macosx_version_min 10.8 %s \
+# RUN: %p/Inputs/linker-as-ld.yaml -o %t \
# RUN: && llvm-nm %t | FileCheck %s
#
# Test linker run as "ld" on darwin works as darwin linker.
@@ -26,14 +27,6 @@ global-symbols:
scope: [ N_EXT ]
sect: 1
value: 0x0000000000000000
-
---- !mach-o
-arch: x86_64
-file-type: MH_DYLIB
-install-name: /usr/lib/libSystem.B.dylib
-exports:
- - name: dyld_stub_binder
-
...
# CHECK: T _main
diff --git a/lld/test/mach-o/re-exported-dylib-ordinal.yaml b/lld/test/mach-o/re-exported-dylib-ordinal.yaml
index 9d628e9af15..ff4d756338c 100644
--- a/lld/test/mach-o/re-exported-dylib-ordinal.yaml
+++ b/lld/test/mach-o/re-exported-dylib-ordinal.yaml
@@ -1,4 +1,7 @@
-# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -dylib -o %t \
+# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s \
+# RUN: %p/Inputs/re-exported-dylib-ordinal.yaml \
+# RUN: %p/Inputs/re-exported-dylib-ordinal2.yaml \
+# RUN: %p/Inputs/re-exported-dylib-ordinal3.yaml -dylib -o %t \
# RUN: && llvm-nm -m %t | FileCheck %s
#
# Test that when one dylib A re-exports dylib B that using a symbol from B
@@ -37,68 +40,6 @@ undefined-symbols:
type: N_UNDF
scope: [ N_EXT ]
value: 0x0000000000000000
-
---- !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
-
---- !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
-
---- !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
-
...
# CHECK: (undefined) external _bar (from libfoo)
diff --git a/lld/test/mach-o/unwind-info-simple-arm64.yaml b/lld/test/mach-o/unwind-info-simple-arm64.yaml
index d46b43ff712..0e85401b16a 100644
--- a/lld/test/mach-o/unwind-info-simple-arm64.yaml
+++ b/lld/test/mach-o/unwind-info-simple-arm64.yaml
@@ -1,4 +1,5 @@
-# RUN: lld -flavor darwin -arch arm64 %s -o %t -e _main %p/Inputs/libSystem.yaml
+# RUN: lld -flavor darwin -arch arm64 -o %t %s \
+# RUN: %p/Inputs/unwind-info-simple-arm64.yaml -e _main %p/Inputs/libSystem.yaml
# RUN: llvm-objdump -unwind-info %t | FileCheck %s
--- !mach-o
@@ -236,20 +237,6 @@ undefined-symbols:
scope: [ N_EXT ]
value: 0x0000000000000000
---- !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/use-simple-dylib.yaml b/lld/test/mach-o/use-simple-dylib.yaml
index 0da7d1b0bd0..658be16356e 100644
--- a/lld/test/mach-o/use-simple-dylib.yaml
+++ b/lld/test/mach-o/use-simple-dylib.yaml
@@ -1,4 +1,5 @@
-# RUN: lld -flavor darwin -arch x86_64 -print_atoms -r %s -o %t | FileCheck %s
+# RUN: lld -flavor darwin -arch x86_64 -print_atoms -r %s \
+# RUN: %p/Inputs/use-simple-dylib.yaml -o %t | FileCheck %s
--- !mach-o
@@ -53,65 +54,6 @@ undefined-symbols:
type: N_UNDF
scope: [ N_EXT ]
value: 0x0000000000000000
-
---- !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/write-final-sections.yaml b/lld/test/mach-o/write-final-sections.yaml
index 7d4afb31900..7403cac1d3d 100644
--- a/lld/test/mach-o/write-final-sections.yaml
+++ b/lld/test/mach-o/write-final-sections.yaml
@@ -1,4 +1,5 @@
-# RUN: lld -flavor darwin -arch x86_64 %s -o %t -e _foo
+# RUN: lld -flavor darwin -arch x86_64 %s %p/Inputs/write-final-sections.yaml \
+# RUN: -o %t -e _foo
# RUN: llvm-readobj -sections -section-data %t | FileCheck %s
--- !native
@@ -143,25 +144,3 @@ defined-atoms:
- type: compact-unwind
content: [ 0E, 00, 00, 00, 00, 00, 00, 00 ]
# CHECK-NOT: Name: __compact_unwind
-
-
---- !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/wrong-arch-error.yaml b/lld/test/mach-o/wrong-arch-error.yaml
index 6d233798a7b..3b8ef0dc7ee 100644
--- a/lld/test/mach-o/wrong-arch-error.yaml
+++ b/lld/test/mach-o/wrong-arch-error.yaml
@@ -1,4 +1,5 @@
-# RUN: not lld -flavor darwin -arch x86_64 -r %s 2> %t.err
+# RUN: not lld -flavor darwin -arch x86_64 -r %s \
+# RUN: %p/Inputs/wrong-arch-error.yaml 2> %t.err
# RUN: FileCheck %s < %t.err
--- !mach-o
@@ -21,28 +22,6 @@ global-symbols:
scope: [ N_EXT ]
sect: 1
value: 0x0000000000000000
-
---- !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
...
OpenPOWER on IntegriCloud