Page MenuHomePhabricator

[yaml2obj][obj2yaml] - Simplify format of the SHT_LLVM_ADDRSIG section.
ClosedPublic

Authored by grimar on Mon, Feb 3, 6:20 AM.

Details

Summary

Previously the description allowed to describe symbols with use of
Name and Index keys. This patch removes them and now it is still
possible to use either names or symbol indexes, but the code is simpler
and the format is slightly different.

Such a change will be useful for another patches, e.g see:
https://reviews.llvm.org/D73788#inline-671077

Diff Detail

Event Timeline

grimar created this revision.Mon, Feb 3, 6:20 AM
Herald added a project: Restricted Project. · View Herald Transcript
grimar marked an inline comment as done.Mon, Feb 3, 7:35 AM
grimar added inline comments.
llvm/test/tools/llvm-readobj/ELF/addrsig.test
23

Thinking about his again, I wonder if we want the following output format:

Symbols:
  - foo
  - bar

All what is needed is to stop using YAMLFlowString and use StringRef,
so the change is trivial.
That might produce a nicer (?) output when symbol names are long probably,
though I am not sure we should care too much here and/or what is better.

MaskRay added inline comments.Mon, Feb 3, 3:48 PM
llvm/test/tools/llvm-readobj/ELF/addrsig.test
23

Is there a test having a special symbol name (a metacharacter in YAML.)? e.g. [

Just want to make sure they are properly quoted.

MaskRay added inline comments.Mon, Feb 3, 3:50 PM
llvm/test/tools/llvm-readobj/ELF/addrsig.test
23

A list of YAMLFlowString can be wrapped (default wrap column is 70), can't it?

If yes, I think YAMLFlowString is fine. I don't have a strong opinion, though. We can also use StringRef.

jhenderson accepted this revision.Tue, Feb 4, 1:36 AM

LGTM, once @MaskRay is happy.

llvm/test/tools/llvm-readobj/ELF/addrsig.test
23

I personally prefer the YAMLFlowString syntax, as long as it can be wrapped as @MaskRay mentions. I think we made a similar change in recent months in that direction for something else, but I don't remember what.

However, if there's strong reasoning to favour the StringRef approach, I don't mind either.

This revision is now accepted and ready to land.Tue, Feb 4, 1:36 AM
grimar marked 2 inline comments as done.Tue, Feb 4, 5:13 AM
grimar added inline comments.
llvm/test/tools/llvm-readobj/ELF/addrsig.test
23

Is there a test having a special symbol name (a metacharacter in YAML.)? e.g. [

If I correctly understood the idea, we have no tests for symbol like "[aabb", "aa[bb" etc yet.

23

A list of YAMLFlowString can be wrapped (default wrap column is 70), can't it?
If yes, I think YAMLFlowString is fine

Yep. here is the output from obj2yaml I had when tested it:

Symbols:         [ foo, bar, foo, bar, foo, bar, foo, bar, foo, bar,
                   foo, bar, foo, bar, foo, bar, foo, bar ]
MaskRay accepted this revision.Tue, Feb 4, 11:55 PM
This revision was automatically updated to reflect the committed changes.