| ## Test malformed global symbal table of big archive. |
| |
| # RUN: rm -rf %t && mkdir %t && cd %t |
| # RUN: yaml2obj -DFLAG=0x1DF %s -o t32.o |
| # RUN: yaml2obj -DFLAG=0x1F7 %s -o t64.o |
| # RUN: llvm-ar q t.a t32.o t64.o |
| |
| # RUN: cp t.a t32_1.a |
| # RUN: cp t.a t32_2.a |
| # RUN: cp t.a t64_1.a |
| # RUN: cp t.a t64_2.a |
| |
| ## Truncate the file to end before the 32-bit global symbol table header ends. |
| # RUN: %python -c "with open('t32_1.a', 'r+b') as input: input.truncate(856)" |
| ## Truncate the file to end before the 32-bit global symbol table ends. |
| # RUN: %python -c "with open('t32_2.a', 'r+b') as input: input.truncate(995)" |
| |
| # RUN: not llvm-ar t t32_1.a 2>&1 | FileCheck -DFILE=t32_1.a --check-prefixes=HEADER32 %s |
| # RUN: not llvm-ar t t32_2.a 2>&1 | FileCheck -DFILE=t32_2.a --check-prefixes=CONTENT32 %s |
| |
| # 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) |
| # 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) |
| |
| ## Truncate the file to end before the 64-bit global symbol table header ends. |
| # RUN: %python -c "with open('t64_1.a', 'r+b') as input: input.truncate(1014)" |
| ## Truncate the file to end before the 64-bit global symbol table ends. |
| # RUN: %python -c "with open('t64_2.a', 'r+b') as input: input.truncate(1096)" |
| |
| # RUN: not llvm-ar t t64_1.a 2>&1 | FileCheck -DFILE=t64_1.a --check-prefixes=HEADER64 %s |
| # RUN: not llvm-ar t t64_2.a 2>&1 | FileCheck -DFILE=t64_2.a --check-prefixes=CONTENT64 %s |
| |
| # 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) |
| # 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) |
| |
| --- !XCOFF |
| FileHeader: |
| MagicNumber: [[FLAG]] |
| Sections: |
| - Name: .data |
| Flags: [ STYP_DATA ] |
| Symbols: |
| - Name: export_protected_var_[[FLAG]] |
| Section: .data |
| Type: 0x4000 |
| StorageClass: C_EXT |
| AuxEntries: |
| - Type: AUX_CSECT |
| SymbolAlignmentAndType: 0x09 |
| StorageMappingClass: XMC_RW |