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

Ryan Prichard via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 4 18:29:25 PDT 2021


rprichard accepted this revision.
rprichard added a comment.
This revision is now accepted and ready to land.

Yes, Android did add `stpcpy` and `stpncpy` in API 21:
https://android.googlesource.com/platform/bionic/+/refs/heads/android11-dev/libc/libc.map.txt



================
Comment at: llvm/lib/Analysis/TargetLibraryInfo.cpp:595
+    TLI.setUnavailable(LibFunc_stpncpy);
+  }
+
----------------
I assume the problem is that LibFunc_stpcpy is available by default, and we need to override the default, marking it unavailable.

I wondered why the `*_unlocked` functions (D45736, D75933) seemed to assume the opposite default, but that's because there's code at the start of this function marking them unavailable. It took me a while to find it because LibFunc_getc_unlocked isn't initialized. (LibFunc_getchar_unlocked and various others are, though.) I'll upload a patch if it still looks broken after digging some more.



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107509/new/

https://reviews.llvm.org/D107509



More information about the llvm-commits mailing list