Peter Smith | 20489ec | 2017-09-07 16:29:52 | [diff] [blame] | 1 | # REQUIRES: aarch64 |
| 2 | |
| 3 | # RUN: yaml2obj %s -o %t.o |
| 4 | # RUN: ld.lld %t.o -o %t.out |
Fangrui Song | f66b767 | 2019-08-20 08:34:56 | [diff] [blame] | 5 | # RUN: llvm-objdump -d --no-show-raw-insn %t.out | FileCheck %s |
Peter Smith | 20489ec | 2017-09-07 16:29:52 | [diff] [blame] | 6 | |
| 7 | # Check that the R_AARCH64_JUMP26 writes the branch opcode as well as the |
| 8 | # immediate. We use this property to overwrite instructions with a branch. |
| 9 | |
| 10 | # CHECK: Disassembly of section .text: |
Fangrui Song | 5387c2c | 2019-05-01 10:40:48 | [diff] [blame] | 11 | # CHECK-EMPTY: |
Fangrui Song | 71e2ca6 | 2020-03-05 22:18:38 | [diff] [blame] | 12 | # CHECK-NEXT: <foo>: |
Fangrui Song | 7f36cb1 | 2020-04-10 01:46:35 | [diff] [blame] | 13 | # CHECK-NEXT: 210120: b 0x210124 |
Fangrui Song | 71e2ca6 | 2020-03-05 22:18:38 | [diff] [blame] | 14 | # CHECK: <bar>: |
Fangrui Song | 7f36cb1 | 2020-04-10 01:46:35 | [diff] [blame] | 15 | # CHECK-NEXT: 210124: b 0x210120 |
Peter Smith | 20489ec | 2017-09-07 16:29:52 | [diff] [blame] | 16 | |
| 17 | !ELF |
| 18 | FileHeader: |
| 19 | Class: ELFCLASS64 |
| 20 | Data: ELFDATA2LSB |
| 21 | Type: ET_REL |
| 22 | Machine: EM_AARCH64 |
| 23 | Sections: |
| 24 | - Type: SHT_PROGBITS |
| 25 | Name: .text |
| 26 | Flags: [ SHF_ALLOC, SHF_EXECINSTR ] |
| 27 | Content: "0000000000000000" |
| 28 | - Type: SHT_RELA |
| 29 | Name: .rela.text |
| 30 | Link: .symtab |
| 31 | Info: .text |
| 32 | Relocations: |
Georgii Rymar | e4ceb8f | 2020-03-04 13:55:15 | [diff] [blame] | 33 | - Symbol: bar |
Peter Smith | 20489ec | 2017-09-07 16:29:52 | [diff] [blame] | 34 | Type: R_AARCH64_JUMP26 |
| 35 | - Offset: 4 |
| 36 | Symbol: foo |
| 37 | Type: R_AARCH64_JUMP26 |
| 38 | |
| 39 | Symbols: |
George Rimar | ff33972 | 2019-04-03 14:54:22 | [diff] [blame] | 40 | - Type: STT_FUNC |
| 41 | Section: .text |
| 42 | Name: foo |
| 43 | Value: 0 |
| 44 | - Type: STT_FUNC |
| 45 | Section: .text |
| 46 | Name: bar |
| 47 | Value: 4 |