|
| 1 | +# REQUIRES: aarch64 |
| 2 | + |
| 3 | +# RUN: llvm-mc -triple=aarch64-windows-gnu %s -filetype=obj -o %t-arm64.obj |
| 4 | +# RUN: llvm-mc -triple=arm64ec-windows-gnu %s -filetype=obj -o %t-arm64ec.obj |
| 5 | +# RUN: lld-link -machine:arm64x -lldmingw -out:%t.exe -opt:ref -entry:main %t-arm64.obj %t-arm64ec.obj -verbose 2>&1 | FileCheck %s |
| 6 | +# CHECK: Discarded unused |
| 7 | + |
| 8 | +# Check that __gxx_personality_v0 is not discarded and is present in the output. |
| 9 | + |
| 10 | +# RUN: llvm-objdump -d %t.exe | FileCheck --check-prefix=DISASM %s |
| 11 | +# DISASM: 0000000140001000 <.text>: |
| 12 | +# DISASM-NEXT: 140001000: 52800000 mov w0, #0x0 // =0 |
| 13 | +# DISASM-NEXT: 140001004: d65f03c0 ret |
| 14 | +# DISASM-NEXT: 140001008: 52800020 mov w0, #0x1 // =1 |
| 15 | +# DISASM-NEXT: 14000100c: d65f03c0 ret |
| 16 | +# DISASM-NEXT: ... |
| 17 | +# DISASM-NEXT: 140002000: 52800000 mov w0, #0x0 // =0 |
| 18 | +# DISASM-NEXT: 140002004: d65f03c0 ret |
| 19 | +# DISASM-NEXT: 140002008: 52800020 mov w0, #0x1 // =1 |
| 20 | +# DISASM-NEXT: 14000200c: d65f03c0 ret |
| 21 | + |
| 22 | + .def main; .scl 2; .type 32; .endef |
| 23 | + .section .text,"xr",one_only,main |
| 24 | + .globl main |
| 25 | +main: |
| 26 | + .cfi_startproc |
| 27 | + .cfi_personality 0, __gxx_personality_v0 |
| 28 | + mov w0, #0 |
| 29 | + ret |
| 30 | + .cfi_endproc |
| 31 | + |
| 32 | + .def __gxx_personality_v0; .scl 2; .type 32; .endef |
| 33 | + .section .text,"xr",one_only,__gxx_personality_v0 |
| 34 | + .globl __gxx_personality_v0 |
| 35 | +__gxx_personality_v0: |
| 36 | + mov w0, #1 |
| 37 | + ret |
| 38 | + |
| 39 | + .def unused; .scl 2; .type 32; .endef |
| 40 | + .section .text,"xr",one_only,unused |
| 41 | + .globl unused |
| 42 | +unused: |
| 43 | + .cfi_startproc |
| 44 | + .cfi_personality 0, __gxx_personality_v0 |
| 45 | + mov w0, #2 |
| 46 | + ret |
| 47 | + .cfi_endproc |
0 commit comments