• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# RUN: yaml2obj --docnum=1 %s -o %t1.o
2# RUN: not ld.lld %t1.o -o /dev/null 2>&1 | FileCheck %s
3# CHECK: error: {{.*}}.o: unsupported relocation reference
4
5--- !ELF
6FileHeader:
7  Class:         ELFCLASS64
8  Data:          ELFDATA2LSB
9  Type:          ET_REL
10  Machine:       EM_X86_64
11Sections:
12  - Name:        .text
13    Type:        SHT_PROGBITS
14    Flags:       [ SHF_ALLOC, SHF_EXECINSTR ]
15  - Name:        .rela.text
16    Type:        SHT_RELA
17    Link:        .symtab
18    Info:        0
19    Relocations:
20      - Symbol:  foo
21        Type:    R_X86_64_64
22Symbols:
23  - Name:        foo
24    Binding:     STB_GLOBAL
25
26# RUN: yaml2obj --docnum=2 %s -o %t2.o
27# RUN: not ld.lld %t2.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR2
28# ERR2: error: {{.*}}.o: invalid relocated section index: 99
29
30--- !ELF
31FileHeader:
32  Class:         ELFCLASS64
33  Data:          ELFDATA2LSB
34  Type:          ET_REL
35  Machine:       EM_X86_64
36Sections:
37  - Name:        .text
38    Type:        SHT_PROGBITS
39    Flags:       [ SHF_ALLOC, SHF_EXECINSTR ]
40  - Name:        .rela.text
41    Type:        SHT_RELA
42    Link:        .symtab
43    Info:        99
44    Relocations:
45      - Symbol:  foo
46        Type:    R_X86_64_64
47Symbols:
48  - Name:        foo
49    Binding:     STB_GLOBAL
50
51## Relocation refers to a symbol with index larger than
52## symbol table size. Check we report it.
53# RUN: yaml2obj --docnum=3 %s -o %t2.o
54# RUN: not ld.lld %t2.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR3
55# ERR3: error: {{.*}}.o: invalid symbol index
56
57--- !ELF
58FileHeader:
59  Class:         ELFCLASS64
60  Data:          ELFDATA2LSB
61  Type:          ET_REL
62  Machine:       EM_X86_64
63Sections:
64  - Name:        .text
65    Type:        SHT_PROGBITS
66    Flags:       [ SHF_ALLOC, SHF_EXECINSTR ]
67  - Name:        .rela.text
68    Type:        SHT_RELA
69    Info:        .text
70    Relocations:
71      - Symbol:  255
72        Type:    R_X86_64_64
73