This is an archive of the discontinued LLVM Phabricator instance.

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

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

Details

Summary

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
coverage.

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
llvm/test/tools/llvm-readobj/ELF/section-symbols.test
1
98

Ditto below.

115–118

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

116

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
llvm/test/tools/llvm-readobj/ELF/section-symbols.test
115–118

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?

116

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.
llvm/test/tools/llvm-readobj/ELF/section-symbols.test
115–118

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

116

I've updated the FIXME for now though.

jhenderson added inline comments.Sep 15 2020, 5:49 AM
llvm/test/tools/llvm-readobj/ELF/section-symbols.test
115–118

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.