66 lines · plain
1## Check that we can use the --elf-linker-options option2## to dump SHT_LLVM_LINKER_OPTIONS sections.3 4# RUN: yaml2obj --docnum=1 %s -o %t15# RUN: llvm-readobj --elf-linker-options %t1 2>&1 | FileCheck %s -DFILE=%t16 7# CHECK: LinkerOptions [8# CHECK: option 0: value 09# CHECK: option 1: value 110# 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-terminated12# 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 314# CHECK-NEXT: ]15 16--- !ELF17FileHeader:18 Class: ELFCLASS6419 Data: ELFDATA2LSB20 Type: ET_REL21Sections:22## Case 1: a correct case.23 - Name: .linker-options.valid124 Type: SHT_LLVM_LINKER_OPTIONS25 Options:26 - Name: option 027 Value: value 028 - Name: option 129 Value: value 130## Case 2: check we do not attempt to dump data from outside the SHT_LLVM_LINKER_OPTIONS section31## when it contains an incomplete key-value pair.32 - Name: .linker-options.incomplete33 Type: SHT_LLVM_LINKER_OPTIONS34 Content: "610062006300" ## 'a', '\0', 'b', '\0', 'c', '\0'35 - Type: Fill36 Pattern: "FF"37 Size: "1"38## Case 3: in case of an empty section we dump nothing.39 - Name: .linker-options.empty40 Type: SHT_LLVM_LINKER_OPTIONS41 Content: ""42## Case 4: check we do not attempt to dump data from outside the SHT_LLVM_LINKER_OPTIONS section43## when it is not null-terminated.44 - Name: .linker-options.nonul45 Type: SHT_LLVM_LINKER_OPTIONS46 Content: "61"47## Case 5: check we report a warning when it is not possible to read48## the content of the SHT_LLVM_LINKER_OPTIONS section.49 - Name: .linker-options.broken.content50 Type: SHT_LLVM_LINKER_OPTIONS51 ShOffset: 0xffffffff52 Options:53 - Name: foo54 Value: bar55## Case 6: another correct case to show we do not stop dumping after reporting a warning.56 - Name: .linker-options.valid257 Type: SHT_LLVM_LINKER_OPTIONS58 Options:59 - Name: option 360 Value: value 361 62## llvm-readelf doesn't support --elf-linker-options yet.63# RUN: llvm-readelf --elf-linker-options %t1 2>&1 | FileCheck %s --check-prefix=READELF64 65# READELF: printELFLinkerOptions not implemented!66