brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.6 KiB · fd107e4 Raw
80 lines · plain
1## REQUIRES: x862# This test intentionally checks for fatal errors, and fatal errors aren't supported for testing when main is run twice.3# XFAIL: main-run-twice4## Test that we can parse SHT_GNU_verneed in a shared object and report certain errors.5 6# RUN: echo '.globl _start; _start:' | llvm-mc -filetype=obj -triple=x86_64 - -o %t.o7 8## sh_offset(SHT_GNU_verneed) is out of bounds.9# RUN: yaml2obj --docnum=1 %s -o %t1.so10# RUN: not ld.lld %t.o %t1.so -o /dev/null 2>&1 | FileCheck --check-prefix=SHOFFSET %s11# SHOFFSET: error: {{.*}}.so: section [index 1] has a sh_offset (0xffffffff) + sh_size (0x0) that is greater than the file size (0x168)12--- !ELF13FileHeader:14  Class:   ELFCLASS6415  Data:    ELFDATA2LSB16  Type:    ET_DYN17  Machine: EM_X86_6418Sections:19  - Name:     .gnu.version_r20    Type:     SHT_GNU_verneed21    Flags:    [ SHF_ALLOC ]22    ShOffset: 0xFFFFFFFF23 24## A Verneed entry is misaligned (not a multiple of 4). This may happen25## some interface shared objects. We use memcpy to read the fields, so26## misalignment isn't a problem and there is no need to diagnose.27# RUN: yaml2obj --docnum=2 %s -o %t2.so28# RUN: ld.lld %t.o %t2.so -o /dev/null29--- !ELF30FileHeader:31  Class:   ELFCLASS6432  Data:    ELFDATA2LSB33  Type:    ET_DYN34  Machine: EM_X86_6435Sections:36  - Type: Fill37    Size: 0x138  - Name:  .gnu.version_r39    Type:  SHT_GNU_verneed40    Flags: [ SHF_ALLOC ]41    Dependencies:42      - Version: 143        File:    foo44        Entries:45          - Name:  'foo'46            Hash:  047            Flags: 048            Other: 049DynamicSymbols:50  - Name: foo51 52## vn_aux points to a place outside of the file.53# RUN: yaml2obj --docnum=3 -D VERNEED=0100010001000000040200000000000000000000 %s -o %t3.so54# RUN: not ld.lld %t.o %t3.so -o /dev/null 2>&1 | FileCheck --check-prefix=AUX-OOB %s55# AUX-OOB: {{.*}}.so has an invalid Vernaux56--- !ELF57FileHeader:58  Class:   ELFCLASS6459  Data:    ELFDATA2LSB60  Type:    ET_DYN61  Machine: EM_X86_6462Sections:63  - Name:  .gnu.version_r64    Type:  SHT_GNU_verneed65    Flags: [ SHF_ALLOC ]66    Info:  167    Content: "[[VERNEED]]"68DynamicSymbols:69  - Name: foo70 71## vn_aux is misaligned.72# RUN: yaml2obj --docnum=3 -D VERNEED=0100010001000000110000000000000000000000 %s -o %t4.so73# RUN: not ld.lld %t.o %t4.so -o /dev/null 2>&1 | FileCheck --check-prefix=AUX-MISALIGNED %s74# AUX-MISALIGNED: {{.*}}.so has an invalid Vernaux75 76## vna_name is out of bounds.77# RUN: yaml2obj --docnum=3 -D VERNEED=010001000000000010000000000000009107000000000000ff00000000000000 %s -o %t5.so78# RUN: not ld.lld %t.o %t5.so -o /dev/null 2>&1 | FileCheck --check-prefix=NAME-OOB %s79# NAME-OOB: {{.*}}.so has a Vernaux with an invalid vna_name80