[llvm] [BOLT] Ignore duplicate global symbols (PR #201082)

Jinjie Huang via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 3 22:57:36 PDT 2026


Jinjie-Huang wrote:

> I will try to find another solution not to ignore the one.

I have also thought about this. If we don't ignore them, two potential issues come to my mind:
1. During BOLT's processing (e.g., in handleRelocation()), getBinaryDataByName(name) is used as a fallback. Since the original ELF name is identical, this could easily resolve to the wrong function instance, leading to silent miscompilations
2. The order in which duplicate symbols are processed might be inconsistent between perf2bolt and llvm-bolt. For instance, perf2bolt might map foo to foo_v1 and foo/1 to foo_v2, while llvm-bolt could do the exact opposite. This would result in some profile mismatches.

For now, I lean towards a conservative 'ignore' approach. It feels like a better trade-off to safely skip them and optimize the rest of the binary, rather than failing completely and not being able to optimize such binaries at all.

https://github.com/llvm/llvm-project/pull/201082


More information about the llvm-commits mailing list