| 1 |
## When multiple sections have the same name, and --rename-section is specified, |
| 2 |
## GNU objcopy renames all these sections. This test shows that llvm-objcopy |
| 3 |
## does the same. |
| 4 |
|
| 5 |
## Note: we have to do this test in two stages because yaml2obj cannot handle |
| 6 |
## multiple sections with the same name. This has the benefit of showing that |
| 7 |
## we can rename to an already existing name. |
| 8 |
# RUN: yaml2obj %s -o %t.o |
| 9 |
|
| 10 |
## First make two sections with the same name... |
| 11 |
# RUN: llvm-objcopy --rename-section=.foo=.bar %t.o %t2.o |
| 12 |
## ... then rename them both. |
| 13 |
# RUN: llvm-objcopy --rename-section=.bar=.baz %t2.o %t3.o |
| 14 |
# RUN: llvm-readobj --sections %t3.o | FileCheck %s |
| 15 |
|
| 16 |
--- !ELF |
| 17 |
FileHeader: |
| 18 |
Class: ELFCLASS64 |
| 19 |
Data: ELFDATA2LSB |
| 20 |
Type: ET_REL |
| 21 |
Machine: EM_X86_64 |
| 22 |
Sections: |
| 23 |
- Name: .foo |
| 24 |
Type: SHT_PROGBITS |
| 25 |
Flags: [ SHF_ALLOC ] |
| 26 |
- Name: .bar |
| 27 |
Type: SHT_PROGBITS |
| 28 |
|
| 29 |
# CHECK: Name: .baz |
| 30 |
# CHECK: Name: .baz |