[all-commits] [llvm/llvm-project] 8c0f3b: [BOLT] Fix debug line emission for functions in mu...

Grigory Pastukhov via All-commits all-commits at lists.llvm.org
Thu Sep 11 10:41:32 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8c0f3b6e8f8db76e4ef47f38fb7b32ba9be1913b
      https://github.com/llvm/llvm-project/commit/8c0f3b6e8f8db76e4ef47f38fb7b32ba9be1913b
  Author: Grigory Pastukhov <99913765+grigorypas at users.noreply.github.com>
  Date:   2025-09-11 (Thu, 11 Sep 2025)

  Changed paths:
    M bolt/include/bolt/Core/BinaryContext.h
    M bolt/include/bolt/Core/BinaryFunction.h
    M bolt/include/bolt/Core/DebugData.h
    M bolt/lib/Core/BinaryContext.cpp
    M bolt/lib/Core/BinaryEmitter.cpp
    M bolt/lib/Core/BinaryFunction.cpp
    M bolt/lib/Core/DebugData.cpp
    A bolt/test/X86/multi-cu-debug-line.s
    M bolt/test/lit.cfg.py
    A bolt/test/process-debug-line
    M bolt/unittests/Core/CMakeLists.txt
    A bolt/unittests/Core/ClusteredRows.cpp

  Log Message:
  -----------
  [BOLT] Fix debug line emission for functions in multiple compilation units (#151230)

This patch fixes a bug in BOLT's debug line emission where functions
that belong to multiple compilation units (such as inline functions in
header files) were not handled correctly. Previously, BOLT incorrectly
assumed that a binary function could belong to only one compilation
unit, leading to incomplete or incorrect debug line information.

### **Problem**

When a function appears in multiple compilation units (common scenarios
include):

*   Template instantiated functions
* Inline functions defined in header files included by multiple source
files

BOLT would only emit debug line information for one compilation unit,
losing debug information for other CUs where the function was compiled.
This resulted in incomplete debugging information and could cause
debuggers to fail to set breakpoints or show incorrect source locations.

### **Root Cause**

The issue was in BOLT's assumption that each binary function maps to
exactly one compilation unit. However, when the same function (e.g., an
inline function from a header) is compiled into multiple object files,
it legitimately belongs to multiple CUs in the final binary.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list