[all-commits] [llvm/llvm-project] 97a432: [lld-macho] Fix ICF differentiation of safe_thunks...
alx32 via All-commits
all-commits at lists.llvm.org
Thu Oct 10 08:23:10 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 97a43242246bf4a55e68bddf3e6a0500c07803cc
https://github.com/llvm/llvm-project/commit/97a43242246bf4a55e68bddf3e6a0500c07803cc
Author: alx32 <103613512+alx32 at users.noreply.github.com>
Date: 2024-10-10 (Thu, 10 Oct 2024)
Changed paths:
M lld/MachO/ICF.cpp
M lld/test/MachO/icf-safe-thunks.ll
Log Message:
-----------
[lld-macho] Fix ICF differentiation of safe_thunks relocs (#111811)
In `--icf=safe_thunks` mode, the linker differentiates `keepUnique`
functions by creating thunks during a post-processing step after
Identical Code Folding (ICF). While this ensures that `keepUnique`
functions themselves are not incorrectly merged, it overlooks functions
that reference these `keepUnique` symbols.
If two functions are identical except for references to different
`keepUnique` functions, the current ICF algorithm incorrectly considers
them identical because it doesn't account for the future differentiation
introduced by thunks. This leads to incorrect deduplication of functions
that should remain distinct.
To address this issue, we modify the ICF comparison to explicitly check
for references to `keepUnique` functions during deduplication. By doing
so, functions that reference different `keepUnique` symbols are
correctly identified as distinct, preventing erroneous merging and
ensuring the correctness of the linked output.
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