[ELFYAML] Support mips64 relocation record format in yaml2obj/obj2yaml
[oota-llvm.git] / test / Object / Mips / elf-mips64-rel.yaml
1 # RUN: yaml2obj -format=elf %s > %t
2 # RUN: llvm-readobj -r %t | FileCheck -check-prefix=OBJ %s
3 # RUN: obj2yaml %t | FileCheck -check-prefix=YAML %s
4
5 # OBJ:      Relocations [
6 # OBJ-NEXT:   Section (2) .rela.text {
7 # OBJ-NEXT:     0x14 R_MIPS_GPREL16/R_MIPS_SUB/R_MIPS_HI16 main 0x4
8 # OBJ-NEXT:     0x1C R_MIPS_GPREL16/R_MIPS_SUB/R_MIPS_LO16 main 0x8
9 # OBJ-NEXT:     0x20 R_MIPS_GOT_PAGE/R_MIPS_NONE/R_MIPS_NONE .rodata 0x0
10 # OBJ-NEXT:     0x24 R_MIPS_GOT_OFST/R_MIPS_NONE/R_MIPS_NONE .rodata 0x0
11 # OBJ-NEXT:     0x28 R_MIPS_CALL16/R_MIPS_NONE/R_MIPS_NONE printf 0x0
12 # OBJ-NEXT:     0x30 R_MIPS_GPREL16/R_MIPS_LO16/R_MIPS_NONE printf 0x0
13 # OBJ-NEXT:   }
14 # OBJ-NEXT: ]
15
16 # YAML:      Relocations:
17 # YAML-NEXT:   - Offset:      0x0000000000000014
18 # YAML-NEXT:     Symbol:      main
19 # YAML-NEXT:     Type:        R_MIPS_GPREL16
20 # YAML-NEXT:     Type2:       R_MIPS_SUB
21 # YAML-NEXT:     Type3:       R_MIPS_HI16
22 # YAML-NEXT:     Addend:      4
23 # YAML-NEXT:   - Offset:      0x000000000000001C
24 # YAML-NEXT:     Symbol:      main
25 # YAML-NEXT:     Type:        R_MIPS_GPREL16
26 # YAML-NEXT:     Type2:       R_MIPS_SUB
27 # YAML-NEXT:     Type3:       R_MIPS_LO16
28 # YAML-NEXT:     Addend:      8
29 # YAML-NEXT:   - Offset:      0x0000000000000020
30 # YAML-NEXT:     Symbol:      .rodata
31 # YAML-NEXT:     Type:        R_MIPS_GOT_PAGE
32 # YAML-NEXT:     Addend:      0
33 # YAML-NEXT:   - Offset:      0x0000000000000024
34 # YAML-NEXT:     Symbol:      .rodata
35 # YAML-NEXT:     Type:        R_MIPS_GOT_OFST
36 # YAML-NEXT:     Addend:      0
37 # YAML-NEXT:   - Offset:      0x0000000000000028
38 # YAML-NEXT:     Symbol:      printf
39 # YAML-NEXT:     Type:        R_MIPS_CALL16
40 # YAML-NEXT:     Addend:      0
41 # YAML-NEXT:   - Offset:      0x0000000000000030
42 # YAML-NEXT:     Symbol:      printf
43 # YAML-NEXT:     Type:        R_MIPS_GPREL16
44 # YAML-NEXT:     Type2:       R_MIPS_LO16
45 # YAML-NEXT:     SpecSym:     RSS_GP0
46 # YAML-NEXT:     Addend:      0
47
48 ---
49 FileHeader:
50   Class:           ELFCLASS64
51   Data:            ELFDATA2LSB
52   Type:            ET_REL
53   Machine:         EM_MIPS
54   Flags:           [ EF_MIPS_PIC, EF_MIPS_CPIC,
55                      EF_MIPS_NOREORDER, EF_MIPS_ARCH_64R2 ]
56 Sections:
57   - Name:            .text
58     Type:            SHT_PROGBITS
59     Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
60     AddressAlign:    0x10
61     Size:            0x60
62   - Name:            .rela.text
63     Type:            SHT_RELA
64     Flags:           [ SHF_INFO_LINK ]
65     Info:            .text
66     Relocations:
67       - Offset:      0x14
68         Symbol:      main
69         Type:        R_MIPS_GPREL16
70         Type2:       R_MIPS_SUB
71         Type3:       R_MIPS_HI16
72         Addend:      4
73       - Offset:      0x1C
74         Symbol:      main
75         Type:        R_MIPS_GPREL16
76         Type2:       R_MIPS_SUB
77         Type3:       R_MIPS_LO16
78         Addend:      8
79       - Offset:      0x20
80         Symbol:      .rodata
81         Type:        R_MIPS_GOT_PAGE
82       - Offset:      0x24
83         Symbol:      .rodata
84         Type:        R_MIPS_GOT_OFST
85       - Offset:      0x28
86         Symbol:      printf
87         Type:        R_MIPS_CALL16
88       - Offset:      0x30
89         Symbol:      printf
90         Type:        R_MIPS_GPREL16
91         Type2:       R_MIPS_LO16
92         SpecSym:     RSS_GP0
93   - Name:            .rodata
94     Type:            SHT_PROGBITS
95     Flags:           [ SHF_ALLOC ]
96     AddressAlign:    0x10
97     Size:            0x0F
98
99 Symbols:
100   Local:
101     - Name:            .text
102       Type:            STT_SECTION
103       Section:         .text
104     - Name:            .rodata
105       Type:            STT_SECTION
106       Section:         .rodata
107   Global:
108     - Name:            main
109       Type:            STT_FUNC
110       Section:         .text
111       Size:            0x58
112     - Name:            printf
113 ...