This revision was automatically updated to reflect the committed changes.
Closed by commit rL298588: [CodeGen] Emit a CoreFoundation link guard when
@available is used (authored by arphaman).
Changed prior to commit:
https://reviews.llvm.org/D30977?vs=92028&id=92780#toc
Repository:
rL LLVM
rjmccall accepted this revision.
rjmccall added a comment.
This revision is now accepted and ready to land.
LGTM.
Comment at: lib/CodeGen/CGObjC.cpp:3428
+ // CoreFoundation is not used in the code, the linker won't link the
+ // framework.
+ auto &Context = getLLVMContext()
arphaman updated this revision to Diff 92028.
arphaman marked an inline comment as done.
arphaman added a comment.
Reverse the early exit checks.
Repository:
rL LLVM
https://reviews.llvm.org/D30977
Files:
lib/CodeGen/CGObjC.cpp
lib/CodeGen/CodeGenModule.cpp
lib/CodeGen/CodeGenModule.h
arphaman added inline comments.
Comment at: lib/CodeGen/CGObjC.cpp:3428
+ // CoreFoundation is not used in the code, the linker won't link the
+ // framework.
+ auto &Context = getLLVMContext();
rjmccall wrote:
> Can you explain why compiler-rt has to load the
rjmccall added inline comments.
Comment at: lib/CodeGen/CGObjC.cpp:3423
+return;
+ if (!IsOSVersionAtLeastFn)
+return;
Reverse these checks, please; IsOSVersionAtLeastFn is much cheaper to check and
will predominantly be null.
Comment
arphaman updated this revision to Diff 91977.
arphaman marked an inline comment as done.
arphaman added a comment.
The guard function is now `hidden`. I also adopted linker options as John
suggested.
Repository:
rL LLVM
https://reviews.llvm.org/D30977
Files:
lib/CodeGen/CGObjC.cpp
lib/C
arphaman added inline comments.
Comment at: lib/CodeGen/CGObjC.cpp:3435
+ CheckFTy, "__clang_at_available_requires_core_foundation_framework"));
+ CFLinkCheckFunc->setLinkage(llvm::GlobalValue::LinkOnceAnyLinkage);
+ CodeGenFunction CGF(*this);
rjmccall wr
rjmccall added inline comments.
Comment at: lib/CodeGen/CGObjC.cpp:3435
+ CheckFTy, "__clang_at_available_requires_core_foundation_framework"));
+ CFLinkCheckFunc->setLinkage(llvm::GlobalValue::LinkOnceAnyLinkage);
+ CodeGenFunction CGF(*this);
Is this a p
arphaman created this revision.
After r297760, __isOSVersionAtLeast in compiler-rt loads the CoreFoundation
symbols at runtime. This means that `@available` will always fail when used in
a binary without a linked CoreFoundation.
This patch forces Clang to emit a reference to a CoreFoundation sy