[PATCH] D101332: [llvm-objcopy] Exclude empty sections in IHexWriter output

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 12 12:10:05 PDT 2021


MaskRay added inline comments.


================
Comment at: llvm/tools/llvm-objcopy/ELF/Object.cpp:2671
   auto ShouldWrite = [](const SectionBase &Sec) {
-    return (Sec.Flags & ELF::SHF_ALLOC) && (Sec.Type != ELF::SHT_NOBITS);
+    return (Sec.Flags & ELF::SHF_ALLOC) && (Sec.Type != ELF::SHT_NOBITS) &&
+           (Sec.Size > 0);
----------------
Adding parentheses around `!=` and `>` are not common. I'll delete them.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101332/new/

https://reviews.llvm.org/D101332



More information about the llvm-commits mailing list