The problem is that FORTIFY was implemented gradually in Android, so the runtime support for that isn't necessarily available in your minSdkVersion, and the _chk functions can only be called if your minSdkVersion is new enough for them to be guaranteed. The extra layer of the problem here is that even if
your minSdkVersion is 35 and would be able to use all the FORTIFY _chk runtime stuff, the NDK has only one libomp.so, and that's built for the minimum minSdkVersion that NDK allows (idr about r25, that's been out of support for a while, but r27's is 21), so it'll only be able to call the _chk functions that existed back in API 21 (some, but not a lot). I think when you don't have the runtime support, you still get compile-time support (
+Elliott Hughes, right?), but you're right that that's a much less effective mitigation.
That doesn't explain why you wouldn't see any references though (I hope you mean references and not exports... I've seen it happen, but that'd be a bug, because libc is the provider for those). My first guess was that they'd be inlined hidden and then the linker would eliminate the references, but they can't be inlined afaik. The only plausible explanation seems to be that my analysis in the first paragraph is wrong and the runtimes are not being built with those flags...
+Pirama Arumuga Nainar.
I guess it could also be the case that none of the code in OMP called any of the fortified functions, nor needed stack protectors? That seems unlikely, but I think it is possible. idr when the compiler is able to elide __stack_chk_guard, but I think there are cases where it may.
FWIW it doesn't look like this is any different for the static or shared runtimes.
~/Library/Android/sdk/ndk/27.1.12297006/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-readelf -sW ~/Library/Android/sdk/ndk/27.1.12297006/toolchains/llvm/prebuilt/darwin-x86_64/lib/clang/18/lib/linux/aarch64/libomp.so | grep _chk
~/Library/Android/sdk/ndk/27.1.12297006/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-readelf -sW ~/Library/Android/sdk/ndk/27.1.12297006/toolchains/llvm/prebuilt/darwin-x86_64/lib/clang/18/lib/linux/aarch64/libomp.a | grep _chk
Both find no results.