llvm/test/tools/yaml2obj/relocation-unsupported-machine.yaml
George Rimar 6a5d9ef0f4 [yaml2obj/obj2yaml] - Do not trigger llvm_unreachable when dumping/parsing relocations and e_machine is unsupported.
Currently when e_machine is set to something that is not supported by YAML lib,
then tools fail with llvm_unreachable.

In this patch I allow them to handle relocations in this case.
It can be used to dump and create objects for broken or unsupported targets.

Differential revision: https://reviews.llvm.org/D67657


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372377 91177308-0d34-0410-b5e6-96231b3b80d8
2019-09-20 09:15:36 +00:00

25 lines
771 B
YAML

## Show that yaml2obj is able to write relocations for an unknown e_machine properly.
# RUN: yaml2obj %s -o %t1
# RUN: llvm-readelf %t1 --relocations | FileCheck %s
# CHECK: Relocation section '.rela.text' at offset 0x40 contains 2 entries:
# CHECK: Offset Info Type Symbol's Value Symbol's Name + Addend
# CHECK-NEXT: 0000000000000001 0000000000000002 Unknown 0
# CHECK-NEXT: 0000000000000003 0000000000000004 Unknown 0
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2MSB
Type: ET_REL
Machine: 0x1234
Sections:
- Name: .rela.text
Type: SHT_RELA
Relocations:
- Offset: 0x1
Type: 0x2
- Offset: 0x3
Type: 0x4