llvm.org GIT mirror llvm / 940b9a1
[YAML] - Teach yaml2obj/obj2yaml to work with numeric relocation values. That may be useful if we want to produce or parse object containing broken relocation values using yaml2obj/obj2yaml. Previously that was impossible because only enum values were parsed correctly, this patch allows to put any numeric value as a relocation type. Differential revision: https://reviews.llvm.org/D34758 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306814 91177308-0d34-0410-b5e6-96231b3b80d8 George Rimar 2 years ago
2 changed file(s) with 30 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
541541 llvm_unreachable("Unsupported architecture");
542542 }
543543 #undef ELF_RELOC
544 IO.enumFallback(Value);
544545 }
545546
546547 void ScalarEnumerationTraits::enumeration(
0 # RUN: yaml2obj %s > %t
1 # RUN: obj2yaml %t | FileCheck %s
2
3 # CHECK: Relocations:
4 # CHECK-NEXT: - Offset:
5 # CHECK-NEXT: Symbol:
6 # CHECK-NEXT: Type: 0x000000FF
7
8 !ELF
9 FileHeader:
10 Class: ELFCLASS32
11 Data: ELFDATA2LSB
12 Type: ET_REL
13 Machine: EM_386
14 Sections:
15 - Type: SHT_PROGBITS
16 Name: .text
17 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
18 AddressAlign: 0x04
19 Content: 0000000000000000
20 - Type: SHT_REL
21 Name: .rel.text
22 Link: .symtab
23 Info: .text
24 AddressAlign: 0x04
25 Relocations:
26 - Offset: 0
27 Symbol: main
28 Type: 0xFF