Files
clang-p2996/llvm/test/tools/llvm-objcopy/ELF/Inputs/compress-debug-sections.yaml
Georgii Rymar d4035af253 [llvm-readelf/obj] - Print section symbol names properly when dumping relocations.
Currently `--relocations` ignores section symbol names and always prints
section names for them. This is inconsistent with GNU readelf and with `--symbols`.

We have a code in `getFullSymbolName` (which is used for `--symbols`) which can be
reused for `getRelocationTarget` (used for `--relocations`).
With that the issue described is fixed and code becomes a bit shorter.
Also with this change we start to print more relocations (in situations when we just
showed warnings instead before) and also start to report more diagnostic warnings
(see reloc-zero-name-or-value.test).

Differential revision: https://reviews.llvm.org/D87613
2020-09-23 13:25:39 +03:00

60 lines
1.7 KiB
YAML

--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_X86_64
Sections:
- Name: .debug_foo
Type: SHT_PROGBITS
Content: 0000000000000000
- Name: .notdebug_foo
Type: SHT_PROGBITS
Content: 0000000000000000
- Name: .rela.debug_foo
Type: SHT_RELA
Info: .debug_foo
Relocations:
- Offset: 0x1
Symbol: 1
Type: R_X86_64_32
- Offset: 0x2
Symbol: 2
Type: R_X86_64_32
## This section should not be involved in relocations.
- Name: .debug_bar
Type: SHT_PROGBITS
Content: 0000000000000000
- Name: .group
Type: SHT_GROUP
Link: .symtab
AddressAlign: 4
EntSize: 0x0000000000000004
Info: groupname
Members:
- SectionOrType: GRP_COMDAT
- SectionOrType: .text.in.group
- SectionOrType: .debug_in_group
- Name: .text.in.group
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ]
Content: '00'
- Name: .debug_in_group
Type: SHT_PROGBITS
Flags: [ SHF_GROUP ]
Content: '00'
Symbols:
- Type: STT_SECTION
Section: .debug_foo
Binding: STB_GLOBAL
- Type: STT_SECTION
Section: .notdebug_foo
Binding: STB_GLOBAL
- Name: .Linfo_string0
Section: .debug_bar
Binding: STB_GLOBAL
- Name: groupname
Section: .group
Binding: STB_GLOBAL
...