[all-commits] [llvm/llvm-project] eecb22: [SanitizerBinaryMetadata] Use weak __start_/__stop...
Fangrui Song via All-commits
all-commits at lists.llvm.org
Sun Dec 4 15:06:47 PST 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: eecb22d8e1fe5ac6cc35ace63ae517c33ff40d85
https://github.com/llvm/llvm-project/commit/eecb22d8e1fe5ac6cc35ace63ae517c33ff40d85
Author: Fangrui Song <i at maskray.me>
Date: 2022-12-04 (Sun, 04 Dec 2022)
Changed paths:
M clang/test/CodeGen/sanitize-metadata.c
M llvm/lib/Transforms/Instrumentation/SanitizerBinaryMetadata.cpp
M llvm/test/Instrumentation/SanitizerBinaryMetadata/atomics.ll
Log Message:
-----------
[SanitizerBinaryMetadata] Use weak __start_/__stop_ instead of dummy empty section
D130887 uses a dummy empty section `sanmd_covered` (with the SHF_GNU_RETAIN flag on
ELF) to prevent `undefined symbol: __start_sanmd_covered` if all `sanmd_covered`
are discarded by `ld --gc-sections` (in `-z start-stop-gc` mode).
The dummy `sanmd_covered` does not have the SHF_LINK_ORDER flag, so mixing it
with SHF_LINK_ORDER `sanmd_covered` causes an issue to GNU ld<2.36
(https://sourceware.org/bugzilla/show_bug.cgi?id=26256).
Similar to D98903 for SanitizerCoverage, let's make encapsulation symbols
undefined weak[1]. This additionally avoids size cost due to the dummy section and
symbol.
[1]: https://maskray.me/blog/2021-01-31-metadata-sections-comdat-and-shf-link-order
Reviewed By: melver
Differential Revision: https://reviews.llvm.org/D139276
More information about the All-commits
mailing list