| 1 |
## --add-section is handled before --rename-section. Note: GNU objcopy produces .foo2. |
| 2 |
# RUN: yaml2obj %s -o %t |
| 3 |
# RUN: llvm-objcopy --rename-section=.foo1=.foo2 --add-section=.foo1=/dev/null %t %t.1 |
| 4 |
# RUN: llvm-readobj -S %t.1 | FileCheck %s |
| 5 |
|
| 6 |
# CHECK: Name: .foo2 |
| 7 |
# CHECK-NEXT: Type: SHT_PROGBITS |
| 8 |
# CHECK-NEXT: Flags [ |
| 9 |
# CHECK-NEXT: ] |
| 10 |
|
| 11 |
## --update-section is handled before --rename-section. |
| 12 |
# RUN: echo 00 > %t.nop |
| 13 |
# RUN: llvm-objcopy --rename-section=.text=.text2 --update-section=.text=%t.nop %t %t.2 |
| 14 |
# RUN: llvm-readelf -x .text2 %t.2 | FileCheck %s --check-prefix=CHECK2 |
| 15 |
|
| 16 |
# CHECK2: Hex dump of section '.text2': |
| 17 |
# CHECK2-NEXT: 0x00000000 30300a |
| 18 |
|
| 19 |
!ELF |
| 20 |
FileHeader: |
| 21 |
Class: ELFCLASS64 |
| 22 |
Data: ELFDATA2LSB |
| 23 |
Type: ET_REL |
| 24 |
Machine: EM_X86_64 |
| 25 |
Sections: |
| 26 |
- Name: .text |
| 27 |
Type: SHT_PROGBITS |
| 28 |
Flags: [ SHF_ALLOC, SHF_EXECINSTR ] |
| 29 |
Content: "c3c3c3" |