[PATCH] D92318: [llvm-readobj, libSupport] - Refine the implementation of the code that dumps build attributes.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 30 06:16:07 PST 2020


grimar created this revision.
grimar added reviewers: jhenderson, MaskRay.
Herald added subscribers: frasercrmck, dexonsmith, jdoerfert, luismarques, apazos, sameer.abuasal, pzheng, s.egerton, lenary, Jim, jocewei, rupprecht, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.
grimar requested review of this revision.

This implementation of `ELFDumper<ELFT>::printAttributes()` in llvm-readobj has issues:

1. It crashes when the content of the attribute section is empty.
2. It uses `unwrapOrError` and `reportWarning` calls, though ideally we want to use `reportUniqueWarning`.
3. It contains a TODO about redundant format version check.

`lib/Support/ELFAttributeParser.cpp` uses a hardcoded constant instead of the named constant.

This patch fixes all these issues.

Depends on D92316 <https://reviews.llvm.org/D92316>.


https://reviews.llvm.org/D92318

Files:
  llvm/lib/Support/ELFAttributeParser.cpp
  llvm/test/tools/llvm-readobj/ELF/RISCV/invalid-attributes-sec.test
  llvm/tools/llvm-readobj/ELFDumper.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92318.308350.patch
Type: text/x-patch
Size: 6984 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201130/b59bd5b8/attachment.bin>


More information about the llvm-commits mailing list