This is an archive of the discontinued LLVM Phabricator instance.

[llvm-nm] - Add a test case for case when we dump a symbol that belongs to a section with a broken sh_name.
ClosedPublic

Authored by grimar on Aug 30 2019, 6:10 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

grimar created this revision.Aug 30 2019, 6:10 AM
jhenderson added inline comments.Aug 30 2019, 7:02 AM
test/tools/llvm-nm/format-sysv-section.test
38 ↗(On Diff #218079)

st_name -> sh_name

39 ↗(On Diff #218079)

"We that we can still print..."

42 ↗(On Diff #218079)

Do we get any warning message here? If we do, I think we should check it. If we don't, I feel like we should.

grimar updated this revision to Diff 218324.Sep 2 2019, 3:26 AM
grimar marked 3 inline comments as done.
  • Addressed review comments.
test/tools/llvm-nm/format-sysv-section.test
42 ↗(On Diff #218079)

No, we don't have a warning, because the error is silently consumed:
https://github.com/llvm-mirror/llvm/blob/master/tools/llvm-nm/llvm-nm.cpp#L1102

There are 16 places around in total where errors are ignored in the same way.

I did a quick test to check what GNU nm do. It prints nothing, returns 1 and reports an error:

umb@ubuntu:~/tests/66$ nm format-sysv-section.test.tmp2.o --format=sysv
bfd plugin: format-sysv-section.test.tmp2.o: ELF section name out of range
nm: format-sysv-section.test.tmp2.o: invalid string offset 65535 >= 35 for section `.shstrtab'
nm: format-sysv-section.test.tmp2.o: invalid string offset 65535 >= 35 for section `.shstrtab'
nm: format-sysv-section.test.tmp2.o: bad value
umb@ubuntu:~/tests/66$ echo $?
1

Given that difference I do not think we should add warnings/errors in this patch, since it only adds a test case for
a mistype fixed and used to check we don't fail with LLVM_ENABLE_ABI_BREAKING_CHECKS.
We should probably decide what the behavior we want to have on errors in llvm-nm first?

jhenderson accepted this revision.Sep 2 2019, 3:33 AM

LGTM.

test/tools/llvm-nm/format-sysv-section.test
42 ↗(On Diff #218079)

Sorry, yes, I wasn't saying that a new error should be part of this change.

This revision is now accepted and ready to land.Sep 2 2019, 3:33 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptSep 2 2019, 6:53 AM
grimar added a comment.Sep 2 2019, 7:58 AM

Recommitted as rL370669.