[PATCH] D97446: Change some addUsedGlobal to addUsedOrCompilerUsedGlobal
Fangrui Song via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 24 23:40:16 PST 2021
MaskRay created this revision.
MaskRay added reviewers: aaron.ballman, rjmccall, rnk, rsmith.
MaskRay requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
An global value in the `llvm.used` list does not have GC root semantics on ELF targets.
This will be changed in a subsequent backend patch.
Change some `llvm.used` in the ELF code path to use `llvm.compiler.used` to
prevent undesired GC root semantics.
GNU ld has a rule "__start_/__stop_ references from a live input section retain the associated C identifier name sections",
which LLD may change in the future (D96914 <https://reviews.llvm.org/D96914>).
For `llvm.used` global values defined in a C identifier name section, keep using `llvm.used` so that
the future LLD change will not affect them.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D97446
Files:
clang/lib/CodeGen/CGDecl.cpp
clang/lib/CodeGen/CodeGenModule.cpp
clang/lib/CodeGen/CodeGenModule.h
clang/test/CodeGen/2005-12-04-AttributeUsed.c
clang/test/CodeGen/attr-msp430.c
clang/test/CodeGen/attr-target-mv.c
clang/test/CodeGen/attr-used.c
clang/test/CodeGen/attr-x86-interrupt.c
clang/test/CodeGen/keep-static-consts.cpp
clang/test/CodeGenCUDA/llvm-used.cu
clang/test/CodeGenCXX/attr-x86-interrupt.cpp
clang/test/CodeGenCXX/extern-c.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97446.326298.patch
Type: text/x-patch
Size: 11566 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210225/b820dedb/attachment.bin>
More information about the cfe-commits
mailing list