xref: /llvm-project/llvm/test/tools/llvm-objcopy/COFF/no-symbol-table.test (revision 556af193309f6e283712602b9a8ca5d19adb1792)
1## Test that llvm-objcopy can read a COFF object with symbols but without a
2## symbol table.
3
4# RUN: yaml2obj %p/Inputs/no-symbol-table.yaml -o %t.obj
5
6## Check that we report a single symbol before overriding the symbol table pointer.
7# RUN: llvm-readobj --file-headers %t.obj | FileCheck %s --check-prefix=BEFORE
8# BEFORE: SymbolCount: 1
9
10## Override the symbol table pointer with zeros.
11# RUN: %python -c "with open(r'%t.obj', 'r+b') as input: input.seek(8); input.write(b'\x00' * 4)"
12# RUN: llvm-readobj --file-headers %t.obj | FileCheck %s --check-prefix=POINTER
13# POINTER: PointerToSymbolTable: 0x0
14
15## Make sure we can run llvm-objcopy on the resulting object.
16# RUN: llvm-objcopy %t.obj
17
18## Check that the number of symbols is now reported as zero.
19# RUN: llvm-readobj --file-headers %t.obj | FileCheck %s --check-prefix=COUNT
20# COUNT: SymbolCount: 0