xref: /llvm-project/llvm/test/tools/llvm-readobj/ELF/mips-symbols-stother.test (revision 93c1a5f3ddd41e0ec09f38ab0045bd5e92199fd5)
1## Check that we are able to dump MIPS STO_* flags correctly when dumping symbols.
2
3# RUN: yaml2obj %s -o %t.o
4# RUN: llvm-readobj --symbols %t.o | FileCheck %s --strict-whitespace --check-prefix=MIPS-LLVM
5# RUN: llvm-readobj --symbols %t.o --elf-output-style=JSON --pretty-print | FileCheck %s --check-prefix=MIPS-JSON
6# RUN: llvm-readelf --symbols %t.o | FileCheck %s --strict-whitespace --check-prefix=MIPS-GNU
7
8#      MIPS-LLVM:Name: foo
9#      MIPS-LLVM:Other [
10# MIPS-LLVM-NEXT:  STO_MIPS_MICROMIPS (0x80)
11# MIPS-LLVM-NEXT:  STO_MIPS_OPTIONAL (0x4)
12# MIPS-LLVM-NEXT:  STO_MIPS_PIC (0x20)
13# MIPS-LLVM-NEXT:  STO_MIPS_PLT (0x8)
14# MIPS-LLVM-NEXT:]
15
16#      MIPS-LLVM:Name: bar
17#      MIPS-LLVM:Other [
18# MIPS-LLVM-NEXT:  STO_MIPS_MIPS16 (0xF0)
19# MIPS-LLVM-NEXT:]
20
21#      MIPS-GNU:Symbol table '.symtab' contains 3 entries:
22# MIPS-GNU-NEXT:  Num:    Value  Size Type    Bind   Vis                    Ndx Name
23# MIPS-GNU-NEXT:    0: 00000000     0 NOTYPE  LOCAL  DEFAULT                UND
24# MIPS-GNU-NEXT:    1: 00000000     0 NOTYPE  LOCAL  DEFAULT [<other: 0xac>] UND foo
25# MIPS-GNU-NEXT:    2: 00000000     0 NOTYPE  LOCAL  DEFAULT [<other: 0xf0>] UND bar
26
27# MIPS-JSON:      "Name": "foo",
28# MIPS-JSON:      "Other": {
29# MIPS-JSON-NEXT:   "Value": 172,
30# MIPS-JSON-NEXT:   "Flags": [
31# MIPS-JSON-NEXT:     {
32# MIPS-JSON-NEXT:       "Name": "STO_MIPS_MICROMIPS",
33# MIPS-JSON-NEXT:       "Value": 128
34# MIPS-JSON-NEXT:     },
35# MIPS-JSON-NEXT:     {
36# MIPS-JSON-NEXT:       "Name": "STO_MIPS_OPTIONAL",
37# MIPS-JSON-NEXT:       "Value": 4
38# MIPS-JSON-NEXT:     },
39# MIPS-JSON-NEXT:     {
40# MIPS-JSON-NEXT:       "Name": "STO_MIPS_PIC",
41# MIPS-JSON-NEXT:       "Value": 32
42# MIPS-JSON-NEXT:     },
43# MIPS-JSON-NEXT:     {
44# MIPS-JSON-NEXT:       "Name": "STO_MIPS_PLT",
45# MIPS-JSON-NEXT:       "Value": 8
46# MIPS-JSON-NEXT:     }
47# MIPS-JSON-NEXT:   ]
48# MIPS-JSON-NEXT: },
49# MIPS-JSON:      "Name": "bar",
50# MIPS-JSON:      "Other": {
51# MIPS-JSON-NEXT:   "Value": 240,
52# MIPS-JSON-NEXT:   "Flags": [
53# MIPS-JSON-NEXT:     {
54# MIPS-JSON-NEXT:       "Name": "STO_MIPS_MIPS16",
55# MIPS-JSON-NEXT:       "Value": 240
56# MIPS-JSON-NEXT:     }
57# MIPS-JSON-NEXT:   ]
58# MIPS-JSON-NEXT: },
59
60--- !ELF
61FileHeader:
62  Class:   ELFCLASS32
63  Data:    ELFDATA2LSB
64  Type:    ET_REL
65  Machine: EM_MIPS
66Symbols:
67  - Name: foo
68    Other: [ STO_MIPS_MICROMIPS, STO_MIPS_PIC,
69             STO_MIPS_PLT, STO_MIPS_OPTIONAL]
70## Use a different symbol for STO_MIPS_MIPS16 (0xf0) as it interferes
71## with STO_MIPS_PIC (0x20) and STO_MIPS_MICROMIPS (0x80).
72  - Name: bar
73    Other: [ STO_MIPS_MIPS16 ]
74