1 # RUN: yaml2obj %s > %t
3 # Single flags on a section with no flags:
4 # RUN: llvm-objcopy --rename-section=.foo=.bar,alloc \
5 # RUN: --rename-section=.baz=.blah,alloc %t %t.alloc
6 # RUN: llvm-readobj --sections %t.alloc | FileCheck %s --check-prefixes=CHECK,NOBITS,ALLOC,WRITE
7 # RUN: llvm-objcopy --rename-section=.foo=.bar,load \
8 # RUN: --rename-section=.baz=.blah,load %t %t.load
9 # RUN: llvm-readobj --sections %t.load | FileCheck %s --check-prefixes=CHECK,PROGBITS,WRITE
10 # RUN: llvm-objcopy --rename-section=.foo=.bar,noload \
11 # RUN: --rename-section=.baz=.blah,noload %t %t.noload
12 # RUN: llvm-readobj --sections %t.noload | FileCheck %s --check-prefixes=CHECK,PROGBITS,WRITE
13 # RUN: llvm-objcopy --rename-section=.foo=.bar,readonly \
14 # RUN: --rename-section=.baz=.blah,readonly %t %t.readonly
15 # RUN: llvm-readobj --sections %t.readonly | FileCheck %s --check-prefixes=CHECK,PROGBITS
16 # RUN: llvm-objcopy --rename-section=.foo=.bar,debug \
17 # RUN: --rename-section=.baz=.blah,debug %t %t.debug
18 # RUN: llvm-readobj --sections %t.debug | FileCheck %s --check-prefixes=CHECK,PROGBITS,WRITE
19 # RUN: llvm-objcopy --rename-section=.foo=.bar,code \
20 # RUN: --rename-section=.baz=.blah,code %t %t.code
21 # RUN: llvm-readobj --sections %t.code | FileCheck %s --check-prefixes=CHECK,PROGBITS,EXEC,WRITE
22 # RUN: llvm-objcopy --rename-section=.foo=.bar,data \
23 # RUN: --rename-section=.baz=.blah,data %t %t.data
24 # RUN: llvm-readobj --sections %t.data | FileCheck %s --check-prefixes=CHECK,PROGBITS,WRITE
25 # RUN: llvm-objcopy --rename-section=.foo=.bar,rom \
26 # RUN: --rename-section=.baz=.blah,rom %t %t.rom
27 # RUN: llvm-readobj --sections %t.rom | FileCheck %s --check-prefixes=CHECK,PROGBITS,WRITE
28 # RUN: llvm-objcopy --rename-section=.foo=.bar,contents \
29 # RUN: --rename-section=.baz=.blah,contents %t %t.contents
30 # RUN: llvm-readobj --sections %t.contents | FileCheck %s --check-prefixes=CHECK,PROGBITS,WRITE
31 # RUN: llvm-objcopy --rename-section=.foo=.bar,merge \
32 # RUN: --rename-section=.baz=.blah,merge %t %t.merge
33 # RUN: llvm-readobj --sections %t.merge | FileCheck %s --check-prefixes=CHECK,PROGBITS,MERGE,WRITE
34 # RUN: llvm-objcopy --rename-section=.foo=.bar,strings \
35 # RUN: --rename-section=.baz=.blah,strings %t %t.strings
36 # RUN: llvm-readobj --sections %t.strings | FileCheck %s --check-prefixes=CHECK,PROGBITS,STRINGS,WRITE
37 # RUN: llvm-objcopy --rename-section=.foo=.bar,share \
38 # RUN: --rename-section=.baz=.blah,share %t %t.share
39 # RUN: llvm-readobj --sections %t.share | FileCheck %s --check-prefixes=CHECK,PROGBITS,WRITE
42 # RUN: llvm-objcopy --rename-section=.foo=.bar,alloc,readonly,strings \
43 # RUN: --rename-section=.baz=.blah,alloc,readonly,strings %t %t.alloc_ro_strings
44 # RUN: llvm-readobj --sections %t.alloc_ro_strings | FileCheck %s --check-prefixes=CHECK,NOBITS,ALLOC,STRINGS
45 # RUN: llvm-objcopy --rename-section=.foo=.bar,alloc,code \
46 # RUN: --rename-section=.baz=.blah,alloc,code %t %t.alloc_code
47 # RUN: llvm-readobj --sections %t.alloc_code | FileCheck %s --check-prefixes=CHECK,NOBITS,ALLOC,EXEC,WRITE
50 # RUN: not llvm-objcopy --rename-section=.foo=.bar,xyzzy %t %t.xyzzy 2>&1 | FileCheck %s --check-prefix=BAD-FLAG
53 # RUN: llvm-objcopy --rename-section=.foo=.bar,ALLOC,LOAD,NOLOAD,READONLY,DEBUG,CODE,DATA,ROM,CONTENTS,MERGE,STRINGS,SHARE \
54 # RUN: --rename-section=.baz=.blah,ALLOC,LOAD,NOLOAD,READONLY,DEBUG,CODE,DATA,ROM,CONTENTS,MERGE,STRINGS,SHARE %t %t.upper
55 # RUN: llvm-readobj --sections %t.upper | FileCheck %s --check-prefixes=CHECK,PROGBITS,ALLOC,EXEC,MERGE,STRINGS
58 # RUN: llvm-objcopy --rename-section=.foo=.bar,aLlOc,LoAd,NoLoad,rEAdONly,Debug,codE,DaTa,rOm,CoNtEnTs,mErGe,sTRINGs,SharE \
59 # RUN: --rename-section=.baz=.blah,aLlOc,LoAd,NoLoad,rEAdONly,Debug,codE,DaTa,rOm,CoNtEnTs,mErGe,sTRINGs,SharE %t %t.mixed
60 # RUN: llvm-readobj --sections %t.mixed | FileCheck %s --check-prefixes=CHECK,PROGBITS,ALLOC,EXEC,MERGE,STRINGS
78 # CHECK-NEXT: Type: SHT_PROGBITS
80 # ALLOC-NEXT: SHF_ALLOC (0x2)
81 # EXEC-NEXT: SHF_EXECINSTR (0x4)
82 # MERGE-NEXT: SHF_MERGE (0x10)
83 # STRINGS-NEXT: SHF_STRINGS (0x20)
84 # WRITE-NEXT: SHF_WRITE (0x1)
88 # NOBITS-NEXT: Type: SHT_NOBITS
89 # PROGBITS-NEXT: Type: SHT_PROGBITS
91 # ALLOC-NEXT: SHF_ALLOC (0x2)
92 # EXEC-NEXT: SHF_EXECINSTR (0x4)
93 # MERGE-NEXT: SHF_MERGE (0x10)
94 # STRINGS-NEXT: SHF_STRINGS (0x20)
95 # WRITE-NEXT: SHF_WRITE (0x1)
98 # BAD-FLAG: unrecognized section flag 'xyzzy'. Flags supported for GNU compatibility: alloc, load, noload, readonly, debug, code, data, rom, share, contents, merge, strings