This is an archive of the discontinued LLVM Phabricator instance.

[yaml2obj] - Make DynamicSymbols to be Optional<> too.
ClosedPublic

Authored by grimar on Dec 3 2019, 4:57 AM.

Details

Summary

We already have Symbols property to list regular symbols and
it is currently Optional<>. This patch makes DynamicSymbols to be optional
too. With this there is no need to define a dummy symbol anymore to trigger
creation of the .dynsym and it is now possible to define an empty .dynsym using
just the following line:

DynamicSymbols: []
(it is important to have when you do not want to have dynamic symbols,
but want to have a .dynsym)

Now the code is consistent and it helped to fix a bug: previously we
did not report an error when both Content/Size and an empty
Symbols/DynamicSymbols list were specified.

Diff Detail

Event Timeline

grimar created this revision.Dec 3 2019, 4:57 AM
grimar edited the summary of this revision. (Show Details)Dec 3 2019, 4:58 AM
grimar edited the summary of this revision. (Show Details)Dec 3 2019, 5:02 AM
jhenderson added inline comments.Dec 3 2019, 7:42 AM
llvm/lib/ObjectYAML/ELFEmitter.cpp
574

Maybe PropName -> Property?

llvm/test/tools/yaml2obj/ELF/symtab-implicit-sections-size-content.yaml
30

It probably doesn't matter much, but do the changes in this test belong with this patch?

MaskRay added inline comments.Dec 3 2019, 10:44 AM
llvm/test/tools/yaml2obj/ELF/dynsymtab-implicit-sections-size-content.yaml
100

Align the values.

grimar updated this revision to Diff 232052.Dec 4 2019, 1:21 AM
grimar marked 2 inline comments as done.
  • Addressed review comments.
llvm/test/tools/yaml2obj/ELF/symtab-implicit-sections-size-content.yaml
30

It is related to changes done in ELFEmitter.cpp: both "Symbols"
and "DynamicSymbols" are handled in the same way now.

Without those changes, this test would fail:
The code without this patch would allow both Size and Symbols [],
just like it allowed Size + DynamicSymbols: [].

This revision is now accepted and ready to land.Dec 4 2019, 2:06 AM
This revision was automatically updated to reflect the committed changes.