Browse Source

Add hidden_weak_alias/hidden_strong_alias, remove gettimeofday hack and add comment about opendir/closedir undoable, it is too early in this file. i386/x86_64 could use optimized internal_function, but the commented part has to be done based on target, not host

Peter S. Mazinger 18 years ago
parent
commit
a0a86e975a
1 changed files with 23 additions and 6 deletions
  1. 23 6
      include/libc-internal.h

+ 23 - 6
include/libc-internal.h

@@ -66,6 +66,9 @@
 /* On some platforms we can make internal function calls (i.e., calls of
    functions not exported) a bit faster by using a different calling
    convention.  */
+#if 0 /*def __i386__*/
+# define internal_function __attribute__ ((regparm (3), stdcall))
+#endif
 #ifndef internal_function
 # define internal_function      /* empty */
 #endif
@@ -98,6 +101,14 @@
 # define attribute_hidden
 #endif
 #define hidden_def(name) extern __typeof (name) name attribute_hidden;
+/* Define ALIASNAME as a hidden weak alias for NAME. */
+# define hidden_weak_alias(name, aliasname) _hidden_weak_alias (name, aliasname)
+# define _hidden_weak_alias(name, aliasname) \
+  extern __typeof (name) aliasname __attribute__ ((weak, alias (#name))) __attribute__ ((visibility ("hidden")));
+/* Define ALIASNAME as a hidden strong alias for NAME.  */
+# define hidden_strong_alias(name, aliasname) _hidden_strong_alias(name, aliasname)
+# define _hidden_strong_alias(name, aliasname) \
+  extern __typeof (name) aliasname __attribute__ ((alias (#name))) __attribute__ ((visibility ("hidden")));
 
 #ifdef __UCLIBC_BUILD_RELRO__
 # define attribute_relro __attribute__ ((section (".data.rel.ro")))
@@ -142,9 +153,6 @@ typedef __ssize_t ssize_t;
 
 #  include <bits/sigset.h>
 
-/* sources are built w/ _GNU_SOURCE, this gets undefined */
-extern int __xpg_strerror_r (int __errnum, char *__buf, size_t __buflen);
-
 /* prototypes for internal use, please keep these in sync w/ updated headers */
 /* #include <fcntl.h> */
 extern int __open(__const char *__file, int __oflag, ...) attribute_hidden;
@@ -167,6 +175,9 @@ extern char *__strdup (__const char *__s) attribute_hidden;
 extern int __strcasecmp (__const char *__s1, __const char *__s2) attribute_hidden;
 extern int __strncasecmp (__const char *__s1, __const char *__s2, size_t __n) attribute_hidden;
 
+/* sources are built w/ _GNU_SOURCE, this gets undefined */
+extern int __xpg_strerror_r (int __errnum, char *__buf, size_t __buflen);
+
 /* #include <unistd.h> */
 extern ssize_t __read(int __fd, void *__buf, size_t __nbytes) attribute_hidden;
 extern ssize_t __write(int __fd, __const void *__buf, size_t __n) attribute_hidden;
@@ -183,13 +194,19 @@ extern char *__getenv (__const char *__name) attribute_hidden;
 extern int __sigprocmask (int __how, __const __sigset_t *__restrict __set,
 			__sigset_t *__restrict __oset) attribute_hidden;
 
-/* #include <sys/time.h> */
+/* #include <sys/ioctl.h> */
+extern int __ioctl (int __fd, unsigned long int __request, ...) attribute_hidden;
+
 #  if 0 /* undoable here */
+/* #include <dirent.h> */
+typedef struct __dirstream DIR;
+extern DIR *__opendir (__const char *__name) attribute_hidden;
+extern int __closedir (DIR *__dirp) attribute_hidden;
+
+/* #include <sys/time.h> */
 #   define __need_timeval
 #   include <bits/time.h>
 extern int __gettimeofday(struct timeval *__restrict __tv, *__restrict __timezone__ptr_t __tz) attribute_hidden;
-#  else
-#   define gettimeofday __gettimeofday
 #  endif
 
 /* #include <pthread.h> */