This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Missing "link", "times", and "gettimeofday" in mips-elf and mips64-elf libraries
- From: Fred Fish <fnf at specifix dot com>
- To: newlib at sources dot redhat dot com
- Cc: fnf at specifix dot com
- Date: Wed, 7 Jun 2006 21:27:14 -0400
- Subject: Missing "link", "times", and "gettimeofday" in mips-elf and mips64-elf libraries
- Reply-to: fnf at specifix dot com
The gdb testsuite test "fileio.exp" fails to link due to missing
runtime functions "link", "times", and "gettimeofday". Below is
how I hacked around this for the moment, but probably only the
addition of "link" is suitable for inclusion in the mainline
sources.
2006-06-06 Fred Fish <fnf@specifix.com>
* link.c: New file.
* mips/Makefile.in (GENOBJS): Add link.o.
* config/mips.mt: Add makefile rule to build link.o
* mips/syscalls.c (times, gettimeofday): Hack to add stubs
to sidestep unresolved link time symbols. Not intended to
be a permanent fix.
Index: newlib/libgloss/link.c
===================================================================
RCS file: newlib/libgloss/link.c
diff -N newlib/libgloss/link.c
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- newlib/libgloss/link.c 6 Jun 2006 17:39:48 -0000
***************
*** 0 ****
--- 1,29 ----
+ /* link.c -- make hard link
+ *
+ * Copyright (c) 1995 Cygnus Support
+ *
+ * The authors hereby grant permission to use, copy, modify, distribute,
+ * and license this software and its documentation for any purpose, provided
+ * that existing copyright notices are retained in all copies and that this
+ * notice is included verbatim in any distributions. No written agreement,
+ * license, or royalty fee is required for any of the authorized uses.
+ * Modifications to this software may be copyrighted by their authors
+ * and need not follow the licensing terms described here, provided that
+ * the new terms are clearly indicated on the first page of each file where
+ * they apply.
+ */
+ #include <errno.h>
+ #include "glue.h"
+
+ /*
+ * link -- since we have no file system,
+ * we just return an error.
+ */
+ int
+ _DEFUN (link, (path1, path2),
+ char * path1 _AND
+ char * path2)
+ {
+ errno = EIO;
+ return (-1);
+ }
Index: newlib/libgloss/config/mips.mt
===================================================================
RCS file: /cvsroots/latest/src/newlib/libgloss/config/mips.mt,v
retrieving revision 1.1.1.1
diff -c -p -r1.1.1.1 mips.mt
*** newlib/libgloss/config/mips.mt 8 Oct 2005 19:45:26 -0000 1.1.1.1
--- newlib/libgloss/config/mips.mt 6 Jun 2006 15:09:52 -0000
*************** isatty.o: ${srcdir}/../isatty.c
*** 13,18 ****
--- 13,20 ----
$(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $?
kill.o: ${srcdir}/../kill.c
$(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $?
+ link.o: ${srcdir}/../link.c
+ $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $?
lseek.o: ${srcdir}/../lseek.c
$(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $?
open.o: ${srcdir}/../open.c
Index: newlib/libgloss/mips/Makefile.in
===================================================================
RCS file: /cvsroots/latest/src/newlib/libgloss/mips/Makefile.in,v
retrieving revision 1.1.1.1
diff -c -p -r1.1.1.1 Makefile.in
*** newlib/libgloss/mips/Makefile.in 8 Oct 2005 19:45:24 -0000 1.1.1.1
--- newlib/libgloss/mips/Makefile.in 6 Jun 2006 14:57:54 -0000
*************** OBJCOPY = `if [ -f ${objroot}/../binutil
*** 67,73 ****
CRT0 = @crt0@
PCRT0 = @pcrt0@
GENOBJS = syscalls.o fstat.o getpid.o isatty.o kill.o \
! lseek.o print.o putnum.o stat.o unlink.o
GENOBJS2 = open.o close.o read.o write.o
IDTOBJS = idtmon.o @part_specific_obj@ ${GENOBJS}
PMONOBJS = pmon.o @part_specific_obj@ ${GENOBJS}
--- 67,73 ----
CRT0 = @crt0@
PCRT0 = @pcrt0@
GENOBJS = syscalls.o fstat.o getpid.o isatty.o kill.o \
! link.o lseek.o print.o putnum.o stat.o unlink.o
GENOBJS2 = open.o close.o read.o write.o
IDTOBJS = idtmon.o @part_specific_obj@ ${GENOBJS}
PMONOBJS = pmon.o @part_specific_obj@ ${GENOBJS}
Index: newlib/libgloss/mips/syscalls.c
===================================================================
RCS file: /cvsroots/latest/src/newlib/libgloss/mips/syscalls.c,v
retrieving revision 1.1.1.1
diff -c -p -r1.1.1.1 syscalls.c
*** newlib/libgloss/mips/syscalls.c 8 Oct 2005 19:45:24 -0000 1.1.1.1
--- newlib/libgloss/mips/syscalls.c 6 Jun 2006 18:25:14 -0000
*************** sbrk (nbytes)
*** 43,45 ****
--- 43,65 ----
return base;
}
+
+ /* Everything below this line is a hack to supply stubs so that the gdb
+ testsuite (and possibly others) won't trip over undefined symbols.
+ There is probably a better way to fix this problem. -fnf */
+
+ #include <errno.h>
+
+ clock_t
+ times ()
+ {
+ errno = ENOSYS;
+ return -1;
+ }
+
+ int
+ gettimeofday ()
+ {
+ errno = ENOSYS;
+ return -1;
+ }