xref: /llvm-project/llvm/test/tools/llvm-objcopy/ELF/prefix-alloc-sections.test (revision 1562e4552cd1b3d2eadd956c966f8a60e928b8ca)
1# RUN: yaml2obj %s -o %t
2# RUN: llvm-objcopy --prefix-alloc-sections=.prefix %t %t2
3# RUN: llvm-readobj --sections %t2 | FileCheck %s
4
5## Show that an empty string is permitted as the argument to
6## --prefix-alloc-sections.
7# RUN: llvm-objcopy --prefix-alloc-sections= %t2 %t3
8# RUN: cmp %t2 %t3
9
10## Show that only the last prefix is applied.
11# RUN: llvm-objcopy --prefix-alloc-sections=.bar --prefix-alloc-sections=.prefix %t %t4
12# RUN: cmp %t2 %t4
13
14!ELF
15FileHeader:
16  Class:           ELFCLASS64
17  Data:            ELFDATA2LSB
18  Type:            ET_REL
19  Machine:         EM_X86_64
20Sections:
21  - Name:            .foo
22    Type:            SHT_PROGBITS
23    Flags:           [  ]
24  - Name:            .prefix.already_prefixed
25    Type:            SHT_PROGBITS
26    Flags:           [ SHF_ALLOC ]
27  - Name:            .text
28    Type:            SHT_PROGBITS
29    Flags:           [ SHF_ALLOC ]
30  - Name:            .rel.text
31    Type:            SHT_REL
32    Info:            .text
33  - Name:            .rela.data
34    Type:            SHT_RELA
35    Info:            .data
36  - Name:            .data
37    Type:            SHT_PROGBITS
38    Flags:           [ SHF_ALLOC ]
39
40# CHECK: Name: .foo
41# CHECK: Name: .prefix.prefix.already_prefixed
42# CHECK: Name: .prefix.text
43# CHECK: Name: .rel.prefix.text
44# CHECK: Name: .rela.prefix.data
45# CHECK: Name: .prefix.data
46