1## Check that yaml2obj is able to produce an object from YAML 2## containing symbols with duplicate names (but different name suffixes). 3 4# RUN: yaml2obj --docnum=1 %s -o %t1 5# RUN: llvm-readobj --syms %t1 | FileCheck %s --check-prefix=CASE1 6 7# CASE1: Name: localfoo (1) 8# CASE1: Name: localfoo (1) 9 10--- !ELF 11FileHeader: 12 Class: ELFCLASS64 13 Data: ELFDATA2LSB 14 Type: ET_REL 15Symbols: 16 - Name: localfoo 17 - Name: 'localfoo (1)' 18 19## Check that yaml2obj reports an error when we have 20## symbols with equal names and suffixes. 21 22# RUN: not yaml2obj --docnum=2 %s 2>&1| FileCheck %s --check-prefix=CASE2 23# CASE2-COUNT-2: error: repeated symbol name: 'localfoo (1)' 24 25--- !ELF 26FileHeader: 27 Class: ELFCLASS64 28 Data: ELFDATA2LSB 29 Type: ET_REL 30Symbols: 31 - Name: 'localfoo (1)' 32 - Name: 'localfoo (1)' 33 - Name: 'localfoo (1)' 34 35## Check that yaml2obj reports an error when we have 36## symbols without suffixes in the names and their 37## names are equal. 38 39# RUN: not yaml2obj --docnum=3 %s 2>&1| FileCheck %s --check-prefix=CASE3 40# CASE3: error: repeated symbol name: 'localfoo' 41# CASE3: error: repeated symbol name: 'localfoo' 42 43--- !ELF 44FileHeader: 45 Class: ELFCLASS64 46 Data: ELFDATA2LSB 47 Type: ET_REL 48Symbols: 49 - Name: localfoo 50 - Name: localfoo 51 - Name: localfoo 52 53## Check that yaml2obj can produce correct relocations that 54## reference symbols with name suffixes. 55 56# RUN: yaml2obj --docnum=4 %s -o %t4 57# RUN: llvm-readobj -r --expand-relocs %t4 | FileCheck %s --check-prefix=CASE4 58 59# CASE4: Relocations [ 60# CASE4-NEXT: Section {{.*}} .rela.text { 61# CASE4-NEXT: Relocation { 62# CASE4-NEXT: Offset: 0x0 63# CASE4-NEXT: Type: R_X86_64_NONE 64# CASE4-NEXT: Symbol: foo (1) 65# CASE4-NEXT: Addend: 0x0 66# CASE4-NEXT: } 67# CASE4-NEXT: Relocation { 68# CASE4-NEXT: Offset: 0x1 69# CASE4-NEXT: Type: R_X86_64_NONE 70# CASE4-NEXT: Symbol: foo (2) 71# CASE4-NEXT: Addend: 0x0 72# CASE4-NEXT: } 73# CASE4-NEXT: } 74# CASE4-NEXT: ] 75 76--- !ELF 77FileHeader: 78 Class: ELFCLASS64 79 Data: ELFDATA2LSB 80 Type: ET_REL 81 Machine: EM_X86_64 82Sections: 83 - Name: .text 84 Type: SHT_PROGBITS 85 - Name: .rela.text 86 Type: SHT_RELA 87 Info: .text 88 Link: .symtab 89 Relocations: 90 - Type: R_X86_64_NONE 91 Symbol: foo 92 - Offset: 0x1 93 Type: R_X86_64_NONE 94 Symbol: 'foo (1)' 95Symbols: 96 - Name: foo 97 - Name: 'foo (1)' 98