LCOV - code coverage report
Current view: top level - util/sanitize - fd_hfuzz_metrics_stubs.c (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 0 11 0.0 %
Date: 2026-02-14 05:50:46 Functions: 0 2 0.0 %

          Line data    Source code
       1             : /* fd_hfuzz_metrics_stubs.c provides weak no-op definitions for the
       2             :    hfuzz_metrics functions referenced by the patched honggfuzz
       3             :    instrument.c (master-patches branch).
       4             : 
       5             :    When building with hfuzz-clang/hfuzz-clang++, the compiler driver
       6             :    implicitly links libhfuzz.a into every binary.  The patched
       7             :    instrument.c within libhfuzz.a calls hfuzz_metrics_register_module
       8             :    and hfuzz_metrics_register_pc_table from the sanitizer coverage
       9             :    callbacks.  Without definitions for these symbols, the link fails.
      10             : 
      11             :    These weak stubs satisfy the linker when no real metrics
      12             :    implementation is present.  When a real implementation is linked
      13             :    (e.g. from solfuzz's hfuzz_metrics.c), the strong definitions
      14             :    there override these weak stubs. */
      15             : 
      16             : #include <stddef.h>
      17             : #include <stdint.h>
      18             : 
      19             : typedef struct {
      20             :   uintptr_t pc;
      21             :   uintptr_t flags;
      22             : } fd_hfuzz_pc_entry_t;
      23             : 
      24             : __attribute__((weak)) void
      25             : hfuzz_metrics_register_module( char const * module_name,
      26             :                                uint32_t     guard_start,
      27           0 :                                uint32_t     guard_count ) {
      28           0 :   (void)module_name;
      29           0 :   (void)guard_start;
      30           0 :   (void)guard_count;
      31           0 : }
      32             : 
      33             : __attribute__((weak)) void
      34             : hfuzz_metrics_register_pc_table( char const *                 module_name,
      35             :                                  fd_hfuzz_pc_entry_t const *  pcs,
      36             :                                  size_t                       pc_count,
      37           0 :                                  uint32_t                     guard_start ) {
      38           0 :   (void)module_name;
      39           0 :   (void)pcs;
      40           0 :   (void)pc_count;
      41           0 :   (void)guard_start;
      42           0 : }

Generated by: LCOV version 1.14