1## Test malformed global symbal table of big archive. 2 3# RUN: rm -rf %t && mkdir %t && cd %t 4# RUN: yaml2obj -DFLAG=0x1DF %s -o t32.o 5# RUN: yaml2obj -DFLAG=0x1F7 %s -o t64.o 6# RUN: llvm-ar q t.a t32.o t64.o 7 8# RUN: cp t.a t32_1.a 9# RUN: cp t.a t32_2.a 10# RUN: cp t.a t64_1.a 11# RUN: cp t.a t64_2.a 12 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 %s 19# RUN: not llvm-ar t t32_2.a 2>&1 | FileCheck -DFILE=t32_2.a --check-prefixes=CONTENT32 %s 20 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 %s 30# RUN: not llvm-ar t t64_2.a 2>&1 | FileCheck -DFILE=t64_2.a --check-prefixes=CONTENT64 %s 31 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--- !XCOFF 36FileHeader: 37 MagicNumber: [[FLAG]] 38Sections: 39 - Name: .data 40 Flags: [ STYP_DATA ] 41Symbols: 42 - Name: export_protected_var_[[FLAG]] 43 Section: .data 44 Type: 0x4000 45 StorageClass: C_EXT 46 AuxEntries: 47 - Type: AUX_CSECT 48 SymbolAlignmentAndType: 0x09 49 StorageMappingClass: XMC_RW 50