James Henderson | 5772e02 | 2019-05-10 12:58:52 +0000 | [diff] [blame] | 1 | ## This test checks that if a section has a sh_link field, and one or more |
| 2 | ## sections are removed such that the target section index changes, then |
| 3 | ## llvm-objcopy correctly updates the sh_link field. |
| 4 | |
| 5 | # RUN: yaml2obj %s -o %t.o |
| 6 | # RUN: llvm-objcopy --remove-section .foo %t.o %t2.o |
| 7 | # RUN: llvm-readobj --section-headers %t2.o | FileCheck %s |
| 8 | |
| 9 | --- !ELF |
| 10 | FileHeader: |
| 11 | Class: ELFCLASS64 |
| 12 | Data: ELFDATA2LSB |
| 13 | Type: ET_EXEC |
| 14 | Machine: EM_X86_64 |
| 15 | Sections: |
| 16 | - Name: .foo |
| 17 | Type: SHT_PROGBITS |
| 18 | - Name: .bar |
| 19 | Type: SHT_PROGBITS |
| 20 | - Name: .baz |
| 21 | Type: SHT_PROGBITS |
| 22 | Link: .bar |
| 23 | |
| 24 | # CHECK: Index: 1 |
| 25 | # CHECK-NEXT: Name: .bar |
| 26 | # CHECK: Name: .baz |
| 27 | ## Find the next "Link" line, then check the value is exactly the index of .bar. |
| 28 | # CHECK: Link |
| 29 | # CHECK-SAME: : 1{{$}} |