[PATCH] D118171: [HWASan] Add __hwasan_init to .preinit_array.

Florian Mayer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 2 17:42:32 PST 2022


fmayer added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/CommonArgs.cpp:842
+      if (!Args.hasArg(options::OPT_shared))
+        SharedRuntimes.push_back("hwasan-preinit");
     }
----------------
pcc wrote:
> morehouse wrote:
> > eugenis wrote:
> > > pcc wrote:
> > > > Shouldn't it be added to `HelperStaticRuntimes`? Otherwise I'm not sure how this would work because the library would need to be enclosed in `--whole-archive` in order to be included in the link.
> > > Right, good point.
> > Yes, good catch!
> Thanks. We'd better test on Android again because I imagine that the previous patch wouldn't have had any effect.
I patched the Android LLVM toolchain with this, build Android, it booted. Built static Hello World executable and it works.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118171



More information about the cfe-commits mailing list