brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.3 KiB · 51a01f3 Raw
149 lines · plain
1# Test that cpu/processor-specific SHF_* flags are preserved,2# except SHF_X86_64_LARGE on x86_64 (which is controlled with the3# "large" flag).4 5# ===== x86_64 =====6 7# RUN: yaml2obj --docnum=1 %s -o %t-x86_64.o8# RUN: llvm-objcopy --rename-section=.foo=.bar,alloc %t-x86_64.o9# RUN: llvm-readobj --sections %t-x86_64.o | FileCheck %s --check-prefix=X86_6410# RUN: llvm-objcopy --rename-section=.bar=.quz,alloc,large %t-x86_64.o11# RUN: llvm-readobj --sections %t-x86_64.o | FileCheck %s --check-prefix=X86_64-LARGE12 13--- !ELF14FileHeader:15  Class:           ELFCLASS6416  Data:            ELFDATA2LSB17  Type:            ET_REL18  Machine:         EM_X86_6419Sections:20  - Name:          .foo21    Type:          SHT_PROGBITS22    Flags:         [ SHF_X86_64_LARGE ]23 24# X86_64:        Name: .bar25# X86_64-NEXT:   Type: SHT_PROGBITS26# X86_64-NEXT:   Flags [27# X86_64-NEXT:     SHF_ALLOC (0x2)28# X86_64-NEXT:     SHF_WRITE (0x1)29# X86_64-NEXT:   ]30 31# X86_64-LARGE:        Name: .quz32# X86_64-LARGE-NEXT:   Type: SHT_PROGBITS33# X86_64-LARGE-NEXT:   Flags [34# X86_64-LARGE-NEXT:     SHF_ALLOC (0x2)35# X86_64-LARGE-NEXT:     SHF_WRITE (0x1)36# X86_64-LARGE-NEXT:     SHF_X86_64_LARGE (0x10000000)37# X86_64-LARGE-NEXT:   ]38 39# ===== hex =====40 41# RUN: yaml2obj --docnum=2 %s -o %t-hex.o42# RUN: llvm-objcopy --rename-section=.foo=.bar,alloc %t-hex.o43# RUN: llvm-readobj --sections %t-hex.o | FileCheck %s --check-prefix=HEX44 45--- !ELF46FileHeader:47  Class:           ELFCLASS6448  Data:            ELFDATA2LSB49  Type:            ET_REL50  Machine:         EM_HEXAGON51Sections:52  - Name:          .foo53    Type:          SHT_PROGBITS54    Flags:         [ SHF_HEX_GPREL ]55 56# HEX:        Name: .bar57# HEX-NEXT:   Type: SHT_PROGBITS58# HEX-NEXT:   Flags [59# HEX-NEXT:     SHF_ALLOC (0x2)60# HEX-NEXT:     SHF_HEX_GPREL (0x10000000)61# HEX-NEXT:     SHF_WRITE (0x1)62# HEX-NEXT:   ]63 64# ===== mips =====65 66# RUN: yaml2obj --docnum=3 %s -o %t-mips.o67# RUN: llvm-objcopy --rename-section=.foo=.bar,alloc %t-mips.o68# RUN: llvm-readobj --sections %t-mips.o | FileCheck %s --check-prefix=MIPS69 70--- !ELF71FileHeader:72  Class:           ELFCLASS6473  Data:            ELFDATA2LSB74  Type:            ET_REL75  Machine:         EM_MIPS76Sections:77  - Name:          .foo78    Type:          SHT_PROGBITS79    Flags:         [ SHF_MIPS_NODUPES, SHF_MIPS_NAMES, SHF_MIPS_LOCAL,80                     SHF_MIPS_NOSTRIP, SHF_MIPS_GPREL, SHF_MIPS_MERGE,81		     SHF_MIPS_ADDR, SHF_MIPS_STRING ]82 83# Note: llvm-readobj prints SHF_EXCLUDE/SHF_MASKPROC since specifying all84# SHF_MIPS_* flags covers the same bitset.85 86# MIPS:        Name: .bar87# MIPS-NEXT:   Type: SHT_PROGBITS88# MIPS-NEXT:   Flags [89# MIPS-NEXT:     SHF_ALLOC (0x2)90# MIPS-NEXT:     SHF_MIPS_ADDR (0x40000000)91# MIPS-NEXT:     SHF_MIPS_GPREL (0x10000000)92# MIPS-NEXT:     SHF_MIPS_LOCAL (0x4000000)93# MIPS-NEXT:     SHF_MIPS_MERGE (0x20000000)94# MIPS-NEXT:     SHF_MIPS_NAMES (0x2000000)95# MIPS-NEXT:     SHF_MIPS_NODUPES (0x1000000)96# MIPS-NEXT:     SHF_MIPS_NOSTRIP (0x8000000)97# MIPS-NEXT:     SHF_WRITE (0x1)98# MIPS-NEXT:   ]99 100# ===== arm =====101 102# RUN: yaml2obj --docnum=4 %s -o %t-arm.o103# RUN: llvm-objcopy --rename-section=.foo=.bar,alloc %t-arm.o104# RUN: llvm-readobj --sections %t-arm.o | FileCheck %s --check-prefix=ARM105 106--- !ELF107FileHeader:108  Class:           ELFCLASS64109  Data:            ELFDATA2LSB110  Type:            ET_REL111  Machine:         EM_ARM112Sections:113  - Name:          .foo114    Type:          SHT_PROGBITS115    Flags:         [ SHF_ARM_PURECODE ]116 117# ARM:        Name: .bar118# ARM-NEXT:   Type: SHT_PROGBITS119# ARM-NEXT:   Flags [120# ARM-NEXT:     SHF_ALLOC (0x2)121# ARM-NEXT:     SHF_ARM_PURECODE (0x20000000)122# ARM-NEXT:     SHF_WRITE (0x1)123# ARM-NEXT:   ]124 125# ===== aarch64 =====126 127# RUN: yaml2obj --docnum=5 %s -o %t-aarch64.o128# RUN: llvm-objcopy --rename-section=.foo=.bar,alloc %t-aarch64.o129# RUN: llvm-readobj --sections %t-aarch64.o | FileCheck %s --check-prefix=AARCH64130 131--- !ELF132FileHeader:133  Class:           ELFCLASS64134  Data:            ELFDATA2LSB135  Type:            ET_REL136  Machine:         EM_AARCH64137Sections:138  - Name:          .foo139    Type:          SHT_PROGBITS140    Flags:         [ SHF_AARCH64_PURECODE ]141 142# AARCH64:        Name: .bar143# AARCH64-NEXT:   Type: SHT_PROGBITS144# AARCH64-NEXT:   Flags [145# AARCH64-NEXT:     SHF_AARCH64_PURECODE (0x20000000)146# AARCH64-NEXT:     SHF_ALLOC (0x2)147# AARCH64-NEXT:     SHF_WRITE (0x1)148# AARCH64-NEXT:   ]149