• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1## .dynamic section has invalid sh_entsize, check we report it.
2# RUN: yaml2obj --docnum=1 %s -o %t.so
3# RUN: not ld.lld %t.so -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR1
4# ERR1: error: {{.*}}.so: section [index 1] has an invalid sh_entsize: 291
5
6--- !ELF
7FileHeader:
8  Class:           ELFCLASS64
9  Data:            ELFDATA2LSB
10  Type:            ET_DYN
11  Machine:         EM_X86_64
12Sections:
13  - Name:          .dynamic
14    Type:          SHT_DYNAMIC
15    Flags:         [ SHF_ALLOC ]
16    Link:          .strtab
17    EntSize:       0x123
18
19## The  .dynamic section has invalid sh_size, which is too short and
20## even less than entry size. Check we report it.
21# RUN: yaml2obj --docnum=2 %s -o %t.so
22# RUN: not ld.lld %t.so -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERR2
23# ERR2: error: {{.*}}.so: section [index 1] has an invalid sh_size (1) which is not a multiple of its sh_entsize (16)
24
25--- !ELF
26FileHeader:
27  Class:           ELFCLASS64
28  Data:            ELFDATA2LSB
29  Type:            ET_DYN
30  Machine:         EM_X86_64
31Sections:
32  - Name:          .dynamic
33    Type:          SHT_DYNAMIC
34    Flags:         [ SHF_ALLOC ]
35    Link:          .strtab
36    Content:       "00"
37