[PATCH] D142408: [SanitizerBinaryMetadata] Declare callbacks extern weak
Marco Elver via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 23 14:57:20 PST 2023
melver created this revision.
melver added reviewers: dvyukov, vitalybuka.
Herald added subscribers: Enna1, hiraditya.
Herald added a project: All.
melver requested review of this revision.
Herald added projects: Sanitizers, LLVM.
Herald added subscribers: llvm-commits, Sanitizers.
Declare callbacks extern weak (if no existing declaration exists), and
only call if the function address is non-null.
This allows to attach semantic metadata to binaries where no user of
that metadata exists, avoiding to have to link empty stub callbacks.
Once the binary is linked (statically or dynamically) against a tool
runtime that implements the callbacks, the respective callbacks will be
called. This vastly simplifies gradual deployment of tools using the
metadata, esp. avoiding having to recompile large codebases with
different compiler flags (which negatively impacts compiler caches).
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D142408
Files:
compiler-rt/test/metadata/nocallback.cpp
llvm/include/llvm/Transforms/Utils/ModuleUtils.h
llvm/lib/Transforms/Instrumentation/SanitizerBinaryMetadata.cpp
llvm/lib/Transforms/Utils/ModuleUtils.cpp
llvm/test/Instrumentation/SanitizerBinaryMetadata/atomics.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142408.491518.patch
Type: text/x-patch
Size: 11131 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230123/7baaaf13/attachment.bin>
More information about the llvm-commits
mailing list