Use -fno-builtin for libc and libm.
clang was getting in the way of a strftime(3) optimization, and smaller
hammers weren't working, and this seems like the right choice for libc
anyway? If we have code that can usefully be optimized, we should do it
in the source. In general, though, no libc/libm author should be
ignorant of memset(3) or memcpy(3), and would have used it themselves if
it made sense. (And the compiler isn't using profiling data or anything;
it's just always assuming it should use the functions, and doesn't
consider whether the cost of the calls can be amortized or not.)
Test: treehugger
Change-Id: Ia7e22623e47bfbfcfe46c1af0d95ef7e8669c0f6
diff --git a/libc/Android.bp b/libc/Android.bp
index 00904aa..2dc10fc 100644
--- a/libc/Android.bp
+++ b/libc/Android.bp
@@ -67,6 +67,13 @@
// GWP-ASan requires platform TLS.
"-fno-emulated-tls",
+
+ // We know clang does a lot of harm by rewriting what we've said, and sadly
+ // never see any good it does, so let's just ask it to do what we say...
+ // (The specific motivating example was clang turning a loop that would only
+ // ever touch 0, 1, or 2 bytes into a call to memset, which was never going
+ // to amortize.)
+ "-fno-builtin",
]
// Define some common cflags