[PATCH] D78709: [llvm-readobj] - Simplify conditions used for printing segment mappings. NFCI.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 23 06:27:26 PDT 2020


grimar created this revision.
grimar added reviewers: jhenderson, MaskRay.
Herald added a subscriber: rupprecht.
grimar marked an inline comment as done.
grimar added inline comments.


================
Comment at: llvm/tools/llvm-readobj/ELFDumper.cpp:4154
-                          ((Sec.sh_flags & ELF::SHF_TLS) != 0) &&
-                          Phdr.p_type != ELF::PT_TLS;
-      if (!TbssInNonTLS && checkTLSSections(Phdr, Sec) &&
----------------
This now lives in `checkTLSSections`


This patch is a NFC refactoring.

Backstory: I'd like to stop using precompiled binaries in
https://github.com/llvm/llvm-project/blob/master/llvm/test/tools/llvm-readobj/ELF/gnu-phdrs.test
because I need to expand it to be able to fix a crash issue.
I've found that the logic of matching sections to segments is tested badly or untested.
(To be able to test it properly, each our sub-condition should be tested).

Currently the logic is overcomplicated, contains dead conditions and is very hard to read.
This patch performs a very straightforward simplification. Probably it can be
simplified and improved more, but I'd like to have a test case documenting/testing
all the current functionality first of all.


https://reviews.llvm.org/D78709

Files:
  llvm/tools/llvm-readobj/ELFDumper.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78709.259543.patch
Type: text/x-patch
Size: 6759 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200423/64915be8/attachment.bin>


More information about the llvm-commits mailing list