Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GlobalValue] Make dso_local function work with comdat nodeduplicate
This fixes -fno-semantic-interposition -fsanitize-coverage incompatibility. -fPIC -fno-semantic-interposition may add dso_local to an external linkage function. -fsanitize-coverage instrumentation does not clear dso_local when adding comdat nodeduplicate. This causes a compatibility issue: the function symbol may be referenced by a PC-relative relocation without using the local alias. In -shared mode, ld will report a relocation error. The fix is to either clear dso_local when adding comdat nodeduplicate, or supporting comdat nodeduplicate. The latter is more appropriate, because a comdat nodeduplicate is like not using comdat. Note: The comdat condition was originally added by D77429 to not use local alias for a hidden external linkage function in a deduplicate comdat. The condition has been unused since the code was refactored to only use local alias for default visibility symbols. Note: `canBenefitFromLocalAlias` is used by clang/lib/CodeGen/CodeGenModule.cpp and we don't want to add dso_local to default visibility external linkage comdat any (clang/test/CodeGenCUDA/usual-deallocators.cu). Differential Revision: https://reviews.llvm.org/D117190
- Loading branch information