[PATCH] D142408: [SanitizerBinaryMetadata] Declare callbacks extern weak

Marco Elver via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 23 15:27:40 PST 2023


melver added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/ModuleUtils.cpp:181
+  auto Fn = M.getOrInsertFunction(InitName, FnTy);
+  if (Weak && !AlreadyDeclared) {
+    // We cannot set extern_weak if this function has already been declared or
----------------
vitalybuka wrote:
> maybe we want skip only if it's defined?
> What is the reason to respect declaration?
Right, the AsmPrinter complained on definition only:
```
Should never emit this
UNREACHABLE executed at /usr/local/google/home/elver/third_party/llvm/llvm-project/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:633!
```

Changing it to skip if definition works.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142408



More information about the llvm-commits mailing list