| 1 |
# RUN: yaml2obj %s -o %t |
| 2 |
|
| 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 |
| 30 |
|
| 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 |
| 35 |
|
| 36 |
!ELF |
| 37 |
FileHeader: |
| 38 |
Class: ELFCLASS64 |
| 39 |
Data: ELFDATA2LSB |
| 40 |
Type: ET_REL |
| 41 |
Machine: EM_X86_64 |
| 42 |
Sections: |
| 43 |
- Name: .infolink |
| 44 |
Type: SHT_NOBITS |
| 45 |
- Name: .group |
| 46 |
Type: SHT_GROUP |
| 47 |
Link: .symtab |
| 48 |
Flags: [ ] |
| 49 |
Info: dummy |
| 50 |
Members: |
| 51 |
- SectionOrType: GRP_COMDAT |
| 52 |
- SectionOrType: .foo |
| 53 |
- Name: .foo |
| 54 |
Type: SHT_PROGBITS |
| 55 |
Link: .infolink |
| 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 ] |
| 59 |
Content: "a4a4a4a4" |
| 60 |
Symbols: |
| 61 |
- Name: dummy |
| 62 |
Section: .group |
| 63 |
|
| 64 |
# CHECK: Name: .bar |
| 65 |
# CHECK-NEXT: Type: SHT_PROGBITS |
| 66 |
# CHECK-NEXT: Flags [ |
| 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) |
| 79 |
# CHECK-NEXT: ] |