[all-commits] [llvm/llvm-project] 31f2ad: [yaml2obj] - Automatically assign sh_addr for allo...

Georgii Rymar via All-commits all-commits at lists.llvm.org
Sat Feb 22 04:38:33 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 31f2ad9c368d47721508cbd0d120d626f9041715
      https://github.com/llvm/llvm-project/commit/31f2ad9c368d47721508cbd0d120d626f9041715
  Author: Georgii Rymar <grimar at accesssoftek.com>
  Date:   2020-02-22 (Sat, 22 Feb 2020)

  Changed paths:
    M llvm/include/llvm/ObjectYAML/ELFYAML.h
    M llvm/lib/ObjectYAML/ELFEmitter.cpp
    M llvm/lib/ObjectYAML/ELFYAML.cpp
    M llvm/test/tools/llvm-objcopy/ELF/only-keep-debug.test
    M llvm/test/tools/llvm-readobj/ELF/verneed-invalid.test
    M llvm/test/tools/llvm-readobj/ELF/versioninfo.test
    M llvm/test/tools/obj2yaml/elf-gnu-hash-section.yaml
    A llvm/test/tools/yaml2obj/ELF/section-address-assign.yaml
    M llvm/tools/obj2yaml/elf2yaml.cpp

  Log Message:
  -----------
  [yaml2obj] - Automatically assign sh_addr for allocatable sections.

I've noticed that it is not convenient to create YAMLs from
binaries (using obj2yaml) that have to be test cases for obj2yaml
later (after applying yaml2obj).

The problem, for example is that obj2yaml emits "DynamicSymbols:"
key instead of .dynsym. It also does not create .dynstr.
And when a YAML document without explicitly defined .dynsym/.dynstr
is given to yaml2obj, we have issues:

1) These sections are placed after non-allocatable sections (I've fixed it in D74756).
2) They have VA == 0. User needs create descriptions for such sections explicitly manually
    to set a VA.

This patch addresses (2). I suggest to let yaml2obj assign virtual addresses by itself.
It makes an output binary to be much closer to "normal" ELF.
(It is still possible to use "Address: 0x0" for a section to get the original behavior
if it is needed)

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




More information about the All-commits mailing list