[PATCH] D87780: [lld-macho] Export trie addresses should be relative to the image base

Shoaib Meenai via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 21 11:55:16 PDT 2020


smeenai added inline comments.


================
Comment at: lld/MachO/ExportTrie.h:36
 
+  uint64_t imageBase = 0;
   std::vector<const Symbol *> exported;
----------------
smeenai wrote:
> int3 wrote:
> > smeenai wrote:
> > > Nit: do we need this initialization, given that `setImageBase` should always be called?
> > I think it's good practice to zero-init fields that aren't initialized in the ctor. That way, if we forget to call `setImageBase`, we'll be more likely to get a deterministic error.
> The flip side is that any tools which detect uninitialized memory wouldn't catch the issue. It doesn't seem like either ASan or UBSan can actually catch the uninitialized access right now though, so that's a purely academic concern :)
Ah, MSan is able to catch the uninitialized memory use, which is helpful.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87780



More information about the llvm-commits mailing list