brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.3 KiB · 006fe4d Raw
50 lines · plain
1## Test malformed global symbal table of big archive.2 3# RUN: rm -rf %t && mkdir %t && cd %t4# RUN: yaml2obj -DFLAG=0x1DF %s -o t32.o5# RUN: yaml2obj -DFLAG=0x1F7 %s -o t64.o6# RUN: llvm-ar q t.a t32.o t64.o7 8# RUN: cp t.a t32_1.a9# RUN: cp t.a t32_2.a10# RUN: cp t.a t64_1.a11# RUN: cp t.a t64_2.a12 13## Truncate the file to end before the 32-bit global symbol table header ends.14# RUN: %python -c "with open('t32_1.a', 'r+b') as input: input.truncate(856)"15## Truncate the file to end before the 32-bit global symbol table ends.16# RUN: %python -c "with open('t32_2.a', 'r+b') as input: input.truncate(995)"17 18# RUN: not llvm-ar t t32_1.a 2>&1 | FileCheck -DFILE=t32_1.a --check-prefixes=HEADER32 %s19# RUN: not llvm-ar t t32_2.a 2>&1 | FileCheck -DFILE=t32_2.a --check-prefixes=CONTENT32 %s20 21# HEADER32:  error: unable to load '[[FILE]]': truncated or malformed archive (32-bit global symbol table header at offset 0x34e and size 0x72 goes past the end of file)22# CONTENT32: error: unable to load '[[FILE]]': truncated or malformed archive (32-bit global symbol table content at offset 0x3c0 and size 0x2b goes past the end of file)23 24## Truncate the file to end before the 64-bit global symbol table header ends.25# RUN: %python -c "with open('t64_1.a', 'r+b') as input: input.truncate(1014)"26## Truncate the file to end before the 64-bit global symbol table ends.27# RUN: %python -c "with open('t64_2.a', 'r+b') as input: input.truncate(1096)"28 29# RUN: not llvm-ar t t64_1.a 2>&1 | FileCheck -DFILE=t64_1.a --check-prefixes=HEADER64 %s30# RUN: not llvm-ar t t64_2.a 2>&1 | FileCheck -DFILE=t64_2.a --check-prefixes=CONTENT64 %s31 32# HEADER64:  error: unable to load '[[FILE]]': truncated or malformed archive (64-bit global symbol table header at offset 0x3ec and size 0x72 goes past the end of file)33# CONTENT64: error: unable to load '[[FILE]]': truncated or malformed archive (64-bit global symbol table header at offset 0x3ec and size 0x72 goes past the end of file)34 35--- !XCOFF36FileHeader:37  MagicNumber:       [[FLAG]]38Sections:39  - Name:            .data40    Flags:           [ STYP_DATA ]41Symbols:42  - Name:            export_protected_var_[[FLAG]]43    Section:         .data44    Type:            0x400045    StorageClass:    C_EXT46    AuxEntries:47     - Type:                   AUX_CSECT48       SymbolAlignmentAndType: 0x0949       StorageMappingClass:    XMC_RW50