[all-commits] [llvm/llvm-project] 5265ad: [SanitizerBinaryMetadata] Declare callbacks extern...

Marco Elver via All-commits all-commits at lists.llvm.org
Tue Jan 24 03:55:47 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5265adc73721963d3bf605a7ad5eab6a7e0850b8
      https://github.com/llvm/llvm-project/commit/5265adc73721963d3bf605a7ad5eab6a7e0850b8
  Author: Marco Elver <elver at google.com>
  Date:   2023-01-24 (Tue, 24 Jan 2023)

  Changed paths:
    A compiler-rt/test/metadata/nocallback.cpp
    M llvm/include/llvm/Transforms/Utils/ModuleUtils.h
    M llvm/lib/Transforms/Instrumentation/SanitizerBinaryMetadata.cpp
    M llvm/lib/Transforms/Utils/ModuleUtils.cpp
    M llvm/test/Instrumentation/SanitizerBinaryMetadata/atomics.ll

  Log Message:
  -----------
  [SanitizerBinaryMetadata] Declare callbacks extern weak

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).

Reviewed By: dvyukov, vitalybuka

Differential Revision: https://reviews.llvm.org/D142408




More information about the All-commits mailing list