Inline helpers need to be exported unmangled.

__open_2() is used by the fortify implementation of open(2) in
fcntl.h, and as such needs an unmangled C name. For some reason
(inlining?), this doesn't cause problems at the default optimization
level, but does for -O0.

The rest of these didn't cause build failures, but they look suspect
and probably will, we just haven't caught them yet.

Bug: 17784968
Change-Id: I7391a7a8999ee204eaf6abd14a3d5373ea419d5b
diff --git a/libc/include/sys/select.h b/libc/include/sys/select.h
index 4ddcb6a..32c1206 100644
--- a/libc/include/sys/select.h
+++ b/libc/include/sys/select.h
@@ -51,10 +51,11 @@
 
 #define FD_ZERO(set) (memset(set, 0, sizeof(*(fd_set*)(set))))
 
-#if defined(__BIONIC_FORTIFY)
 extern void __FD_CLR_chk(int, fd_set*, size_t);
 extern void __FD_SET_chk(int, fd_set*, size_t);
 extern int  __FD_ISSET_chk(int, fd_set*, size_t);
+
+#if defined(__BIONIC_FORTIFY)
 #define FD_CLR(fd, set) __FD_CLR_chk(fd, set, __bos(set))
 #define FD_SET(fd, set) __FD_SET_chk(fd, set, __bos(set))
 #define FD_ISSET(fd, set) __FD_ISSET_chk(fd, set, __bos(set))
diff --git a/libc/include/sys/socket.h b/libc/include/sys/socket.h
index a8840ff..43d1586 100644
--- a/libc/include/sys/socket.h
+++ b/libc/include/sys/socket.h
@@ -291,11 +291,12 @@
 __socketcall ssize_t sendto(int, const void*, size_t, int, const struct sockaddr*, socklen_t);
 __socketcall ssize_t recvfrom(int, void*, size_t, int, const struct sockaddr*, socklen_t*);
 
-#if defined(__BIONIC_FORTIFY)
 __errordecl(__recvfrom_error, "recvfrom called with size bigger than buffer");
 extern ssize_t __recvfrom_chk(int, void*, size_t, size_t, int, const struct sockaddr*, socklen_t*);
 extern ssize_t __recvfrom_real(int, void*, size_t, int, const struct sockaddr*, socklen_t*) __RENAME(recvfrom);
 
+#if defined(__BIONIC_FORTIFY)
+
 __BIONIC_FORTIFY_INLINE
 ssize_t recvfrom(int fd, void* buf, size_t len, int flags, const struct sockaddr* src_addr, socklen_t* addr_len) {
   size_t bos = __bos0(buf);
diff --git a/libc/include/sys/stat.h b/libc/include/sys/stat.h
index b56ffa4..77d7cac 100644
--- a/libc/include/sys/stat.h
+++ b/libc/include/sys/stat.h
@@ -160,12 +160,12 @@
 extern int mknod(const char*, mode_t, dev_t);
 extern mode_t umask(mode_t);
 
-#if defined(__BIONIC_FORTIFY)
-
 extern mode_t __umask_chk(mode_t);
 extern mode_t __umask_real(mode_t) __RENAME(umask);
 __errordecl(__umask_invalid_mode, "umask called with invalid mode");
 
+#if defined(__BIONIC_FORTIFY)
+
 __BIONIC_FORTIFY_INLINE
 mode_t umask(mode_t mode) {
 #if !defined(__clang__)