| # REQUIRES: aarch64 |
| |
| # RUN: yaml2obj %s -o %t.obj |
| # RUN: llvm-objdump -d %t.obj | FileCheck %s --check-prefix BEFORE |
| # RUN: lld-link /entry:main /subsystem:console /out:%t.exe %t.obj %p/Inputs/library-arm64.lib |
| # RUN: llvm-objdump -d %t.exe | FileCheck %s --check-prefix AFTER |
| |
| # BEFORE: Disassembly of section .text: |
| # BEFORE-EMPTY: |
| # BEFORE: 0: fe 0f 1f f8 str x30, [sp, #-16]! |
| # BEFORE: 4: 00 00 00 90 adrp x0, 0x0 |
| # BEFORE: 8: 00 08 00 91 add x0, x0, #2 |
| # BEFORE: c: 00 00 00 94 bl 0xc |
| # BEFORE: 10: 00 01 40 39 ldrb w0, [x8] |
| # BEFORE: 14: 00 01 40 79 ldrh w0, [x8] |
| # BEFORE: 18: 00 01 40 b9 ldr w0, [x8] |
| # BEFORE: 1c: 00 01 40 f9 ldr x0, [x8] |
| # BEFORE: 20: 00 01 00 39 strb w0, [x8] |
| # BEFORE: 24: 00 01 00 79 strh w0, [x8] |
| # BEFORE: 28: 00 01 00 b9 str w0, [x8] |
| # BEFORE: 2c: 00 01 00 f9 str x0, [x8] |
| # BEFORE: 30: 00 01 40 3d ldr b0, [x8] |
| # BEFORE: 34: 00 01 40 7d ldr h0, [x8] |
| # BEFORE: 38: 00 01 40 bd ldr s0, [x8] |
| # BEFORE: 3c: 00 01 40 fd ldr d0, [x8] |
| # BEFORE: 40: 00 01 c0 3d ldr q0, [x8] |
| # BEFORE: 44: 00 01 00 3d str b0, [x8] |
| # BEFORE: 48: 00 01 00 7d str h0, [x8] |
| # BEFORE: 4c: 00 01 00 bd str s0, [x8] |
| # BEFORE: 50: 00 01 00 fd str d0, [x8] |
| # BEFORE: 54: 00 01 80 3d str q0, [x8] |
| # BEFORE: 58: 00 05 40 f9 ldr x0, [x8, #8] |
| # BEFORE: 5c: 20 1a 01 b0 adrp x0, 0x2345000 |
| # BEFORE: 60: 00 fc 4f f9 ldr x0, [x0, #8184] |
| # BEFORE: 64: e0 03 1f 2a mov w0, wzr |
| # BEFORE: 68: fe 07 41 f8 ldr x30, [sp], #16 |
| # BEFORE: 6c: c0 03 5f d6 ret |
| # BEFORE: 70: 08 00 00 00 udf #8 |
| # BEFORE: 74: 00 00 00 00 udf #0 |
| # BEFORE: 78: 01 00 00 00 udf #1 |
| # BEFORE: 7c: 01 00 00 00 udf #1 |
| # BEFORE: 80: 00 00 00 91 add x0, x0, #0 |
| # BEFORE: 84: 00 00 40 91 add x0, x0, #0, lsl #12 |
| # BEFORE: 88: 00 00 40 f9 ldr x0, [x0] |
| # BEFORE: 8c: 01 00 00 00 udf #1 |
| # BEFORE: 90: 20 1a 09 30 adr x0, #74565 |
| # BEFORE: 94: 01 00 00 54 b.ne 0x94 |
| # BEFORE: 98: 00 00 00 36 tbz w0, #0, 0x98 |
| # BEFORE: 9c: 01 00 00 00 udf #1 |
| # BEFORE: a0: 02 00 80 90 adrp x2, 0xffffffff00000000 |
| |
| # AFTER: Disassembly of section .text: |
| # AFTER-EMPTY: |
| # AFTER: 140001000: fe 0f 1f f8 str x30, [sp, #-16]! |
| # AFTER: 140001004: 00 00 00 b0 adrp x0, 0x140002000 |
| # AFTER: 140001008: 00 18 00 91 add x0, x0, #6 |
| # AFTER: 14000100c: 26 00 00 94 bl 0x1400010a4 |
| # AFTER: 140001010: 00 21 40 39 ldrb w0, [x8, #8] |
| # AFTER: 140001014: 00 11 40 79 ldrh w0, [x8, #8] |
| # AFTER: 140001018: 00 09 40 b9 ldr w0, [x8, #8] |
| # AFTER: 14000101c: 00 05 40 f9 ldr x0, [x8, #8] |
| # AFTER: 140001020: 00 21 00 39 strb w0, [x8, #8] |
| # AFTER: 140001024: 00 11 00 79 strh w0, [x8, #8] |
| # AFTER: 140001028: 00 09 00 b9 str w0, [x8, #8] |
| # AFTER: 14000102c: 00 05 00 f9 str x0, [x8, #8] |
| # AFTER: 140001030: 00 41 40 3d ldr b0, [x8, #16] |
| # AFTER: 140001034: 00 21 40 7d ldr h0, [x8, #16] |
| # AFTER: 140001038: 00 11 40 bd ldr s0, [x8, #16] |
| # AFTER: 14000103c: 00 09 40 fd ldr d0, [x8, #16] |
| # AFTER: 140001040: 00 05 c0 3d ldr q0, [x8, #16] |
| # AFTER: 140001044: 00 41 00 3d str b0, [x8, #16] |
| # AFTER: 140001048: 00 21 00 7d str h0, [x8, #16] |
| # AFTER: 14000104c: 00 11 00 bd str s0, [x8, #16] |
| # AFTER: 140001050: 00 09 00 fd str d0, [x8, #16] |
| # AFTER: 140001054: 00 05 80 3d str q0, [x8, #16] |
| # AFTER: 140001058: 00 09 40 f9 ldr x0, [x8, #16] |
| # AFTER: 14000105c: 00 00 00 f0 adrp x0, 0x140004000 |
| # AFTER: 140001060: 00 fc 47 f9 ldr x0, [x0, #4088] |
| # AFTER: 140001064: e0 03 1f 2a mov w0, wzr |
| # AFTER: 140001068: fe 07 41 f8 ldr x30, [sp], #16 |
| # AFTER: 14000106c: c0 03 5f d6 ret |
| # AFTER: 140001070: 10 20 00 40 <unknown> |
| # AFTER: 140001074: 01 00 00 00 udf #1 |
| # AFTER: 140001078: 09 20 00 00 udf #8201 |
| # AFTER: 14000107c: 09 00 00 00 udf #9 |
| # AFTER: 140001080: 00 20 0e 91 add x0, x0, #904 |
| # AFTER: 140001084: 00 04 40 91 add x0, x0, #1, lsl #12 |
| # AFTER: 140001088: 00 c4 41 f9 ldr x0, [x0, #904] |
| # AFTER: 14000108c: 03 00 00 00 udf #3 |
| # AFTER: 140001090: e0 95 09 30 adr x0, #78525 |
| # AFTER: 140001094: 81 00 00 54 b.ne 0x1400010a4 |
| # AFTER: 140001098: 60 00 00 36 tbz w0, #0, 0x1400010a4 |
| # AFTER: 14000109c: 61 ff ff ff <unknown> |
| # AFTER: 1400010a0: 02 f8 ff b0 adrp x2, 0x13ff02000 |
| # AFTER: 1400010a4: 10 00 00 b0 adrp x16, 0x140002000 |
| # AFTER: 1400010a8: 10 2a 40 f9 ldr x16, [x16, #80] |
| # AFTER: 1400010ac: 00 02 1f d6 br x16 |
| |
| --- !COFF |
| header: |
| Machine: IMAGE_FILE_MACHINE_ARM64 |
| Characteristics: [ ] |
| sections: |
| - Name: .text |
| Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ] |
| Alignment: 4 |
| SectionData: FE0F1FF80000009000080091000000940001403900014079000140B9000140F90001003900010079000100B9000100F90001403D0001407D000140BD000140FD0001C03D0001003D0001007D000100BD000100FD0001803D000540F9201A01B000FC4FF9E0031F2AFE0741F8C0035FD6080000000000000001000000010000000000009100004091000040f901000000201a093001000054000000360100000002008090 |
| Relocations: |
| - VirtualAddress: 4 |
| SymbolName: .Lstr |
| Type: IMAGE_REL_ARM64_PAGEBASE_REL21 |
| - VirtualAddress: 8 |
| SymbolName: .Lstr |
| Type: IMAGE_REL_ARM64_PAGEOFFSET_12A |
| - VirtualAddress: 12 |
| SymbolName: function |
| Type: IMAGE_REL_ARM64_BRANCH26 |
| - VirtualAddress: 16 |
| SymbolName: .Lglobal |
| Type: IMAGE_REL_ARM64_PAGEOFFSET_12L |
| - VirtualAddress: 20 |
| SymbolName: .Lglobal |
| Type: IMAGE_REL_ARM64_PAGEOFFSET_12L |
| - VirtualAddress: 24 |
| SymbolName: .Lglobal |
| Type: IMAGE_REL_ARM64_PAGEOFFSET_12L |
| - VirtualAddress: 28 |
| SymbolName: .Lglobal |
| Type: IMAGE_REL_ARM64_PAGEOFFSET_12L |
| - VirtualAddress: 32 |
| SymbolName: .Lglobal |
| Type: IMAGE_REL_ARM64_PAGEOFFSET_12L |
| - VirtualAddress: 36 |
| SymbolName: .Lglobal |
| Type: IMAGE_REL_ARM64_PAGEOFFSET_12L |
| - VirtualAddress: 40 |
| SymbolName: .Lglobal |
| Type: IMAGE_REL_ARM64_PAGEOFFSET_12L |
| - VirtualAddress: 44 |
| SymbolName: .Lglobal |
| Type: IMAGE_REL_ARM64_PAGEOFFSET_12L |
| - VirtualAddress: 48 |
| SymbolName: .Lglobal16 |
| Type: IMAGE_REL_ARM64_PAGEOFFSET_12L |
| - VirtualAddress: 52 |
| SymbolName: .Lglobal16 |
| Type: IMAGE_REL_ARM64_PAGEOFFSET_12L |
| - VirtualAddress: 56 |
| SymbolName: .Lglobal16 |
| Type: IMAGE_REL_ARM64_PAGEOFFSET_12L |
| - VirtualAddress: 60 |
| SymbolName: .Lglobal16 |
| Type: IMAGE_REL_ARM64_PAGEOFFSET_12L |
| - VirtualAddress: 64 |
| SymbolName: .Lglobal16 |
| Type: IMAGE_REL_ARM64_PAGEOFFSET_12L |
| - VirtualAddress: 68 |
| SymbolName: .Lglobal16 |
| Type: IMAGE_REL_ARM64_PAGEOFFSET_12L |
| - VirtualAddress: 72 |
| SymbolName: .Lglobal16 |
| Type: IMAGE_REL_ARM64_PAGEOFFSET_12L |
| - VirtualAddress: 76 |
| SymbolName: .Lglobal16 |
| Type: IMAGE_REL_ARM64_PAGEOFFSET_12L |
| - VirtualAddress: 80 |
| SymbolName: .Lglobal16 |
| Type: IMAGE_REL_ARM64_PAGEOFFSET_12L |
| - VirtualAddress: 84 |
| SymbolName: .Lglobal16 |
| Type: IMAGE_REL_ARM64_PAGEOFFSET_12L |
| - VirtualAddress: 88 |
| SymbolName: .Lglobal |
| Type: IMAGE_REL_ARM64_PAGEOFFSET_12L |
| - VirtualAddress: 92 |
| SymbolName: .Lglobal16 |
| Type: IMAGE_REL_ARM64_PAGEBASE_REL21 |
| - VirtualAddress: 96 |
| SymbolName: .Lglobal0 |
| Type: IMAGE_REL_ARM64_PAGEOFFSET_12L |
| - VirtualAddress: 112 |
| SymbolName: .Lglobal |
| Type: IMAGE_REL_ARM64_ADDR64 |
| - VirtualAddress: 120 |
| SymbolName: .Lglobal |
| Type: IMAGE_REL_ARM64_ADDR32NB |
| - VirtualAddress: 124 |
| SymbolName: .Lglobal |
| Type: IMAGE_REL_ARM64_SECREL |
| - VirtualAddress: 128 |
| SymbolName: .Lglobal5000 |
| Type: IMAGE_REL_ARM64_SECREL_LOW12A |
| - VirtualAddress: 132 |
| SymbolName: .Lglobal5000 |
| Type: IMAGE_REL_ARM64_SECREL_HIGH12A |
| - VirtualAddress: 136 |
| SymbolName: .Lglobal5000 |
| Type: IMAGE_REL_ARM64_SECREL_LOW12L |
| - VirtualAddress: 140 |
| SymbolName: .Lglobal |
| Type: IMAGE_REL_ARM64_SECTION |
| - VirtualAddress: 144 |
| SymbolName: .Lglobal |
| Type: IMAGE_REL_ARM64_REL21 |
| - VirtualAddress: 148 |
| SymbolName: function |
| Type: IMAGE_REL_ARM64_BRANCH19 |
| - VirtualAddress: 152 |
| SymbolName: function |
| Type: IMAGE_REL_ARM64_BRANCH14 |
| - VirtualAddress: 156 |
| SymbolName: main |
| Type: IMAGE_REL_ARM64_REL32 |
| - VirtualAddress: 160 |
| SymbolName: .Lstr |
| Type: IMAGE_REL_ARM64_PAGEBASE_REL21 |
| - Name: .data |
| Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ] |
| Alignment: 4 |
| SectionData: '' |
| - Name: .bss |
| Characteristics: [ IMAGE_SCN_CNT_UNINITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ] |
| Alignment: 4 |
| SectionData: '' |
| - Name: .rdata |
| Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ] |
| Alignment: 1 |
| SectionData: 00000000202068656C6C6F20776F726C6400 |
| symbols: |
| - Name: .text |
| Value: 0 |
| SectionNumber: 1 |
| SimpleType: IMAGE_SYM_TYPE_NULL |
| ComplexType: IMAGE_SYM_DTYPE_NULL |
| StorageClass: IMAGE_SYM_CLASS_STATIC |
| SectionDefinition: |
| Length: 28 |
| NumberOfRelocations: 3 |
| NumberOfLinenumbers: 0 |
| CheckSum: 1438860354 |
| Number: 1 |
| - Name: .rdata |
| Value: 0 |
| SectionNumber: 4 |
| SimpleType: IMAGE_SYM_TYPE_NULL |
| ComplexType: IMAGE_SYM_DTYPE_NULL |
| StorageClass: IMAGE_SYM_CLASS_STATIC |
| SectionDefinition: |
| Length: 12 |
| NumberOfRelocations: 0 |
| NumberOfLinenumbers: 0 |
| CheckSum: 872944732 |
| Number: 4 |
| - Name: main |
| Value: 0 |
| SectionNumber: 1 |
| SimpleType: IMAGE_SYM_TYPE_NULL |
| ComplexType: IMAGE_SYM_DTYPE_NULL |
| StorageClass: IMAGE_SYM_CLASS_EXTERNAL |
| - Name: .Lstr |
| Value: 4 |
| SectionNumber: 4 |
| SimpleType: IMAGE_SYM_TYPE_NULL |
| ComplexType: IMAGE_SYM_DTYPE_NULL |
| StorageClass: IMAGE_SYM_CLASS_STATIC |
| - Name: .Lglobal |
| Value: 8 |
| SectionNumber: 4 |
| SimpleType: IMAGE_SYM_TYPE_NULL |
| ComplexType: IMAGE_SYM_DTYPE_NULL |
| StorageClass: IMAGE_SYM_CLASS_STATIC |
| - Name: .Lglobal16 |
| Value: 16 |
| SectionNumber: 4 |
| SimpleType: IMAGE_SYM_TYPE_NULL |
| ComplexType: IMAGE_SYM_DTYPE_NULL |
| StorageClass: IMAGE_SYM_CLASS_STATIC |
| - Name: .Lglobal0 |
| Value: 0 |
| SectionNumber: 4 |
| SimpleType: IMAGE_SYM_TYPE_NULL |
| ComplexType: IMAGE_SYM_DTYPE_NULL |
| StorageClass: IMAGE_SYM_CLASS_STATIC |
| - Name: function |
| Value: 0 |
| SectionNumber: 0 |
| SimpleType: IMAGE_SYM_TYPE_NULL |
| ComplexType: IMAGE_SYM_DTYPE_NULL |
| StorageClass: IMAGE_SYM_CLASS_EXTERNAL |
| - Name: .Lglobal5000 |
| Value: 5000 |
| SectionNumber: 4 |
| SimpleType: IMAGE_SYM_TYPE_NULL |
| ComplexType: IMAGE_SYM_DTYPE_NULL |
| StorageClass: IMAGE_SYM_CLASS_STATIC |
| ... |