|
| 1 | +// REQUIRES: aarch64, x86 |
| 2 | +// RUN: split-file %s %t.dir && cd %t.dir |
| 3 | + |
| 4 | +// RUN: llvm-mc -filetype=obj -triple=aarch64-windows ctor1-arm64.s -o ctor1-arm64.obj |
| 5 | +// RUN: llvm-mc -filetype=obj -triple=aarch64-windows ctor2-arm64.s -o ctor2-arm64.obj |
| 6 | +// RUN: llvm-mc -filetype=obj -triple=arm64ec-windows ctor1-arm64ec.s -o ctor1-arm64ec.obj |
| 7 | +// RUN: llvm-mc -filetype=obj -triple=x86_64-windows ctor2-amd64.s -o ctor2-amd64.obj |
| 8 | +// RUN: llvm-mc -filetype=obj -triple=aarch64-windows test.s -o test-arm64.obj |
| 9 | +// RUN: llvm-mc -filetype=obj -triple=arm64ec-windows test.s -o test-arm64ec.obj |
| 10 | + |
| 11 | +// Check that .ctors and .dtors chunks are correctly sorted and that EC and native chunks are split. |
| 12 | + |
| 13 | +// RUN: lld-link -out:out.dll -machine:arm64x -lldmingw -dll -noentry test-arm64.obj test-arm64ec.obj \ |
| 14 | +// RUN: ctor1-arm64.obj ctor2-arm64.obj ctor1-arm64ec.obj ctor2-amd64.obj |
| 15 | +// RUN: llvm-readobj --hex-dump=.rdata --hex-dump=.test out.dll | FileCheck %s |
| 16 | + |
| 17 | +// RUN: lld-link -out:out2.dll -machine:arm64x -lldmingw -dll -noentry test-arm64.obj test-arm64ec.obj \ |
| 18 | +// RUN: ctor1-arm64ec.obj ctor2-amd64.obj ctor1-arm64.obj ctor2-arm64.obj |
| 19 | +// RUN: llvm-readobj --hex-dump=.rdata --hex-dump=.test out2.dll | FileCheck %s |
| 20 | + |
| 21 | +// RUN: lld-link -out:out3.dll -machine:arm64x -lldmingw -dll -noentry test-arm64.obj test-arm64ec.obj \ |
| 22 | +// RUN: ctor2-arm64.obj ctor1-arm64ec.obj ctor2-amd64.obj ctor1-arm64.obj |
| 23 | +// RUN: llvm-readobj --hex-dump=.rdata --hex-dump=.test out3.dll | FileCheck %s |
| 24 | + |
| 25 | +// CHECK: Hex dump of section '.rdata': |
| 26 | +// CHECK-NEXT: 0x180001000 ffffffff ffffffff 01000000 00000000 |
| 27 | +// CHECK-NEXT: 0x180001010 02000000 00000000 03000000 00000000 |
| 28 | +// CHECK-NEXT: 0x180001020 00000000 00000000 ffffffff ffffffff |
| 29 | +// CHECK-NEXT: 0x180001030 11000000 00000000 12000000 00000000 |
| 30 | +// CHECK-NEXT: 0x180001040 13000000 00000000 00000000 00000000 |
| 31 | +// CHECK-NEXT: 0x180001050 ffffffff ffffffff 01010000 00000000 |
| 32 | +// CHECK-NEXT: 0x180001060 02010000 00000000 03010000 00000000 |
| 33 | +// CHECK-NEXT: 0x180001070 00000000 00000000 ffffffff ffffffff |
| 34 | +// CHECK-NEXT: 0x180001080 11010000 00000000 12010000 00000000 |
| 35 | +// CHECK-NEXT: 0x180001090 13010000 00000000 00000000 00000000 |
| 36 | +// CHECK-EMPTY: |
| 37 | +// CHECK-NEXT: Hex dump of section '.test': |
| 38 | +// CHECK-NEXT: 0x180003000 00100000 50100000 28100000 78100000 |
| 39 | + |
| 40 | +#--- ctor1-arm64.s |
| 41 | + .section .ctors.1,"drw" |
| 42 | + .xword 1 |
| 43 | + .section .ctors.3,"drw" |
| 44 | + .xword 3 |
| 45 | + .section .dtors.1,"drw" |
| 46 | + .xword 0x101 |
| 47 | + .section .dtors.3,"drw" |
| 48 | + .xword 0x103 |
| 49 | + |
| 50 | +#--- ctor2-arm64.s |
| 51 | + .section .ctors.2,"drw" |
| 52 | + .xword 2 |
| 53 | + .section .dtors.2,"drw" |
| 54 | + .xword 0x102 |
| 55 | + |
| 56 | +#--- ctor1-arm64ec.s |
| 57 | + .section .ctors.1,"drw" |
| 58 | + .xword 0x11 |
| 59 | + .section .ctors.3,"drw" |
| 60 | + .xword 0x13 |
| 61 | + .section .dtors.1,"drw" |
| 62 | + .xword 0x111 |
| 63 | + .section .dtors.3,"drw" |
| 64 | + .xword 0x113 |
| 65 | + |
| 66 | +#--- ctor2-amd64.s |
| 67 | + .section .ctors.2,"drw" |
| 68 | + .quad 0x12 |
| 69 | + .section .dtors.2,"drw" |
| 70 | + .quad 0x112 |
| 71 | + |
| 72 | +#--- test.s |
| 73 | + .section .test |
| 74 | + .rva __CTOR_LIST__ |
| 75 | + .rva __DTOR_LIST__ |
| 76 | + |
0 commit comments