[PATCH] D30977: [CodeGen] Emit a CoreFoundation link guard when @available is used

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 17 09:48:14 PDT 2017


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 wrote:
> rjmccall wrote:
> > Can you explain why compiler-rt has to load the symbol at runtime?  Is this just some compiler-rt testing thing?  Because it seems like a shame to pay a code-size cost — even a negligible one — for something like that.
> Because compiler-rt is linked into some internal projects that use the `-all_load` flag, so the linker loads `__isOSVersionAtLeast` that references the CoreFoundation symbols even when it's not used in code.
Well, that is terrible.


Repository:
  rL LLVM

https://reviews.llvm.org/D30977





More information about the cfe-commits mailing list