1## Check that we can use the --elf-linker-options option 2## to dump SHT_LLVM_LINKER_OPTIONS sections. 3 4# RUN: yaml2obj --docnum=1 %s -o %t1 5# RUN: llvm-readobj --elf-linker-options %t1 2>&1 | FileCheck %s -DFILE=%t1 6 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 14# CHECK-NEXT: ] 15 16--- !ELF 17FileHeader: 18 Class: ELFCLASS64 19 Data: ELFDATA2LSB 20 Type: ET_REL 21Sections: 22## Case 1: a correct case. 23 - Name: .linker-options.valid1 24 Type: SHT_LLVM_LINKER_OPTIONS 25 Options: 26 - Name: option 0 27 Value: value 0 28 - Name: option 1 29 Value: value 1 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' 35 - Type: Fill 36 Pattern: "FF" 37 Size: "1" 38## Case 3: in case of an empty section we dump nothing. 39 - Name: .linker-options.empty 40 Type: SHT_LLVM_LINKER_OPTIONS 41 Content: "" 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 46 Content: "61" 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 51 ShOffset: 0xffffffff 52 Options: 53 - Name: foo 54 Value: bar 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 58 Options: 59 - Name: option 3 60 Value: value 3 61 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 64 65# READELF: printELFLinkerOptions not implemented! 66