[PATCH] D107509: Disable LibFuncs for stpcpy and stpncpy for Android < 21

Nathan Lanza via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 4 16:01:16 PDT 2021


lanza created this revision.
Herald added subscribers: danielkiss, hiraditya.
lanza requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

These functions don't exist in android API levels < 21. A change in
llvm-12 caused Oz builds to emit this symbol assuming it's available and
thus is causing link errors. Simply disable it here.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107509

Files:
  llvm/lib/Analysis/TargetLibraryInfo.cpp


Index: llvm/lib/Analysis/TargetLibraryInfo.cpp
===================================================================
--- llvm/lib/Analysis/TargetLibraryInfo.cpp
+++ llvm/lib/Analysis/TargetLibraryInfo.cpp
@@ -589,6 +589,11 @@
     TLI.setAvailable(LibFunc_fgets_unlocked);
   }
 
+  if (T.isAndroid() && T.isAndroidVersionLT(21)) {
+    TLI.setUnavailable(LibFunc_stpcpy);
+    TLI.setUnavailable(LibFunc_stpncpy);
+  }
+
   // As currently implemented in clang, NVPTX code has no standard library to
   // speak of.  Headers provide a standard-ish library implementation, but many
   // of the signatures are wrong -- for example, many libm functions are not


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107509.364278.patch
Type: text/x-patch
Size: 658 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210804/2707412d/attachment.bin>


More information about the llvm-commits mailing list