summaryrefslogtreecommitdiff
path: root/test/mach-o
diff options
context:
space:
mode:
Diffstat (limited to 'test/mach-o')
-rw-r--r--test/mach-o/Inputs/arm64/libSystem.yaml13
-rw-r--r--test/mach-o/Inputs/armv7/libSystem.yaml13
-rw-r--r--test/mach-o/Inputs/libSystem.yaml13
-rw-r--r--test/mach-o/Inputs/x86/libSystem.yaml13
-rw-r--r--test/mach-o/Inputs/x86_64/libSystem.yaml13
-rw-r--r--test/mach-o/arm-interworking-movw.yaml2
-rw-r--r--test/mach-o/arm-interworking.yaml2
-rw-r--r--test/mach-o/arm-shims.yaml2
-rw-r--r--test/mach-o/arm64-reloc-negDelta32-fixup.yaml38
-rw-r--r--test/mach-o/arm64-relocs-errors-delta64-offset.yaml12
-rw-r--r--test/mach-o/bind-opcodes.yaml143
-rw-r--r--test/mach-o/data-in-code-load-command.yaml16
-rw-r--r--test/mach-o/data-only-dylib.yaml2
-rw-r--r--test/mach-o/dead-strip-globals.yaml10
-rw-r--r--test/mach-o/debug-syms.yaml249
-rw-r--r--test/mach-o/demangle.yaml4
-rw-r--r--test/mach-o/dso_handle.yaml8
-rw-r--r--test/mach-o/dylib-install-names.yaml12
-rw-r--r--test/mach-o/eh-frame-relocs-arm64.yaml92
-rw-r--r--test/mach-o/exe-offsets.yaml2
-rw-r--r--test/mach-o/exe-segment-overlap.yaml2
-rw-r--r--test/mach-o/executable-exports.yaml2
-rw-r--r--test/mach-o/export-trie-order.yaml62
-rw-r--r--test/mach-o/exported_symbols_list-dylib.yaml8
-rw-r--r--test/mach-o/exported_symbols_list-undef.yaml2
-rw-r--r--test/mach-o/fat-archive.yaml2
-rw-r--r--test/mach-o/flat_namespace_undef_error.yaml2
-rw-r--r--test/mach-o/flat_namespace_undef_suppress.yaml2
-rw-r--r--test/mach-o/force_load-dylib.yaml4
-rw-r--r--test/mach-o/force_load-x86_64.yaml4
-rw-r--r--test/mach-o/function-starts-load-command.yaml10
-rw-r--r--test/mach-o/gcc_except_tab-got-arm64.yaml30
-rw-r--r--test/mach-o/got-order.yaml2
-rw-r--r--test/mach-o/hello-world-arm64.yaml8
-rw-r--r--test/mach-o/image-base.yaml2
-rw-r--r--test/mach-o/interposing-section.yaml2
-rw-r--r--test/mach-o/lazy-bind-x86_64.yaml2
-rw-r--r--test/mach-o/lc_segment_filesize.yaml31
-rw-r--r--test/mach-o/library-order.yaml2
-rw-r--r--test/mach-o/library-rescan.yaml2
-rw-r--r--test/mach-o/linker-as-ld.yaml4
-rw-r--r--test/mach-o/lit.local.cfg2
-rw-r--r--test/mach-o/mh_bundle_header.yaml4
-rw-r--r--test/mach-o/mh_dylib_header.yaml2
-rw-r--r--test/mach-o/objc-category-list-atom.yaml14
-rw-r--r--test/mach-o/objc_export_list.yaml2
-rw-r--r--test/mach-o/order_file-basic.yaml2
-rw-r--r--test/mach-o/parse-data-in-code-armv7.yaml2
-rw-r--r--test/mach-o/parse-data-relocs-x86_64.yaml6
-rw-r--r--test/mach-o/rpath.yaml2
-rw-r--r--test/mach-o/run-tlv-pass-x86-64.yaml18
-rw-r--r--test/mach-o/sectalign.yaml2
-rw-r--r--test/mach-o/sectattrs.yaml2
-rw-r--r--test/mach-o/source-version.yaml2
-rw-r--r--test/mach-o/stack-size.yaml4
-rw-r--r--test/mach-o/string-table.yaml66
-rw-r--r--test/mach-o/twolevel_namespace_undef_dynamic_lookup.yaml2
-rw-r--r--test/mach-o/twolevel_namespace_undef_warning_suppress.yaml4
-rw-r--r--test/mach-o/unwind-info-simple-arm64.yaml2
-rw-r--r--test/mach-o/unwind-info-simple-x86_64.yaml2
-rw-r--r--test/mach-o/upward-dylib-load-command.yaml4
-rw-r--r--test/mach-o/use-dylib.yaml39
-rw-r--r--test/mach-o/version-min-load-command.yaml14
63 files changed, 841 insertions, 200 deletions
diff --git a/test/mach-o/Inputs/arm64/libSystem.yaml b/test/mach-o/Inputs/arm64/libSystem.yaml
new file mode 100644
index 0000000000000..76cba1bc32555
--- /dev/null
+++ b/test/mach-o/Inputs/arm64/libSystem.yaml
@@ -0,0 +1,13 @@
+#
+# For use by test cases that create dynamic output types which may needs stubs
+# and therefore will need a dylib definition of dyld_stub_binder.
+#
+
+--- !mach-o
+arch: arm64
+file-type: MH_DYLIB
+install-name: /usr/lib/libSystem.B.dylib
+exports:
+ - name: dyld_stub_binder
+
+...
diff --git a/test/mach-o/Inputs/armv7/libSystem.yaml b/test/mach-o/Inputs/armv7/libSystem.yaml
new file mode 100644
index 0000000000000..2539f9003540e
--- /dev/null
+++ b/test/mach-o/Inputs/armv7/libSystem.yaml
@@ -0,0 +1,13 @@
+#
+# For use by test cases that create dynamic output types which may needs stubs
+# and therefore will need a dylib definition of dyld_stub_binder.
+#
+
+--- !mach-o
+arch: armv7
+file-type: MH_DYLIB
+install-name: /usr/lib/libSystem.B.dylib
+exports:
+ - name: dyld_stub_binder
+
+...
diff --git a/test/mach-o/Inputs/libSystem.yaml b/test/mach-o/Inputs/libSystem.yaml
deleted file mode 100644
index 2a7f46381dcc1..0000000000000
--- a/test/mach-o/Inputs/libSystem.yaml
+++ /dev/null
@@ -1,13 +0,0 @@
-#
-# For use by test cases that create dynamic output types which may needs stubs
-# and therefore will need a dylib definition of dyld_stub_binder.
-#
-
----
-shared-library-atoms:
- - name: dyld_stub_binder
- load-name: /usr/lib/libSystem.B.dylib
- type: code
- size: 0
-
-...
diff --git a/test/mach-o/Inputs/x86/libSystem.yaml b/test/mach-o/Inputs/x86/libSystem.yaml
new file mode 100644
index 0000000000000..87a4895c9f4ad
--- /dev/null
+++ b/test/mach-o/Inputs/x86/libSystem.yaml
@@ -0,0 +1,13 @@
+#
+# For use by test cases that create dynamic output types which may needs stubs
+# and therefore will need a dylib definition of dyld_stub_binder.
+#
+
+--- !mach-o
+arch: x86
+file-type: MH_DYLIB
+install-name: /usr/lib/libSystem.B.dylib
+exports:
+ - name: dyld_stub_binder
+
+...
diff --git a/test/mach-o/Inputs/x86_64/libSystem.yaml b/test/mach-o/Inputs/x86_64/libSystem.yaml
new file mode 100644
index 0000000000000..fbbf794f3264a
--- /dev/null
+++ b/test/mach-o/Inputs/x86_64/libSystem.yaml
@@ -0,0 +1,13 @@
+#
+# For use by test cases that create dynamic output types which may needs stubs
+# and therefore will need a dylib definition of dyld_stub_binder.
+#
+
+--- !mach-o
+arch: x86_64
+file-type: MH_DYLIB
+install-name: /usr/lib/libSystem.B.dylib
+exports:
+ - name: dyld_stub_binder
+
+...
diff --git a/test/mach-o/arm-interworking-movw.yaml b/test/mach-o/arm-interworking-movw.yaml
index 0423ed6445762..b555112dde824 100644
--- a/test/mach-o/arm-interworking-movw.yaml
+++ b/test/mach-o/arm-interworking-movw.yaml
@@ -1,7 +1,7 @@
# REQUIRES: arm
# RUN: lld -flavor darwin -arch armv7 -r -print_atoms %s -o %t | FileCheck %s
# RUN: lld -flavor darwin -arch armv7 -dylib -print_atoms %t -o %t2 \
-# RUN: %p/Inputs/libSystem.yaml -sectalign __TEXT __text 0x1000 | FileCheck %s
+# RUN: %p/Inputs/armv7/libSystem.yaml -sectalign __TEXT __text 0x1000 | FileCheck %s
# RUN: llvm-objdump -d -macho -no-symbolic-operands %t2 | FileCheck -check-prefix=CODE %s
#
# Test thumb and arm branches round trip through -r.
diff --git a/test/mach-o/arm-interworking.yaml b/test/mach-o/arm-interworking.yaml
index 59c46050fab5c..3988a19584588 100644
--- a/test/mach-o/arm-interworking.yaml
+++ b/test/mach-o/arm-interworking.yaml
@@ -1,7 +1,7 @@
# 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: %p/Inputs/armv7/libSystem.yaml %t -o %t2 | FileCheck %s \
# RUN: && llvm-readobj -s -sd %t2 | FileCheck -check-prefix=CODE %s
#
# Test thumb and arm branches round trip through -r.
diff --git a/test/mach-o/arm-shims.yaml b/test/mach-o/arm-shims.yaml
index 62739c967ab15..1b54de4f05aab 100644
--- a/test/mach-o/arm-shims.yaml
+++ b/test/mach-o/arm-shims.yaml
@@ -1,5 +1,5 @@
# RUN: lld -flavor darwin -arch armv7 %s %p/Inputs/arm-shims.yaml \
-# RUN: -dylib %p/Inputs/libSystem.yaml -o %t
+# RUN: -dylib %p/Inputs/armv7/libSystem.yaml -o %t
# RUN: llvm-readobj -s -sd %t | FileCheck %s
#
# Test b from arm to thumb or vice versa has shims added.s
diff --git a/test/mach-o/arm64-reloc-negDelta32-fixup.yaml b/test/mach-o/arm64-reloc-negDelta32-fixup.yaml
index 4da88097eb604..ee8686cabb623 100644
--- a/test/mach-o/arm64-reloc-negDelta32-fixup.yaml
+++ b/test/mach-o/arm64-reloc-negDelta32-fixup.yaml
@@ -21,18 +21,18 @@ compat-version: 0.0
current-version: 0.0
has-UUID: false
OS: unknown
-sections:
+sections:
- segment: __TEXT
section: __text
type: S_REGULAR
attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
alignment: 4
address: 0x0000000000000000
- content: [ 0xFD, 0x7B, 0xBF, 0xA9, 0xFD, 0x03, 0x00, 0x91,
- 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x91,
- 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x80, 0x52,
+ content: [ 0xFD, 0x7B, 0xBF, 0xA9, 0xFD, 0x03, 0x00, 0x91,
+ 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x91,
+ 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x80, 0x52,
0xFD, 0x7B, 0xC1, 0xA8, 0xC0, 0x03, 0x5F, 0xD6 ]
- relocations:
+ relocations:
- offset: 0x00000010
type: ARM64_RELOC_BRANCH26
length: 2
@@ -56,7 +56,7 @@ sections:
type: S_CSTRING_LITERALS
attributes: [ ]
address: 0x0000000000000020
- content: [ 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F,
+ content: [ 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F,
0x72, 0x6C, 0x64, 0x00 ]
- segment: __LD
section: __compact_unwind
@@ -64,11 +64,11 @@ sections:
attributes: [ ]
alignment: 8
address: 0x0000000000000030
- content: [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ content: [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]
- relocations:
+ relocations:
- offset: 0x00000000
type: ARM64_RELOC_UNSIGNED
length: 3
@@ -81,14 +81,14 @@ sections:
attributes: [ ]
alignment: 8
address: 0x0000000000000050
- content: [ 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x7A, 0x52, 0x00, 0x01, 0x78, 0x1E, 0x01,
- 0x10, 0x0C, 0x1F, 0x00, 0x20, 0x00, 0x00, 0x00,
- 0x18, 0x00, 0x00, 0x00, 0x94, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0x20, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x0E, 0x10,
+ content: [ 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x7A, 0x52, 0x00, 0x01, 0x78, 0x1E, 0x01,
+ 0x10, 0x0C, 0x1F, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x18, 0x00, 0x00, 0x00, 0x94, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x20, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x0E, 0x10,
0x9E, 0x01, 0x9D, 0x02, 0x00, 0x00, 0x00, 0x00 ]
-local-symbols:
+local-symbols:
- name: ltmp0
type: N_SECT
sect: 1
@@ -109,13 +109,13 @@ local-symbols:
type: N_SECT
sect: 4
value: 0x0000000000000050
-global-symbols:
+global-symbols:
- name: __Z3fooi
type: N_SECT
scope: [ N_EXT ]
sect: 1
value: 0x0000000000000000
-undefined-symbols:
+undefined-symbols:
- name: _puts
type: N_UNDF
scope: [ N_EXT ]
diff --git a/test/mach-o/arm64-relocs-errors-delta64-offset.yaml b/test/mach-o/arm64-relocs-errors-delta64-offset.yaml
index 08e41bc65fff6..d238097f96951 100644
--- a/test/mach-o/arm64-relocs-errors-delta64-offset.yaml
+++ b/test/mach-o/arm64-relocs-errors-delta64-offset.yaml
@@ -14,11 +14,11 @@ sections:
attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
alignment: 4
address: 0x0000000000000000
- content: [ 0xFF, 0x83, 0x00, 0xD1, 0xE0, 0x0B, 0x00, 0xF9,
- 0x08, 0x00, 0x40, 0xB9, 0x08, 0x0D, 0x00, 0x71,
- 0x08, 0x09, 0x00, 0x71, 0xE8, 0x0F, 0x00, 0xB9,
- 0xC8, 0x00, 0x00, 0x54, 0x01, 0x00, 0x00, 0x14,
- 0xE8, 0x03, 0x00, 0x32, 0x08, 0x01, 0x00, 0x12,
+ content: [ 0xFF, 0x83, 0x00, 0xD1, 0xE0, 0x0B, 0x00, 0xF9,
+ 0x08, 0x00, 0x40, 0xB9, 0x08, 0x0D, 0x00, 0x71,
+ 0x08, 0x09, 0x00, 0x71, 0xE8, 0x0F, 0x00, 0xB9,
+ 0xC8, 0x00, 0x00, 0x54, 0x01, 0x00, 0x00, 0x14,
+ 0xE8, 0x03, 0x00, 0x32, 0x08, 0x01, 0x00, 0x12,
0xE8, 0x7F, 0x00, 0x39, 0x02, 0x00, 0x00, 0x14 ]
- segment: __DATA
section: __data
@@ -34,7 +34,7 @@ sections:
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]
- relocations:
+ relocations:
# Make sure that the offsets of the subtractor and unsigned both match.
# CHECK: bad relocation (paired relocs must have the same offset) in section __DATA/__data (r1_address=1, r1_type=1, r1_extern=1, r1_length=3, r1_pcrel=0, r1_symbolnum=1), (r2_address=0, r2_type=0, r2_extern=1, r2_length=3, r2_pcrel=0, r2_symbolnum=1)
diff --git a/test/mach-o/bind-opcodes.yaml b/test/mach-o/bind-opcodes.yaml
new file mode 100644
index 0000000000000..ad8cd169a85cf
--- /dev/null
+++ b/test/mach-o/bind-opcodes.yaml
@@ -0,0 +1,143 @@
+# RUN: lld -flavor darwin -arch arm64 %s %p/Inputs/hello-world-arm64.yaml -o %t
+# RUN: obj2yaml %t | FileCheck %s
+#
+
+--- !mach-o
+arch: arm64
+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: [ 0xFD, 0x7B, 0xBF, 0xA9, 0xFD, 0x03, 0x00, 0x91,
+ 0x08, 0x00, 0x00, 0x90, 0x08, 0x01, 0x40, 0xF9,
+ 0x00, 0x01, 0x40, 0xF9, 0x01, 0x00, 0x00, 0x90,
+ 0x21, 0x00, 0x00, 0x91, 0x00, 0x00, 0x00, 0x94,
+ 0x00, 0x00, 0x80, 0x52, 0xFD, 0x7B, 0xC1, 0xA8,
+ 0xC0, 0x03, 0x5F, 0xD6 ]
+ relocations:
+ - offset: 0x0000001C
+ type: ARM64_RELOC_BRANCH26
+ length: 2
+ pc-rel: true
+ extern: true
+ symbol: 5
+ - offset: 0x00000018
+ type: ARM64_RELOC_PAGEOFF12
+ length: 2
+ pc-rel: false
+ extern: true
+ symbol: 1
+ - offset: 0x00000014
+ type: ARM64_RELOC_PAGE21
+ length: 2
+ pc-rel: true
+ extern: true
+ symbol: 1
+ - offset: 0x0000000C
+ type: ARM64_RELOC_GOT_LOAD_PAGEOFF12
+ length: 2
+ pc-rel: false
+ extern: true
+ symbol: 4
+ - offset: 0x00000008
+ type: ARM64_RELOC_GOT_LOAD_PAGE21
+ length: 2
+ pc-rel: true
+ extern: true
+ symbol: 4
+ - segment: __TEXT
+ section: __cstring
+ type: S_CSTRING_LITERALS
+ attributes: [ ]
+ address: 0x000000000000002C
+ content: [ 0x68, 0x65, 0x6C, 0x6C, 0x6F, 0x0A, 0x00 ]
+local-symbols:
+ - name: ltmp0
+ type: N_SECT
+ sect: 1
+ value: 0x0000000000000000
+ - name: l_.str
+ type: N_SECT
+ sect: 2
+ value: 0x000000000000002C
+ - name: ltmp1
+ type: N_SECT
+ sect: 2
+ value: 0x000000000000002C
+global-symbols:
+ - name: _main
+ type: N_SECT
+ scope: [ N_EXT ]
+ sect: 1
+ value: 0x0000000000000000
+undefined-symbols:
+ - name: ___stdoutp
+ type: N_UNDF
+ scope: [ N_EXT ]
+ value: 0x0000000000000000
+ - name: _fprintf
+ type: N_UNDF
+ scope: [ N_EXT ]
+ value: 0x0000000000000000
+...
+
+
+# CHECK: BindOpcodes:
+# CHECK: - Opcode: BIND_OPCODE_SET_DYLIB_ORDINAL_IMM
+# CHECK: Imm: 1
+# CHECK: Symbol: ''
+# CHECK: - Opcode: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM
+# CHECK: Imm: 0
+# CHECK: Symbol: dyld_stub_binder
+# CHECK: - Opcode: BIND_OPCODE_SET_TYPE_IMM
+# CHECK: Imm: 1
+# CHECK: Symbol: ''
+# CHECK: - Opcode: BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB
+# CHECK: Imm: 2
+# CHECK: ULEBExtraData:
+# CHECK: - 0x0000000000000000
+# CHECK: Symbol: ''
+# CHECK: - Opcode: BIND_OPCODE_DO_BIND
+# CHECK: Imm: 0
+# CHECK: Symbol: ''
+# CHECK: - Opcode: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM
+# CHECK: Imm: 0
+# CHECK: Symbol: ___stdoutp
+# CHECK: - Opcode: BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB
+# CHECK: Imm: 2
+# CHECK: ULEBExtraData:
+# CHECK: - 0x0000000000000010
+# CHECK: Symbol: ''
+# CHECK: - Opcode: BIND_OPCODE_DO_BIND
+# CHECK: Imm: 0
+# CHECK: Symbol: ''
+# CHECK: - Opcode: BIND_OPCODE_DONE
+# CHECK: Imm: 0
+# CHECK: Symbol: ''
+
+# CHECK: LazyBindOpcodes:
+# CHECK: - Opcode: BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB
+# CHECK: Imm: 2
+# CHECK: ULEBExtraData:
+# CHECK: - 0x0000000000000018
+# CHECK: Symbol: ''
+# CHECK: - Opcode: BIND_OPCODE_SET_DYLIB_ORDINAL_IMM
+# CHECK: Imm: 1
+# CHECK: Symbol: ''
+# CHECK: - Opcode: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM
+# CHECK: Imm: 0
+# CHECK: Symbol: _fprintf
+# CHECK: - Opcode: BIND_OPCODE_DO_BIND
+# CHECK: Imm: 0
+# CHECK: Symbol: ''
+# CHECK: - Opcode: BIND_OPCODE_DONE
+# CHECK: Imm: 0
+# CHECK: Symbol: ''
+# CHECK: - Opcode: BIND_OPCODE_DONE
+# CHECK: Imm: 0
+# CHECK: Symbol: '' \ No newline at end of file
diff --git a/test/mach-o/data-in-code-load-command.yaml b/test/mach-o/data-in-code-load-command.yaml
index 604592afcd3f2..0c84bd4d7452c 100644
--- a/test/mach-o/data-in-code-load-command.yaml
+++ b/test/mach-o/data-in-code-load-command.yaml
@@ -1,11 +1,11 @@
-# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/libSystem.yaml && llvm-objdump -private-headers %t | FileCheck %s
-# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/libSystem.yaml -static -data_in_code_info && llvm-objdump -private-headers %t | FileCheck %s
-# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/libSystem.yaml -no_data_in_code_info && llvm-objdump -private-headers %t | FileCheck %s --check-prefix=NO_DATA_IN_CODE_INFO
-# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/libSystem.yaml -static -data_in_code_info -no_data_in_code_info && llvm-objdump -private-headers %t | FileCheck %s --check-prefix=NO_DATA_IN_CODE_INFO
-# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/libSystem.yaml -static && llvm-objdump -private-headers %t | FileCheck %s --check-prefix=NO_DATA_IN_CODE_INFO
-# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/libSystem.yaml -r && llvm-objdump -private-headers %t | FileCheck %s
-# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/libSystem.yaml -r -data_in_code_info && llvm-objdump -private-headers %t | FileCheck %s
-# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/libSystem.yaml -r -no_data_in_code_info && llvm-objdump -private-headers %t | FileCheck %s --check-prefix=NO_DATA_IN_CODE_INFO
+# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/x86_64/libSystem.yaml && llvm-objdump -private-headers %t | FileCheck %s
+# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/x86_64/libSystem.yaml -static -data_in_code_info && llvm-objdump -private-headers %t | FileCheck %s
+# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/x86_64/libSystem.yaml -no_data_in_code_info && llvm-objdump -private-headers %t | FileCheck %s --check-prefix=NO_DATA_IN_CODE_INFO
+# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/x86_64/libSystem.yaml -static -data_in_code_info -no_data_in_code_info && llvm-objdump -private-headers %t | FileCheck %s --check-prefix=NO_DATA_IN_CODE_INFO
+# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/x86_64/libSystem.yaml -static && llvm-objdump -private-headers %t | FileCheck %s --check-prefix=NO_DATA_IN_CODE_INFO
+# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/x86_64/libSystem.yaml -r && llvm-objdump -private-headers %t | FileCheck %s
+# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/x86_64/libSystem.yaml -r -data_in_code_info && llvm-objdump -private-headers %t | FileCheck %s
+# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/x86_64/libSystem.yaml -r -no_data_in_code_info && llvm-objdump -private-headers %t | FileCheck %s --check-prefix=NO_DATA_IN_CODE_INFO
--- !mach-o
arch: x86_64
diff --git a/test/mach-o/data-only-dylib.yaml b/test/mach-o/data-only-dylib.yaml
index 8d21430474521..541e02f61ef96 100644
--- a/test/mach-o/data-only-dylib.yaml
+++ b/test/mach-o/data-only-dylib.yaml
@@ -1,4 +1,4 @@
-# RUN: lld -flavor darwin -arch x86_64 -dylib %s -o %t %p/Inputs/libSystem.yaml
+# RUN: lld -flavor darwin -arch x86_64 -dylib %s -o %t %p/Inputs/x86_64/libSystem.yaml
# RUN: llvm-nm %t | FileCheck %s
#
# Test that a data-only dylib can be built.
diff --git a/test/mach-o/dead-strip-globals.yaml b/test/mach-o/dead-strip-globals.yaml
index df5ff73aa4417..45d919db3aa59 100644
--- a/test/mach-o/dead-strip-globals.yaml
+++ b/test/mach-o/dead-strip-globals.yaml
@@ -1,6 +1,9 @@
-# RUN: lld -flavor darwin -arch x86_64 -dead_strip -export_dynamic %s -dylib %p/Inputs/libSystem.yaml -o %t.dylib -print_atoms | FileCheck -check-prefix=CHECK1 %s
-# RUN: lld -flavor darwin -arch x86_64 -export_dynamic -dead_strip %s -dylib %p/Inputs/libSystem.yaml -o %t.dylib -print_atoms | FileCheck -check-prefix=CHECK1 %s
-# RUN: lld -flavor darwin -arch x86_64 -dead_strip %s -dylib %p/Inputs/libSystem.yaml -o %t2.dylib -print_atoms | FileCheck -check-prefix=CHECK2 %s
+# RUN: lld -flavor darwin -arch x86_64 -dead_strip -export_dynamic %s -dylib %p/Inputs/x86_64/libSystem.yaml -o %t.dylib -print_atoms | FileCheck -check-prefix=CHECK1 %s
+# RUN: lld -flavor darwin -arch x86_64 -export_dynamic -dead_strip %s -dylib %p/Inputs/x86_64/libSystem.yaml -o %t.dylib -print_atoms | FileCheck -check-prefix=CHECK1 %s
+# RUN: lld -flavor darwin -arch x86_64 -dead_strip %s -dylib %p/Inputs/x86_64/libSystem.yaml -o %t2.dylib -print_atoms | FileCheck -check-prefix=CHECK2 %s
+
+# RUN: lld -flavor darwin -arch x86_64 -r %s -dylib %p/Inputs/x86_64/libSystem.yaml -o %t3.o
+# RUN: llvm-nm -m %t3.o | FileCheck -check-prefix=RELOCATABLE_SYMBOLS %s
#
# Test that -export_dynamic -dead-strip from removing globals.
@@ -25,3 +28,4 @@ shared-library-atoms:
# CHECK2: name: def
# CHECK2-NOT: name: dead
+# RELOCATABLE_SYMBOLS: external def
diff --git a/test/mach-o/debug-syms.yaml b/test/mach-o/debug-syms.yaml
new file mode 100644
index 0000000000000..28428724ffe72
--- /dev/null
+++ b/test/mach-o/debug-syms.yaml
@@ -0,0 +1,249 @@
+# RUN: lld -flavor darwin -arch x86_64 -o %t %s -dylib %p/Inputs/x86_64/libSystem.yaml && \
+# RUN: llvm-nm -no-sort -debug-syms %t | FileCheck %s
+
+# CHECK: 0000000000000000 - 00 0000 SO /Users/lhames/Projects/lld/lld-svn-tot/scratch/
+# CHECK-NEXT: 0000000000000000 - 00 0000 SO hw.c
+# CHECK-NEXT: {{[0-9a-f]+}} - 03 0001 OSO {{.*}}{{/|\\}}test{{/|\\}}mach-o{{/|\\}}debug-syms.yaml
+# CHECK-NEXT: 0000000000000fa0 - 01 0000 BNSYM
+# CHECK-NEXT: 0000000000000fa0 - 01 0000 FUN _main
+# CHECK-NEXT: 0000000000000016 - 00 0000 FUN
+# CHECK-NEXT: 0000000000000016 - 01 0000 ENSYM
+# CHECK-NEXT: 0000000000000000 - 01 0000 SO
+
+--- !mach-o
+arch: x86_64
+file-type: MH_OBJECT
+flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ]
+compat-version: 0.0
+current-version: 0.0
+has-UUID: false
+OS: unknown
+min-os-version-kind: LC_VERSION_MIN_MACOSX
+sections:
+ - segment: __TEXT
+ section: __text
+ type: S_REGULAR
+ attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
+ alignment: 16
+ address: 0x0000000000000000
+ content: [ 0x55, 0x48, 0x89, 0xE5, 0x31, 0xC0, 0xC7, 0x45,
+ 0xFC, 0x00, 0x00, 0x00, 0x00, 0x89, 0x7D, 0xF8,
+ 0x48, 0x89, 0x75, 0xF0, 0x5D, 0xC3 ]
+ - segment: __DWARF
+ section: __debug_str
+ type: S_REGULAR
+ attributes: [ S_ATTR_DEBUG ]
+ address: 0x0000000000000016
+ content: [ 0x41, 0x70, 0x70, 0x6C, 0x65, 0x20, 0x4C, 0x4C,
+ 0x56, 0x4D, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69,
+ 0x6F, 0x6E, 0x20, 0x38, 0x2E, 0x30, 0x2E, 0x30,
+ 0x20, 0x28, 0x63, 0x6C, 0x61, 0x6E, 0x67, 0x2D,
+ 0x38, 0x30, 0x30, 0x2E, 0x30, 0x2E, 0x32, 0x34,
+ 0x2E, 0x31, 0x29, 0x00, 0x68, 0x77, 0x2E, 0x63,
+ 0x00, 0x2F, 0x55, 0x73, 0x65, 0x72, 0x73, 0x2F,
+ 0x6C, 0x68, 0x61, 0x6D, 0x65, 0x73, 0x2F, 0x50,
+ 0x72, 0x6F, 0x6A, 0x65, 0x63, 0x74, 0x73, 0x2F,
+ 0x6C, 0x6C, 0x64, 0x2F, 0x6C, 0x6C, 0x64, 0x2D,
+ 0x73, 0x76, 0x6E, 0x2D, 0x74, 0x6F, 0x74, 0x2F,
+ 0x73, 0x63, 0x72, 0x61, 0x74, 0x63, 0x68, 0x00,
+ 0x6D, 0x61, 0x69, 0x6E, 0x00, 0x69, 0x6E, 0x74,
+ 0x00, 0x61, 0x72, 0x67, 0x63, 0x00, 0x61, 0x72,
+ 0x67, 0x76, 0x00, 0x63, 0x68, 0x61, 0x72, 0x00 ]
+ - segment: __DWARF
+ section: __debug_loc
+ type: S_REGULAR
+ attributes: [ S_ATTR_DEBUG ]
+ address: 0x000000000000008E
+ - segment: __DWARF
+ section: __debug_abbrev
+ type: S_REGULAR
+ attributes: [ S_ATTR_DEBUG ]
+ address: 0x000000000000008E
+ content: [ 0x01, 0x11, 0x01, 0x25, 0x0E, 0x13, 0x05, 0x03,
+ 0x0E, 0x10, 0x06, 0x1B, 0x0E, 0x11, 0x01, 0x12,
+ 0x01, 0x00, 0x00, 0x02, 0x2E, 0x01, 0x11, 0x01,
+ 0x12, 0x01, 0x40, 0x0A, 0x03, 0x0E, 0x3A, 0x0B,
+ 0x3B, 0x0B, 0x27, 0x0C, 0x49, 0x13, 0x3F, 0x0C,
+ 0x00, 0x00, 0x03, 0x05, 0x00, 0x02, 0x0A, 0x03,
+ 0x0E, 0x3A, 0x0B, 0x3B, 0x0B, 0x49, 0x13, 0x00,
+ 0x00, 0x04, 0x24, 0x00, 0x03, 0x0E, 0x3E, 0x0B,
+ 0x0B, 0x0B, 0x00, 0x00, 0x05, 0x0F, 0x00, 0x49,
+ 0x13, 0x00, 0x00, 0x00 ]
+ - segment: __DWARF
+ section: __debug_info
+ type: S_REGULAR
+ attributes: [ S_ATTR_DEBUG ]
+ address: 0x00000000000000DA
+ content: [ 0x7F, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x08, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x0C, 0x00, 0x2C, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
+ 0x56, 0x60, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
+ 0x6A, 0x00, 0x00, 0x00, 0x01, 0x03, 0x02, 0x91,
+ 0x78, 0x69, 0x00, 0x00, 0x00, 0x01, 0x01, 0x6A,
+ 0x00, 0x00, 0x00, 0x03, 0x02, 0x91, 0x70, 0x6E,
+ 0x00, 0x00, 0x00, 0x01, 0x01, 0x71, 0x00, 0x00,
+ 0x00, 0x00, 0x04, 0x65, 0x00, 0x00, 0x00, 0x05,
+ 0x04, 0x05, 0x76, 0x00, 0x00, 0x00, 0x05, 0x7B,
+ 0x00, 0x00, 0x00, 0x04, 0x73, 0x00, 0x00, 0x00,
+ 0x06, 0x01, 0x00 ]
+ relocations:
+ - offset: 0x00000037
+ type: X86_64_RELOC_UNSIGNED
+ length: 3
+ pc-rel: false
+ extern: false
+ symbol: 1
+ - offset: 0x0000002F
+ type: X86_64_RELOC_UNSIGNED
+ length: 3
+ pc-rel: false
+ extern: false
+ symbol: 1
+ - offset: 0x00000026
+ type: X86_64_RELOC_UNSIGNED
+ length: 3
+ pc-rel: false
+ extern: false
+ symbol: 1
+ - offset: 0x0000001E
+ type: X86_64_RELOC_UNSIGNED
+ length: 3
+ pc-rel: false
+ extern: false
+ symbol: 1
+ - segment: __DWARF
+ section: __debug_ranges
+ type: S_REGULAR
+ attributes: [ S_ATTR_DEBUG ]
+ address: 0x000000000000015D
+ - segment: __DWARF
+ section: __debug_macinfo
+ type: S_REGULAR
+ attributes: [ S_ATTR_DEBUG ]
+ address: 0x000000000000015D
+ content: [ 0x00 ]
+ - segment: __DWARF
+ section: __apple_names
+ type: S_REGULAR
+ attributes: [ S_ATTR_DEBUG ]
+ address: 0x000000000000015E
+ content: [ 0x48, 0x53, 0x41, 0x48, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x06, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x6A, 0x7F, 0x9A, 0x7C,
+ 0x2C, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x2E, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00 ]
+ - segment: __DWARF
+ section: __apple_objc
+ type: S_REGULAR
+ attributes: [ S_ATTR_DEBUG ]
+ address: 0x000000000000019A
+ content: [ 0x48, 0x53, 0x41, 0x48, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x06, 0x00,
+ 0xFF, 0xFF, 0xFF, 0xFF ]
+ - segment: __DWARF
+ section: __apple_namespac
+ type: S_REGULAR
+ attributes: [ S_ATTR_DEBUG ]
+ address: 0x00000000000001BE
+ content: [ 0x48, 0x53, 0x41, 0x48, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x06, 0x00,
+ 0xFF, 0xFF, 0xFF, 0xFF ]
+ - segment: __DWARF
+ section: __apple_types
+ type: S_REGULAR
+ attributes: [ S_ATTR_DEBUG ]
+ address: 0x00000000000001E2
+ content: [ 0x48, 0x53, 0x41, 0x48, 0x01, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x06, 0x00,
+ 0x03, 0x00, 0x05, 0x00, 0x04, 0x00, 0x0B, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x30, 0x80, 0x88, 0x0B, 0x63, 0x20, 0x95, 0x7C,
+ 0x40, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, 0x00,
+ 0x65, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x6A, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x7B, 0x00, 0x00, 0x00, 0x24,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]
+ - segment: __DWARF
+ section: __apple_exttypes
+ type: S_REGULAR
+ attributes: [ S_ATTR_DEBUG ]
+ address: 0x0000000000000248
+ content: [ 0x48, 0x53, 0x41, 0x48, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x06, 0x00,
+ 0xFF, 0xFF, 0xFF, 0xFF ]
+ - segment: __LD
+ section: __compact_unwind
+ type: S_REGULAR
+ attributes: [ S_ATTR_DEBUG ]
+ alignment: 8
+ address: 0x0000000000000270
+ content: [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]
+ relocations:
+ - offset: 0x00000000
+ type: X86_64_RELOC_UNSIGNED
+ length: 3
+ pc-rel: false
+ extern: false
+ symbol: 1
+ - segment: __TEXT
+ section: __eh_frame
+ type: S_COALESCED
+ attributes: [ ]
+ alignment: 8
+ address: 0x0000000000000290
+ content: [ 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x7A, 0x52, 0x00, 0x01, 0x78, 0x10, 0x01,
+ 0x10, 0x0C, 0x07, 0x08, 0x90, 0x01, 0x00, 0x00,
+ 0x24, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00,
+ 0x50, 0xFD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x41, 0x0E, 0x10, 0x86, 0x02, 0x43, 0x0D,
+ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]
+ - segment: __DWARF
+ section: __debug_line
+ type: S_REGULAR
+ attributes: [ S_ATTR_DEBUG ]
+ address: 0x00000000000002D0
+ content: [ 0x37, 0x00, 0x00, 0x00, 0x02, 0x00, 0x1B, 0x00,
+ 0x00, 0x00, 0x01, 0x01, 0xFB, 0x0E, 0x0D, 0x00,
+ 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x01, 0x00, 0x68, 0x77, 0x2E, 0x63,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x05, 0x03, 0x0A, 0x08, 0x3D, 0x02, 0x02,
+ 0x00, 0x01, 0x01 ]
+ relocations:
+ - offset: 0x00000028
+ type: X86_64_RELOC_UNSIGNED
+ length: 3
+ pc-rel: false
+ extern: false
+ symbol: 1
+global-symbols:
+ - name: _main
+ type: N_SECT
+ scope: [ N_EXT ]
+ sect: 1
+ value: 0x0000000000000000
+page-size: 0x00000000
+...
diff --git a/test/mach-o/demangle.yaml b/test/mach-o/demangle.yaml
index f8a76cddd29f9..333a59eaa528e 100644
--- a/test/mach-o/demangle.yaml
+++ b/test/mach-o/demangle.yaml
@@ -1,11 +1,11 @@
# REQUIRES: system-linker-mach-o
#
# RUN: not lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s \
-# RUN: -dylib -o %t %p/Inputs/libSystem.yaml 2> %t.err
+# RUN: -dylib -o %t %p/Inputs/x86_64/libSystem.yaml 2> %t.err
# RUN: FileCheck %s < %t.err
#
# RUN: not lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s \
-# RUN: -dylib -o %t %p/Inputs/libSystem.yaml -demangle 2> %t.err2
+# RUN: -dylib -o %t %p/Inputs/x86_64/libSystem.yaml -demangle 2> %t.err2
# RUN: FileCheck %s --check-prefix=DCHECK < %t.err2
#
# Test -demangle option works on undefined symbol errors.
diff --git a/test/mach-o/dso_handle.yaml b/test/mach-o/dso_handle.yaml
index 400e2c899c905..0796c2ee566d0 100644
--- a/test/mach-o/dso_handle.yaml
+++ b/test/mach-o/dso_handle.yaml
@@ -1,13 +1,13 @@
-# RUN: lld -flavor darwin -arch x86_64 %s %p/Inputs/libSystem.yaml -o %t1
+# RUN: lld -flavor darwin -arch x86_64 %s %p/Inputs/x86_64/libSystem.yaml -o %t1
# RUN: llvm-nm -m -n %t1 | FileCheck %s
#
-# RUN: lld -flavor darwin -arch x86_64 %s %p/Inputs/libSystem.yaml -dead_strip -o %t2
+# RUN: lld -flavor darwin -arch x86_64 %s %p/Inputs/x86_64/libSystem.yaml -dead_strip -o %t2
# RUN: llvm-nm -m -n %t2 | FileCheck %s
#
-# RUN: lld -flavor darwin -arch x86_64 %s %p/Inputs/libSystem.yaml -dylib -o %t3
+# RUN: lld -flavor darwin -arch x86_64 %s %p/Inputs/x86_64/libSystem.yaml -dylib -o %t3
# RUN: llvm-nm -m -n %t3 | FileCheck %s
#
-# RUN: lld -flavor darwin -arch x86_64 %s %p/Inputs/libSystem.yaml -bundle -o %t4
+# RUN: lld -flavor darwin -arch x86_64 %s %p/Inputs/x86_64/libSystem.yaml -bundle -o %t4
# RUN: llvm-nm -m -n %t4 | FileCheck %s
#
# Test that ___dso_handle symbol is available for executables, bundles, and dylibs
diff --git a/test/mach-o/dylib-install-names.yaml b/test/mach-o/dylib-install-names.yaml
index 845085be42aba..af00adfd59081 100644
--- a/test/mach-o/dylib-install-names.yaml
+++ b/test/mach-o/dylib-install-names.yaml
@@ -1,25 +1,25 @@
# Check we accept -install_name correctly:
# RUN: lld -flavor darwin -arch x86_64 -install_name libwibble.dylib -dylib \
# RUN: -compatibility_version 2.0 -current_version 5.3 \
-# RUN: %p/Inputs/libSystem.yaml %s -o %t.dylib
+# RUN: %p/Inputs/x86_64/libSystem.yaml %s -o %t.dylib
# RUN: llvm-objdump -private-headers %t.dylib | FileCheck %s --check-prefix=CHECK-BINARY-WRITE
# Check we read LC_ID_DYLIB correctly:
# RUN: lld -flavor darwin -arch x86_64 %p/Inputs/use-dylib-install-names.yaml \
-# RUN: %p/Inputs/libSystem.yaml %t.dylib -dylib -o %t2.dylib
+# RUN: %p/Inputs/x86_64/libSystem.yaml %t.dylib -dylib -o %t2.dylib
# RUN: llvm-objdump -private-headers %t2.dylib | FileCheck %s --check-prefix=CHECK-BINARY-READ
# Check we default the install-name to the output file:
# RUN: lld -flavor darwin -arch x86_64 -dylib %s -o libwibble.dylib \
# RUN: -compatibility_version 2.0 -current_version 5.3 \
-# RUN: %p/Inputs/libSystem.yaml
+# RUN: %p/Inputs/x86_64/libSystem.yaml
# RUN: llvm-objdump -private-headers libwibble.dylib | FileCheck %s --check-prefix=CHECK-BINARY-WRITE
# RUN: rm -f libwibble.dylib
# Check -single_module does nothing
# RUN: lld -flavor darwin -arch x86_64 -dylib %s -install_name libwibble.dylib \
# RUN: -compatibility_version 2.0 -current_version 5.3 \
-# RUN: -single_module -o %t2.dylib %p/Inputs/libSystem.yaml
+# RUN: -single_module -o %t2.dylib %p/Inputs/x86_64/libSystem.yaml
# RUN: llvm-objdump -private-headers %t2.dylib | FileCheck %s --check-prefix=CHECK-BINARY-WRITE
--- !mach-o
@@ -63,8 +63,8 @@ global-symbols:
# CHECK-BINARY-READ-NEXT: cmdsize 56
# CHECK-BINARY-READ-NEXT: name /usr/lib/libSystem.B.dylib (offset 24)
# CHECK-BINARY-READ-NEXT: time stamp 2
-# CHECK-BINARY-READ-NEXT: current version 0.16.0
-# CHECK-BINARY-READ-NEXT: compatibility version 0.16.0
+# CHECK-BINARY-READ-NEXT: current version 1.0.0
+# CHECK-BINARY-READ-NEXT: compatibility version 1.0.0
# CHECK-BINARY-READ: cmd LC_LOAD_DYLIB
# CHECK-BINARY-READ-NEXT: cmdsize 40
diff --git a/test/mach-o/eh-frame-relocs-arm64.yaml b/test/mach-o/eh-frame-relocs-arm64.yaml
index 6681ded794988..e23dd7c48ed99 100644
--- a/test/mach-o/eh-frame-relocs-arm64.yaml
+++ b/test/mach-o/eh-frame-relocs-arm64.yaml
@@ -12,15 +12,15 @@ compat-version: 0.0
current-version: 0.0
has-UUID: false
OS: unknown
-sections:
+sections:
- segment: __TEXT
section: __text
type: S_REGULAR
attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
alignment: 4
address: 0x0000000000000000
- content: [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xC0, 0x03, 0x5F, 0xD6, 0xC0, 0x03, 0x5F, 0xD6,
+ content: [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xC0, 0x03, 0x5F, 0xD6, 0xC0, 0x03, 0x5F, 0xD6,
0xC0, 0x03, 0x5F, 0xD6 ]
- segment: __TEXT
section: __gcc_except_tab
@@ -40,15 +40,15 @@ sections:
attributes: [ ]
alignment: 8
address: 0x0000000000000020
- content: [ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ content: [ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]
- relocations:
+ relocations:
- offset: 0x00000020
type: ARM64_RELOC_UNSIGNED
length: 3
@@ -67,25 +67,25 @@ sections:
attributes: [ ]
alignment: 8
address: 0x0000000000000060
- content: [ 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x03, 0x7A, 0x50, 0x4C, 0x52, 0x00, 0x01, 0x78,
- 0x1E, 0x07, 0x9B, 0xED, 0xFF, 0xFF, 0xFF, 0x10,
- 0x10, 0x0C, 0x1F, 0x00, 0x28, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0xDC, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0xCB, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0E, 0x10, 0x9E,
- 0x01, 0x9D, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x03, 0x7A, 0x50, 0x4C, 0x52, 0x00, 0x01, 0x78,
- 0x1E, 0x07, 0x9B, 0xA9, 0xFF, 0xFF, 0xFF, 0x10,
- 0x10, 0x0C, 0x1F, 0x00, 0x28, 0x00, 0x00, 0x00,
- 0x20, 0x00, 0x00, 0x00, 0x94, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x08, 0x83, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0E, 0x10, 0x9E,
+ content: [ 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x03, 0x7A, 0x50, 0x4C, 0x52, 0x00, 0x01, 0x78,
+ 0x1E, 0x07, 0x9B, 0xED, 0xFF, 0xFF, 0xFF, 0x10,
+ 0x10, 0x0C, 0x1F, 0x00, 0x28, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0xDC, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0xCB, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0E, 0x10, 0x9E,
+ 0x01, 0x9D, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x03, 0x7A, 0x50, 0x4C, 0x52, 0x00, 0x01, 0x78,
+ 0x1E, 0x07, 0x9B, 0xA9, 0xFF, 0xFF, 0xFF, 0x10,
+ 0x10, 0x0C, 0x1F, 0x00, 0x28, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x94, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x83, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0E, 0x10, 0x9E,
0x01, 0x9D, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00 ]
- relocations:
+ relocations:
- offset: 0x0000007D
type: ARM64_RELOC_SUBTRACTOR
length: 3
@@ -146,7 +146,7 @@ sections:
pc-rel: true
extern: true
symbol: 9
-local-symbols:
+local-symbols:
- name: ltmp0
type: N_SECT
sect: 1
@@ -175,7 +175,7 @@ local-symbols:
type: N_SECT
sect: 5
value: 0x0000000000000060
-global-symbols:
+global-symbols:
- name: __Z3fooi
type: N_SECT
scope: [ N_EXT ]
@@ -211,24 +211,24 @@ page-size: 0x00000000
# CHECK: --- !native
# CHECK: path: '<linker-internal>'
-# CHECK: defined-atoms:
+# CHECK: defined-atoms:
# CHECK: - ref-name: L000
# CHECK: type: unwind-cfi
-# CHECK: content: [ 18, 00, 00, 00, 00, 00, 00, 00, 03, 7A, 50, 4C,
-# CHECK: 52, 00, 01, 78, 1E, 07, 9B, {{..}}, {{..}}, {{..}}, {{..}}, 10,
+# CHECK: content: [ 18, 00, 00, 00, 00, 00, 00, 00, 03, 7A, 50, 4C,
+# CHECK: 52, 00, 01, 78, 1E, 07, 9B, {{..}}, {{..}}, {{..}}, {{..}}, 10,
# CHECK: 10, 0C, 1F, 00 ]
# CHECK: alignment: 8
-# CHECK: references:
+# CHECK: references:
# CHECK: - kind: unwindCIEToPersonalityFunction
# CHECK: offset: 19
# CHECK: target: __gxx_personality_v0
# CHECK: - type: unwind-cfi
-# CHECK: content: [ 28, 00, 00, 00, 20, 00, 00, 00, {{..}}, {{..}}, {{..}}, {{..}},
-# CHECK: {{..}}, {{..}}, {{..}}, {{..}}, 04, 00, 00, 00, 00, 00, 00, 00,
-# CHECK: 08, {{..}}, {{..}}, {{..}}, {{..}}, {{..}}, {{..}}, {{..}}, {{..}}, 0E, 10, 9E,
+# CHECK: content: [ 28, 00, 00, 00, 20, 00, 00, 00, {{..}}, {{..}}, {{..}}, {{..}},
+# CHECK: {{..}}, {{..}}, {{..}}, {{..}}, 04, 00, 00, 00, 00, 00, 00, 00,
+# CHECK: 08, {{..}}, {{..}}, {{..}}, {{..}}, {{..}}, {{..}}, {{..}}, {{..}}, 0E, 10, 9E,
# CHECK: 01, 9D, 02, 00, 00, 00, 00, 00 ]
# CHECK: alignment: 4 mod 8
-# CHECK: references:
+# CHECK: references:
# CHECK: - kind: negDelta32
# CHECK: offset: 4
# CHECK: target: L000
@@ -240,21 +240,21 @@ page-size: 0x00000000
# CHECK: target: _bar1
# CHECK: - ref-name: L001
# CHECK: type: unwind-cfi
-# CHECK: content: [ 18, 00, 00, 00, 00, 00, 00, 00, 03, 7A, 50, 4C,
-# CHECK: 52, 00, 01, 78, 1E, 07, 9B, {{..}}, {{..}}, {{..}}, {{..}}, 10,
+# CHECK: content: [ 18, 00, 00, 00, 00, 00, 00, 00, 03, 7A, 50, 4C,
+# CHECK: 52, 00, 01, 78, 1E, 07, 9B, {{..}}, {{..}}, {{..}}, {{..}}, 10,
# CHECK: 10, 0C, 1F, 00 ]
# CHECK: alignment: 8
-# CHECK: references:
+# CHECK: references:
# CHECK: - kind: unwindCIEToPersonalityFunction
# CHECK: offset: 19
# CHECK: target: __gxx_personality_v1
# CHECK: - type: unwind-cfi
-# CHECK: content: [ 28, 00, 00, 00, 20, 00, 00, 00, {{..}}, {{..}}, {{..}}, {{..}},
-# CHECK: {{..}}, {{..}}, {{..}}, {{..}}, 04, 00, 00, 00, 00, 00, 00, 00,
-# CHECK: 08, {{..}}, {{..}}, {{..}}, {{..}}, {{..}}, {{..}}, {{..}}, {{..}}, 0E, 10, 9E,
+# CHECK: content: [ 28, 00, 00, 00, 20, 00, 00, 00, {{..}}, {{..}}, {{..}}, {{..}},
+# CHECK: {{..}}, {{..}}, {{..}}, {{..}}, 04, 00, 00, 00, 00, 00, 00, 00,
+# CHECK: 08, {{..}}, {{..}}, {{..}}, {{..}}, {{..}}, {{..}}, {{..}}, {{..}}, 0E, 10, 9E,
# CHECK: 01, 9D, 02, 00, 00, 00, 00, 00 ]
# CHECK: alignment: 4 mod 8
-# CHECK: references:
+# CHECK: references:
# CHECK: - kind: negDelta32
# CHECK: offset: 4
# CHECK: target: L001
diff --git a/test/mach-o/exe-offsets.yaml b/test/mach-o/exe-offsets.yaml
index a751507432eef..6a0e35cedb46d 100644
--- a/test/mach-o/exe-offsets.yaml
+++ b/test/mach-o/exe-offsets.yaml
@@ -1,4 +1,4 @@
-# RUN: lld -flavor darwin -arch x86_64 %s -o %t -e start %p/Inputs/libSystem.yaml
+# RUN: lld -flavor darwin -arch x86_64 %s -o %t -e start %p/Inputs/x86_64/libSystem.yaml
# RUN: llvm-readobj -sections %t | FileCheck %s
# Make sure data gets put at offset
diff --git a/test/mach-o/exe-segment-overlap.yaml b/test/mach-o/exe-segment-overlap.yaml
index a416ee3ca73b2..47f0214efd6c4 100644
--- a/test/mach-o/exe-segment-overlap.yaml
+++ b/test/mach-o/exe-segment-overlap.yaml
@@ -1,4 +1,4 @@
-# RUN: lld -flavor darwin -arch x86_64 %s -o %t %p/Inputs/libSystem.yaml
+# RUN: lld -flavor darwin -arch x86_64 %s -o %t %p/Inputs/x86_64/libSystem.yaml
# RUN: llvm-readobj -sections -section-data %t | FileCheck %s
--- !native
diff --git a/test/mach-o/executable-exports.yaml b/test/mach-o/executable-exports.yaml
index b14e2d2292963..0b8717eb724e3 100644
--- a/test/mach-o/executable-exports.yaml
+++ b/test/mach-o/executable-exports.yaml
@@ -1,5 +1,5 @@
# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 \
-# RUN: %s %p/Inputs/libSystem.yaml -o %t && \
+# RUN: %s %p/Inputs/x86_64/libSystem.yaml -o %t && \
# RUN: llvm-objdump -exports-trie %t | FileCheck %s
#
#
diff --git a/test/mach-o/export-trie-order.yaml b/test/mach-o/export-trie-order.yaml
new file mode 100644
index 0000000000000..a11c998bdb06a
--- /dev/null
+++ b/test/mach-o/export-trie-order.yaml
@@ -0,0 +1,62 @@
+# RUN: lld -flavor darwin -arch i386 %s %p/Inputs/hello-world-x86.yaml -o %t
+# RUN: llvm-objdump -exports-trie %t | FileCheck %s
+#
+# Test that the export trie is emitted in order.
+#
+
+--- !mach-o
+arch: x86
+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, 0x89, 0xE5, 0x83, 0xEC, 0x08, 0xE8, 0x00,
+ 0x00, 0x00, 0x00, 0x58, 0x8D, 0x80, 0x16, 0x00,
+ 0x00, 0x00, 0x89, 0x04, 0x24, 0xE8, 0xE6, 0xFF,
+ 0xFF, 0xFF, 0x31, 0xC0, 0x83, 0xC4, 0x08, 0x5D,
+ 0xC3 ]
+ relocations:
+ - offset: 0x00000016
+ type: GENERIC_RELOC_VANILLA
+ length: 2
+ pc-rel: true
+ extern: true
+ symbol: 1
+ - offset: 0x0000000E
+ scattered: true
+ type: GENERIC_RELOC_LOCAL_SECTDIFF
+ length: 2
+ pc-rel: false
+ value: 0x00000021
+ - offset: 0x00000000
+ scattered: true
+ type: GENERIC_RELOC_PAIR
+ length: 2
+ pc-rel: false
+ value: 0x0000000B
+ - segment: __TEXT
+ section: __cstring
+ type: S_CSTRING_LITERALS
+ attributes: [ ]
+ address: 0x0000000000000021
+ content: [ 0x68, 0x65, 0x6C, 0x6C, 0x6F, 0x0A, 0x00 ]
+global-symbols:
+ - name: _main
+ type: N_SECT
+ scope: [ N_EXT ]
+ sect: 1
+ value: 0x0000000000000000
+undefined-symbols:
+ - name: _printf
+ type: N_UNDF
+ scope: [ N_EXT ]
+ value: 0x0000000000000000
+...
+
+# CHECK: Exports trie:
+# CHECK-NEXT: __mh_execute_header
+# CHECK-NEXT: _main
diff --git a/test/mach-o/exported_symbols_list-dylib.yaml b/test/mach-o/exported_symbols_list-dylib.yaml
index f52614038ca46..f9de5fe976e22 100644
--- a/test/mach-o/exported_symbols_list-dylib.yaml
+++ b/test/mach-o/exported_symbols_list-dylib.yaml
@@ -1,20 +1,20 @@
# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 -dylib \
-# RUN: %s %p/Inputs/libSystem.yaml -o %t \
+# RUN: %s %p/Inputs/x86_64/libSystem.yaml -o %t \
# RUN: -exported_symbols_list %p/Inputs/exported_symbols_list.exp && \
# RUN: llvm-nm -m %t | FileCheck %s
#
# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 -dylib \
-# RUN: %s %p/Inputs/libSystem.yaml -o %t2 \
+# RUN: %s %p/Inputs/x86_64/libSystem.yaml -o %t2 \
# RUN: -exported_symbol _foo -exported_symbol _b && \
# RUN: llvm-nm -m %t2 | FileCheck %s
#
# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 -dylib \
-# RUN: %s %p/Inputs/libSystem.yaml -o %t3 \
+# RUN: %s %p/Inputs/x86_64/libSystem.yaml -o %t3 \
# RUN: -unexported_symbol _bar -unexported_symbol _a && \
# RUN: llvm-nm -m %t3 | FileCheck %s
#
# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 -dylib \
-# RUN: %s %p/Inputs/libSystem.yaml -dead_strip -o %t \
+# RUN: %s %p/Inputs/x86_64/libSystem.yaml -dead_strip -o %t \
# RUN: -exported_symbols_list %p/Inputs/exported_symbols_list.exp && \
# RUN: llvm-nm -m %t | FileCheck -check-prefix=CHECK_DEAD %s
#
diff --git a/test/mach-o/exported_symbols_list-undef.yaml b/test/mach-o/exported_symbols_list-undef.yaml
index 1e2fc821c3655..377282f2a7c4f 100644
--- a/test/mach-o/exported_symbols_list-undef.yaml
+++ b/test/mach-o/exported_symbols_list-undef.yaml
@@ -1,5 +1,5 @@
# RUN: not lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 -dylib \
-# RUN: %s %p/Inputs/libSystem.yaml -o %t -exported_symbol _foobar 2> %t2
+# RUN: %s %p/Inputs/x86_64/libSystem.yaml -o %t -exported_symbol _foobar 2> %t2
#
# Test -exported_symbol fails if exported symbol not found.
#
diff --git a/test/mach-o/fat-archive.yaml b/test/mach-o/fat-archive.yaml
index 86828d6a12b72..979ede30a72ab 100644
--- a/test/mach-o/fat-archive.yaml
+++ b/test/mach-o/fat-archive.yaml
@@ -1,5 +1,5 @@
# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t \
-# RUN: -L %p/Inputs -lfoo %p/Inputs/libSystem.yaml
+# RUN: -L %p/Inputs -lfoo %p/Inputs/x86_64/libSystem.yaml
# RUN: llvm-nm -m -n %t | FileCheck %s
#
# Test that fat archives are handled.
diff --git a/test/mach-o/flat_namespace_undef_error.yaml b/test/mach-o/flat_namespace_undef_error.yaml
index 904b9c776e597..af84608aa5fff 100644
--- a/test/mach-o/flat_namespace_undef_error.yaml
+++ b/test/mach-o/flat_namespace_undef_error.yaml
@@ -1,4 +1,4 @@
-# RUN: not lld -flavor darwin -arch x86_64 -macosx_version_min 10.9 -flat_namespace -undefined error %s -o %t %p/Inputs/libSystem.yaml 2>&1 | FileCheck %s
+# RUN: not lld -flavor darwin -arch x86_64 -macosx_version_min 10.9 -flat_namespace -undefined error %s -o %t %p/Inputs/x86_64/libSystem.yaml 2>&1 | FileCheck %s
--- !native
defined-atoms:
diff --git a/test/mach-o/flat_namespace_undef_suppress.yaml b/test/mach-o/flat_namespace_undef_suppress.yaml
index 5152a1cd985cd..e68fd998c1b21 100644
--- a/test/mach-o/flat_namespace_undef_suppress.yaml
+++ b/test/mach-o/flat_namespace_undef_suppress.yaml
@@ -1,4 +1,4 @@
-# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.9 -flat_namespace -undefined suppress %s -o %t %p/Inputs/libSystem.yaml
+# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.9 -flat_namespace -undefined suppress %s -o %t %p/Inputs/x86_64/libSystem.yaml
#
# Sanity check '-flat_namespace -undefined suppress'.
# This should pass without error, even though '_bar' is undefined.
diff --git a/test/mach-o/force_load-dylib.yaml b/test/mach-o/force_load-dylib.yaml
index c8f559bedd79a..d32c63eab5c10 100644
--- a/test/mach-o/force_load-dylib.yaml
+++ b/test/mach-o/force_load-dylib.yaml
@@ -1,7 +1,7 @@
# RUN: lld -flavor darwin -arch x86_64 -dylib %p/Inputs/bar.yaml \
-# RUN: -install_name /usr/lib/libbar.dylib %p/Inputs/libSystem.yaml -o %t1.dylib
+# RUN: -install_name /usr/lib/libbar.dylib %p/Inputs/x86_64/libSystem.yaml -o %t1.dylib
# RUN: lld -flavor darwin -arch x86_64 -dylib %s -all_load %t1.dylib \
-# RUN: -install_name /usr/lib/libfoo.dylib %p/Inputs/libSystem.yaml -o %t
+# RUN: -install_name /usr/lib/libfoo.dylib %p/Inputs/x86_64/libSystem.yaml -o %t
# RUN: llvm-nm -m %t | FileCheck %s
#
#
diff --git a/test/mach-o/force_load-x86_64.yaml b/test/mach-o/force_load-x86_64.yaml
index 1be216ca3a746..5b37f4764e682 100644
--- a/test/mach-o/force_load-x86_64.yaml
+++ b/test/mach-o/force_load-x86_64.yaml
@@ -1,8 +1,8 @@
-# RUN: lld -flavor darwin -arch x86_64 %s %p/Inputs/libSystem.yaml \
+# RUN: lld -flavor darwin -arch x86_64 %s %p/Inputs/x86_64/libSystem.yaml \
# RUN: %p/Inputs/libfoo.a %p/Inputs/libbar.a -o %t1
# RUN: llvm-nm -m -n %t1 | FileCheck %s
#
-# RUN: lld -flavor darwin -arch x86_64 %s %p/Inputs/libSystem.yaml \
+# RUN: lld -flavor darwin -arch x86_64 %s %p/Inputs/x86_64/libSystem.yaml \
# RUN: -force_load %p/Inputs/libfoo.a %p/Inputs/libbar.a -o %t2
# RUN: llvm-nm -m -n %t2 | FileCheck --check-prefix=CHECKF %s
#
diff --git a/test/mach-o/function-starts-load-command.yaml b/test/mach-o/function-starts-load-command.yaml
index 9f251898f6e09..5cfe9dcac67d0 100644
--- a/test/mach-o/function-starts-load-command.yaml
+++ b/test/mach-o/function-starts-load-command.yaml
@@ -1,8 +1,8 @@
-# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/libSystem.yaml && llvm-objdump -private-headers %t | FileCheck %s
-# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/libSystem.yaml -static -function_starts && llvm-objdump -private-headers %t | FileCheck %s
-# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/libSystem.yaml -no_function_starts && llvm-objdump -private-headers %t | FileCheck %s --check-prefix=NO_FUNCTION_STARTS
-# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/libSystem.yaml -static -function_starts -no_function_starts && llvm-objdump -private-headers %t | FileCheck %s --check-prefix=NO_FUNCTION_STARTS
-# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/libSystem.yaml -static && llvm-objdump -private-headers %t | FileCheck %s --check-prefix=NO_FUNCTION_STARTS
+# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/x86_64/libSystem.yaml && llvm-objdump -private-headers %t | FileCheck %s
+# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/x86_64/libSystem.yaml -static -function_starts && llvm-objdump -private-headers %t | FileCheck %s
+# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/x86_64/libSystem.yaml -no_function_starts && llvm-objdump -private-headers %t | FileCheck %s --check-prefix=NO_FUNCTION_STARTS
+# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/x86_64/libSystem.yaml -static -function_starts -no_function_starts && llvm-objdump -private-headers %t | FileCheck %s --check-prefix=NO_FUNCTION_STARTS
+# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/x86_64/libSystem.yaml -static && llvm-objdump -private-headers %t | FileCheck %s --check-prefix=NO_FUNCTION_STARTS
--- !mach-o
arch: x86_64
diff --git a/test/mach-o/gcc_except_tab-got-arm64.yaml b/test/mach-o/gcc_except_tab-got-arm64.yaml
index 7d105ec17847d..47b174d6cf295 100644
--- a/test/mach-o/gcc_except_tab-got-arm64.yaml
+++ b/test/mach-o/gcc_except_tab-got-arm64.yaml
@@ -1,16 +1,16 @@
# RUN: lld -flavor darwin -arch arm64 %s \
-# RUN: -dylib %p/Inputs/libSystem.yaml -o %t
+# RUN: -dylib %p/Inputs/arm64/libSystem.yaml -o %t
# RUN: llvm-objdump -section-headers %t | FileCheck %s
# Make sure that the GOT relocation from gcc_except_tab to the data
# is not removed.
--- !native
-defined-atoms:
+defined-atoms:
- name: _main
scope: global
- content: [ FD, 7B, BF, A9, FD, 03, 00, 91, FF, 43, 00, D1,
- BF, C3, 1F, B8, 00, 00, 00, 94, BF, 03, 00, 91,
+ content: [ FD, 7B, BF, A9, FD, 03, 00, 91, FF, 43, 00, D1,
+ BF, C3, 1F, B8, 00, 00, 00, 94, BF, 03, 00, 91,
FD, 7B, C1, A8, C0, 03, 5F, D6 ]
alignment: 4
- name: __ZTSP1A
@@ -20,25 +20,25 @@ defined-atoms:
merge: as-weak
- name: GCC_except_table0
type: unwind-lsda
- content: [ FF, 9B, E7, 80, 00, 03, 5B, 00, 00, 00, 00, 1C,
- 00, 00, 00, 00, 00, 00, 00, 00, 1C, 00, 00, 00,
- 18, 00, 00, 00, 84, 00, 00, 00, 03, 40, 00, 00,
- 00, 10, 00, 00, 00, 94, 00, 00, 00, 03, 60, 00,
- 00, 00, 20, 00, 00, 00, B4, 00, 00, 00, 05, 80,
- 00, 00, 00, 68, 00, 00, 00, 00, 00, 00, 00, 00,
- E8, 00, 00, 00, 08, 00, 00, 00, 28, 01, 00, 00,
- 00, F0, 00, 00, 00, 74, 00, 00, 00, 00, 00, 00,
+ content: [ FF, 9B, E7, 80, 00, 03, 5B, 00, 00, 00, 00, 1C,
+ 00, 00, 00, 00, 00, 00, 00, 00, 1C, 00, 00, 00,
+ 18, 00, 00, 00, 84, 00, 00, 00, 03, 40, 00, 00,
+ 00, 10, 00, 00, 00, 94, 00, 00, 00, 03, 60, 00,
+ 00, 00, 20, 00, 00, 00, B4, 00, 00, 00, 05, 80,
+ 00, 00, 00, 68, 00, 00, 00, 00, 00, 00, 00, 00,
+ E8, 00, 00, 00, 08, 00, 00, 00, 28, 01, 00, 00,
+ 00, F0, 00, 00, 00, 74, 00, 00, 00, 00, 00, 00,
00, 00, 00, 00, 01, 7D, 01, 00, A8, FF, FF, FF ]
alignment: 4
- references:
+ references:
- kind: delta32ToGOT
offset: 104
target: __ZTIP1A
- name: __ZTIP1A
scope: hidden
type: data
- content: [ 10, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
- 00, 00, 00, 80, 00, 00, 00, 00, 00, 00, 00, 00,
+ content: [ 10, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
+ 00, 00, 00, 80, 00, 00, 00, 00, 00, 00, 00, 00,
00, 00, 00, 00, 00, 00, 00, 00 ]
merge: as-weak
alignment: 16
diff --git a/test/mach-o/got-order.yaml b/test/mach-o/got-order.yaml
index b69877ecdc396..2e8579cad6d28 100644
--- a/test/mach-o/got-order.yaml
+++ b/test/mach-o/got-order.yaml
@@ -1,5 +1,5 @@
# 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: %p/Inputs/got-order2.yaml -o %t %p/Inputs/x86_64/libSystem.yaml
# RUN: llvm-objdump -bind %t | FileCheck %s
#
# Test that GOT slots are sorted by name
diff --git a/test/mach-o/hello-world-arm64.yaml b/test/mach-o/hello-world-arm64.yaml
index 75ac4f7477955..138af59409975 100644
--- a/test/mach-o/hello-world-arm64.yaml
+++ b/test/mach-o/hello-world-arm64.yaml
@@ -1,5 +1,6 @@
# RUN: lld -flavor darwin -arch arm64 %s %p/Inputs/hello-world-arm64.yaml -o %t
# RUN: llvm-nm -m -n %t | FileCheck %s
+# RUN: llvm-objdump -private-headers %t | FileCheck %s --check-prefix=CHECK-PRIVATE-HEADER
#
# Test that arm64 hello-world can be linked into a mach-o executable
#
@@ -92,3 +93,10 @@ undefined-symbols:
# CHECK: (undefined) external _fprintf (from libSystem)
# CHECK: (undefined) external dyld_stub_binder (from libSystem)
# CHECK: {{[0-9a-f]+}} (__TEXT,__text) external _main
+
+# CHECK-PRIVATE-HEADER: sectname __stubs
+# CHECK-PRIVATE-HEADER-NEXT: segname __TEXT
+# CHECK-PRIVATE-HEADER-NEXT: addr
+# CHECK-PRIVATE-HEADER-NEXT: size
+# CHECK-PRIVATE-HEADER-NEXT: offset
+# CHECK-PRIVATE-HEADER-NEXT: align 2^1 (2)
diff --git a/test/mach-o/image-base.yaml b/test/mach-o/image-base.yaml
index d274621f8dd36..aa78fea1c3384 100644
--- a/test/mach-o/image-base.yaml
+++ b/test/mach-o/image-base.yaml
@@ -1,4 +1,4 @@
-# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.9 %s -o %t -image_base 31415926000 %p/Inputs/libSystem.yaml
+# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.9 %s -o %t -image_base 31415926000 %p/Inputs/x86_64/libSystem.yaml
# RUN: llvm-readobj -macho-segment %t | FileCheck %s
# RUN: not lld -flavor darwin -arch x86_64 -image_base 0x31415926530 %s >/dev/null 2> %t
# RUN: FileCheck < %t %s --check-prefix=CHECK-ERROR-MISPAGED
diff --git a/test/mach-o/interposing-section.yaml b/test/mach-o/interposing-section.yaml
index 4f6bafc200fb8..ec4eaa3f70ad5 100644
--- a/test/mach-o/interposing-section.yaml
+++ b/test/mach-o/interposing-section.yaml
@@ -1,5 +1,5 @@
# RUN: lld -flavor darwin -arch x86_64 %s %p/Inputs/interposing-section.yaml \
-# RUN: -dylib -o %t %p/Inputs/libSystem.yaml
+# RUN: -dylib -o %t %p/Inputs/x86_64/libSystem.yaml
# RUN: llvm-objdump -private-headers %t | FileCheck %s
#
# RUN: lld -flavor darwin -arch x86_64 %s -r -o %t1
diff --git a/test/mach-o/lazy-bind-x86_64.yaml b/test/mach-o/lazy-bind-x86_64.yaml
index ee3e2278b15b9..5c588c5719522 100644
--- a/test/mach-o/lazy-bind-x86_64.yaml
+++ b/test/mach-o/lazy-bind-x86_64.yaml
@@ -3,7 +3,7 @@
# 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: %p/Inputs/x86_64/libSystem.yaml
# RUN: llvm-objdump -lazy-bind %t | FileCheck %s
# RUN: llvm-nm -m %t | FileCheck --check-prefix=CHECK-NM %s
# RUN: llvm-objdump -disassemble %t | FileCheck --check-prefix=CHECK-HELPERS %s
diff --git a/test/mach-o/lc_segment_filesize.yaml b/test/mach-o/lc_segment_filesize.yaml
new file mode 100644
index 0000000000000..4413c76987671
--- /dev/null
+++ b/test/mach-o/lc_segment_filesize.yaml
@@ -0,0 +1,31 @@
+# RUN: lld -flavor darwin -arch x86_64 -r -o %t %s && llvm-objdump -private-headers %t | FileCheck %s
+
+# CHECK: filesize 19
+
+--- !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 ]
+ alignment: 16
+ address: 0x0000000000000000
+ content: [ 0x00, 0x00, 0x00 ]
+ - segment: __TEXT
+ section: __alt
+ type: S_REGULAR
+ attributes: [ S_ATTR_PURE_INSTRUCTIONS ]
+ alignment: 16
+ address: 0x0000000000000010
+ content: [ 0x00, 0x00, 0x00 ]
+global-symbols:
+ - name: _main
+ type: N_SECT
+ scope: [ N_EXT ]
+ sect: 1
+ value: 0x0000000000000000
+page-size: 0x00000000
+...
diff --git a/test/mach-o/library-order.yaml b/test/mach-o/library-order.yaml
index f9cd5a6c44d23..b53232dd398f7 100644
--- a/test/mach-o/library-order.yaml
+++ b/test/mach-o/library-order.yaml
@@ -1,5 +1,5 @@
# RUN: lld -flavor darwin -arch x86_64 %p/Inputs/libfoo.a %s -o %t \
-# RUN: %p/Inputs/libSystem.yaml
+# RUN: %p/Inputs/x86_64/libSystem.yaml
# RUN: llvm-nm -m -n %t | FileCheck %s
#
# Test that if library is before object file on command line, it still is used.
diff --git a/test/mach-o/library-rescan.yaml b/test/mach-o/library-rescan.yaml
index a8a0ca8968b3b..99c7b88c7e34d 100644
--- a/test/mach-o/library-rescan.yaml
+++ b/test/mach-o/library-rescan.yaml
@@ -1,5 +1,5 @@
# RUN: lld -flavor darwin -arch x86_64 %p/Inputs/libfoo.a %p/Inputs/libbar.a \
-# RUN: %s -o %t %p/Inputs/libSystem.yaml
+# RUN: %s -o %t %p/Inputs/x86_64/libSystem.yaml
# RUN: llvm-nm -m -n %t | FileCheck %s
#
# Test that static libraries are automatically rescanned (bar needs foo).
diff --git a/test/mach-o/linker-as-ld.yaml b/test/mach-o/linker-as-ld.yaml
index f0bf189876a6b..21afdb2ea02eb 100644
--- a/test/mach-o/linker-as-ld.yaml
+++ b/test/mach-o/linker-as-ld.yaml
@@ -1,7 +1,7 @@
# 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 \
+# RUN: rm -rf %T/ld && ln -s `which lld` %T/ld \
+# RUN: && %T/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
#
diff --git a/test/mach-o/lit.local.cfg b/test/mach-o/lit.local.cfg
index 739a0994fdda7..ccbf4e12fbf05 100644
--- a/test/mach-o/lit.local.cfg
+++ b/test/mach-o/lit.local.cfg
@@ -1,4 +1,4 @@
# mach-o test cases encode input files in yaml and use .yaml extension
-config.suffixes = ['.yaml']
+config.suffixes = ['.yaml']
config.excludes = ['Inputs']
diff --git a/test/mach-o/mh_bundle_header.yaml b/test/mach-o/mh_bundle_header.yaml
index e440141c56893..d1b7d9ab21430 100644
--- a/test/mach-o/mh_bundle_header.yaml
+++ b/test/mach-o/mh_bundle_header.yaml
@@ -1,5 +1,5 @@
-# RUN: lld -flavor darwin -arch x86_64 %s -bundle -o %t %p/Inputs/libSystem.yaml && llvm-nm -m -n %t | FileCheck %s
-# RUN: lld -flavor darwin -arch x86_64 %s -bundle -dead_strip -o %t %p/Inputs/libSystem.yaml && llvm-nm -m -n %t | FileCheck %s
+# RUN: lld -flavor darwin -arch x86_64 %s -bundle -o %t %p/Inputs/x86_64/libSystem.yaml && llvm-nm -m -n %t | FileCheck %s
+# RUN: lld -flavor darwin -arch x86_64 %s -bundle -dead_strip -o %t %p/Inputs/x86_64/libSystem.yaml && llvm-nm -m -n %t | FileCheck %s
#
# Test that __mh_bundle_header symbol is available for bundles
#
diff --git a/test/mach-o/mh_dylib_header.yaml b/test/mach-o/mh_dylib_header.yaml
index 96b67aacae211..8222063ee1617 100644
--- a/test/mach-o/mh_dylib_header.yaml
+++ b/test/mach-o/mh_dylib_header.yaml
@@ -1,4 +1,4 @@
-# RUN: lld -flavor darwin -arch x86_64 %s -dylib -o %t %p/Inputs/libSystem.yaml
+# RUN: lld -flavor darwin -arch x86_64 %s -dylib -o %t %p/Inputs/x86_64/libSystem.yaml
# RUN: llvm-nm -m -n %t | FileCheck %s
#
# Test that __mh_dylib_header symbol is available for dylibs
diff --git a/test/mach-o/objc-category-list-atom.yaml b/test/mach-o/objc-category-list-atom.yaml
index e061171241900..93974a646e061 100644
--- a/test/mach-o/objc-category-list-atom.yaml
+++ b/test/mach-o/objc-category-list-atom.yaml
@@ -17,9 +17,9 @@ sections:
attributes: [ S_ATTR_NO_DEAD_STRIP ]
alignment: 8
address: 0x00000000000003F8
- content: [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ content: [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]
- relocations:
+ relocations:
- offset: 0x00000008
type: X86_64_RELOC_UNSIGNED
length: 3
@@ -32,7 +32,7 @@ sections:
pc-rel: false
extern: true
symbol: 1
-undefined-symbols:
+undefined-symbols:
- name: __category1
type: N_UNDF
scope: [ N_EXT ]
@@ -47,12 +47,12 @@ page-size: 0x00000000
# Make sure we atomize the category list section by pointer sized atoms.
# CHECK: path: '<linker-internal>'
-# CHECK: defined-atoms:
+# CHECK: defined-atoms:
# CHECK: - type: objc-category-list
# CHECK: content: [ 00, 00, 00, 00, 00, 00, 00, 00 ]
# CHECK: merge: by-content
# CHECK: alignment: 8
-# CHECK: references:
+# CHECK: references:
# CHECK: - kind: pointer64
# CHECK: offset: 0
# CHECK: target: __category2
@@ -60,11 +60,11 @@ page-size: 0x00000000
# CHECK: content: [ 00, 00, 00, 00, 00, 00, 00, 00 ]
# CHECK: merge: by-content
# CHECK: alignment: 8
-# CHECK: references:
+# CHECK: references:
# CHECK: - kind: pointer64
# CHECK: offset: 0
# CHECK: target: __category1
-# CHECK: undefined-atoms:
+# CHECK: undefined-atoms:
# CHECK: - name: __category1
# CHECK: - name: __category2
# CHECK: ...
diff --git a/test/mach-o/objc_export_list.yaml b/test/mach-o/objc_export_list.yaml
index e67a4c7ece755..a2fcfa22ec071 100644
--- a/test/mach-o/objc_export_list.yaml
+++ b/test/mach-o/objc_export_list.yaml
@@ -1,5 +1,5 @@
# RUN: lld -flavor darwin -arch x86_64 -dylib %s -o %t \
-# RUN: -exported_symbol .objc_class_name_Foo %p/Inputs/libSystem.yaml
+# RUN: -exported_symbol .objc_class_name_Foo %p/Inputs/x86_64/libSystem.yaml
# RUN: llvm-nm -m %t | FileCheck %s
#
# Test that exported objc classes can be specificed using old naming
diff --git a/test/mach-o/order_file-basic.yaml b/test/mach-o/order_file-basic.yaml
index 3fea9be15601f..f4d29fa170128 100644
--- a/test/mach-o/order_file-basic.yaml
+++ b/test/mach-o/order_file-basic.yaml
@@ -1,4 +1,4 @@
-# RUN: lld -flavor darwin -arch x86_64 %s %p/Inputs/libSystem.yaml \
+# RUN: lld -flavor darwin -arch x86_64 %s %p/Inputs/x86_64/libSystem.yaml \
# RUN: -order_file %p/Inputs/order_file-basic.order \
# RUN: -force_load %p/Inputs/libfoo.a -o %t
# RUN: llvm-nm -m -n %t | FileCheck %s
diff --git a/test/mach-o/parse-data-in-code-armv7.yaml b/test/mach-o/parse-data-in-code-armv7.yaml
index 720f24d7b47fa..163cb18fdc5f0 100644
--- a/test/mach-o/parse-data-in-code-armv7.yaml
+++ b/test/mach-o/parse-data-in-code-armv7.yaml
@@ -1,6 +1,6 @@
# RUN: lld -flavor darwin -arch armv7 -r -print_atoms %s -o %t | FileCheck %s
# RUN: lld -flavor darwin -arch armv7 -r -print_atoms %t -o %t2 | FileCheck %s
-# RUN: lld -flavor darwin -arch armv7 -dylib %s -o %t3.dylib %p/Inputs/libSystem.yaml \
+# RUN: lld -flavor darwin -arch armv7 -dylib %s -o %t3.dylib %p/Inputs/armv7/libSystem.yaml \
# RUN: && llvm-objdump -macho -private-headers %t3.dylib | FileCheck --check-prefix=CHECK2 %s
#
# Test parsing LC_DATA_IN_CODE
diff --git a/test/mach-o/parse-data-relocs-x86_64.yaml b/test/mach-o/parse-data-relocs-x86_64.yaml
index 72a256ef1f027..6b5bb4b8fb599 100644
--- a/test/mach-o/parse-data-relocs-x86_64.yaml
+++ b/test/mach-o/parse-data-relocs-x86_64.yaml
@@ -60,7 +60,7 @@ sections:
type: S_REGULAR
attributes: [ ]
address: 0x000000000000000A
- content: [
+ content: [
# .quad _foo
# No addend is needed here as we are referencing _foo directly and that is
# encoded entirely in the X86_64_RELOC_UNSIGNED
@@ -301,7 +301,7 @@ page-size: 0x00000000
...
-# CHECK:defined-atoms:
+# CHECK:defined-atoms:
# CHECK: - name: _d
# CHECK: type: data
# CHECK: content: [ 00, 00, 00, 00, 00, 00, 00, 00, 04, 00, 00, 00,
@@ -313,7 +313,7 @@ page-size: 0x00000000
# CHECK: B8, FF, FF, FF, B4, FF, FF, FF, B4, FF, FF, FF,
# CHECK: {{..}}, {{..}}, {{..}}, {{..}} ]
# CHECK: dead-strip: never
-# CHECK: references:
+# CHECK: references:
# CHECK: - kind: pointer64
# CHECK: offset: 0
# CHECK: target: _foo
diff --git a/test/mach-o/rpath.yaml b/test/mach-o/rpath.yaml
index ce1234d4c78fe..639149381293b 100644
--- a/test/mach-o/rpath.yaml
+++ b/test/mach-o/rpath.yaml
@@ -1,6 +1,6 @@
# Check we handle -rpath correctly:
# RUN: lld -flavor darwin -arch x86_64 -rpath @loader_path/../Frameworks \
-# RUN: %p/Inputs/libSystem.yaml %s -o %t
+# RUN: %p/Inputs/x86_64/libSystem.yaml %s -o %t
# RUN: llvm-objdump -private-headers %t | FileCheck %s --check-prefix=CHECK-BINARY-WRITE
--- !mach-o
diff --git a/test/mach-o/run-tlv-pass-x86-64.yaml b/test/mach-o/run-tlv-pass-x86-64.yaml
index 0e648458645bd..dd524c067d87c 100644
--- a/test/mach-o/run-tlv-pass-x86-64.yaml
+++ b/test/mach-o/run-tlv-pass-x86-64.yaml
@@ -13,17 +13,17 @@ compat-version: 0.0
current-version: 0.0
has-UUID: false
OS: unknown
-sections:
+sections:
- segment: __TEXT
section: __text
type: S_REGULAR
attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
alignment: 16
address: 0x0000000000000000
- content: [ 0x55, 0x48, 0x89, 0xE5, 0x48, 0x8B, 0x3D, 0x00,
- 0x00, 0x00, 0x00, 0xFF, 0x17, 0x8B, 0x00, 0x5D,
+ content: [ 0x55, 0x48, 0x89, 0xE5, 0x48, 0x8B, 0x3D, 0x00,
+ 0x00, 0x00, 0x00, 0xFF, 0x17, 0x8B, 0x00, 0x5D,
0xC3 ]
- relocations:
+ relocations:
- offset: 0x00000007
type: X86_64_RELOC_TLV
length: 2
@@ -42,10 +42,10 @@ sections:
type: S_THREAD_LOCAL_VARIABLES
attributes: [ ]
address: 0x0000000000000018
- content: [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ content: [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]
- relocations:
+ relocations:
- offset: 0x00000010
type: X86_64_RELOC_UNSIGNED
length: 3
@@ -67,12 +67,12 @@ sections:
content: [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]
-local-symbols:
+local-symbols:
- name: '_x$tlv$init'
type: N_SECT
sect: 2
value: 0x0000000000000014
-global-symbols:
+global-symbols:
- name: _main
type: N_SECT
scope: [ N_EXT ]
diff --git a/test/mach-o/sectalign.yaml b/test/mach-o/sectalign.yaml
index 556fd52c96e10..f0df9f9c54859 100644
--- a/test/mach-o/sectalign.yaml
+++ b/test/mach-o/sectalign.yaml
@@ -1,6 +1,6 @@
# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -dylib \
# RUN: -sectalign __DATA __custom 0x800 -sectalign __TEXT __text 0x400 \
-# RUN: %p/Inputs/libSystem.yaml -o %t \
+# RUN: %p/Inputs/x86_64/libSystem.yaml -o %t \
# RUN: && llvm-readobj -sections %t | FileCheck %s
#
# Test -sectalign option on __text and a custom section.
diff --git a/test/mach-o/sectattrs.yaml b/test/mach-o/sectattrs.yaml
index 800ba55d1b3b7..21113dcf82806 100644
--- a/test/mach-o/sectattrs.yaml
+++ b/test/mach-o/sectattrs.yaml
@@ -1,5 +1,5 @@
# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -dylib \
-# RUN: %p/Inputs/libSystem.yaml -o %t \
+# RUN: %p/Inputs/x86_64/libSystem.yaml -o %t \
# RUN: && llvm-objdump -private-headers %t | FileCheck %s
#
diff --git a/test/mach-o/source-version.yaml b/test/mach-o/source-version.yaml
index 169e97571357a..4e0eaee394f11 100644
--- a/test/mach-o/source-version.yaml
+++ b/test/mach-o/source-version.yaml
@@ -1,5 +1,5 @@
# RUN: not lld -flavor darwin -arch x86_64 -source_version 10.blah %s -o %t 2>&1 | FileCheck %s --check-prefix=ERROR
-# RUN: lld -flavor darwin -arch x86_64 -source_version 10.1.2.3.4 %s -o %t -dylib %p/Inputs/libSystem.yaml && llvm-objdump -private-headers %t | FileCheck %s
+# RUN: lld -flavor darwin -arch x86_64 -source_version 10.1.2.3.4 %s -o %t -dylib %p/Inputs/x86_64/libSystem.yaml && llvm-objdump -private-headers %t | FileCheck %s
--- !mach-o
arch: x86_64
diff --git a/test/mach-o/stack-size.yaml b/test/mach-o/stack-size.yaml
index 0e8edb2b5498f..048282c504efa 100644
--- a/test/mach-o/stack-size.yaml
+++ b/test/mach-o/stack-size.yaml
@@ -1,6 +1,6 @@
-# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.9 %s -o %t %p/Inputs/libSystem.yaml
+# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.9 %s -o %t %p/Inputs/x86_64/libSystem.yaml
# RUN: llvm-objdump -private-headers %t | FileCheck --check-prefix=CHECK-DEFAULT %s
-# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.9 %s -o %t -stack_size 31415926000 %p/Inputs/libSystem.yaml
+# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.9 %s -o %t -stack_size 31415926000 %p/Inputs/x86_64/libSystem.yaml
# RUN: llvm-objdump -private-headers %t | FileCheck --check-prefix=CHECK-EXPLICIT %s
# RUN: not lld -flavor darwin -arch x86_64 -stack_size 0x31415926530 %s >/dev/null 2> %t
# RUN: FileCheck < %t %s --check-prefix=CHECK-ERROR-MISPAGED
diff --git a/test/mach-o/string-table.yaml b/test/mach-o/string-table.yaml
new file mode 100644
index 0000000000000..eec2c77fe1571
--- /dev/null
+++ b/test/mach-o/string-table.yaml
@@ -0,0 +1,66 @@
+# RUN: lld -flavor darwin -arch i386 %s %p/Inputs/hello-world-x86.yaml -o %t
+# RUN: obj2yaml %t | FileCheck %s
+#
+# Test that the string table contains a ' ' as its first symbol
+#
+
+--- !mach-o
+arch: x86
+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, 0x89, 0xE5, 0x83, 0xEC, 0x08, 0xE8, 0x00,
+ 0x00, 0x00, 0x00, 0x58, 0x8D, 0x80, 0x16, 0x00,
+ 0x00, 0x00, 0x89, 0x04, 0x24, 0xE8, 0xE6, 0xFF,
+ 0xFF, 0xFF, 0x31, 0xC0, 0x83, 0xC4, 0x08, 0x5D,
+ 0xC3 ]
+ relocations:
+ - offset: 0x00000016
+ type: GENERIC_RELOC_VANILLA
+ length: 2
+ pc-rel: true
+ extern: true
+ symbol: 1
+ - offset: 0x0000000E
+ scattered: true
+ type: GENERIC_RELOC_LOCAL_SECTDIFF
+ length: 2
+ pc-rel: false
+ value: 0x00000021
+ - offset: 0x00000000
+ scattered: true
+ type: GENERIC_RELOC_PAIR
+ length: 2
+ pc-rel: false
+ value: 0x0000000B
+ - segment: __TEXT
+ section: __cstring
+ type: S_CSTRING_LITERALS
+ attributes: [ ]
+ address: 0x0000000000000021
+ content: [ 0x68, 0x65, 0x6C, 0x6C, 0x6F, 0x0A, 0x00 ]
+global-symbols:
+ - name: _main
+ type: N_SECT
+ scope: [ N_EXT ]
+ sect: 1
+ value: 0x0000000000000000
+undefined-symbols:
+ - name: _printf
+ type: N_UNDF
+ scope: [ N_EXT ]
+ value: 0x0000000000000000
+...
+
+# CHECK: StringTable:
+# CHECK-NEXT: - ' '
+# CHECK-NEXT: - __mh_execute_header
+# CHECK-NEXT: - _main
+# CHECK-NEXT: - _printf
+# CHECK-NEXT: - dyld_stub_binder
+# CHECK-NEXT: - ''
diff --git a/test/mach-o/twolevel_namespace_undef_dynamic_lookup.yaml b/test/mach-o/twolevel_namespace_undef_dynamic_lookup.yaml
index a39a3e7f8c1b1..b402ae3e17f28 100644
--- a/test/mach-o/twolevel_namespace_undef_dynamic_lookup.yaml
+++ b/test/mach-o/twolevel_namespace_undef_dynamic_lookup.yaml
@@ -1,4 +1,4 @@
-# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.9 -twolevel_namespace -undefined dynamic_lookup %s -o %t %p/Inputs/libSystem.yaml
+# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.9 -twolevel_namespace -undefined dynamic_lookup %s -o %t %p/Inputs/x86_64/libSystem.yaml
#
# Sanity check '-twolevel_namespace -undefined dynamic_lookup'.
# This should pass without error, even though '_bar' is undefined.
diff --git a/test/mach-o/twolevel_namespace_undef_warning_suppress.yaml b/test/mach-o/twolevel_namespace_undef_warning_suppress.yaml
index eeb01de5f707b..1ac704cdf9546 100644
--- a/test/mach-o/twolevel_namespace_undef_warning_suppress.yaml
+++ b/test/mach-o/twolevel_namespace_undef_warning_suppress.yaml
@@ -1,6 +1,6 @@
-# RUN: not lld -flavor darwin -arch x86_64 -macosx_version_min 10.9 -twolevel_namespace -undefined warning %s -o %t %p/Inputs/libSystem.yaml 2>&1 | \
+# RUN: not lld -flavor darwin -arch x86_64 -macosx_version_min 10.9 -twolevel_namespace -undefined warning %s -o %t %p/Inputs/x86_64/libSystem.yaml 2>&1 | \
# RUN: FileCheck --check-prefix=CHECK-WARNING %s
-# RUN: not lld -flavor darwin -arch x86_64 -macosx_version_min 10.9 -twolevel_namespace -undefined suppress %s -o %t %p/Inputs/libSystem.yaml 2>&1 | \
+# RUN: not lld -flavor darwin -arch x86_64 -macosx_version_min 10.9 -twolevel_namespace -undefined suppress %s -o %t %p/Inputs/x86_64/libSystem.yaml 2>&1 | \
# RUN: FileCheck --check-prefix=CHECK-SUPPRESS %s
--- !native
diff --git a/test/mach-o/unwind-info-simple-arm64.yaml b/test/mach-o/unwind-info-simple-arm64.yaml
index 2ef6dda8f3af9..4caaf3582630c 100644
--- a/test/mach-o/unwind-info-simple-arm64.yaml
+++ b/test/mach-o/unwind-info-simple-arm64.yaml
@@ -1,5 +1,5 @@
# RUN: lld -flavor darwin -arch arm64 -o %t %s \
-# RUN: %p/Inputs/unwind-info-simple-arm64.yaml -e _main %p/Inputs/libSystem.yaml
+# RUN: %p/Inputs/unwind-info-simple-arm64.yaml -e _main %p/Inputs/arm64/libSystem.yaml
# RUN: llvm-objdump -unwind-info %t | FileCheck %s
--- !mach-o
diff --git a/test/mach-o/unwind-info-simple-x86_64.yaml b/test/mach-o/unwind-info-simple-x86_64.yaml
index 7dfae1b715816..797c5a319d2ca 100644
--- a/test/mach-o/unwind-info-simple-x86_64.yaml
+++ b/test/mach-o/unwind-info-simple-x86_64.yaml
@@ -1,4 +1,4 @@
-# RUN: lld -flavor darwin -arch x86_64 %s -o %t -e _main %p/Inputs/libSystem.yaml
+# RUN: lld -flavor darwin -arch x86_64 %s -o %t -e _main %p/Inputs/x86_64/libSystem.yaml
# RUN: llvm-objdump -unwind-info %t | FileCheck %s
# CHECK: Contents of __unwind_info section:
diff --git a/test/mach-o/upward-dylib-load-command.yaml b/test/mach-o/upward-dylib-load-command.yaml
index 1383ad75b0a68..54e31f6960bea 100644
--- a/test/mach-o/upward-dylib-load-command.yaml
+++ b/test/mach-o/upward-dylib-load-command.yaml
@@ -1,7 +1,7 @@
# RUN: lld -flavor darwin -arch x86_64 -dylib %p/Inputs/bar.yaml \
-# RUN: -install_name /usr/lib/libbar.dylib %p/Inputs/libSystem.yaml -o %t1.dylib
+# RUN: -install_name /usr/lib/libbar.dylib %p/Inputs/x86_64/libSystem.yaml -o %t1.dylib
# RUN: lld -flavor darwin -arch x86_64 -dylib %s -upward_library %t1.dylib \
-# RUN: -install_name /usr/lib/libfoo.dylib %p/Inputs/libSystem.yaml -o %t
+# RUN: -install_name /usr/lib/libfoo.dylib %p/Inputs/x86_64/libSystem.yaml -o %t
# RUN: llvm-objdump -private-headers %t | FileCheck %s
#
#
diff --git a/test/mach-o/use-dylib.yaml b/test/mach-o/use-dylib.yaml
new file mode 100644
index 0000000000000..c173cc0af3528
--- /dev/null
+++ b/test/mach-o/use-dylib.yaml
@@ -0,0 +1,39 @@
+# RUN: lld -flavor darwin -arch x86_64 %s \
+# RUN: %p/Inputs/use-simple-dylib.yaml %p/Inputs/x86_64/libSystem.yaml -dylib -o %t.dylib
+# RUN: llvm-objdump -private-headers %t.dylib | FileCheck %s
+
+# This test ensures that we have a LC_LOAD_DYLIB for libspecial.dylib even though we don't
+# use any atoms from it. This matches the ld64 behaviour.
+--- !mach-o
+arch: x86_64
+file-type: MH_OBJECT
+flags: [ ]
+has-UUID: false
+OS: unknown
+sections:
+ - segment: __TEXT
+ section: __text
+ type: S_REGULAR
+ attributes: [ S_ATTR_PURE_INSTRUCTIONS ]
+ address: 0x0000000000000000
+ content: [ 0x55, 0x48, 0x89, 0xE5, 0xE8, 0x00, 0x00, 0x00,
+ 0x00, 0xE8, 0x00, 0x00, 0x00, 0x00, 0xE8, 0x00,
+ 0x00, 0x00, 0x00, 0xE8, 0x00, 0x00, 0x00, 0x00,
+ 0xE8, 0x00, 0x00, 0x00, 0x00, 0x5D, 0xE9, 0x00,
+ 0x00, 0x00, 0x00 ]
+global-symbols:
+ - name: _foo
+ type: N_SECT
+ scope: [ N_EXT ]
+ sect: 1
+ value: 0x0000000000000000
+
+
+# CHECK: cmd LC_LOAD_DYLIB
+# CHECK: name libspecial.dylib (offset 24)
+# CHECK: current version 1.0.0
+# CHECK: compatibility version 1.0.0
+# CHECK: cmd LC_LOAD_DYLIB
+# CHECK: name /usr/lib/libSystem.B.dylib (offset 24)
+# CHECK: current version 1.0.0
+# CHECK: compatibility version 1.0.0
diff --git a/test/mach-o/version-min-load-command.yaml b/test/mach-o/version-min-load-command.yaml
index aa378a71fcf40..cb5331ec7f4b6 100644
--- a/test/mach-o/version-min-load-command.yaml
+++ b/test/mach-o/version-min-load-command.yaml
@@ -1,11 +1,11 @@
-# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/libSystem.yaml && llvm-objdump -private-headers %t | FileCheck %s
-# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/libSystem.yaml 2>&1 | FileCheck %s --check-prefix=WARNING
-# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/libSystem.yaml -static -version_load_command && llvm-objdump -private-headers %t | FileCheck %s
-# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/libSystem.yaml -no_version_load_command && llvm-objdump -private-headers %t | FileCheck %s --check-prefix=NO_VERSION_MIN
-# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/libSystem.yaml -static -version_load_command -no_version_load_command && llvm-objdump -private-headers %t | FileCheck %s --check-prefix=NO_VERSION_MIN
-# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/libSystem.yaml -static && llvm-objdump -private-headers %t | FileCheck %s --check-prefix=NO_VERSION_MIN
+# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/x86_64/libSystem.yaml && llvm-objdump -private-headers %t | FileCheck %s
+# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/x86_64/libSystem.yaml 2>&1 | FileCheck %s --check-prefix=WARNING
+# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/x86_64/libSystem.yaml -static -version_load_command && llvm-objdump -private-headers %t | FileCheck %s
+# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/x86_64/libSystem.yaml -no_version_load_command && llvm-objdump -private-headers %t | FileCheck %s --check-prefix=NO_VERSION_MIN
+# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/x86_64/libSystem.yaml -static -version_load_command -no_version_load_command && llvm-objdump -private-headers %t | FileCheck %s --check-prefix=NO_VERSION_MIN
+# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 %s -o %t -dylib %p/Inputs/x86_64/libSystem.yaml -static && llvm-objdump -private-headers %t | FileCheck %s --check-prefix=NO_VERSION_MIN
-# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 -sdk_version 10.9 %s -o %t -dylib %p/Inputs/libSystem.yaml && llvm-objdump -private-headers %t | FileCheck %s --check-prefix=SDK_VERSION
+# RUN: lld -flavor darwin -arch x86_64 -macosx_version_min 10.8 -sdk_version 10.9 %s -o %t -dylib %p/Inputs/x86_64/libSystem.yaml && llvm-objdump -private-headers %t | FileCheck %s --check-prefix=SDK_VERSION
--- !mach-o
arch: x86_64