[PATCH] D99813: [lld-macho][nfc] Add test for ARM64 stubs

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 7 09:12:06 PDT 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rGd855a727bbf3: [lld-macho][nfc] Add test for ARM64 stubs (authored by int3).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99813/new/

https://reviews.llvm.org/D99813

Files:
  lld/test/MachO/arm64-stubs.s


Index: lld/test/MachO/arm64-stubs.s
===================================================================
--- /dev/null
+++ lld/test/MachO/arm64-stubs.s
@@ -0,0 +1,55 @@
+# REQUIRES: aarch64
+# RUN: rm -rf %t; split-file %s %t
+# RUN: llvm-mc -filetype=obj -triple=arm64-apple-darwin %t/foo.s -o %t/foo.o
+# RUN: llvm-mc -filetype=obj -triple=arm64-apple-darwin %t/bar.s -o %t/bar.o
+# RUN: llvm-mc -filetype=obj -triple=arm64-apple-darwin %t/test.s -o %t/test.o
+# RUN: %lld -arch arm64 -dylib -install_name @executable_path/libfoo.dylib %t/foo.o -o %t/libfoo.dylib
+# RUN: %lld -arch arm64 -dylib -install_name @executable_path/libbar.dylib %t/bar.o -o %t/libbar.dylib
+# RUN: %lld -arch arm64 -lSystem %t/libfoo.dylib %t/libbar.dylib %t/test.o -o %t/test
+
+# RUN: llvm-objdump --macho -d --no-show-raw-insn --section="__TEXT,__stubs" --section="__TEXT,__stub_helper" %t/test | FileCheck %s
+
+# CHECK:       _main:
+# CHECK-NEXT:  bl 0x[[#%x,FOO:]] ; symbol stub for: _foo
+# CHECK-NEXT:  bl 0x[[#%x,BAR:]] ; symbol stub for: _bar
+# CHECK-NEXT:  ret
+
+# CHECK-LABEL: Contents of (__TEXT,__stubs) section
+# CHECK-NEXT:  [[#BAR]]: adrp x16
+# CHECK-NEXT:            ldr x16, [x16{{.*}}] ; literal pool symbol address: _bar
+# CHECK-NEXT:            br x16
+# CHECK-NEXT:  [[#FOO]]: adrp x16
+# CHECK-NEXT:            ldr x16, [x16{{.*}}] ; literal pool symbol address: _foo
+# CHECK-NEXT:            br x16
+
+# CHECK-LABEL: Contents of (__TEXT,__stub_helper) section
+# CHECK-NEXT:  [[#%x,HELPER_HEADER:]]: adrp x17
+# CHECK-NEXT:                          add x17, x17
+# CHECK-NEXT:                          stp x16, x17, [sp, #-16]!
+# CHECK-NEXT:                          adrp x16
+# CHECK-NEXT:                          ldr x16, [x16] ; literal pool symbol address: dyld_stub_binder
+# CHECK-NEXT:                          br x16
+# CHECK-NEXT:                          ldr w16, 0x[[#%x,BAR_BIND_OFF_ADDR:]]
+# CHECK-NEXT:                          b 0x[[#HELPER_HEADER]]
+# CHECK-NEXT:  [[#BAR_BIND_OFF_ADDR]]: udf #0
+# CHECK-NEXT:                          ldr w16, 0x[[#%x,FOO_BIND_OFF_ADDR:]]
+# CHECK-NEXT:                          b 0x[[#HELPER_HEADER]]
+# CHECK-NEXT:  [[#FOO_BIND_OFF_ADDR]]: udf #11
+
+#--- foo.s
+.globl _foo
+_foo:
+
+#--- bar.s
+.globl _bar
+_bar:
+
+#--- test.s
+.text
+.globl _main
+
+.p2align 2
+_main:
+  bl _foo
+  bl _bar
+  ret


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99813.335833.patch
Type: text/x-patch
Size: 2370 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210407/945ea5ef/attachment.bin>


More information about the llvm-commits mailing list