brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.4 KiB · 97724f7 Raw
142 lines · yaml
1## Check that obj2yaml is able to produce YAML from2## an object containing symbols and sections with duplicate3## names and produces same-named sections and symbols4## with distinguishing suffixes.5 6# RUN: yaml2obj --docnum=1 %s -o %t17# RUN: llvm-readobj -s -t %t1 | FileCheck %s8 9# CHECK: Name: .foo (10# CHECK: Name: .foo (11# CHECK: Name: .foo (12# CHECK: Name: .bar (13# CHECK: Name: .bar (14# CHECK: Name: .bar (15 16# CHECK: Name: localfoo (17# CHECK: Name: localfoo (18# CHECK: Name: localfoo (19# CHECK: Name: localbar (20# CHECK: Name: localbar (21# CHECK: Name: localbar (22 23# RUN: obj2yaml %t1 | FileCheck %s --check-prefix=CASE124 25# CASE1:      --- !ELF26# CASE1-NEXT: FileHeader:27# CASE1-NEXT:   Class: ELFCLASS6428# CASE1-NEXT:   Data:  ELFDATA2LSB29# CASE1-NEXT:   Type:  ET_REL30# CASE1-NEXT: Sections:31# CASE1-NEXT:   - Name: .foo32# CASE1-NEXT:     Type: SHT_PROGBITS33# CASE1-NEXT:   - Name: '.foo (1)'34# CASE1-NEXT:     Type: SHT_PROGBITS35# CASE1-NEXT:   - Name: '.foo (2)'36# CASE1-NEXT:     Type: SHT_PROGBITS37# CASE1-NEXT:   - Name: .bar38# CASE1-NEXT:     Type: SHT_PROGBITS39# CASE1-NEXT:   - Name: '.bar (1)'40# CASE1-NEXT:     Type: SHT_PROGBITS41# CASE1-NEXT:   - Name: '.bar (2)'42# CASE1-NEXT:     Type: SHT_PROGBITS43# CASE1-NEXT: Symbols:44# CASE1-NEXT:   - Name: localfoo45# CASE1-NEXT:   - Name: 'localfoo (1)'46# CASE1-NEXT:   - Name: 'localfoo (2)'47# CASE1-NEXT:   - Name: localbar48# CASE1-NEXT:   - Name: 'localbar (1)'49# CASE1-NEXT:   - Name: 'localbar (2)'50# CASE1-NEXT: ...51 52--- !ELF53FileHeader:54  Class: ELFCLASS6455  Data:  ELFDATA2LSB56  Type:  ET_REL57Sections:58  - Name: .foo59    Type: SHT_PROGBITS60  - Name: '.foo (555)'61    Type: SHT_PROGBITS62  - Name: '.foo (random_tag)'63    Type: SHT_PROGBITS64  - Name: .bar65    Type: SHT_PROGBITS66  - Name: '.bar (666)'67    Type: SHT_PROGBITS68  - Name: '.bar (random_tag)'69    Type: SHT_PROGBITS70Symbols:71  - Name: 'localfoo (111)'72  - Name: 'localfoo (222)'73  - Name: 'localfoo (random_tag)'74  - Name: 'localbar (333)'75  - Name: 'localbar (444)'76  - Name: 'localbar (random_tag)'77 78## Check we can refer to symbols with the same79## name from relocations.80 81# RUN: yaml2obj --docnum=2 %s -o %t282# RUN: obj2yaml %t2 | FileCheck %s --check-prefix=CASE283 84# CASE2:      Relocations:85# CASE2-NEXT:  - Symbol: 'foo (1)'86# CASE2-NEXT:    Type:   R_X86_64_PC3287# CASE2-NEXT:  - Offset: 0x488# CASE2-NEXT:    Symbol: foo89# CASE2-NEXT:    Type:   R_X86_64_PC3290# CASE2-NEXT: Symbols:91# CASE2-NEXT:  - Name: foo92# CASE2-NEXT:  - Name: 'foo (1)'93  94--- !ELF95FileHeader:96  Class:   ELFCLASS6497  Data:    ELFDATA2LSB98  Type:    ET_REL99  Machine: EM_X86_64100Sections:101  - Name: .text102    Type: SHT_PROGBITS103    Size: 8104  - Name: .rela.text105    Type: SHT_RELA106    Info: .text107    Link: .symtab108    Relocations:109      - Type: R_X86_64_PC32110        Symbol: 'foo (1)'111      - Type: R_X86_64_PC32112        Offset: 4113        Symbol: foo114Symbols:115  - Name: foo116  - Name: 'foo (1)'117 118## Check obj2yaml does not add a suffix to a name if the119## symbol is in .symtab and .dynsym at the same time.120 121# RUN: yaml2obj --docnum=3 %s -o %t3122# RUN: obj2yaml %t3 | FileCheck %s --check-prefix=CASE3123 124# CASE3:      Symbols:125# CASE3-NEXT:   - Name:    foo126# CASE3-NEXT:     Binding: STB_GLOBAL127# CASE3-NEXT: DynamicSymbols:128# CASE3-NEXT:   - Name:    foo129# CASE3-NEXT:     Binding: STB_GLOBAL130 131--- !ELF132FileHeader:133  Class: ELFCLASS64134  Data:  ELFDATA2LSB135  Type:  ET_DYN136Symbols:137  - Name:    foo138    Binding: STB_GLOBAL139DynamicSymbols:140  - Name:    foo141    Binding: STB_GLOBAL142