1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-02-01 05:01:59 +01:00
llvm-mirror/test/tools/yaml2obj/dynamic-section-raw-content.yaml
George Rimar 26bc596a02 [lib/ObjectYAML] - Improve and cleanup error reporting in ELFState<ELFT> class.
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
2019-09-09 09:43:03 +00:00

53 lines
1.3 KiB
YAML

# Show that yaml2obj can handle a dynamic section with raw content instead of
# entries. Also show that it rejects raw content when entries are also provided.
# RUN: yaml2obj --docnum=1 %s -o %t1
# RUN: llvm-readobj -x .dynamic --sections %t1 | FileCheck %s --check-prefix=RAW
# RAW: Name: .dynamic
# RAW-NEXT: Type: SHT_DYNAMIC
# RAW-NEXT: Flags [
# RAW-NEXT: ]
# RAW-NEXT: Address:
# RAW-NEXT: Offset:
# RAW-NEXT: Size: 16
# RAW: Hex dump of section '.dynamic':
# RAW-NEXT: 0x00000000 01234567 89012345 67890000 00000000 {{.*}}
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_EXEC
Machine: EM_X86_64
Sections:
- Name: .dynamic
Type: SHT_DYNAMIC
Content: "01234567890123456789000000000000"
# RUN: not yaml2obj --docnum=2 %s 2>&1 | FileCheck %s --check-prefix=ERR
# ERR: cannot specify both raw content and explicit entries for dynamic section '.dynamic1'
# ERR: cannot specify both raw content and explicit entries for dynamic section '.dynamic2'
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_EXEC
Machine: EM_X86_64
Sections:
- Name: .dynamic1
Type: SHT_DYNAMIC
Content: "0123456789"
Entries:
- Tag: DT_STRSZ
Value: 0
- Name: .dynamic2
Type: SHT_DYNAMIC
Content: "0123456789"
Entries:
- Tag: DT_STRSZ
Value: 0