1# RUN: yaml2obj %s -o %t 2 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 43 44# Multiple flags: 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 51 52# Invalid flags: 53# RUN: not llvm-objcopy --rename-section=.foo=.bar,xyzzy %t %t.xyzzy 2>&1 | FileCheck %s --check-prefix=BAD-FLAG 54 55# Upper-case flags: 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 59 60# Mixed-case flags: 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 64 65!ELF 66FileHeader: 67 Class: ELFCLASS64 68 Data: ELFDATA2LSB 69 Type: ET_REL 70 Machine: EM_X86_64 71Sections: 72 - Name: .foo 73 Type: SHT_PROGBITS 74 Flags: [ ] 75 Content: "c3c3c3c3" 76 - Name: .baz 77 Type: SHT_NOBITS 78 Flags: [ ] 79 80# CHECK: Name: .bar 81# CHECK-NEXT: Type: SHT_PROGBITS 82# CHECK-NEXT: Flags [ 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) 89# CHECK-NEXT: ] 90 91# CHECK: Name: .blah 92# NOBITS-NEXT: Type: SHT_NOBITS 93# PROGBITS-NEXT: Type: SHT_PROGBITS 94# CHECK-NEXT: Flags [ 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) 101# CHECK-NEXT: ] 102 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 104