2 ## Test that we can parse SHT_GNU_verneed in a shared object and report certain errors.
4 # RUN: echo '.globl _start; _start:' | llvm-mc -filetype=obj -triple=x86_64 - -o %t.o
6 ## sh_offset(SHT_GNU_verneed) is out of bounds.
7 # RUN: yaml2obj --docnum=1 %s -o %t1.so
8 # RUN: not ld.lld %t.o %t1.so -o /dev/null 2>&1 | FileCheck --check-prefix=SHOFFSET %s
9 # SHOFFSET: error: {{.*}}.so: section [index 1] has a sh_offset (0xffffffff) + sh_size (0x0) that is greater than the file size (0x168)
17 - Name: .gnu.version_r
22 ## A Verneed entry is misaligned (not a multiple of 4). This may happen
23 ## some interface shared objects. We use memcpy to read the fields, so
24 ## misalignment isn't a problem and there is no need to diagnose.
25 # RUN: yaml2obj --docnum=2 %s -o %t2.so
26 # RUN: ld.lld %t.o %t2.so -o /dev/null
36 - Name: .gnu.version_r
50 ## vn_aux points to a place outside of the file.
51 # RUN: yaml2obj --docnum=3 -D VERNEED=0100010001000000040200000000000000000000 %s -o %t3.so
52 # RUN: not ld.lld %t.o %t3.so -o /dev/null 2>&1 | FileCheck --check-prefix=AUX-OOB %s
53 # AUX-OOB: {{.*}}.so has an invalid Vernaux
61 - Name: .gnu.version_r
65 Content: "[[VERNEED]]"
69 ## vn_aux is misaligned.
70 # RUN: yaml2obj --docnum=3 -D VERNEED=0100010001000000110000000000000000000000 %s -o %t4.so
71 # RUN: not ld.lld %t.o %t4.so -o /dev/null 2>&1 | FileCheck --check-prefix=AUX-MISALIGNED %s
72 # AUX-MISALIGNED: {{.*}}.so has an invalid Vernaux
74 ## vna_name is out of bounds.
75 # RUN: yaml2obj --docnum=3 -D VERNEED=010001000000000010000000000000009107000000000000ff00000000000000 %s -o %t5.so
76 # RUN: not ld.lld %t.o %t5.so -o /dev/null 2>&1 | FileCheck --check-prefix=NAME-OOB %s
77 # NAME-OOB: {{.*}}.so has a Vernaux with an invalid vna_name