mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
26bc596a02
The aim of this patch is to refactor how we handle and report error. I suggest to use the same approach we use in LLD: delayed error reporting. For that I introduced 'HasError' flag which triggers when we report an error. Now we do not exit instantly on any error. The benefits are: 1) There are no more 'exit(1)' calls in the library code. 2) Code was simplified significantly in a few places. 3) It is now possible to print multiple errors instead of only one. Also, I changed the messages to be lower case and removed a full stop. Differential revision: https://reviews.llvm.org/D67182 llvm-svn: 371380
102 lines
2.4 KiB
Plaintext
102 lines
2.4 KiB
Plaintext
## Check that yaml2obj is able to produce an object from YAML
|
|
## containing symbols with duplicate names (but different name suffixes).
|
|
|
|
# RUN: yaml2obj --docnum=1 %s -o %t1
|
|
# RUN: llvm-readobj -t %t1 | FileCheck %s --check-prefix=CASE1
|
|
|
|
# CASE1: Name: localfoo (1)
|
|
# CASE1: Name: localfoo (1)
|
|
|
|
--- !ELF
|
|
FileHeader:
|
|
Class: ELFCLASS64
|
|
Data: ELFDATA2LSB
|
|
Type: ET_REL
|
|
Machine: EM_X86_64
|
|
Symbols:
|
|
- Name: localfoo
|
|
- Name: 'localfoo [1]'
|
|
|
|
## Check that yaml2obj reports an error when we have
|
|
## symbols with equal names and suffixes.
|
|
|
|
# RUN: not yaml2obj --docnum=2 %s 2>&1| FileCheck %s --check-prefix=CASE2
|
|
# CASE2-COUNT-2: error: repeated symbol name: 'localfoo [1]'
|
|
|
|
--- !ELF
|
|
FileHeader:
|
|
Class: ELFCLASS64
|
|
Data: ELFDATA2LSB
|
|
Type: ET_REL
|
|
Machine: EM_X86_64
|
|
Symbols:
|
|
- Name: 'localfoo [1]'
|
|
- Name: 'localfoo [1]'
|
|
- Name: 'localfoo [1]'
|
|
|
|
## Check that yaml2obj reports an error when we have
|
|
## symbols without suffixes in the names and their
|
|
## names are equal.
|
|
|
|
# RUN: not yaml2obj --docnum=3 %s 2>&1| FileCheck %s --check-prefix=CASE3
|
|
# CASE3: error: repeated symbol name: 'localfoo'
|
|
# CASE3: error: repeated symbol name: 'localfoo'
|
|
|
|
--- !ELF
|
|
FileHeader:
|
|
Class: ELFCLASS64
|
|
Data: ELFDATA2LSB
|
|
Type: ET_REL
|
|
Machine: EM_X86_64
|
|
Symbols:
|
|
- Name: localfoo
|
|
- Name: localfoo
|
|
- Name: localfoo
|
|
|
|
## Check that yaml2obj can produce correct relocations that
|
|
## reference symbols with name suffixes.
|
|
|
|
# RUN: yaml2obj --docnum=4 %s -o %t4
|
|
# RUN: llvm-readobj -r --expand-relocs %t4 | FileCheck %s --check-prefix=CASE4
|
|
|
|
# CASE4: Relocations [
|
|
# CASE4-NEXT: Section {{.*}} .rela.text {
|
|
# CASE4-NEXT: Relocation {
|
|
# CASE4-NEXT: Offset: 0x0
|
|
# CASE4-NEXT: Type: R_X86_64_NONE
|
|
# CASE4-NEXT: Symbol: foo (1)
|
|
# CASE4-NEXT: Addend: 0x0
|
|
# CASE4-NEXT: }
|
|
# CASE4-NEXT: Relocation {
|
|
# CASE4-NEXT: Offset: 0x1
|
|
# CASE4-NEXT: Type: R_X86_64_NONE
|
|
# CASE4-NEXT: Symbol: foo (2)
|
|
# CASE4-NEXT: Addend: 0x0
|
|
# CASE4-NEXT: }
|
|
# CASE4-NEXT: }
|
|
# CASE4-NEXT: ]
|
|
|
|
--- !ELF
|
|
FileHeader:
|
|
Class: ELFCLASS64
|
|
Data: ELFDATA2LSB
|
|
Type: ET_REL
|
|
Machine: EM_X86_64
|
|
Sections:
|
|
- Name: .text
|
|
Type: SHT_PROGBITS
|
|
- Name: .rela.text
|
|
Type: SHT_RELA
|
|
Info: .text
|
|
Link: .symtab
|
|
Relocations:
|
|
- Offset: 0x0
|
|
Type: R_X86_64_NONE
|
|
Symbol: foo
|
|
- Offset: 0x1
|
|
Type: R_X86_64_NONE
|
|
Symbol: 'foo [1]'
|
|
Symbols:
|
|
- Name: foo
|
|
- Name: 'foo [1]'
|