1 ## Show that llvm-readobj/llvm-readelf tools can dump the .dynamic section which
2 ## is not alone in PT_DYNAMIC segment.
4 ## In the first case .text is placed before .dynamic.
5 ## We check that we warn about this case.
7 # RUN: yaml2obj --docnum=1 %s -o %t1.o
8 # RUN: llvm-readobj --dynamic-table %t1.o 2>&1 \
9 # RUN: | FileCheck %s --DFILE=%t1.o --check-prefixes=WARNING,LLVM
10 # RUN: llvm-readelf --dynamic-table %t1.o 2>&1 \
11 # RUN: | FileCheck %s --DFILE=%t1.o --check-prefixes=WARNING,GNU
13 # WARNING: warning: '[[FILE]]': SHT_DYNAMIC section with index 2 is not at the start of PT_DYNAMIC segment
14 # WARNING: warning: '[[FILE]]': invalid PT_DYNAMIC size (0x21){{$}}
15 # WARNING: warning: '[[FILE]]': SHT_DYNAMIC section header and PT_DYNAMIC program header disagree about the location of the dynamic table
16 # WARNING: warning: '[[FILE]]': PT_DYNAMIC dynamic table is invalid: SHT_DYNAMIC will be used
18 # LLVM: DynamicSection [ (2 entries)
19 # LLVM-NEXT: Tag Type Name/Value
20 # LLVM-NEXT: 0x0000000000000018 BIND_NOW 0x1
21 # LLVM-NEXT: 0x0000000000000000 NULL 0x0
24 # GNU: Dynamic section at offset 0x{{.*}} contains 2 entries:
25 # GNU-NEXT: Tag Type Name/Value
26 # GNU-NEXT: 0x0000000000000018 (BIND_NOW) 0x1
27 # GNU-NEXT: 0x0000000000000000 (NULL) 0x0
60 ## In this case .text goes after .dynamic and we don't display any warnings,
61 ## though the content of the .text is used for dumping the dynamic table.
63 # RUN: yaml2obj --docnum=2 %s -o %t2.o
64 # RUN: llvm-readobj --dynamic-table %t2.o 2>&1 | FileCheck %s --check-prefix=LLVM2
65 # RUN: llvm-readelf --dynamic-table %t2.o 2>&1 | FileCheck %s --check-prefix=GNU2
67 # LLVM2: DynamicSection [ (3 entries)
68 # LLVM2-NEXT: Tag Type Name/Value
69 # LLVM2-NEXT: 0x0000000000000018 BIND_NOW 0x1
70 # LLVM2-NEXT: 0x0000000000000018 BIND_NOW 0x2
71 # LLVM2-NEXT: 0x0000000000000000 NULL 0x0
74 # GNU2: Dynamic section at offset 0x{{.*}} contains 3 entries:
75 # GNU2-NEXT: Tag Type Name/Value
76 # GNU2-NEXT: 0x0000000000000018 (BIND_NOW) 0x1
77 # GNU2-NEXT: 0x0000000000000018 (BIND_NOW) 0x2
78 # GNU2-NEXT: 0x0000000000000000 (NULL) 0x0
101 Content: "00000000000000000000000000000000"
112 ## In this case .text goes after .dynamic, but (PT_DYNAMIC segment size % dynamic entry size != 0)
113 ## and we have to use the information from the section header instead.
115 # RUN: yaml2obj --docnum=3 %s -o %t3.o
116 # RUN: llvm-readobj --dynamic-table %t3.o 2>&1 | FileCheck %s --DFILE=%t3.o --check-prefixes=WARNING2,LLVM3
117 # RUN: llvm-readelf --dynamic-table %t3.o 2>&1 | FileCheck %s --DFILE=%t3.o --check-prefixes=WARNING2,GNU3
119 # WARNING2: warning: '[[FILE]]': invalid PT_DYNAMIC size (0x101){{$}}
120 # WARNING2: warning: '[[FILE]]': PT_DYNAMIC dynamic table is invalid: SHT_DYNAMIC will be used
122 # LLVM3: DynamicSection [ (2 entries)
123 # LLVM3-NEXT: Tag Type Name/Value
124 # LLVM3-NEXT: 0x0000000000000018 BIND_NOW 0x1
125 # LLVM3-NEXT: 0x0000000000000000 NULL 0x0
128 # GNU3: Dynamic section at offset 0x{{.*}} contains 2 entries:
129 # GNU3-NEXT: Tag Type Name/Value
130 # GNU3-NEXT: 0x0000000000000018 (BIND_NOW) 0x1
131 # GNU3-NEXT: 0x0000000000000000 (NULL) 0x0