Files
clang-p2996/llvm/test/tools/llvm-objdump/X86/Inputs/simple-executable-x86_64.yaml
George Rimar 6da44ad75d [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

76 lines
2.8 KiB
YAML

--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_EXEC
Machine: EM_X86_64
Sections:
- Name: .text
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
AddressAlign: 0x0000000000000010
Content: 554889E58B0425A80000005DC30F1F00
- Name: .anothertext
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
Address: 0x0000000000000010
AddressAlign: 0x0000000000000010
Content: 554889E54883EC20488D0425A8000000C745FC00000000488945F0488B45F08B08894DECE8C7FFFFFF8B4DEC01C189C84883C4205D746573742073747200C3
- Name: .eh_frame
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC ]
Address: 0x0000000000000050
AddressAlign: 0x0000000000000008
Content: 1400000000000000017A5200017810011B0C0708900100001C0000001C00000090FFFFFF0D00000000410E108602430D06000000000000001C0000003C00000080FFFFFF3F00000000410E108602430D0600000000000000
- Name: .data
Type: SHT_PROGBITS
Flags: [ SHF_WRITE, SHF_ALLOC ]
Address: 0x00000000000000A8
AddressAlign: 0x0000000000000004
Content: '01000000'
- Name: .comment
Type: SHT_PROGBITS
Flags: [ SHF_MERGE, SHF_STRINGS ]
AddressAlign: 0x0000000000000001
Content: 5562756E747520636C616E672076657273696F6E20332E352D317562756E74753120287472756E6B2920286261736564206F6E204C4C564D20332E352900
Symbols:
- Type: STT_SECTION
Section: .text
- Type: STT_SECTION
Section: .anothertext
Value: 0x0000000000000010
- Type: STT_SECTION
Section: .eh_frame
Value: 0x0000000000000050
- Type: STT_SECTION
Section: .data
Value: 0x00000000000000A8
- Type: STT_SECTION
Section: .comment
- Name: /tmp/a.c
Type: STT_FILE
- Type: STT_FILE
- Name: somedata
Type: STT_OBJECT
Section: .anothertext
Value: 0x0000000000000045
Binding: STB_GLOBAL
- Name: main
Type: STT_FUNC
Section: .anothertext
Value: 0x0000000000000010
Size: 0x000000000000003F
Binding: STB_GLOBAL
- Name: foo
Type: STT_FUNC
Section: .text
Size: 0x000000000000000D
Binding: STB_GLOBAL
- Name: a
Type: STT_OBJECT
Section: .data
Value: 0x00000000000000A8
Size: 0x0000000000000004
Binding: STB_GLOBAL
...