Ensure we always have symbols for atof, strtof, strtold.

We'll need a better implementation of strtold for LP64, but all our
long double functions are currently broken for LP64 anyway so this
isn't a regression.

Change-Id: I2bdebac11245d31521d5fa09a16331c03dc4339c
diff --git a/libc/Android.mk b/libc/Android.mk
index 11aac7f..df9ad21 100644
--- a/libc/Android.mk
+++ b/libc/Android.mk
@@ -114,6 +114,7 @@
     bionic/abort.cpp \
     bionic/access.cpp \
     bionic/assert.cpp \
+    bionic/atof.cpp \
     bionic/__bionic_name_mem.cpp \
     bionic/bionic_time_conversions.cpp \
     bionic/brk.cpp \
@@ -188,8 +189,8 @@
     bionic/setegid.cpp \
     bionic/__set_errno.cpp \
     bionic/seteuid.cpp \
-    bionic/setpgrp.cpp \
     bionic/setlocale.cpp \
+    bionic/setpgrp.cpp \
     bionic/sigaction.cpp \
     bionic/sigaddset.cpp \
     bionic/sigdelset.cpp \
@@ -207,12 +208,14 @@
     bionic/strerror.cpp \
     bionic/strerror_r.cpp \
     bionic/strsignal.cpp \
+    bionic/strtof.cpp \
+    bionic/strtold.cpp \
     bionic/stubs.cpp \
     bionic/symlink.cpp \
     bionic/sysconf.cpp \
-    bionic/system_properties.cpp \
     bionic/sys_siglist.c \
     bionic/sys_signame.c \
+    bionic/system_properties.cpp \
     bionic/tdestroy.cpp \
     bionic/termios.cpp \
     bionic/thread_atexit.cpp \
diff --git a/libc/bionic/atof.cpp b/libc/bionic/atof.cpp
new file mode 100644
index 0000000..e77ccdd
--- /dev/null
+++ b/libc/bionic/atof.cpp
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <stdlib.h>
+
+double atof(const char* s) {
+  // Despite the 'f' in the name, this returns a double and is
+  // specified to be equivalent to strtod.
+  return strtod(s, NULL);
+}
diff --git a/libc/bionic/strtof.cpp b/libc/bionic/strtof.cpp
new file mode 100644
index 0000000..a41e4d4
--- /dev/null
+++ b/libc/bionic/strtof.cpp
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <stdlib.h>
+
+float strtof(const char* s, char** end_ptr) {
+  // TODO: upgrade to a non-hack implementation.
+  return strtod(s, end_ptr);
+}
diff --git a/libc/bionic/strtold.cpp b/libc/bionic/strtold.cpp
new file mode 100644
index 0000000..079f393
--- /dev/null
+++ b/libc/bionic/strtold.cpp
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <stdlib.h>
+
+long double strtold(const char* s, char** end_ptr) {
+  // TODO: this is fine for LP32 where double == long double, but is broken on LP64.
+  return strtod(s, end_ptr);
+}
diff --git a/libc/include/stdlib.h b/libc/include/stdlib.h
index 9595170..9b7e6d1 100644
--- a/libc/include/stdlib.h
+++ b/libc/include/stdlib.h
@@ -60,23 +60,17 @@
 extern long long strtoll(const char *, char **, int);
 extern unsigned long strtoul(const char *, char **, int);
 extern unsigned long long strtoull(const char *, char **, int);
-extern double strtod(const char *nptr, char **endptr);
 
 extern int posix_memalign(void **memptr, size_t alignment, size_t size);
 
-static __inline__ float strtof(const char *nptr, char **endptr)
-{
-    return (float)strtod(nptr, endptr);
-}
+extern double atof(const char*);
+extern double strtod(const char*, char**);
+extern float strtof(const char*, char**);
+extern long double strtold(const char*, char**);
 
-extern int atoi(const char *) __purefunc;
-extern long atol(const char *) __purefunc;
-extern long long atoll(const char *) __purefunc;
-
-static __inline__ double atof(const char *nptr)
-{
-    return (strtod(nptr, NULL));
-}
+extern int atoi(const char*) __purefunc;
+extern long atol(const char*) __purefunc;
+extern long long atoll(const char*) __purefunc;
 
 extern int abs(int) __pure2;
 extern long labs(long) __pure2;