[llvm] r352373 - [obj2yaml] - Dump the sh_entsize section field.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 28 07:05:10 PST 2019
Author: grimar
Date: Mon Jan 28 07:05:10 2019
New Revision: 352373
URL: http://llvm.org/viewvc/llvm-project?rev=352373&view=rev
Log:
[obj2yaml] - Dump the sh_entsize section field.
I faced with the fact that obj2yaml does not dump the sh_entsize field.
A problem arose when I tried to dump ELF versioning sections.
This is close to what D50235 did, but D50235 did the change for yaml2obj, and now
I had to do the same for obj2yaml.
Differential revision: https://reviews.llvm.org/D57229
Added:
llvm/trunk/test/tools/obj2yaml/elf-entsize.yaml
Modified:
llvm/trunk/test/Object/AArch64/yaml2obj-elf-aarch64-rel.yaml
llvm/trunk/test/Object/Mips/abi-flags.yaml
llvm/trunk/test/Object/obj2yaml-invalid-reloc.test
llvm/trunk/test/Object/obj2yaml.test
llvm/trunk/tools/obj2yaml/elf2yaml.cpp
Modified: llvm/trunk/test/Object/AArch64/yaml2obj-elf-aarch64-rel.yaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/AArch64/yaml2obj-elf-aarch64-rel.yaml?rev=352373&r1=352372&r2=352373&view=diff
==============================================================================
--- llvm/trunk/test/Object/AArch64/yaml2obj-elf-aarch64-rel.yaml (original)
+++ llvm/trunk/test/Object/AArch64/yaml2obj-elf-aarch64-rel.yaml Mon Jan 28 07:05:10 2019
@@ -5,6 +5,7 @@
# 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
Modified: llvm/trunk/test/Object/Mips/abi-flags.yaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/Mips/abi-flags.yaml?rev=352373&r1=352372&r2=352373&view=diff
==============================================================================
--- llvm/trunk/test/Object/Mips/abi-flags.yaml (original)
+++ llvm/trunk/test/Object/Mips/abi-flags.yaml Mon Jan 28 07:05:10 2019
@@ -25,6 +25,7 @@
# YAML-NEXT: - Name: .MIPS.abiflags
# YAML-NEXT: Type: SHT_MIPS_ABIFLAGS
# YAML-NEXT: AddressAlign: 0x0000000000000008
+# YAML-NEXT: EntSize: 0x0000000000000018
# YAML-NEXT: ISA: MIPS64
# YAML-NEXT: ISARevision: 0x05
# YAML-NEXT: ISAExtension: EXT_OCTEON3
Modified: llvm/trunk/test/Object/obj2yaml-invalid-reloc.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/obj2yaml-invalid-reloc.test?rev=352373&r1=352372&r2=352373&view=diff
==============================================================================
--- llvm/trunk/test/Object/obj2yaml-invalid-reloc.test (original)
+++ llvm/trunk/test/Object/obj2yaml-invalid-reloc.test Mon Jan 28 07:05:10 2019
@@ -17,6 +17,7 @@ CHECK-NEXT: - Name: .rela.t
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
Modified: llvm/trunk/test/Object/obj2yaml.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/obj2yaml.test?rev=352373&r1=352372&r2=352373&view=diff
==============================================================================
--- llvm/trunk/test/Object/obj2yaml.test (original)
+++ llvm/trunk/test/Object/obj2yaml.test Mon Jan 28 07:05:10 2019
@@ -364,6 +364,7 @@ ELF-MIPSEL-NEXT: - Name: .r
ELF-MIPSEL-NEXT: Type: SHT_REL
ELF-MIPSEL-NEXT: Link: .symtab
ELF-MIPSEL-NEXT: AddressAlign: 0x0000000000000004
+ELF-MIPSEL-NEXT: EntSize: 0x0000000000000008
ELF-MIPSEL-NEXT: Info: .text
ELF-MIPSEL-NEXT: Relocations:
ELF-MIPSEL-NEXT: - Offset: 0x0000000000000000
@@ -402,6 +403,7 @@ ELF-MIPSEL-NEXT: - Name: .r
ELF-MIPSEL-NEXT: Type: SHT_PROGBITS
ELF-MIPSEL-NEXT: Flags: [ SHF_ALLOC, SHF_MERGE, SHF_STRINGS ]
ELF-MIPSEL-NEXT: AddressAlign: 0x0000000000000001
+ELF-MIPSEL-NEXT: EntSize: 0x0000000000000001
ELF-MIPSEL-NEXT: Content: 48656C6C6F20576F726C640A00
ELF-MIPSEL-NEXT: - Name: .reginfo
ELF-MIPSEL-NEXT: Type: SHT_MIPS_REGINFO
@@ -481,6 +483,7 @@ ELF-MIPS64EL-NEXT: - Name:
ELF-MIPS64EL-NEXT: Type: SHT_RELA
ELF-MIPS64EL-NEXT: Link: .symtab
ELF-MIPS64EL-NEXT: AddressAlign: 0x0000000000000008
+ELF-MIPS64EL-NEXT: EntSize: 0x0000000000000018
ELF-MIPS64EL-NEXT: Info: .data
ELF-MIPS64EL-NEXT: Relocations:
ELF-MIPS64EL-NEXT: - Offset: 0
@@ -494,6 +497,7 @@ ELF-MIPS64EL-NEXT: - Name:
ELF-MIPS64EL-NEXT: Type: SHT_MIPS_OPTIONS
ELF-MIPS64EL-NEXT: Flags: [ SHF_ALLOC, SHF_MIPS_NOSTRIP ]
ELF-MIPS64EL-NEXT: AddressAlign: 0x0000000000000008
+ELF-MIPS64EL-NEXT: EntSize: 0x0000000000000001
ELF-MIPS64EL-NEXT: Content: '01280000000000000000000000000000000000000000000000000000000000000000000000000000'
ELF-MIPS64EL-NEXT: - Name: .pdr
ELF-MIPS64EL-NEXT: Type: SHT_PROGBITS
@@ -549,6 +553,7 @@ ELF-X86-64-NEXT: Type: SH
ELF-X86-64-NEXT: Address: 0x0000000000000038
ELF-X86-64-NEXT: Link: .symtab
ELF-X86-64-NEXT: AddressAlign: 0x0000000000000008
+ELF-X86-64-NEXT: EntSize: 0x0000000000000018
ELF-X86-64-NEXT: Info: .text
ELF-X86-64-NEXT: Relocations:
ELF-X86-64-NEXT: - Offset: 0x000000000000000D
Added: llvm/trunk/test/tools/obj2yaml/elf-entsize.yaml
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/obj2yaml/elf-entsize.yaml?rev=352373&view=auto
==============================================================================
--- llvm/trunk/test/tools/obj2yaml/elf-entsize.yaml (added)
+++ llvm/trunk/test/tools/obj2yaml/elf-entsize.yaml Mon Jan 28 07:05:10 2019
@@ -0,0 +1,21 @@
+# RUN: yaml2obj %s -o %t
+# RUN: obj2yaml %t | FileCheck %s
+
+## Check obj2yaml is able to dump sh_entsize field of a section.
+
+# CHECK: - Name: .rodata.cst4
+# CHECK-NEXT: Type: SHT_PROGBITS
+# CHECK-NEXT: Flags: [ SHF_ALLOC, SHF_MERGE ]
+# CHECK-NEXT: EntSize: 0x0000000000000004
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_X86_64
+Sections:
+ - Name: .rodata.cst4
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_MERGE ]
+ EntSize: 0x0000000000000004
Modified: llvm/trunk/tools/obj2yaml/elf2yaml.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/obj2yaml/elf2yaml.cpp?rev=352373&r1=352372&r2=352373&view=diff
==============================================================================
--- llvm/trunk/tools/obj2yaml/elf2yaml.cpp (original)
+++ llvm/trunk/tools/obj2yaml/elf2yaml.cpp Mon Jan 28 07:05:10 2019
@@ -317,6 +317,8 @@ std::error_code ELFDumper<ELFT>::dumpCom
S.Flags = Shdr->sh_flags;
S.Address = Shdr->sh_addr;
S.AddressAlign = Shdr->sh_addralign;
+ if (Shdr->sh_entsize)
+ S.EntSize = static_cast<llvm::yaml::Hex64>(Shdr->sh_entsize);
auto NameOrErr = getUniquedSectionName(Shdr);
if (!NameOrErr)
More information about the llvm-commits
mailing list