1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00
llvm-mirror/test/Object/obj2yaml-invalid-reloc.test
George Rimar 60c8d3580e [yaml2obj][obj2yaml] - Change how symbol's binding is descibed when parsing/dumping.
Currently, YAML has the following syntax for describing the symbols:

Symbols:
  Local:
    LocalSymbol1:
    ...
    LocalSymbol2:
    ...
  ...
  Global:
    GlobalSymbol1:
  ...
  Weak:
  ...
  GNUUnique:

I.e. symbols are grouped by their bindings. That is not very convenient,
because:

It does not allow to set a custom binding, what can be useful for producing
broken/special outputs for test cases. Adding a new binding would require to
change a syntax (what we observed when added GNUUnique recently).

It does not allow to change the order of the symbols in .symtab/.dynsym,
i.e. currently all Local symbols are placed first, then Global, Weak and GNUUnique
are following, but we are not able to change the order.

It is not consistent. Binding is just one of the properties of the symbol,
we do not group them by other properties.

It makes the code more complex that it can be. This patch shows it can be simplified
with the change performed.

The patch changes the syntax to just:

Symbols:
  Symbol1:
  ...
  Symbol2:
  ...
...

With that, we are able to work with the binding field just like with any other symbol property.

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

llvm-svn: 357595
2019-04-03 14:53:42 +00:00

40 lines
1.7 KiB
Plaintext

RUN: obj2yaml %p/Inputs/invalid-reloc.elf-x86-64 | FileCheck %s
CHECK: --- !ELF
CHECK-NEXT: FileHeader:
CHECK-NEXT: Class: ELFCLASS64
CHECK-NEXT: Data: ELFDATA2LSB
CHECK-NEXT: OSABI: ELFOSABI_FREEBSD
CHECK-NEXT: Type: ET_REL
CHECK-NEXT: Machine: EM_X86_64
CHECK-NEXT: Sections:
CHECK-NEXT: - Name: .text
CHECK-NEXT: Type: SHT_PROGBITS
CHECK-NEXT: Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
CHECK-NEXT: AddressAlign: 0x0000000000000004
CHECK-NEXT: Content: 4833C0C390
CHECK-NEXT: - Name: .rela.text
CHECK-NEXT: Type: SHT_RELA
CHECK-NEXT: Link: .symtab
CHECK-NEXT: AddressAlign: 0x0000000000000008
CHECK-NEXT: EntSize: 0x0000000000000018
CHECK-NEXT: Info: .text
CHECK-NEXT: Relocations:
CHECK-NEXT: - Offset: 0x0000000000000000
CHECK-NEXT: Symbol: ''
CHECK-NEXT: Type: R_X86_64_NONE
CHECK-NEXT: Symbols:
CHECK-NEXT: - Name: rb_ary_new_capa
CHECK-NEXT: Type: STT_FUNC
CHECK-NEXT: Section: .text
CHECK-NEXT: Size: 0x0000000000000005
CHECK-NEXT: - Name: __dtraceenabled_ruby___array-create
CHECK-NEXT: Index: SHN_ABS
CHECK-NEXT: Binding: STB_GLOBAL
CHECK-NEXT: - Name: '$dtrace1316529.rb_ary_new_capa'
CHECK-NEXT: Type: STT_FUNC
CHECK-NEXT: Section: .text
CHECK-NEXT: Binding: STB_GLOBAL
CHECK-NEXT: Size: 0x0000000000000005
CHECK-NEXT: Visibility: STV_HIDDEN