[PATCH] D94329: [lld-macho] Fix TLV data initialization

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 8 12:28:08 PST 2021


int3 marked an inline comment as done.
int3 added inline comments.


================
Comment at: lld/MachO/Writer.cpp:591-594
   // ZeroFill sections must always be the at the end of their segments,
   // otherwise subsequent sections may get overwritten with zeroes at runtime.
-  if (isZeroFill(osec->flags))
+  if (sectionType(osec->flags) == S_ZEROFILL)
     return std::numeric_limits<int>::max();
----------------
smeenai wrote:
> int3 wrote:
> > ld64 has logic that does this, but I have no idea how we can actually test it -- it doesn't look like it's possible to create arbitrary `S_ZEROFILL` sections from assembly, at least if I'm reading MCSectionMachO.cpp correctly. I could remove this / replace it with an assert if anyone cares.
> There's a `.zerofill` directive ... does that do what you want?
ooh yeah it does. I had been looking for modifiers to the `.section` directive... thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94329



More information about the llvm-commits mailing list