librust_baremetal: statically choose x86_64 memset
The x86_64 architecture has multiple optimized implementations of
memset, and normally one is chosen at runtime based on CPU features.
However, for the librust_baremetal target, we do not have the ifunc
resolver to perform the dynamic function resolution, so we need to
choose a single memset implementation at compile time. Accomplish this
by rewriting the SSE2 memset_generic function's name to just "memset"
when building librust_baremetal.
Bug: 389669171
Test: nm librust_baremetal.a | grep memset
Change-Id: Ic616d62ac3c427552c05bf6694070a2d00d71a34
diff --git a/libc/Android.bp b/libc/Android.bp
index f13a76c..a5bc482 100644
--- a/libc/Android.bp
+++ b/libc/Android.bp
@@ -2110,6 +2110,12 @@
enabled: false,
},
x86_64: {
+ asflags: [
+ // Statically choose the SSE2 memset_generic as memset for
+ // baremetal, where we do not have the dynamic function
+ // dispatch machinery.
+ "-Dmemset_generic=memset",
+ ],
srcs: [
"arch-x86_64/string/sse2-memmove-slm.S",
"arch-x86_64/string/sse2-memset-slm.S",