1 ## Show that llvm-readobj/llvm-readelf tools sometimes can dump the
2 ## dynamic table when it is not in a PT_DYNAMIC segment.
4 ## Case 1: The dynamic table found using the dynamic program header is corrupted
5 ## (<size of data> % <size of dynamic entry> != 0). So the table is taken
6 ## from the section header.
8 # RUN: yaml2obj --docnum=1 %s -o %t1.o
9 # RUN: llvm-readobj --dynamic-table %t1.o 2>&1 \
10 # RUN: | FileCheck -DFILE=%t1.o --check-prefixes=WARNING1,LLVM1 %s
11 # RUN: llvm-readelf --dynamic-table %t1.o 2>&1 \
12 # RUN: | FileCheck -DFILE=%t1.o --check-prefixes=WARNING1,GNU1 %s
14 # WARNING1: warning: '[[FILE]]': SHT_DYNAMIC section with index 1 is not contained within the PT_DYNAMIC segment
15 # WARNING1: warning: '[[FILE]]': invalid PT_DYNAMIC size (0x1){{$}}
16 # WARNING1: warning: '[[FILE]]': SHT_DYNAMIC section header and PT_DYNAMIC program header disagree about the location of the dynamic table
17 # WARNING1: warning: '[[FILE]]': PT_DYNAMIC dynamic table is invalid: SHT_DYNAMIC will be used
19 # LLVM1: DynamicSection [ (2 entries)
20 # LLVM1-NEXT: Tag Type Name/Value
21 # LLVM1-NEXT: 0x0000000000000018 BIND_NOW 0x1
22 # LLVM1-NEXT: 0x0000000000000000 NULL 0x0
25 # GNU1: Dynamic section at offset 0x{{.*}} contains 2 entries:
26 # GNU1-NEXT: Tag Type Name/Value
27 # GNU1-NEXT: 0x0000000000000018 (BIND_NOW) 0x1
28 # GNU1-NEXT: 0x0000000000000000 (NULL) 0x0
62 ## Case 2: The dynamic table found using the dynamic program header is different from the
63 ## table found using the section header table.
65 # RUN: yaml2obj --docnum=2 %s -o %t2.o
66 # RUN: llvm-readobj --dynamic-table %t2.o 2>&1 \
67 # RUN: | FileCheck -DFILE=%t2.o --check-prefixes=WARNING2,LLVM2 %s
68 # RUN: llvm-readelf --dynamic-table %t2.o 2>&1 \
69 # RUN: | FileCheck -DFILE=%t2.o --check-prefixes=WARNING2,GNU2 %s
71 # WARNING2: warning: '[[FILE]]': SHT_DYNAMIC section with index 1 is not contained within the PT_DYNAMIC segment
72 # WARNING2: warning: '[[FILE]]': SHT_DYNAMIC section header and PT_DYNAMIC program header disagree about the location of the dynamic table
74 # LLVM2: DynamicSection [ (1 entries)
75 # LLVM2-NEXT: Tag Type Name/Value
76 # LLVM2-NEXT: 0x0000000000000000 NULL 0x0
79 # GNU2: Dynamic section at offset 0x{{.*}} contains 1 entries:
80 # GNU2-NEXT: Tag Type Name/Value
81 # GNU2-NEXT: 0x0000000000000000 (NULL) 0x0
104 Content: "00000000000000000000000000000000"
115 ## Case 3: Both dynamic tables found using SHT_DYNAMIC/PT_DYNAMIC are corrupted.
117 # RUN: yaml2obj --docnum=3 %s -o %t3.o
118 # RUN: llvm-readobj --dynamic-table %t3.o 2>&1 \
119 # RUN: | FileCheck -DFILE=%t3.o --check-prefix=WARNING3 --implicit-check-not="Dynamic" %s
120 # RUN: llvm-readelf --dynamic-table %t3.o 2>&1 \
121 # RUN: | FileCheck -DFILE=%t3.o --check-prefix=WARNING3 --implicit-check-not="Dynamic" %s
123 # WARNING3: warning: '[[FILE]]': invalid PT_DYNAMIC size (0x1){{$}}
124 # WARNING3: warning: '[[FILE]]': SHT_DYNAMIC section header and PT_DYNAMIC program header disagree about the location of the dynamic table
125 # WARNING3: warning: '[[FILE]]': no valid dynamic table was found