[all-commits] [llvm/llvm-project] b55f29: [SanitizerCoverage] Clarify llvm.used/llvm.compile...
Fangrui Song via All-commits
all-commits at lists.llvm.org
Fri Feb 26 11:10:21 PST 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: b55f29c194d31cb51096d80b5e2710fc3385a7ef
https://github.com/llvm/llvm-project/commit/b55f29c194d31cb51096d80b5e2710fc3385a7ef
Author: Fangrui Song <i at maskray.me>
Date: 2021-02-26 (Fri, 26 Feb 2021)
Changed paths:
M llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
M llvm/test/Instrumentation/SanitizerCoverage/trace-pc-guard.ll
Log Message:
-----------
[SanitizerCoverage] Clarify llvm.used/llvm.compiler.used and partially fix unmatched metadata sections on Windows
`__sancov_pcs` parallels the other metadata section(s). While some optimizers
(e.g. GlobalDCE) respect linker semantics for comdat and retain or discard the
sections as a unit, some (e.g. GlobalOpt/ConstantMerge) do not. So we have to
conservatively retain all unconditionally in the compiler.
When a comdat is used, the COFF/ELF linkers' GC semantics ensure the
associated parallel array elements are retained or discarded together,
so `llvm.compiler.used` is sufficient.
Otherwise (MachO (see rL311955/rL311959), COFF special case where comdat is not
used), we have to use `llvm.used` to conservatively make all sections retain by
the linker. This will fix the Windows problem once internal linkage
GlobalObject's in `llvm.used` are retained via `/INCLUDE:`.
Reviewed By: morehouse, vitalybuka
Differential Revision: https://reviews.llvm.org/D97432
More information about the All-commits
mailing list