• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Regression test for the following case:
2# $ cat /tmp/a.c
3# int main() { return 0; }
4# $ clang -static /tmp/a.c -o /tmp/a
5# $ llvm-strip /tmp/a -o /tmp/b
6# llvm-strip: error: Link field value 0 in section .rela.plt is invalid.
7
8# RUN: yaml2obj %s -o %t.original
9# RUN: llvm-strip %t.original -o %t.stripped
10# RUN: llvm-readobj --sections %t.original | FileCheck %s
11# RUN: llvm-readobj --sections %t.stripped | FileCheck %s
12
13!ELF
14FileHeader:
15  Class:           ELFCLASS64
16  Data:            ELFDATA2LSB
17  Type:            ET_REL
18  Machine:         EM_X86_64
19Sections:
20  - Name:          .text
21    Type:          SHT_PROGBITS
22    Flags:         [ SHF_ALLOC, SHF_EXECINSTR ]
23  - Name:          .rela.plt
24    Type:          SHT_RELA
25    Flags:         [ SHF_ALLOC, SHF_INFO_LINK ]
26    Info:          .got.plt
27    Link:          0
28  - Name:          .plt
29    Type:          SHT_PROGBITS
30    Flags:         [ SHF_ALLOC, SHF_EXECINSTR ]
31  - Name:          .got.plt
32    Type:          SHT_PROGBITS
33    Flags:         [ SHF_ALLOC, SHF_WRITE ]
34
35# CHECK:      Name: .rela.plt
36# CHECK-NEXT: Type: SHT_RELA
37# CHECK-NEXT: Flags [
38# CHECK-NEXT:   SHF_ALLOC
39# CHECK-NEXT:   SHF_INFO_LINK
40# CHECK-NEXT: ]
41# CHECK-NEXT: Address:
42# CHECK-NEXT: Offset:
43# CHECK-NEXT: Size: 0
44# CHECK-NEXT: Link: 0
45# CHECK-NEXT: Info: 4
46