1 # RUN: yaml2obj %s -o %t
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-LARGE
5 # BAD-LARGE: error: {{.*}}: section flag SHF_X86_64_LARGE can only be used with x86_64 architecture
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 flags
9 ## works for arch-specific flags.)
10 # RUN: llvm-objcopy -O elf64-tradbigmips --set-section-flags=.foo=alloc --set-section-flags=.bar=alloc %t %t.mips
11 # RUN: llvm-readobj --sections %t.mips | FileCheck %s --check-prefixes=CHECK,REINTERPRET-GPREL
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, then
16 ## 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-large
18 # RUN: llvm-readobj --sections %t.x86_64.no-large | FileCheck %s --check-prefixes=CHECK,REINTERPRET-LARGE
19 # RUN: llvm-objcopy -O elf64-x86-64 --set-section-flags=.foo=alloc,large --set-section-flags=.bar=alloc,large %t.mips %t.x86_64.large
20 # RUN: llvm-readobj --sections %t.x86_64.large | FileCheck %s --check-prefixes=CHECK,LARGE,REINTERPRET-LARGE
34 Flags: [ SHF_X86_64_LARGE ]
38 - Name: .untouched_large
40 Flags: [ SHF_X86_64_LARGE ]
43 # CHECK-NEXT: Type: SHT_PROGBITS
45 # CHECK-NEXT: SHF_ALLOC (0x2)
46 # CHECK-NEXT: SHF_WRITE (0x1)
47 # LARGE-NEXT: SHF_X86_64_LARGE (0x10000000)
51 # CHECK-NEXT: Type: SHT_PROGBITS
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)
59 # CHECK: Name: .untouched
60 # CHECK-NEXT: Type: SHT_PROGBITS
64 # CHECK: Name: .untouched_large
65 # CHECK-NEXT: Type: SHT_PROGBITS
67 # REINTERPRET-GPREL-NEXT: SHF_MIPS_GPREL (0x10000000)
68 # REINTERPRET-LARGE-NEXT: SHF_X86_64_LARGE (0x10000000)