static void *alloc_ptr, *alloc_end, *alloc_last_block;
-void *
+void * weak_function
malloc (size_t n)
{
extern int _dl_zerofd;
alloc_ptr += n;
return alloc_last_block;
}
-weak_symbol (malloc)
/* This will rarely be called. */
-void
+void weak_function
free (void *ptr)
{
/* We can free only the last block allocated. */
if (ptr == alloc_last_block)
alloc_ptr = alloc_last_block;
}
-weak_symbol (free)
/* This is only called with the most recent block returned by malloc. */
-void *
+void * weak_function
realloc (void *ptr, size_t n)
{
void *new;
assert (new == ptr);
return new;
}
-weak_symbol (realloc)
\f
/* Avoid signal frobnication in setjmp/longjmp. Keeps things smaller. */
#include <setjmp.h>
-int __sigjmp_save (sigjmp_buf env, int savemask)
+int weak_function
+__sigjmp_save (sigjmp_buf env, int savemask)
{ env[0].__mask_was_saved = savemask; return 0; }
-weak_symbol (__sigjmp_save)
-void
+void weak_function
longjmp (jmp_buf env, int val) { __longjmp (env[0].__jmpbuf, val); }
-weak_symbol (longjmp)
-
\f
/* Define our own stub for the localization function used by strerror.
English-only in the dynamic linker keeps it smaller. */
-char *
+char * weak_function
__dgettext (const char *domainname, const char *msgid)
{
assert (domainname == _libc_intl_domainname);
return (char *) msgid;
}
-weak_symbol (__dgettext)
weak_alias (__dgettext, dgettext)
\f
#ifndef NDEBUG
If we are linked into the user program (-ldl), the normal __assert_fail
defn can override this one. */
-void
+void weak_function
__assert_fail (const char *assertion,
const char *file, unsigned int line, const char *function)
{
NULL);
}
-weak_symbol (__assert_fail)
-void
+void weak_function
__assert_perror_fail (int errnum,
const char *file, unsigned int line,
const char *function)
"Unexpected error: ", strerror (errnum), "\n", NULL);
}
-weak_symbol (__assert_perror_fail)
#endif
\f
/* External user entry point. */
INT
+#ifdef weak_function
+weak_function
+#endif
strtol (nptr, endptr, base)
const STRING_TYPE *nptr;
STRING_TYPE **endptr;
{
return INTERNAL (strtol) (nptr, endptr, base, 0);
}
-#ifdef weak_symbol
-/* We need to weaken this symbol because some the the defined
- functions do not come from ANSI. The indirection is necessary
- because `strtol' might be a macro. */
-#define weak_this(x) weak_symbol (x)
-weak_this (strtol)
-#endif
dynamic linker re-relocates itself to be user-visible (for -ldl),
it will get the user's definition (i.e. usually libc's). */
-int
+int weak_function
__open (const char *file_name, int mode, ...)
{
enum retry_type doretry;
}
}
-int
+int weak_function
__close (int fd)
{
if (fd != (int) MACH_PORT_NULL)
return 0;
}
-caddr_t
+caddr_t weak_function
__mmap (caddr_t addr, size_t len, int prot, int flags, int fd, off_t offset)
{
error_t err;
return err ? (caddr_t) __hurd_fail (err) : (caddr_t) mapaddr;
}
-void
+void weak_function
_exit (int status)
{
__proc_mark_exit (_dl_hurd_data->portarray[INIT_PORT_PROC],
while (__task_terminate (__mach_task_self ()))
__mach_task_self_ = (__mach_task_self) ();
}
-
-weak_symbol (_exit)
-weak_symbol (__open)
-weak_symbol (__close)
-weak_symbol (__mmap)
\f
/* This function is called by interruptible RPC stubs. For initial
weak, the real defn in libc.so will override it if we are linked into
the user program (-ldl). */
-error_t
+error_t weak_function
_hurd_intr_rpc_mach_msg (mach_msg_header_t *msg,
mach_msg_option_t option,
mach_msg_size_t send_size,
return __mach_msg (msg, option, send_size, rcv_size, rcv_name,
timeout, notify);
}
-weak_symbol (_hurd_intr_rpc_mach_msg)