1 # RUN: yaml2obj %s -o %t
3 # Single flags on a section with all flags:
4 # RUN: llvm-objcopy --rename-section=.foo=.bar,alloc %t %t.alloc
5 # RUN: llvm-readobj --sections %t.alloc | FileCheck %s --check-prefixes=CHECK,ALLOC,WRITE
6 # RUN: llvm-objcopy --rename-section=.foo=.bar,load %t %t.load
7 # RUN: llvm-readobj --sections %t.load | FileCheck %s --check-prefixes=CHECK,WRITE
8 # RUN: llvm-objcopy --rename-section=.foo=.bar,noload %t %t.noload
9 # RUN: llvm-readobj --sections %t.noload | FileCheck %s --check-prefixes=CHECK,WRITE
10 # RUN: llvm-objcopy --rename-section=.foo=.bar,readonly %t %t.readonly
11 # RUN: llvm-readobj --sections %t.readonly | FileCheck %s --check-prefixes=CHECK
12 # RUN: llvm-objcopy --rename-section=.foo=.bar,debug %t %t.debug
13 # RUN: llvm-readobj --sections %t.debug | FileCheck %s --check-prefixes=CHECK,WRITE
14 # RUN: llvm-objcopy --rename-section=.foo=.bar,code %t %t.code
15 # RUN: llvm-readobj --sections %t.code | FileCheck %s --check-prefixes=CHECK,EXEC,WRITE
16 # RUN: llvm-objcopy --rename-section=.foo=.bar,data %t %t.data
17 # RUN: llvm-readobj --sections %t.data | FileCheck %s --check-prefixes=CHECK,WRITE
18 # RUN: llvm-objcopy --rename-section=.foo=.bar,rom %t %t.rom
19 # RUN: llvm-readobj --sections %t.rom | FileCheck %s --check-prefixes=CHECK,WRITE
20 # RUN: llvm-objcopy --rename-section=.foo=.bar,contents %t %t.contents
21 # RUN: llvm-readobj --sections %t.contents | FileCheck %s --check-prefixes=CHECK,WRITE
22 # RUN: llvm-objcopy --rename-section=.foo=.bar,merge %t %t.merge
23 # RUN: llvm-readobj --sections %t.merge | FileCheck %s --check-prefixes=CHECK,MERGE,WRITE
24 # RUN: llvm-objcopy --rename-section=.foo=.bar,strings %t %t.strings
25 # RUN: llvm-readobj --sections %t.strings | FileCheck %s --check-prefixes=CHECK,STRINGS,WRITE
26 # RUN: llvm-objcopy --rename-section=.foo=.bar,share %t %t.share
27 # RUN: llvm-readobj --sections %t.share | FileCheck %s --check-prefixes=CHECK,WRITE
28 # RUN: llvm-objcopy --rename-section=.foo=.bar,exclude %t %t.exclude
29 # RUN: llvm-readobj --sections %t.exclude | FileCheck %s --check-prefixes=CHECK,WRITE,EXCLUDE
31 ## Show that if no flags are specified, all existing flags are preserved.
32 ## Note: GNU objcopy does not preserve the SHF_OS_NONCONFORMING flag.
33 # RUN: llvm-objcopy --rename-section=.foo=.bar %t %t.none
34 # RUN: llvm-readobj --sections %t.none | FileCheck %s --check-prefixes=CHECK,ALLOC,EXCLUDE,EXEC,MERGE,NONCONFORMING,STRINGS,WRITE
51 - SectionOrType: GRP_COMDAT
56 Flags: [ SHF_ALLOC, SHF_COMPRESSED, SHF_EXCLUDE, SHF_EXECINSTR,
57 SHF_GROUP, SHF_INFO_LINK, SHF_LINK_ORDER, SHF_MERGE,
58 SHF_OS_NONCONFORMING, SHF_STRINGS, SHF_TLS, SHF_WRITE ]
65 # CHECK-NEXT: Type: SHT_PROGBITS
67 # ALLOC-NEXT: SHF_ALLOC (0x2)
68 # CHECK-NEXT: SHF_COMPRESSED (0x800)
69 # EXCLUDE-NEXT: SHF_EXCLUDE (0x80000000)
70 # EXEC-NEXT: SHF_EXECINSTR (0x4)
71 # CHECK-NEXT: SHF_GROUP (0x200)
72 # CHECK-NEXT: SHF_INFO_LINK (0x40)
73 # CHECK-NEXT: SHF_LINK_ORDER (0x80)
74 # MERGE-NEXT: SHF_MERGE (0x10)
75 # NONCONFORMING-NEXT: SHF_OS_NONCONFORMING (0x100)
76 # STRINGS-NEXT: SHF_STRINGS (0x20)
77 # CHECK-NEXT: SHF_TLS (0x400)
78 # WRITE-NEXT: SHF_WRITE (0x1)