Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / llvm / test / tools / llvm-objcopy / COFF / redefine-symbol.test
blob84511f10f57e7a8feec1183dc60970985a112e3a
1 # RUN: yaml2obj %s -o %t
3 ## A non-existent symbol does not error.
4 # RUN: llvm-objcopy --redefine-sym func=cnuf1234 --redefine-sym foo=ba --redefine-sym=notexist= %t %t2 2>&1 | count 0
5 # RUN: llvm-readobj --symbols %t2 | FileCheck %s
7 # RUN: echo 'func cnuf1234 #rename func' > %t.rename.txt
8 # RUN: echo '  foo ba ' >> %t.rename.txt
9 # RUN: echo 'notexist notexist' >> %t.rename.txt
10 # RUN: llvm-objcopy --redefine-syms %t.rename.txt %t %t3 2>&1 | count 0
11 # RUN: cmp %t2 %t3
13 # CHECK:      Symbol {
14 # CHECK:      Symbol {
15 # CHECK:      Symbol {
16 # CHECK-NEXT:   Name: cnuf1234
17 # CHECK-NEXT:   Value: 0
18 # CHECK-NEXT:   Section: .text (1)
19 # CHECK-NEXT:   BaseType: Null (0x0)
20 # CHECK-NEXT:   ComplexType: Function (0x2)
21 # CHECK-NEXT:   StorageClass: External (0x2)
22 # CHECK-NEXT:   AuxSymbolCount: 0
23 # CHECK-NEXT: }
24 # CHECK-NEXT: Symbol {
25 # CHECK-NEXT:   Name: ba
26 # CHECK-NEXT:   Value: 0
27 # CHECK-NEXT:   Section: .rdata (2)
28 # CHECK-NEXT:   BaseType: Null (0x0)
29 # CHECK-NEXT:   ComplexType: Null (0x0)
30 # CHECK-NEXT:   StorageClass: External (0x2)
31 # CHECK-NEXT:   AuxSymbolCount: 0
32 # CHECK-NEXT: }
34 --- !COFF
35 header:
36   Machine:         IMAGE_FILE_MACHINE_AMD64
37   Characteristics: [  ]
38 sections:
39   - Name:            .text
40     Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
41   - Name:            .rdata
42     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
43 symbols:
44   - Name:            .text
45     Value:           0
46     SectionNumber:   1
47     SimpleType:      IMAGE_SYM_TYPE_NULL
48     ComplexType:     IMAGE_SYM_DTYPE_NULL
49     StorageClass:    IMAGE_SYM_CLASS_STATIC
50   - Name:            .rdata
51     Value:           0
52     SectionNumber:   2
53     SimpleType:      IMAGE_SYM_TYPE_NULL
54     ComplexType:     IMAGE_SYM_DTYPE_NULL
55     StorageClass:    IMAGE_SYM_CLASS_STATIC
56   - Name:            func
57     Value:           0
58     SectionNumber:   1
59     SimpleType:      IMAGE_SYM_TYPE_NULL
60     ComplexType:     IMAGE_SYM_DTYPE_FUNCTION
61     StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
62   - Name:            foo
63     Value:           0
64     SectionNumber:   2
65     SimpleType:      IMAGE_SYM_TYPE_NULL
66     ComplexType:     IMAGE_SYM_DTYPE_NULL
67     StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
68 ...