xref: /llvm-project/llvm/test/tools/llvm-objcopy/COFF/strip-symbol.test (revision 55c81d4282c5da0189711261a11537bc8a7fe85c)
1RUN: yaml2obj %p/Inputs/strip-symbols.yaml -o %t.in.o
2
3RUN: llvm-readobj -r %t.in.o | FileCheck %s --check-prefixes=RELOCS,RELOCS-PRE
4RUN: llvm-objdump -t %t.in.o | FileCheck %s --check-prefixes=SYMBOLS,SYMBOLS-PRE
5
6RUN: llvm-objcopy -N mainfunc %t.in.o %t.out.o
7RUN: llvm-readobj -r %t.out.o | FileCheck %s --check-prefixes=RELOCS,RELOCS-POST
8RUN: llvm-objdump -t %t.out.o | FileCheck %s --check-prefix=SYMBOLS
9
10RUN: llvm-objcopy --strip-symbol mainfunc %t.in.o %t.out.o
11RUN: llvm-readobj -r %t.out.o | FileCheck %s --check-prefixes=RELOCS,RELOCS-POST
12RUN: llvm-objdump -t %t.out.o | FileCheck %s --check-prefix=SYMBOLS
13
14Explicitly listing the relocations for the input as well, to show
15that the symbol index of the symbol foo is updated in the relocations,
16while keeping relocations to two distinct .rdata symbols separate.
17
18RELOCS:      Relocations [
19RELOCS-NEXT:   Section (1) .text {
20RELOCS-NEXT:     0x3 IMAGE_REL_AMD64_REL32 .rdata (0)
21RELOCS-NEXT:     0xA IMAGE_REL_AMD64_REL32 .rdata (1)
22RELOCS-PRE-NEXT:  0x11 IMAGE_REL_AMD64_REL32 foo (3)
23RELOCS-POST-NEXT: 0x11 IMAGE_REL_AMD64_REL32 foo (2)
24RELOCS-NEXT:   }
25RELOCS-NEXT: ]
26
27SYMBOLS: SYMBOL TABLE:
28SYMBOLS-NEXT: .rdata
29SYMBOLS-NEXT: .rdata
30SYMBOLS-PRE-NEXT: mainfunc
31SYMBOLS-NEXT: foo
32SYMBOLS-EMPTY:
33