[PATCH] D107273: [llvm-objcopy] IHexELFBuilder::addDataSections - fix evaluation ordering static analyzer warning
Igor Kudrin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 2 07:33:25 PDT 2021
ikudrin added inline comments.
================
Comment at: llvm/tools/llvm-objcopy/ELF/Object.cpp:1345
RecAddr = R.Addr + SegmentAddr + BaseAddr;
- if (!Section || Section->Addr + Section->Size != RecAddr)
+ if (!Section || (Section->Addr + Section->Size) != RecAddr) {
// OriginalOffset field is only used to sort section properly, so
----------------
This change is irrelevant to the issue.
================
Comment at: llvm/tools/llvm-objcopy/ELF/Object.cpp:1351
+ ".sec" + std::to_string(SecNo), RecAddr,
+ ELF::SHF_ALLOC | ELF::SHF_WRITE, SecNo + 1);
+ ++SecNo;
----------------
`Object::sortSections()` uses `llvm::stable_sort()`, thus, you may just pass a constant, e.g. `0`, as the last argument.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D107273/new/
https://reviews.llvm.org/D107273
More information about the llvm-commits
mailing list