• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1## Check how obj2yaml produces SHT_LLVM_LINKER_OPTIONS section descriptions.
2
3## Check we dump valid sections using pairs of "Name" and "Value" strings.
4
5# RUN: yaml2obj --docnum=1 %s -o %t1
6# RUN: obj2yaml %t1 | FileCheck %s --check-prefix=VALID
7
8# VALID:      - Name: .linker-options-valid1
9# VALID-NEXT:   Type: SHT_LLVM_LINKER_OPTIONS
10# VALID-NEXT:   Options:
11# VALID-NEXT:     - Name:  a
12# VALID-NEXT:       Value: b
13# VALID-NEXT: - Name: .linker-options-valid2
14# VALID-NEXT:   Type: SHT_LLVM_LINKER_OPTIONS
15# VALID-NEXT:   Options:
16# VALID-NEXT:     - Name:  a
17# VALID-NEXT:       Value: b
18# VALID-NEXT:     - Name:  c
19# VALID-NEXT:       Value: d
20
21--- !ELF
22FileHeader:
23  Class: ELFCLASS64
24  Data:  ELFDATA2LSB
25  Type:  ET_REL
26Sections:
27  - Name:    .linker-options-valid1
28    Type:    SHT_LLVM_LINKER_OPTIONS
29    Content: "61006200"
30  - Name:    .linker-options-valid2
31    Type:    SHT_LLVM_LINKER_OPTIONS
32    Content: "6100620063006400"
33
34## Check we dump corrupt sections using the "Content" key.
35
36# RUN: yaml2obj --docnum=2 %s -o %t2
37# RUN: obj2yaml %t2 | FileCheck %s --check-prefix=CORRUPT
38
39# CORRUPT:      - Name:    .linker-options-empty
40# CORRUPT-NEXT:   Type:    SHT_LLVM_LINKER_OPTIONS
41# CORRUPT-NEXT:   Content: ''
42# CORRUPT-NEXT: - Name:    .linker-options-no-null
43# CORRUPT-NEXT:   Type:    SHT_LLVM_LINKER_OPTIONS
44# CORRUPT-NEXT:   Content: '610062'
45# CORRUPT-NEXT: - Name:    .linker-options-incomplete
46# CORRUPT-NEXT:   Type:    SHT_LLVM_LINKER_OPTIONS
47# CORRUPT-NEXT:   Content: '6100'
48
49--- !ELF
50FileHeader:
51  Class: ELFCLASS64
52  Data:  ELFDATA2LSB
53  Type:  ET_REL
54Sections:
55## 1) Empty content.
56  - Name:    .linker-options-empty
57    Type:    SHT_LLVM_LINKER_OPTIONS
58    Content: ""
59## 2) Non-null terminated content.
60  - Name:    .linker-options-no-null
61    Type:    SHT_LLVM_LINKER_OPTIONS
62    Content: "610062"
63## 3) Odd number of strings in the section.
64##   (Hence it contains an incomplete key-value pair).
65  - Name:    .linker-options-incomplete
66    Type:    SHT_LLVM_LINKER_OPTIONS
67    Content: "6100"
68