]> granicus.if.org Git - llvm/commit
[llvm-readobj] Only print the real size of the note
authorPetr Hosek <phosek@chromium.org>
Wed, 5 Apr 2017 18:55:50 +0000 (18:55 +0000)
committerPetr Hosek <phosek@chromium.org>
Wed, 5 Apr 2017 18:55:50 +0000 (18:55 +0000)
commit12290fa787b87a34733395379e0a092598c80580
tree50701a0987da93e7fdc7c372eff05dfac0f4ea6f
parentc0a481413e8c6c18e7744041f5a7f26674f9b4ea
[llvm-readobj] Only print the real size of the note

Note payloads are padded to a multiple of 4 bytes in size, but the size
of the string that should be print can be smaller e.g. the n_descsz
field in gold's version note is 9, so that's the whole size of the
string that should be printed. The padding is part of the format of a
SHT_NOTE section or PT_NOTE segment, but it's not part of the note
itself.

Printing the extra null bytes may confuse some tools, e.g. when the
llvm-readobj is sent to grep, it treats the output as binary because
it contains a null byte.

Differential Revision: https://reviews.llvm.org/D30804

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299576 91177308-0d34-0410-b5e6-96231b3b80d8
tools/llvm-readobj/ELFDumper.cpp