[all-commits] [llvm/llvm-project] 828767: COFF/ELF: Place llvm.global_ctors elements in llvm...
Fangrui Song via All-commits
all-commits at lists.llvm.org
Wed Jul 28 11:44:32 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 828767f325b5dd0356c5fd90e40a1c047010853e
https://github.com/llvm/llvm-project/commit/828767f325b5dd0356c5fd90e40a1c047010853e
Author: Fangrui Song <i at maskray.me>
Date: 2021-07-28 (Wed, 28 Jul 2021)
Changed paths:
M clang/lib/CodeGen/CGDeclCXX.cpp
M clang/test/CodeGenCXX/microsoft-abi-template-static-init.cpp
M clang/test/CodeGenCXX/static-member-variable-explicit-specialization.cpp
Log Message:
-----------
COFF/ELF: Place llvm.global_ctors elements in llvm.used if comdat is used
On ELF, an SHT_INIT_ARRAY outside a section group is a GC root. The current
codegen abuses SHT_INIT_ARRAY in a section group to mean a GC root.
On PE/COFF, the dynamic initialization for `__declspec(selectany)` in a comdat
can be garbage collected by `-opt:ref`.
Call `addUsedGlobal` for the two cases to fix the abuse/bug.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D106925
More information about the All-commits
mailing list