1 # RUN: yaml2obj %s -o %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,exclude \
17 # RUN: --rename-section=.baz=.blah,exclude %t %t.exclude
18 # RUN: llvm-readobj --sections %t.exclude | FileCheck %s --check-prefixes=CHECK,PROGBITS,EXCLUDE,WRITE
19 # RUN: llvm-objcopy --rename-section=.foo=.bar,debug \
20 # RUN: --rename-section=.baz=.blah,debug %t %t.debug
21 # RUN: llvm-readobj --sections %t.debug | FileCheck %s --check-prefixes=CHECK,PROGBITS,WRITE
22 # RUN: llvm-objcopy --rename-section=.foo=.bar,code \
23 # RUN: --rename-section=.baz=.blah,code %t %t.code
24 # RUN: llvm-readobj --sections %t.code | FileCheck %s --check-prefixes=CHECK,PROGBITS,EXEC,WRITE
25 # RUN: llvm-objcopy --rename-section=.foo=.bar,data \
26 # RUN: --rename-section=.baz=.blah,data %t %t.data
27 # RUN: llvm-readobj --sections %t.data | FileCheck %s --check-prefixes=CHECK,PROGBITS,WRITE
28 # RUN: llvm-objcopy --rename-section=.foo=.bar,rom \
29 # RUN: --rename-section=.baz=.blah,rom %t %t.rom
30 # RUN: llvm-readobj --sections %t.rom | FileCheck %s --check-prefixes=CHECK,PROGBITS,WRITE
31 # RUN: llvm-objcopy --rename-section=.foo=.bar,contents \
32 # RUN: --rename-section=.baz=.blah,contents %t %t.contents
33 # RUN: llvm-readobj --sections %t.contents | FileCheck %s --check-prefixes=CHECK,PROGBITS,WRITE
34 # RUN: llvm-objcopy --rename-section=.foo=.bar,merge \
35 # RUN: --rename-section=.baz=.blah,merge %t %t.merge
36 # RUN: llvm-readobj --sections %t.merge | FileCheck %s --check-prefixes=CHECK,PROGBITS,MERGE,WRITE
37 # RUN: llvm-objcopy --rename-section=.foo=.bar,strings \
38 # RUN: --rename-section=.baz=.blah,strings %t %t.strings
39 # RUN: llvm-readobj --sections %t.strings | FileCheck %s --check-prefixes=CHECK,PROGBITS,STRINGS,WRITE
40 # RUN: llvm-objcopy --rename-section=.foo=.bar,share \
41 # RUN: --rename-section=.baz=.blah,share %t %t.share
42 # RUN: llvm-readobj --sections %t.share | FileCheck %s --check-prefixes=CHECK,PROGBITS,WRITE
45 # RUN: llvm-objcopy --rename-section=.foo=.bar,alloc,readonly,strings \
46 # RUN: --rename-section=.baz=.blah,alloc,readonly,strings %t %t.alloc_ro_strings
47 # RUN: llvm-readobj --sections %t.alloc_ro_strings | FileCheck %s --check-prefixes=CHECK,NOBITS,ALLOC,STRINGS
48 # RUN: llvm-objcopy --rename-section=.foo=.bar,alloc,code \
49 # RUN: --rename-section=.baz=.blah,alloc,code %t %t.alloc_code
50 # RUN: llvm-readobj --sections %t.alloc_code | FileCheck %s --check-prefixes=CHECK,NOBITS,ALLOC,EXEC,WRITE
53 # RUN: not llvm-objcopy --rename-section=.foo=.bar,xyzzy %t %t.xyzzy 2>&1 | FileCheck %s --check-prefix=BAD-FLAG
56 # RUN: llvm-objcopy --rename-section=.foo=.bar,ALLOC,LOAD,NOLOAD,READONLY,DEBUG,CODE,DATA,ROM,CONTENTS,MERGE,STRINGS,SHARE \
57 # RUN: --rename-section=.baz=.blah,ALLOC,LOAD,NOLOAD,READONLY,DEBUG,CODE,DATA,ROM,CONTENTS,MERGE,STRINGS,SHARE %t %t.upper
58 # RUN: llvm-readobj --sections %t.upper | FileCheck %s --check-prefixes=CHECK,PROGBITS,ALLOC,EXEC,MERGE,STRINGS
61 # RUN: llvm-objcopy --rename-section=.foo=.bar,aLlOc,LoAd,NoLoad,rEAdONly,Debug,codE,DaTa,rOm,CoNtEnTs,mErGe,sTRINGs,SharE \
62 # RUN: --rename-section=.baz=.blah,aLlOc,LoAd,NoLoad,rEAdONly,Debug,codE,DaTa,rOm,CoNtEnTs,mErGe,sTRINGs,SharE %t %t.mixed
63 # RUN: llvm-readobj --sections %t.mixed | FileCheck %s --check-prefixes=CHECK,PROGBITS,ALLOC,EXEC,MERGE,STRINGS
81 # CHECK-NEXT: Type: SHT_PROGBITS
83 # ALLOC-NEXT: SHF_ALLOC (0x2)
84 # EXEC-NEXT: SHF_EXECINSTR (0x4)
85 # MERGE-NEXT: SHF_MERGE (0x10)
86 # STRINGS-NEXT: SHF_STRINGS (0x20)
87 # EXCLUDE-NEXT: SHF_EXCLUDE (0x80000000)
88 # WRITE-NEXT: SHF_WRITE (0x1)
92 # NOBITS-NEXT: Type: SHT_NOBITS
93 # PROGBITS-NEXT: Type: SHT_PROGBITS
95 # ALLOC-NEXT: SHF_ALLOC (0x2)
96 # EXEC-NEXT: SHF_EXECINSTR (0x4)
97 # MERGE-NEXT: SHF_MERGE (0x10)
98 # STRINGS-NEXT: SHF_STRINGS (0x20)
99 # EXCLUDE-NEXT: SHF_EXCLUDE (0x80000000)
100 # WRITE-NEXT: SHF_WRITE (0x1)
103 # BAD-FLAG: unrecognized section flag 'xyzzy'. Flags supported for GNU compatibility: alloc, load, noload, readonly, exclude, debug, code, data, rom, share, contents, merge, strings