brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.8 KiB · 53eaa50 Raw
109 lines · plain
1## Check that we can use the --dependent-libraries option2## to dump SHT_LLVM_DEPENDENT_LIBRARIES sections.3 4## Check how we dump a file that has a single valid SHT_LLVM_DEPENDENT_LIBRARIES5## section with multiple entries.6 7# RUN: yaml2obj --docnum=1 %s -o %t18# RUN: llvm-readobj --dependent-libraries %t1 | \9# RUN:   FileCheck %s --check-prefix=LLVM --strict-whitespace --match-full-lines10# RUN: llvm-readelf --dependent-libraries %t1 | \11# RUN:   FileCheck %s --check-prefix=GNU --strict-whitespace --match-full-lines --implicit-check-not="Dependent libraries"12 13#      LLVM:DependentLibs [14# LLVM-NEXT:  foo15# LLVM-NEXT:  bar16# LLVM-NEXT:  foo17# LLVM-NEXT:]18 19#      GNU:Dependent libraries section .deplibs at offset 0x40 contains 3 entries:20# GNU-NEXT:  [     0]  foo21# GNU-NEXT:  [     4]  bar22# GNU-NEXT:  [     8]  foo23 24--- !ELF25FileHeader:26  Class: ELFCLASS6427  Data:  ELFDATA2LSB28  Type:  ET_REL29Sections:30  - Name:      .deplibs31    Type:      SHT_LLVM_DEPENDENT_LIBRARIES32    ShType:    [[TYPE=<none>]]33    Libraries: [ foo, bar, foo ]34 35## Show the output when there are no dependent library sections. Check that we are36## locating dependent library sections by type. To do this we change the type to an arbitrary one.37# RUN: yaml2obj --docnum=1 -DTYPE=SHT_PROGBITS %s -o %t338# RUN: llvm-readobj --dependent-libraries %t3 2>&1 | FileCheck %s --check-prefix=NONE39# RUN: llvm-readelf --dependent-libraries %t3 2>&1 | FileCheck %s --allow-empty --implicit-check-not={{.}}40 41# NONE:      DependentLibs [42# NONE-NEXT: ]43 44## Now, check how we dump a mix of valid, empty and invalid SHT_LLVM_DEPENDENT_LIBRARIES sections.45 46# RUN: yaml2obj --docnum=2 %s -o %t247# RUN: llvm-readobj --dependent-libraries %t2 2>&1 | FileCheck %s --check-prefix=MIX-LLVM -DFILE=%t248# RUN: llvm-readelf --dependent-libraries %t2 2>&1 | FileCheck %s --check-prefix=MIX-GNU -DFILE=%t249 50# MIX-LLVM:      DependentLibs [51# MIX-LLVM-NEXT:   warning: '[[FILE]]': SHT_LLVM_DEPENDENT_LIBRARIES section at index 1 is broken: the content is not null-terminated52# MIX-LLVM-NEXT:   abc53# MIX-LLVM-NEXT:   warning: '[[FILE]]': SHT_LLVM_DEPENDENT_LIBRARIES section at index 4 is broken: section [index 4] has a sh_offset (0xffff0000) + sh_size (0x4) that is greater than the file size (0x308)54# MIX-LLVM-NEXT:   bar55# MIX-LLVM-NEXT:   xxx56# MIX-LLVM-NEXT:   baz57# MIX-LLVM-NEXT: ]58 59# MIX-GNU:      warning: '[[FILE]]': SHT_LLVM_DEPENDENT_LIBRARIES section at index 1 is broken: the content is not null-terminated60# MIX-GNU-NEXT: Dependent libraries section .deplibs.nonul at offset 0x40 contains 0 entries:61# MIX-GNU-EMPTY:62# MIX-GNU-NEXT: Dependent libraries section .deplibs.single at offset 0x43 contains 1 entries:63# MIX-GNU-NEXT:   [     0]  abc64# MIX-GNU-EMPTY:65# MIX-GNU-NEXT: Dependent libraries section .deplibs.empty at offset 0x47 contains 0 entries:66# MIX-GNU-EMPTY:67# MIX-GNU-NEXT: warning: '[[FILE]]': SHT_LLVM_DEPENDENT_LIBRARIES section at index 4 is broken: section [index 4] has a sh_offset (0xffff0000) + sh_size (0x4) that is greater than the file size (0x308)68# MIX-GNU-NEXT: Dependent libraries section .deplibs.broken.shoffset at offset 0xffff0000 contains 0 entries:69# MIX-GNU-EMPTY:70# MIX-GNU-NEXT: Dependent libraries section .deplibs.multiple at offset 0x4b contains 2 entries:71# MIX-GNU-NEXT:   [     0]  bar72# MIX-GNU-NEXT:   [     4]  xxx73# MIX-GNU-EMPTY:74# MIX-GNU-NEXT: warning: '[[FILE]]': unable to get the name of SHT_LLVM_DEPENDENT_LIBRARIES section with index 6: a section [index 6] has an invalid sh_name (0x10000) offset which goes past the end of the section name string table75# MIX-GNU-NEXT: Dependent libraries section <?> at offset 0x53 contains 1 entries:76# MIX-GNU-NEXT:   [     0]  baz77 78--- !ELF79FileHeader:80  Class: ELFCLASS6481  Data:  ELFDATA2LSB82  Type:  ET_REL83Sections:84## Case 1: test we report a warning for a non-null-terminated section.85  - Name:      .deplibs.nonul86    Type:      SHT_LLVM_DEPENDENT_LIBRARIES87    Content:   "666f6f" ## 'f', 'o', 'o'88## Case 2: test we can dump an entry from a valid section that has a single entry.89  - Name:      .deplibs.single90    Type:      SHT_LLVM_DEPENDENT_LIBRARIES91    Libraries: [ abc ]92## Case 3: test we do not display warnings for an empty section.93  - Name:      .deplibs.empty94    Type:      SHT_LLVM_DEPENDENT_LIBRARIES95    Content:   ""96## Case 4: test we report a warning when the section offset is invalid.97  - Name:      .deplibs.broken.shoffset98    Type:      SHT_LLVM_DEPENDENT_LIBRARIES99    Libraries: [ yyy ]100    ShOffset:  0xffff0000101## Case 5: test we can dump all entries from a valid section that has more than one entry.102  - Name:      .deplibs.multiple103    Type:      SHT_LLVM_DEPENDENT_LIBRARIES104    Libraries: [ bar, xxx ]105## Case 6: test we report a warning in GNU mode if the section name can't be read.106  - ShName:    0x10000107    Type:      SHT_LLVM_DEPENDENT_LIBRARIES108    Libraries: [ baz ]109