Page MenuHomePhabricator

[llvm-readobj][test] - Improve section-symbols.test

Authored by grimar on Sep 14 2020, 7:31 AM.



section-symbols.test tests how we print section symbols in
different situations.

We might have 2 different cases:

  1. A named STT_SECTION symbol.
  2. An unnamed STT_SECTION symbol.

Usually section symbols have no name and then --symbols uses their
section names when prints them. If symbol has a name, then it is used.

For --relocations we also want to have this logic probably,
but currently we always ignore symbol names and always use section names.
It is not consistent with GNU readelf and with our logic for --symbols.

This patch refines testing to document the existent behavior and improve

Diff Detail

Event Timeline

grimar created this revision.Sep 14 2020, 7:31 AM
Herald added a project: Restricted Project. · View Herald Transcript
grimar requested review of this revision.Sep 14 2020, 7:31 AM
jhenderson added inline comments.Sep 15 2020, 1:28 AM

Ditto below.


Is there any reason to do this in a separate run? You could do llvm-readobj --symbols --relocations at the same time.


I also think that if a name can't be looked up, it shouldn't prevent printing of the relocation. That seems unhelpful to me. Possibly another piece of work, and worth highlighting in the FIXME?

grimar added inline comments.Sep 15 2020, 1:36 AM

The first test contains constructions like 2> %t.llvm.err1 and then checks the stderr output separatelly for --symbols
I am not sure how much it is useful honestly. I think more useful is to check an exact output to reveal places where we print warnings.
Are you OK if I change 2> %t.llvm.err1 to 2>&1 and merge these tests then?


I think it is addressed in D87613: all relocations are dumped there and this FIXME is removed.

grimar updated this revision to Diff 291846.Sep 15 2020, 3:12 AM
grimar marked 3 inline comments as done.
  • Addressed review comments.

So, I've leaved this place as is for now, but will be happy to merge tests if you think that it is fine.


I've updated the FIXME for now though.

jhenderson added inline comments.Sep 15 2020, 5:49 AM

I think we can merge the tests. I think the motivation for the output being separate before isn't a particularly strong one given the current code state.

grimar updated this revision to Diff 291936.Sep 15 2020, 8:06 AM
  • Merged tests.
jhenderson accepted this revision.Sep 16 2020, 12:40 AM

Thanks, LGTM.

This revision is now accepted and ready to land.Sep 16 2020, 12:40 AM
This revision was automatically updated to reflect the committed changes.