[PATCH] D128688: [llvm-objcopy] Remove support for legacy .zdebug sections

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 28 02:33:40 PDT 2022


jhenderson added inline comments.


================
Comment at: llvm/lib/ObjCopy/ELF/ELFObject.cpp:522
   uint8_t *Buf = reinterpret_cast<uint8_t *>(Out.getBufferStart()) + Sec.Offset;
   if (Sec.CompressionType == DebugCompressionType::None) {
     std::copy(Sec.OriginalData.begin(), Sec.OriginalData.end(), Buf);
----------------
MaskRay wrote:
> jhenderson wrote:
> > I wonder if this should be a switch statement, so that we can benefit from compiler diagnostics if not all `DebugCompressionType` values are handled. Thoughts?
> I placed `assert(Sec.CompressionType == DebugCompressionType::Z);` below. When zstd is added, the assert will fire :)
My thinking was that it would turn the runtime failure into a potential build-time one, which improves developer experience. We'd still want an llvm_unreachable or similar after the switch of course.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128688



More information about the llvm-commits mailing list