xref: /llvm-project/llvm/test/tools/llvm-objcopy/ELF/set-section-attr-and-rename.test (revision b28412d5397dc5a23f172d6ebeac760c82a82248)
1# RUN: yaml2obj %s -o %t
2
3# RUN: llvm-objcopy --rename-section=.foo=.bar --set-section-alignment=.foo=16 --set-section-flags=.foo=alloc --set-section-type=.foo=5 %t %t.1
4# RUN: llvm-readobj -S %t.1 | FileCheck %s
5
6# CHECK:      Name: .bar
7# CHECK-NEXT: Type: SHT_HASH (0x5)
8# CHECK-NEXT: Flags [
9# CHECK-NEXT:   SHF_ALLOC
10# CHECK-NEXT:   SHF_WRITE
11# CHECK-NEXT: ]
12# CHECK:      AddressAlignment:
13# CHECK-SAME:   {{^}} 16
14
15# RUN: not llvm-objcopy --rename-section=.foo=.bar --set-section-flags=.bar=alloc %t %t.2 2>&1 | \
16# RUN:   FileCheck %s --check-prefix=SET-BAR1
17# SET-BAR1: --set-section-flags=.bar conflicts with --rename-section=.foo=.bar
18
19# RUN: not llvm-objcopy --rename-section=.foo=.bar --set-section-type=.bar=1 %t %t.2 2>&1 | \
20# RUN:   FileCheck %s --check-prefix=SET-BAR2
21# SET-BAR2: --set-section-type=.bar conflicts with --rename-section=.foo=.bar
22
23!ELF
24FileHeader:
25  Class:           ELFCLASS64
26  Data:            ELFDATA2LSB
27  Type:            ET_REL
28  Machine:         EM_X86_64
29Sections:
30  - Name:  .foo
31    Type:  SHT_PROGBITS
32    Flags: [ SHF_ALLOC ]
33