104 lines · plain
1# RUN: yaml2obj %s -o %t2 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.alloc6# RUN: llvm-readobj --sections %t.alloc | FileCheck %s --check-prefixes=CHECK,NOBITS,ALLOC,WRITE7# RUN: llvm-objcopy --rename-section=.foo=.bar,load \8# RUN: --rename-section=.baz=.blah,load %t %t.load9# RUN: llvm-readobj --sections %t.load | FileCheck %s --check-prefixes=CHECK,PROGBITS,WRITE10# RUN: llvm-objcopy --rename-section=.foo=.bar,noload \11# RUN: --rename-section=.baz=.blah,noload %t %t.noload12# RUN: llvm-readobj --sections %t.noload | FileCheck %s --check-prefixes=CHECK,PROGBITS,WRITE13# RUN: llvm-objcopy --rename-section=.foo=.bar,readonly \14# RUN: --rename-section=.baz=.blah,readonly %t %t.readonly15# RUN: llvm-readobj --sections %t.readonly | FileCheck %s --check-prefixes=CHECK,PROGBITS16# RUN: llvm-objcopy --rename-section=.foo=.bar,exclude \17# RUN: --rename-section=.baz=.blah,exclude %t %t.exclude18# RUN: llvm-readobj --sections %t.exclude | FileCheck %s --check-prefixes=CHECK,PROGBITS,EXCLUDE,WRITE19# RUN: llvm-objcopy --rename-section=.foo=.bar,debug \20# RUN: --rename-section=.baz=.blah,debug %t %t.debug21# RUN: llvm-readobj --sections %t.debug | FileCheck %s --check-prefixes=CHECK,PROGBITS,WRITE22# RUN: llvm-objcopy --rename-section=.foo=.bar,code \23# RUN: --rename-section=.baz=.blah,code %t %t.code24# RUN: llvm-readobj --sections %t.code | FileCheck %s --check-prefixes=CHECK,PROGBITS,EXEC,WRITE25# RUN: llvm-objcopy --rename-section=.foo=.bar,data \26# RUN: --rename-section=.baz=.blah,data %t %t.data27# RUN: llvm-readobj --sections %t.data | FileCheck %s --check-prefixes=CHECK,PROGBITS,WRITE28# RUN: llvm-objcopy --rename-section=.foo=.bar,rom \29# RUN: --rename-section=.baz=.blah,rom %t %t.rom30# RUN: llvm-readobj --sections %t.rom | FileCheck %s --check-prefixes=CHECK,PROGBITS,WRITE31# RUN: llvm-objcopy --rename-section=.foo=.bar,contents \32# RUN: --rename-section=.baz=.blah,contents %t %t.contents33# RUN: llvm-readobj --sections %t.contents | FileCheck %s --check-prefixes=CHECK,PROGBITS,WRITE34# RUN: llvm-objcopy --rename-section=.foo=.bar,merge \35# RUN: --rename-section=.baz=.blah,merge %t %t.merge36# RUN: llvm-readobj --sections %t.merge | FileCheck %s --check-prefixes=CHECK,PROGBITS,MERGE,WRITE37# RUN: llvm-objcopy --rename-section=.foo=.bar,strings \38# RUN: --rename-section=.baz=.blah,strings %t %t.strings39# RUN: llvm-readobj --sections %t.strings | FileCheck %s --check-prefixes=CHECK,PROGBITS,STRINGS,WRITE40# RUN: llvm-objcopy --rename-section=.foo=.bar,share \41# RUN: --rename-section=.baz=.blah,share %t %t.share42# RUN: llvm-readobj --sections %t.share | FileCheck %s --check-prefixes=CHECK,PROGBITS,WRITE43 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_strings47# RUN: llvm-readobj --sections %t.alloc_ro_strings | FileCheck %s --check-prefixes=CHECK,NOBITS,ALLOC,STRINGS48# RUN: llvm-objcopy --rename-section=.foo=.bar,alloc,code \49# RUN: --rename-section=.baz=.blah,alloc,code %t %t.alloc_code50# RUN: llvm-readobj --sections %t.alloc_code | FileCheck %s --check-prefixes=CHECK,NOBITS,ALLOC,EXEC,WRITE51 52# Invalid flags:53# RUN: not llvm-objcopy --rename-section=.foo=.bar,xyzzy %t %t.xyzzy 2>&1 | FileCheck %s --check-prefix=BAD-FLAG54 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.upper58# RUN: llvm-readobj --sections %t.upper | FileCheck %s --check-prefixes=CHECK,PROGBITS,ALLOC,EXEC,MERGE,STRINGS59 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.mixed63# RUN: llvm-readobj --sections %t.mixed | FileCheck %s --check-prefixes=CHECK,PROGBITS,ALLOC,EXEC,MERGE,STRINGS64 65!ELF66FileHeader:67 Class: ELFCLASS6468 Data: ELFDATA2LSB69 Type: ET_REL70 Machine: EM_X86_6471Sections:72 - Name: .foo73 Type: SHT_PROGBITS74 Flags: [ ]75 Content: "c3c3c3c3"76 - Name: .baz77 Type: SHT_NOBITS78 Flags: [ ]79 80# CHECK: Name: .bar81# CHECK-NEXT: Type: SHT_PROGBITS82# 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: .blah92# NOBITS-NEXT: Type: SHT_NOBITS93# PROGBITS-NEXT: Type: SHT_PROGBITS94# 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, strings104