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/fcntl.h b/libc/include/fcntl.h
index f57c320..1089788 100644
--- a/libc/include/fcntl.h
+++ b/libc/include/fcntl.h
@@ -75,8 +75,6 @@
extern int unlinkat(int, const char*, int);
extern ssize_t vmsplice(int, const struct iovec*, size_t, unsigned int);
-#if defined(__BIONIC_FORTIFY)
-
extern int __open_2(const char*, int);
extern int __open_real(const char*, int, ...) __RENAME(open);
extern int __openat_2(int, const char*, int);
@@ -84,6 +82,8 @@
__errordecl(__creat_missing_mode, "called with O_CREAT, but missing mode");
__errordecl(__creat_too_many_args, "too many arguments");
+#if defined(__BIONIC_FORTIFY)
+
#if !defined(__clang__)
__BIONIC_FORTIFY_INLINE