[all-commits] [llvm/llvm-project] d5e48f: [yaml2obj][obj2yaml] - Improve how we set/dump the...

Georgii Rymar via All-commits all-commits at lists.llvm.org
Tue Jan 26 02:37:44 PST 2021


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: d5e48f1347d50e0da4926c5e41e12fd4700abd14
      https://github.com/llvm/llvm-project/commit/d5e48f1347d50e0da4926c5e41e12fd4700abd14
  Author: Georgii Rymar <grimar at accesssoftek.com>
  Date:   2021-01-26 (Tue, 26 Jan 2021)

  Changed paths:
    M llvm/include/llvm/ObjectYAML/ELFYAML.h
    M llvm/lib/ObjectYAML/ELFEmitter.cpp
    M llvm/test/tools/llvm-objcopy/ELF/only-keep-debug.test
    M llvm/test/tools/obj2yaml/ELF/entsize.yaml
    M llvm/test/tools/obj2yaml/ELF/implicit-sections-order.yaml
    M llvm/test/tools/obj2yaml/ELF/no-symtab.yaml

  Log Message:
  -----------
  [yaml2obj][obj2yaml] - Improve how we set/dump the sh_entsize field.

We already set the `sh_entsize` field in a single place
for all non-implicit sections.

This patch reorders the logic slightly and with it
we finally have the only one place where the `sh_entsize` is set.

obj2yaml will not dump the `EntSize` key for `SHT_DYNSYM/SHT_SYMTAB` sections anymore,
when the value of `sh_entsize` is equal to `sizeof(Elf_Sym)`

Note that this also seems revealed an issue in llvm-objcopy:
Previously yaml2obj set the `sh_entsize` for the `.symtab` section to 0x18,
now we it sets it for `SHT_SYMTAB` sections, i.e. by type.
But the `llvm-objcopy/ELF/only-keep-debug.test` has a `.symtab` section of type `SHT_STRTAB`,
and now yaml2obj sets the `sh_entsize` to 0 for it.
I had to update the corresponding check lines for `ES`, but the behavior of
`llvm-objcopy` should be fixed instead I think.
I've added a TODO and a comment.

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




More information about the All-commits mailing list