brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.7 KiB · f75ae17 Raw
70 lines · plain
1# RUN: yaml2obj %s -o %t2 3## When targetting non-x86_64, the "large" flag is not allowed:4# RUN: not llvm-objcopy -O elf64-tradbigmips --set-section-flags=.foo=large %t %t.mips.large 2>&1 | FileCheck %s --check-prefixes=BAD-LARGE5# BAD-LARGE: error: {{.*}}: section flag SHF_X86_64_LARGE can only be used with x86_64 architecture6 7## Converting x86_64 to non-x86_64 preserves the flag equivalent to SHF_X86_64_LARGE.8## (This is not a deliberate feature, but it reflects how preservation/setting of flags9## works for arch-specific flags.)10# RUN: llvm-objcopy -O elf64-tradbigmips --set-section-flags=.foo=alloc --set-section-flags=.bar=alloc %t %t.mips11# RUN: llvm-readobj --sections %t.mips | FileCheck %s --check-prefixes=CHECK,REINTERPRET-GPREL12 13## Converting non-x86_64 to x86_64 clears the flag equivalent to SHF_X86_64_LARGE,14## and SHF_X86_64_LARGE is set according to the presence of the "large" flag,15## as long as --set-section-flags is used. If --set-section-flag is _not_ used, then16## the section flag is retained. (This latter behaviour is also not deliberate.)17# RUN: llvm-objcopy -O elf64-x86-64 --set-section-flags=.foo=alloc --set-section-flags=.bar=alloc %t.mips %t.x86_64.no-large18# RUN: llvm-readobj --sections %t.x86_64.no-large | FileCheck %s --check-prefixes=CHECK,REINTERPRET-LARGE19# RUN: llvm-objcopy -O elf64-x86-64 --set-section-flags=.foo=alloc,large --set-section-flags=.bar=alloc,large %t.mips %t.x86_64.large20# RUN: llvm-readobj --sections %t.x86_64.large | FileCheck %s --check-prefixes=CHECK,LARGE,REINTERPRET-LARGE21 22!ELF23FileHeader:24  Class:    ELFCLASS6425  Data:     ELFDATA2LSB26  Type:     ET_REL27  Machine:  EM_X86_6428Sections:29  - Name:   .foo30    Type:   SHT_PROGBITS31    Flags:  [ ]32  - Name:   .bar33    Type:   SHT_PROGBITS34    Flags:  [ SHF_X86_64_LARGE ]35  - Name:   .untouched36    Type:   SHT_PROGBITS37    Flags:  [ ]38  - Name:   .untouched_large39    Type:   SHT_PROGBITS40    Flags:  [ SHF_X86_64_LARGE ]41 42# CHECK:         Name: .foo43# CHECK-NEXT:    Type: SHT_PROGBITS44# CHECK-NEXT:    Flags [45# CHECK-NEXT:      SHF_ALLOC (0x2)46# CHECK-NEXT:      SHF_WRITE (0x1)47# LARGE-NEXT:      SHF_X86_64_LARGE (0x10000000)48# CHECK-NEXT:    ]49 50# CHECK:         Name: .bar51# CHECK-NEXT:    Type: SHT_PROGBITS52# CHECK-NEXT:    Flags [53# CHECK-NEXT:      SHF_ALLOC (0x2)54# REINTERPRET-GPREL-NEXT: SHF_MIPS_GPREL (0x10000000)55# CHECK-NEXT:      SHF_WRITE (0x1)56# LARGE-NEXT:      SHF_X86_64_LARGE (0x10000000)57# CHECK-NEXT:    ]58 59# CHECK:         Name: .untouched60# CHECK-NEXT:    Type: SHT_PROGBITS61# CHECK-NEXT:    Flags [62# CHECK-NEXT:    ]63 64# CHECK:         Name: .untouched_large65# CHECK-NEXT:    Type: SHT_PROGBITS66# CHECK-NEXT:    Flags [67# REINTERPRET-GPREL-NEXT: SHF_MIPS_GPREL (0x10000000)68# REINTERPRET-LARGE-NEXT: SHF_X86_64_LARGE (0x10000000)69# CHECK-NEXT:    ]70