[PATCH] D74764: [yaml2obj][WIP] - Automatically assign VA for allocatable sections.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 18 06:14:08 PST 2020


grimar created this revision.
grimar added reviewers: jhenderson, MaskRay.
Herald added subscribers: hiraditya, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.

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 <https://reviews.llvm.org/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)

It is in WIP status, because with this patch many yaml2obj tests are failing,
and I'd like to be sure that the idea itself is fine before I start fixing them.
The test case added shows how the change works. So, what about doing this change?


https://reviews.llvm.org/D74764

Files:
  llvm/include/llvm/ObjectYAML/ELFYAML.h
  llvm/lib/ObjectYAML/ELFEmitter.cpp
  llvm/lib/ObjectYAML/ELFYAML.cpp
  llvm/test/tools/yaml2obj/ELF/section-address-assign.yaml
  llvm/tools/obj2yaml/elf2yaml.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74764.245143.patch
Type: text/x-patch
Size: 7678 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200218/2228a7d7/attachment.bin>


More information about the llvm-commits mailing list