1 ## Check that we can use the --elf-linker-options option
2 ## to dump SHT_LLVM_LINKER_OPTIONS sections.
4 # RUN: yaml2obj --docnum=1 %s -o %t1
5 # RUN: llvm-readobj --elf-linker-options %t1 2>&1 | FileCheck %s -DFILE=%t1
7 # CHECK: LinkerOptions [
8 # CHECK: option 0: value 0
9 # CHECK: option 1: value 1
10 # CHECK-NEXT: warning: '[[FILE]]': SHT_LLVM_LINKER_OPTIONS section at index 2 is broken: an incomplete key-value pair was found. The last possible key was: "c"
11 # CHECK-NEXT: warning: '[[FILE]]': SHT_LLVM_LINKER_OPTIONS section at index 4 is broken: the content is not null-terminated
12 # CHECK-NEXT: warning: '[[FILE]]': unable to read the content of the SHT_LLVM_LINKER_OPTIONS section: section [index 5] has a sh_offset (0xffffffff) + sh_size (0x8) that is greater than the file size (0x370)
13 # CHECK-NEXT: option 3: value 3
22 ## Case 1: a correct case.
23 - Name: .linker-options.valid1
24 Type: SHT_LLVM_LINKER_OPTIONS
30 ## Case 2: check we do not attempt to dump data from outside the SHT_LLVM_LINKER_OPTIONS section
31 ## when it contains an incomplete key-value pair.
32 - Name: .linker-options.incomplete
33 Type: SHT_LLVM_LINKER_OPTIONS
34 Content: "610062006300" ## 'a', '\0', 'b', '\0', 'c', '\0'
38 ## Case 3: in case of an empty section we dump nothing.
39 - Name: .linker-options.empty
40 Type: SHT_LLVM_LINKER_OPTIONS
42 ## Case 4: check we do not attempt to dump data from outside the SHT_LLVM_LINKER_OPTIONS section
43 ## when it is not null-terminated.
44 - Name: .linker-options.nonul
45 Type: SHT_LLVM_LINKER_OPTIONS
47 ## Case 5: check we report a warning when it is not possible to read
48 ## the content of the SHT_LLVM_LINKER_OPTIONS section.
49 - Name: .linker-options.broken.content
50 Type: SHT_LLVM_LINKER_OPTIONS
55 ## Case 6: another correct case to show we do not stop dumping after reporting a warning.
56 - Name: .linker-options.valid2
57 Type: SHT_LLVM_LINKER_OPTIONS
62 ## llvm-readelf doesn't support --elf-linker-options yet.
63 # RUN: llvm-readelf --elf-linker-options %t1 2>&1 | FileCheck %s --check-prefix=READELF
65 # READELF: printELFLinkerOptions not implemented!