[lld] d9c8ffa - [lld-macho][nfc] Clean up header.s test

Jez Ng via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 29 12:11:32 PDT 2021


Author: Jez Ng
Date: 2021-04-29T15:11:23-04:00
New Revision: d9c8ffa958b7725e7d3a2231701ab20eb477b9ee

URL: https://github.com/llvm/llvm-project/commit/d9c8ffa958b7725e7d3a2231701ab20eb477b9ee
DIFF: https://github.com/llvm/llvm-project/commit/d9c8ffa958b7725e7d3a2231701ab20eb477b9ee.diff

LOG: [lld-macho][nfc] Clean up header.s test

I don't think it's super worthwhile to test the dylib headers outputs of
all the different archs when x86_64 is the only one that has interesting
behavior.

Motivated by my upcoming addition of arm32...

Added: 
    lld/test/MachO/arm-relocs.s

Modified: 
    lld/test/MachO/header.s

Removed: 
    


################################################################################
diff  --git a/lld/test/MachO/arm-relocs.s b/lld/test/MachO/arm-relocs.s
new file mode 100644
index 000000000000..880894ff6440
--- /dev/null
+++ b/lld/test/MachO/arm-relocs.s
@@ -0,0 +1,26 @@
+# REQUIRES: arm
+# RUN: llvm-mc -filetype=obj -triple=armv7-apple-watchos %s -o %t.o
+# RUN: ld -dylib -arch armv7 -lSystem -o %t %t.o
+# RUN: show-relocs %t.o
+# RUN: llvm-objdump --macho -d %t
+# RUN: llvm-objdump --triple=thumb -d %t
+
+.globl _arm, _thumb
+.syntax unified
+.thumb_func _thumb
+
+.p2align 2
+
+.code 16
+_thumb:
+  bl _arm
+  blx _arm
+  bl _thumb
+  blx _thumb
+
+.code 32
+_arm:
+  bl _thumb
+  blx _thumb
+  bl _arm
+  blx _arm

diff  --git a/lld/test/MachO/header.s b/lld/test/MachO/header.s
index 77356eb813cd..657f984a2a5a 100644
--- a/lld/test/MachO/header.s
+++ b/lld/test/MachO/header.s
@@ -1,28 +1,26 @@
-# REQUIRES: x86, aarch64
+# REQUIRES: x86, aarch64, arm
 # RUN: rm -rf %t && mkdir -p %t
 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t/x86-64-test.o
 # RUN: llvm-mc -filetype=obj -triple=arm64-apple-darwin %s -o %t/arm64-test.o
 # RUN: llvm-mc -filetype=obj -triple=arm64_32-apple-watchos %s -o %t/arm64-32-test.o
-# RUN: %lld -arch x86_64 -platform_version macos 10.5.0 11.0 -o %t/x86-64-executable %t/x86-64-test.o
-# RUN: %lld -arch arm64 -o %t/arm64-executable %t/arm64-test.o
-# RUN: %lld-watchos -o %t/arm64-32-executable %t/arm64-32-test.o
+# RUN: llvm-mc -filetype=obj -triple=arm64_32-apple-watchos %s -o %t/arm64-32-test.o
+
+# RUN: %lld -lSystem -arch x86_64 -o %t/x86-64-executable %t/x86-64-test.o
+# RUN: %lld -lSystem -arch arm64 -o %t/arm64-executable %t/arm64-test.o
+# RUN: %lld-watchos -lSystem -o %t/arm64-32-executable %t/arm64-32-test.o
 # RUN: %lld -arch x86_64 -dylib -o %t/x86-64-dylib %t/x86-64-test.o
-# RUN: %lld -arch arm64  -dylib -o %t/arm64-dylib %t/arm64-test.o
-# RUN: %lld-watchos -dylib -o %t/arm64-32-dylib %t/arm64-32-test.o
 
-# RUN: llvm-objdump --macho --private-header %t/x86-64-executable | FileCheck %s -DCPU=X86_64 -DCAPS=LIB64
-# RUN: llvm-objdump --macho --private-header %t/arm64-executable | FileCheck %s -DCPU=ARM64 -DCAPS=0x00
-# RUN: llvm-objdump --macho --private-header %t/arm64-32-executable | FileCheck %s --check-prefix=ARM64-32
-# RUN: llvm-objdump --macho --private-header %t/x86-64-dylib | FileCheck %s -DCPU=X86_64 -DCAPS=0x00
-# RUN: llvm-objdump --macho --private-header %t/arm64-dylib | FileCheck %s -DCPU=ARM64 -DCAPS=0x00
-# RUN: llvm-objdump --macho --private-header %t/arm64-32-dylib | FileCheck %s --check-prefix=ARM64-32
+## NOTE: recent versions of ld64 don't emit LIB64 for x86-64-executable, maybe we should follow suit
+# RUN: llvm-objdump --macho --private-header %t/x86-64-executable | FileCheck %s --check-prefix=EXEC -DCPU=X86_64 -DSUBTYPE=ALL -DCAPS=LIB64
+# RUN: llvm-objdump --macho --private-header %t/arm64-executable | FileCheck %s --check-prefix=EXEC -DCPU=ARM64 -DSUBTYPE=ALL -DCAPS=0x00
+# RUN: llvm-objdump --macho --private-header %t/arm64-32-executable | FileCheck %s --check-prefix=EXEC -DCPU=ARM64_32 -DSUBTYPE=V8 -DCAPS=0x00
+# RUN: llvm-objdump --macho --private-header %t/x86-64-dylib | FileCheck %s --check-prefix=DYLIB -DCPU=X86_64 -DSUBTYPE=ALL -DCAPS=0x00
 
-# CHECK:      magic        cputype  cpusubtype  caps     filetype {{.*}} flags
-# CHECK-NEXT: MH_MAGIC_64  [[CPU]]         ALL  [[CAPS]] {{.*}}          NOUNDEFS {{.*}} TWOLEVEL
+# EXEC:      magic               cputype  cpusubtype   caps     filetype {{.*}} flags
+# EXEC-NEXT: MH_MAGIC{{(_64)?}}  [[CPU]]  [[SUBTYPE]]  [[CAPS]] EXECUTE  {{.*}} NOUNDEFS DYLDLINK TWOLEVEL PIE{{$}}
 
-# ARM64-32:      magic     cputype  cpusubtype  caps  filetype {{.*}} flags
-# ARM64-32-NEXT: MH_MAGIC  ARM64_32         V8  0x00  {{.*}}          NOUNDEFS {{.*}} TWOLEVEL
+# DYLIB:      magic                  cputype  cpusubtype   caps      filetype {{.*}} flags
+# DYLIB-NEXT: MH_MAGIC_64{{(_64)?}}  [[CPU]]  [[SUBTYPE]]  [[CAPS]]  DYLIB    {{.*}} NOUNDEFS DYLDLINK TWOLEVEL NO_REEXPORTED_DYLIBS{{$}}
 
 .globl _main
 _main:
-  ret


        


More information about the llvm-commits mailing list