Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2006-10-08 00:08:48 +0400
committerNathan Sidwell <nathan@codesourcery.com>2006-10-08 00:08:48 +0400
commitd36ae2cec9355bd721f470cf4924c01fa3be04f7 (patch)
tree71bfeef819cda1fa27d095e2ed5cc2f70cb96b60
parent92859c43ce9afb1ee0c5c8e0d2ab92276d4afc70 (diff)
* m68k/Makefile.in: Adjust Coldfire rules. (BDM_CRT0, BDM_BSP, BDM_OBJS, BDM_ISRS): Rename to ... (CF_CRT0, CF_BSP, CF_OBJS, CF_ISRS): ... here. Adjust. (BDM_OTHER_OBJS): Remove. (BDM_SYSOBJS): Rename to ... (UNHOSTED_OBJS): ... here. Adjust. (UNHOSTED_BSP, HOSTED_OBJS, HOSTED_BSP): New. (CF_HOSTED_SCRIPTS): New. (CF_SCRIPTS, CF_SOURCES): Adjust. * m68k/cf.sc: Add IO library variable. * m68k/bdm-crt0.S, m68k/bdm-crt1.c, m68k/bdm-isrs.c, m68k/bdm-sbrk.c, m68k/bdm-semihost.S: Rename to ... * m68k/cf-crt0.S, m68k/cf-crt1.c, m68k/cf-isrs.c, m68k/cf-sbrk.c, m68k/cf-hosted.S: ... here. * m68k/cf-exit.c: New. * m68k/bdm-gdb.h, m68k/bdm-semihost.h: Merge into ... * m68k/io.h: ... here. Add unhosted support. Adjust conversion function names. * m68k/bdm-gdb.c: Rename to ... * m68k/io-gdb.c: ... here. Adjust names of conversion functions. * m68k/bdm-close.c, m68k/bdm-exit.c, m68k/bdm-fstat.c, m68k/bdm-gettimeofday.c, m68k/bdm-isatty.c, m68k/bdm-lseek.c, m68k/bdm-open.c, m68k/bdm-read.c, m68k/bdm-rename.c, m68k/bdm-stat.c, m68k/bdm-system.c, m68k/bdm-time.c, m68k/bdm-unlink.c, m68k/bdm-write.c: Rename to ... * m68k/io-close.c, m68k/io-exit.c, m68k/io-fstat.c, m68k/io-gettimeofday.c, m68k/io-isatty.c, m68k/io-lseek.c, m68k/io-open.c, m68k/io-read.c, m68k/io-rename.c, m68k/io-stat.c, m68k/io-system.c, m68k/io-time.c, m68k/io-unlink.c, m68k/io-write.c: ... here. Include io.h. Adjust for hosted & unhosted libraries. Adjust names of gdb conversion functions.
-rw-r--r--ChangeLog.csl35
-rw-r--r--libgloss/m68k/Makefile.in102
-rw-r--r--libgloss/m68k/bdm-time.c21
-rw-r--r--libgloss/m68k/cf-crt0.S (renamed from libgloss/m68k/bdm-crt0.S)0
-rw-r--r--libgloss/m68k/cf-crt1.c (renamed from libgloss/m68k/bdm-crt1.c)0
-rw-r--r--libgloss/m68k/cf-exit.c (renamed from libgloss/m68k/bdm-exit.c)7
-rw-r--r--libgloss/m68k/cf-hosted.S (renamed from libgloss/m68k/bdm-semihost.S)6
-rw-r--r--libgloss/m68k/cf-isrs.c (renamed from libgloss/m68k/bdm-isrs.c)2
-rw-r--r--libgloss/m68k/cf-sbrk.c (renamed from libgloss/m68k/bdm-sbrk.c)2
-rw-r--r--libgloss/m68k/cf.sc7
-rw-r--r--libgloss/m68k/io-close.c (renamed from libgloss/m68k/bdm-close.c)14
-rw-r--r--libgloss/m68k/io-exit.c (renamed from libgloss/m68k/bdm-semihost.h)29
-rw-r--r--libgloss/m68k/io-fstat.c (renamed from libgloss/m68k/bdm-fstat.c)17
-rw-r--r--libgloss/m68k/io-gdb.c (renamed from libgloss/m68k/bdm-gdb.c)20
-rw-r--r--libgloss/m68k/io-gettimeofday.c (renamed from libgloss/m68k/bdm-gettimeofday.c)17
-rw-r--r--libgloss/m68k/io-isatty.c (renamed from libgloss/m68k/bdm-isatty.c)14
-rw-r--r--libgloss/m68k/io-lseek.c (renamed from libgloss/m68k/bdm-lseek.c)17
-rw-r--r--libgloss/m68k/io-open.c (renamed from libgloss/m68k/bdm-open.c)19
-rw-r--r--libgloss/m68k/io-read.c (renamed from libgloss/m68k/bdm-read.c)15
-rw-r--r--libgloss/m68k/io-rename.c (renamed from libgloss/m68k/bdm-rename.c)15
-rw-r--r--libgloss/m68k/io-stat.c (renamed from libgloss/m68k/bdm-stat.c)17
-rw-r--r--libgloss/m68k/io-system.c (renamed from libgloss/m68k/bdm-system.c)18
-rw-r--r--libgloss/m68k/io-time.c45
-rw-r--r--libgloss/m68k/io-unlink.c (renamed from libgloss/m68k/bdm-unlink.c)15
-rw-r--r--libgloss/m68k/io-write.c (renamed from libgloss/m68k/bdm-write.c)15
-rw-r--r--libgloss/m68k/io.h (renamed from libgloss/m68k/bdm-gdb.h)59
26 files changed, 348 insertions, 180 deletions
diff --git a/ChangeLog.csl b/ChangeLog.csl
index ffcb18341..f59b5ffe1 100644
--- a/ChangeLog.csl
+++ b/ChangeLog.csl
@@ -1,3 +1,38 @@
+2006-10-07 Nathan Sidwell <nathan@codesourcery.com>
+
+ libgloss/
+ * m68k/Makefile.in: Adjust Coldfire rules.
+ (BDM_CRT0, BDM_BSP, BDM_OBJS, BDM_ISRS): Rename to ...
+ (CF_CRT0, CF_BSP, CF_OBJS, CF_ISRS): ... here. Adjust.
+ (BDM_OTHER_OBJS): Remove.
+ (BDM_SYSOBJS): Rename to ...
+ (UNHOSTED_OBJS): ... here. Adjust.
+ (UNHOSTED_BSP, HOSTED_OBJS, HOSTED_BSP): New.
+ (CF_HOSTED_SCRIPTS): New.
+ (CF_SCRIPTS, CF_SOURCES): Adjust.
+ * m68k/cf.sc: Add IO library variable.
+ * m68k/bdm-crt0.S, m68k/bdm-crt1.c, m68k/bdm-isrs.c,
+ m68k/bdm-sbrk.c, m68k/bdm-semihost.S: Rename to ...
+ * m68k/cf-crt0.S, m68k/cf-crt1.c, m68k/cf-isrs.c, m68k/cf-sbrk.c,
+ m68k/cf-hosted.S: ... here.
+ * m68k/cf-exit.c: New.
+ * m68k/bdm-gdb.h, m68k/bdm-semihost.h: Merge into ...
+ * m68k/io.h: ... here. Add unhosted support. Adjust conversion
+ function names.
+ * m68k/bdm-gdb.c: Rename to ...
+ * m68k/io-gdb.c: ... here. Adjust names of conversion functions.
+ * m68k/bdm-close.c, m68k/bdm-exit.c, m68k/bdm-fstat.c,
+ m68k/bdm-gettimeofday.c, m68k/bdm-isatty.c, m68k/bdm-lseek.c,
+ m68k/bdm-open.c, m68k/bdm-read.c, m68k/bdm-rename.c,
+ m68k/bdm-stat.c, m68k/bdm-system.c, m68k/bdm-time.c,
+ m68k/bdm-unlink.c, m68k/bdm-write.c: Rename to ...
+ * m68k/io-close.c, m68k/io-exit.c, m68k/io-fstat.c,
+ m68k/io-gettimeofday.c, m68k/io-isatty.c, m68k/io-lseek.c,
+ m68k/io-open.c, m68k/io-read.c, m68k/io-rename.c, m68k/io-stat.c,
+ m68k/io-system.c, m68k/io-time.c, m68k/io-unlink.c,
+ m68k/io-write.c: ... here. Include io.h. Adjust for hosted &
+ unhosted libraries. Adjust names of gdb conversion functions.
+
2006-10-01 Paul Brook <paul@codesourcery.com>
* libgloss/
diff --git a/libgloss/m68k/Makefile.in b/libgloss/m68k/Makefile.in
index 3b66c6c64..c61b08148 100644
--- a/libgloss/m68k/Makefile.in
+++ b/libgloss/m68k/Makefile.in
@@ -1,4 +1,4 @@
-# Copyright (c) 1995, 1996, 2001 Cygnus Support
+# Copyright (c) 1995, 1996, 2001 Cygnus Support -*- mode:makefile -*-
#
# The authors hereby grant permission to use, copy, modify, distribute,
# and license this software and its documentation for any purpose, provided
@@ -118,18 +118,29 @@ IDPGDB_BSP= libidpgdb.a
IDPGDB_OBJS= leds.o idp-inbyte.o idp-gdb-outbyte.o mc68ec.o
#
-# here's all the BDM semihosting stuff
+# here's all the unhosted stuff
#
-BDM_CRT0= bdm-crt0.o
-BDM_BSP= libbdm.a
-BDM_OBJS= bdm-crt1.o bdm-semihost.o $(BDM_SYSOBJS) \
- $(patsubst %,bdm-%.o,${BDM_ISRS})
-BDM_OTHER_OBJS= getpid.o kill.o
-BDM_SYSOBJS= bdm-close.o bdm-exit.o bdm-fstat.o bdm-gdb.o \
- bdm-gettimeofday.o bdm-isatty.o bdm-lseek.o \
- bdm-open.o bdm-read.o bdm-rename.o bdm-sbrk.o \
- bdm-stat.o bdm-system.o bdm-time.o bdm-unlink.o bdm-write.o
-BDM_ISRS= other_interrupt reset access_error address_error \
+UNHOSTED_BSP= libunhosted.a
+UNHOSTED_OBJS= unhosted-close.o unhosted-fstat.o \
+ unhosted-gettimeofday.o unhosted-isatty.o unhosted-lseek.o \
+ unhosted-open.o unhosted-read.o unhosted-rename.o \
+ unhosted-stat.o unhosted-system.o unhosted-time.o \
+ unhosted-unlink.o unhosted-write.o
+
+#
+# here's all the hosted stuff
+#
+HOSTED_BSP= libhosted.a
+HOSTED_OBJS= hosted-gdb.o hosted-exit.o $(patsubst un%,%,$(UNHOSTED_OBJS))
+
+#
+# here's all the ColdFire boards
+#
+CF_CRT0= cf-crt0.o
+CF_BSP= libcf.a
+CF_OBJS= cf-crt1.o cf-hosted.o getpid.o kill.o cf-sbrk.o cf-exit.o \
+ $(patsubst %,cf-%.o,${CF_ISRS})
+CF_ISRS= other_interrupt reset access_error address_error \
illegal_instruction divide_by_zero privilege_violation \
trace unimplemented_line_a_opcode unimplemented_line_f_opcode \
non_pc_breakpoint_debug_interrupt pc_breakpoint_debug_interrupt \
@@ -143,8 +154,9 @@ CF_BOARDS := m5208evb m5213evb m52235evb m5235evb m5272c3 m5282evb \
m5329evb m5485evb
CF_RAM_SCRIPTS := $(patsubst %,%-ram.ld,$(CF_BOARDS))
CF_ROM_SCRIPTS := $(patsubst %,%-rom.ld,$(CF_BOARDS))
-CF_SCRIPTS = $(CF_RAM_SCRIPTS) $(CF_ROM_SCRIPTS)
-CF_SOURCES = bdm-crt0.S bdm-crt1.c asm.h
+CF_HOSTED_SCRIPTS := $(patsubst %.ld,%-hosted.ld,$(CF_RAM_SCRIPTS) $(CF_ROM_SCRIPTS))
+CF_SCRIPTS = $(CF_RAM_SCRIPTS) $(CF_ROM_SCRIPTS) $(CF_HOSTED_SCRIPTS)
+CF_SOURCES = cf-crt0.S cf-crt1.c asm.h
# Host specific makefile fragment comes in here.
@host_makefile_frag@
@@ -154,7 +166,8 @@ CF_SOURCES = bdm-crt0.S bdm-crt1.c asm.h
# it to link is a good test, so we ignore all the errors for now.
#
all: ${SIM_CRT0} ${SIM_BSP} ${CRT0} ${BCC_BSP} ${IDP_BSP} ${IDPGDB_BSP} \
- ${MVME135_BSP} ${MVME162_BSP} ${BDM_CRT0} ${BDM_BSP} ${CF_SCRIPTS}
+ ${MVME135_BSP} ${MVME162_BSP} ${HOSTED_BSP} ${UNHOSTED_BSP} \
+ ${CF_CRT0} ${CF_BSP} ${CF_SCRIPTS}
#
# here's where we build the board support packages for each target
@@ -175,10 +188,6 @@ ${IDPGDB_BSP}: $(OBJS) ${IDPGDB_OBJS}
${AR} ${ARFLAGS} $@ $(OBJS) ${IDPGDB_OBJS}
${RANLIB} $@
-${BDM_BSP}: $(BDM_OTHER_OBJS) ${BDM_OBJS}
- ${AR} ${ARFLAGS} $@ $(BDM_OTHER_OBJS) ${BDM_OBJS}
- ${RANLIB} $@
-
${MVME135_BSP}: $(OBJS) ${MVME135_OBJS}
${AR} ${ARFLAGS} $@ $(OBJS) ${MVME135_OBJS}
${RANLIB} $@
@@ -187,18 +196,27 @@ ${MVME162_BSP}: $(OBJS) ${MVME162_OBJS}
${AR} ${ARFLAGS} $@ $(OBJS) ${MVME162_OBJS}
${RANLIB} $@
-$(BDM_SYSOBJS): %.o: %.c bdm-semihost.h bdm-gdb.h
- $(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $< -o $@
-bdm-crt0.o : bdm-crt0.S
- $(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $< -o $@
-bdm-crt1.o : bdm-crt1.c
- $(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $< -o $@
-bdm-semihost.o : bdm-semihost.S
- $(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $< -o $@
+# build hosted library
+$(HOSTED_OBJS): hosted%.o: io%.c io.h
+ $(CC) $(CFLAGS_FOR_TARGET) -DHOSTED=1 $(INCLUDES) -c $< -o $@
+$(HOSTED_BSP): $(HOSTED_OBJS)
+ ${AR} ${ARFLAGS} $@ $^
+ ${RANLIB} $@
-$(patsubst %,bdm-%.o,${BDM_ISRS}) : bdm-isrs.c
+# build unhosted library
+$(UNHOSTED_OBJS): unhosted%.o: io%.c io.h
+ $(CC) $(CFLAGS_FOR_TARGET) -DHOSTED=0 $(INCLUDES) -c $< -o $@
+$(UNHOSTED_BSP): $(UNHOSTED_OBJS)
+ ${AR} ${ARFLAGS} $@ $^
+ ${RANLIB} $@
+
+# build coldfire library
+$(patsubst %,cf-%.o,${CF_ISRS}) : cf-isrs.c
$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $< -o $@ \
- -DL_$(patsubst bdm-%.o,%,$@)
+ -DL_$(patsubst cf-%.o,%,$@)
+$(CF_BSP): $(CF_OBJS)
+ ${AR} ${ARFLAGS} $@ $^
+ ${RANLIB} $@
# RAM ROM
m5208evb := 1024M 16M 0M 2M
@@ -211,9 +229,16 @@ m5329evb := 1024M 32M 0M 2M
m5485evb := 0M 64M 1024M 16M
%-ram.ld : cf.sc Makefile
- RAM=$(word 1,$($*)) RAM_SIZE=$(word 2,$($*)) ${SHELL} $< >$@
+ IO=unhosted RAM=$(word 1,$($*)) RAM_SIZE=$(word 2,$($*)) \
+ ${SHELL} $< >$@
%-rom.ld : cf.sc Makefile
- RAM=$(word 1,$($*)) RAM_SIZE=$(word 2,$($*)) \
+ IO=unhosted RAM=$(word 1,$($*)) RAM_SIZE=$(word 2,$($*)) \
+ ROM=$(word 3,$($*)) ROM_SIZE=$(word 4,$($*)) ${SHELL} $< >$@
+%-ram-hosted.ld : cf.sc Makefile
+ IO=hosted RAM=$(word 1,$($*)) RAM_SIZE=$(word 2,$($*)) \
+ ${SHELL} $< >$@
+%-rom-hosted.ld : cf.sc Makefile
+ IO=hosted RAM=$(word 1,$($*)) RAM_SIZE=$(word 2,$($*)) \
ROM=$(word 3,$($*)) ROM_SIZE=$(word 4,$($*)) ${SHELL} $< >$@
leds.o: ${srcdir}/leds.c
@@ -332,17 +357,20 @@ install:
# install MVME162lx stuff
$(INSTALL_PROGRAM) $(MVME162_BSP) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(MVME162_BSP)
$(INSTALL_DATA) ${srcdir}/mvme162.ld $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/mvme162.ld
- # install BDM stuff
- $(INSTALL_DATA) $(BDM_CRT0) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(BDM_CRT0)
- $(INSTALL_DATA) $(BDM_BSP) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(BDM_BSP)
- for src in $(CF_SOURCES) ; \
- do $(INSTALL_DATA) ${srcdir}/$$src $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$$src ; \
- done
$(INSTALL_DATA) ${srcdir}/sbc5204.ld $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/sbc5204.ld
$(INSTALL_DATA) ${srcdir}/sbc5206.ld $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/sbc5206.ld
+ # install IO stuff
+ $(INSTALL_DATA) $(HOSTED_BSP) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(HOSTED_BSP)
+ $(INSTALL_DATA) $(UNHOSTED_BSP) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(UNHOSTED_BSP)
+ # install CF stuff
+ $(INSTALL_DATA) $(CF_CRT0) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(CF_CRT0)
+ $(INSTALL_DATA) $(CF_BSP) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(CF_BSP)
for script in $(CF_SCRIPTS) ; \
do $(INSTALL_DATA) $$script $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$$script ; \
done
+ for src in $(CF_SOURCES) ; \
+ do $(INSTALL_DATA) ${srcdir}/$$src $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$$src ; \
+ done
# target specific makefile fragment comes in here.
@target_makefile_frag@
diff --git a/libgloss/m68k/bdm-time.c b/libgloss/m68k/bdm-time.c
deleted file mode 100644
index 02fbfabbe..000000000
--- a/libgloss/m68k/bdm-time.c
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <sys/time.h>
-
-/*
- * time -- get the current time
- * input parameters:
- * 0 : timeval ptr
- * output parameters:
- * 0 : result
- * 1 : errno
- */
-
-time_t time (time_t *t)
-{
- struct timeval tv;
-
- if (gettimeofday (&tv, NULL))
- return -1;
- if (t)
- *t = tv.tv_sec;
- return tv.tv_sec;
-}
diff --git a/libgloss/m68k/bdm-crt0.S b/libgloss/m68k/cf-crt0.S
index a61919a4f..a61919a4f 100644
--- a/libgloss/m68k/bdm-crt0.S
+++ b/libgloss/m68k/cf-crt0.S
diff --git a/libgloss/m68k/bdm-crt1.c b/libgloss/m68k/cf-crt1.c
index 25605fe91..25605fe91 100644
--- a/libgloss/m68k/bdm-crt1.c
+++ b/libgloss/m68k/cf-crt1.c
diff --git a/libgloss/m68k/bdm-exit.c b/libgloss/m68k/cf-exit.c
index 128d54710..7d17a9bbb 100644
--- a/libgloss/m68k/bdm-exit.c
+++ b/libgloss/m68k/cf-exit.c
@@ -1,5 +1,5 @@
/*
- * bdm-exit.c --
+ * cf-exit.c --
*
* Copyright (c) 2006 CodeSourcery Inc
*
@@ -14,9 +14,6 @@
* they apply.
*/
-#include "bdm-semihost.h"
-#include "bdm-gdb.h"
-
extern void __reset (void);
/*
@@ -27,7 +24,7 @@ void __attribute__ ((noreturn)) _exit (int code)
{
while (1)
{
- __bdm_semihost (BDM_EXIT, (void *)code);
+ __asm__ __volatile__ ("halt" ::: "memory");
__reset ();
}
}
diff --git a/libgloss/m68k/bdm-semihost.S b/libgloss/m68k/cf-hosted.S
index 60b812c28..9cf88209c 100644
--- a/libgloss/m68k/bdm-semihost.S
+++ b/libgloss/m68k/cf-hosted.S
@@ -1,5 +1,5 @@
/*
- * bdm-semihost.S --
+ * cf-hosted.S --
*
* Copyright (c) 2006 CodeSourcery Inc
*
@@ -17,8 +17,8 @@
/* Semihosting function. The debugger intercepts the halt, and
determines that it is followed by the sentinel pattern. */
- .globl __bdm_semihost
-__bdm_semihost:
+ .globl __hosted
+__hosted:
linkw %fp,#0
movel %fp@(8),%d0
movel %fp@(12),%d1
diff --git a/libgloss/m68k/bdm-isrs.c b/libgloss/m68k/cf-isrs.c
index 2b80d6691..e9846e237 100644
--- a/libgloss/m68k/bdm-isrs.c
+++ b/libgloss/m68k/cf-isrs.c
@@ -1,5 +1,5 @@
/*
- * bdm-isv.c --
+ * cf-isv.c --
*
* Copyright (c) 2006 CodeSourcery Inc
*
diff --git a/libgloss/m68k/bdm-sbrk.c b/libgloss/m68k/cf-sbrk.c
index b1d539d46..e2899f256 100644
--- a/libgloss/m68k/bdm-sbrk.c
+++ b/libgloss/m68k/cf-sbrk.c
@@ -1,5 +1,5 @@
/*
- * bdm-open.c --
+ * cf-sbrk.c --
*
* Copyright (c) 2006 CodeSourcery Inc
*
diff --git a/libgloss/m68k/cf.sc b/libgloss/m68k/cf.sc
index 61502114d..07472a9c2 100644
--- a/libgloss/m68k/cf.sc
+++ b/libgloss/m68k/cf.sc
@@ -3,15 +3,16 @@
# RAM_SIZE - size of board's ram
# ROM - start of board's rom
# ROM_SIZE - size of board's rom
+# IO - io library name
test -z "${ROM:+1}" && NOROM=1
cat <<EOF
-STARTUP(bdm-crt0.o)
+STARTUP(cf-crt0.o)
OUTPUT_ARCH(m68k)
ENTRY(__start)
SEARCH_DIR(.)
-GROUP(-lc -lbdm)
+GROUP(-lc -l${IO} -lcf)
__DYNAMIC = 0;
MEMORY
@@ -28,7 +29,7 @@ SECTIONS
.text :
{
CREATE_OBJECT_SYMBOLS
- bdm-crt0.o(.text)
+ cf-crt0.o(.text)
*(.text .text.*)
. = ALIGN(0x4);
diff --git a/libgloss/m68k/bdm-close.c b/libgloss/m68k/io-close.c
index dced304b9..fb8cde371 100644
--- a/libgloss/m68k/bdm-close.c
+++ b/libgloss/m68k/io-close.c
@@ -1,5 +1,5 @@
/*
- * bdm-close.c --
+ * io-close.c --
*
* Copyright (c) 2006 CodeSourcery Inc
*
@@ -14,10 +14,10 @@
* they apply.
*/
-#include "bdm-semihost.h"
-#include "bdm-gdb.h"
#include <unistd.h>
#include <errno.h>
+#define IO close
+#include "io.h"
/*
* close -- close a file descriptor.
@@ -30,9 +30,13 @@
int close (int fd)
{
+#if HOSTED
gdb_parambuf_t parameters;
parameters[0] = (uint32_t) fd;
- __bdm_semihost (BDM_CLOSE, parameters);
- errno = convert_from_gdb_errno (parameters[1]);
+ __hosted (HOSTED_CLOSE, parameters);
+ errno = __hosted_from_gdb_errno (parameters[1]);
return parameters[0];
+#else
+ return 0;
+#endif
}
diff --git a/libgloss/m68k/bdm-semihost.h b/libgloss/m68k/io-exit.c
index d82027557..3eee09d8f 100644
--- a/libgloss/m68k/bdm-semihost.h
+++ b/libgloss/m68k/io-exit.c
@@ -1,5 +1,5 @@
/*
- * bdm semihosting support.
+ * io-exit.c --
*
* Copyright (c) 2006 CodeSourcery Inc
*
@@ -14,21 +14,16 @@
* they apply.
*/
-/* Codes for BDM_FUNC_REG. */
+#if HOSTED
+#include "io.h"
-#define BDM_EXIT 0
-#define BDM_PUTCHAR 1 /* Obsolete */
-#define BDM_OPEN 2
-#define BDM_CLOSE 3
-#define BDM_READ 4
-#define BDM_WRITE 5
-#define BDM_LSEEK 6
-#define BDM_RENAME 7
-#define BDM_UNLINK 8
-#define BDM_STAT 9
-#define BDM_FSTAT 10
-#define BDM_GETTIMEOFDAY 11
-#define BDM_ISATTY 12
-#define BDM_SYSTEM 13
+/*
+ * _exit -- Exit from the application.
+ */
-extern int __bdm_semihost (int func, void *args);
+void __attribute__ ((noreturn)) _exit (int code)
+{
+ while (1)
+ __hosted (HOSTED_EXIT, (void *)code);
+}
+#endif
diff --git a/libgloss/m68k/bdm-fstat.c b/libgloss/m68k/io-fstat.c
index e8fb67619..83f15168f 100644
--- a/libgloss/m68k/bdm-fstat.c
+++ b/libgloss/m68k/io-fstat.c
@@ -1,5 +1,5 @@
/*
- * bdm-fstat.c --
+ * io-fstat.c --
*
* Copyright (c) 2006 CodeSourcery Inc
*
@@ -14,12 +14,12 @@
* they apply.
*/
-#include "bdm-semihost.h"
-#include "bdm-gdb.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>
+#define IO fstat
+#include "io.h"
/*
* fstat -- get file information
@@ -33,12 +33,17 @@
int fstat (int fd, struct stat *buf)
{
+#if HOSTED
gdb_parambuf_t parameters;
struct gdb_stat gbuf;
parameters[0] = (uint32_t) fd;
parameters[1] = (uint32_t) &gbuf;
- __bdm_semihost (BDM_FSTAT, parameters);
- convert_from_gdb_stat (&gbuf, buf);
- errno = convert_from_gdb_errno (parameters[1]);
+ __hosted (HOSTED_FSTAT, parameters);
+ __hosted_from_gdb_stat (&gbuf, buf);
+ errno = __hosted_from_gdb_errno (parameters[1]);
return parameters[0];
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
}
diff --git a/libgloss/m68k/bdm-gdb.c b/libgloss/m68k/io-gdb.c
index 7ad1ea1ef..4f16b2f7b 100644
--- a/libgloss/m68k/bdm-gdb.c
+++ b/libgloss/m68k/io-gdb.c
@@ -1,5 +1,5 @@
/*
- * bdm support for GDB's remote fileio protocol
+ * hosted io support for GDB's remote fileio protocol
*
* Copyright (c) 2006 CodeSourcery Inc
*
@@ -14,13 +14,13 @@
* they apply.
*/
-#include "bdm-gdb.h"
+#include "io.h"
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
gdb_mode_t
-convert_to_gdb_mode_t (mode_t m)
+__hosted_to_gdb_mode_t (mode_t m)
{
gdb_mode_t result = 0;
if (m & S_IFREG)
@@ -49,7 +49,7 @@ convert_to_gdb_mode_t (mode_t m)
}
int32_t
-convert_to_gdb_open_flags (int f)
+__hosted_to_gdb_open_flags (int f)
{
int32_t result = 0;
if (f & O_RDONLY)
@@ -70,7 +70,7 @@ convert_to_gdb_open_flags (int f)
}
int32_t
-convert_to_gdb_lseek_flags (int f)
+__hosted_to_gdb_lseek_flags (int f)
{
if (f == SEEK_CUR)
return GDB_SEEK_CUR;
@@ -81,8 +81,8 @@ convert_to_gdb_lseek_flags (int f)
}
void
-convert_from_gdb_stat (const struct gdb_stat *gs,
- struct stat *s)
+__hosted_from_gdb_stat (const struct gdb_stat *gs,
+ struct stat *s)
{
s->st_dev = gs->st_dev;
s->st_ino = gs->st_ino;
@@ -100,15 +100,15 @@ convert_from_gdb_stat (const struct gdb_stat *gs,
}
void
-convert_from_gdb_timeval (const struct gdb_timeval *gt,
- struct timeval *t)
+__hosted_from_gdb_timeval (const struct gdb_timeval *gt,
+ struct timeval *t)
{
t->tv_sec = gt->tv_sec;
t->tv_usec = gt->tv_usec;
}
int
-convert_from_gdb_errno (int32_t err)
+__hosted_from_gdb_errno (int32_t err)
{
switch (err)
{
diff --git a/libgloss/m68k/bdm-gettimeofday.c b/libgloss/m68k/io-gettimeofday.c
index 5ed1331f8..41e6ee3f7 100644
--- a/libgloss/m68k/bdm-gettimeofday.c
+++ b/libgloss/m68k/io-gettimeofday.c
@@ -1,5 +1,5 @@
/*
- * bdm-gettimeofday.c --
+ * io-gettimeofday.c --
*
* Copyright (c) 2006 CodeSourcery Inc
*
@@ -14,10 +14,10 @@
* they apply.
*/
-#include "bdm-semihost.h"
-#include "bdm-gdb.h"
#include <sys/time.h>
#include <errno.h>
+#define IO gettimeofday
+#include "io.h"
/*
* gettimeofday -- get the current time
@@ -30,6 +30,7 @@
int gettimeofday (struct timeval *tv, struct timezone *tz)
{
+#if HOSTED
gdb_parambuf_t parameters;
struct gdb_timeval gtv;
if (!tv)
@@ -40,8 +41,12 @@ int gettimeofday (struct timeval *tv, struct timezone *tz)
return -1;
}
parameters[0] = (uint32_t) &gtv;
- __bdm_semihost (BDM_GETTIMEOFDAY, parameters);
- convert_from_gdb_timeval (&gtv, tv);
- errno = convert_from_gdb_errno (parameters[1]);
+ __hosted (HOSTED_GETTIMEOFDAY, parameters);
+ __hosted_from_gdb_timeval (&gtv, tv);
+ errno = __hosted_from_gdb_errno (parameters[1]);
return parameters[0];
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
}
diff --git a/libgloss/m68k/bdm-isatty.c b/libgloss/m68k/io-isatty.c
index 81cad1cdb..4d9bb7d35 100644
--- a/libgloss/m68k/bdm-isatty.c
+++ b/libgloss/m68k/io-isatty.c
@@ -1,5 +1,5 @@
/*
- * bdm-isatty.c --
+ * io-isatty.c --
*
* Copyright (c) 2006 CodeSourcery Inc
*
@@ -14,10 +14,10 @@
* they apply.
*/
-#include "bdm-semihost.h"
-#include "bdm-gdb.h"
#include <unistd.h>
#include <errno.h>
+#define IO isatty
+#include "io.h"
/*
* isatty -- check if fd is a terminal
@@ -30,9 +30,13 @@
int isatty (int fd)
{
+#if HOSTED
gdb_parambuf_t parameters;
parameters[0] = (uint32_t) fd;
- __bdm_semihost (BDM_ISATTY, parameters);
- errno = convert_from_gdb_errno (parameters[1]);
+ __hosted (HOSTED_ISATTY, parameters);
+ errno = __hosted_from_gdb_errno (parameters[1]);
return parameters[0];
+#else
+ return 1;
+#endif
}
diff --git a/libgloss/m68k/bdm-lseek.c b/libgloss/m68k/io-lseek.c
index 2ae7d667e..63ec56451 100644
--- a/libgloss/m68k/bdm-lseek.c
+++ b/libgloss/m68k/io-lseek.c
@@ -1,5 +1,5 @@
/*
- * bdm-lseek.c --
+ * io-lseek.c --
*
* Copyright (c) 2006 CodeSourcery Inc
*
@@ -14,11 +14,11 @@
* they apply.
*/
-#include "bdm-semihost.h"
-#include "bdm-gdb.h"
#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
+#define IO lseek
+#include "io.h"
/*
* lseek -- reposition a file descriptor
@@ -35,12 +35,17 @@
off_t lseek (int fd, off_t offset, int whence)
{
+#if HOSTED
gdb_parambuf_t parameters;
parameters[0] = (uint32_t) fd;
parameters[1] = (uint32_t) ((offset >> 32) & 0xffffffff);
parameters[2] = (uint32_t) (offset & 0xffffffff);
- parameters[3] = convert_to_gdb_lseek_flags (whence);
- __bdm_semihost (BDM_LSEEK, parameters);
- errno = convert_from_gdb_errno (parameters[2]);
+ parameters[3] = __hosted_to_gdb_lseek_flags (whence);
+ __hosted (HOSTED_LSEEK, parameters);
+ errno = __hosted_from_gdb_errno (parameters[2]);
return ((uint64_t)parameters[0] << 32) | ((uint64_t)parameters[1]);
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
}
diff --git a/libgloss/m68k/bdm-open.c b/libgloss/m68k/io-open.c
index 10e9148ad..ec45a533c 100644
--- a/libgloss/m68k/bdm-open.c
+++ b/libgloss/m68k/io-open.c
@@ -1,5 +1,5 @@
/*
- * bdm-open.c --
+ * io-open.c --
*
* Copyright (c) 2006 CodeSourcery Inc
*
@@ -14,14 +14,14 @@
* they apply.
*/
-#include "bdm-semihost.h"
-#include "bdm-gdb.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdarg.h>
#include <string.h>
#include <errno.h>
+#define IO open
+#include "io.h"
/*
* open -- Open a file.
@@ -37,20 +37,25 @@
int open (const char *fname, int flags, ...)
{
+#if HOSTED
gdb_parambuf_t parameters;
parameters[0] = (uint32_t) fname;
parameters[1] = strlen (fname) + 1;
- parameters[2] = convert_to_gdb_open_flags (flags);
+ parameters[2] = __hosted_to_gdb_open_flags (flags);
if (flags & O_CREAT)
{
va_list ap;
va_start (ap, flags);
- parameters[3] = convert_to_gdb_mode_t (va_arg (ap, mode_t));
+ parameters[3] = __hosted_to_gdb_mode_t (va_arg (ap, mode_t));
va_end (ap);
}
else
parameters[3] = 0;
- __bdm_semihost (BDM_OPEN, parameters);
- errno = convert_from_gdb_errno (parameters[1]);
+ __hosted (HOSTED_OPEN, parameters);
+ errno = __hosted_from_gdb_errno (parameters[1]);
return parameters[0];
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
}
diff --git a/libgloss/m68k/bdm-read.c b/libgloss/m68k/io-read.c
index 805feeb5b..2cf3555e8 100644
--- a/libgloss/m68k/bdm-read.c
+++ b/libgloss/m68k/io-read.c
@@ -1,5 +1,5 @@
/*
- * bdm-read.c --
+ * io-read.c --
*
* Copyright (c) 2006 CodeSourcery Inc
*
@@ -14,10 +14,10 @@
* they apply.
*/
-#include "bdm-semihost.h"
-#include "bdm-gdb.h"
#include <unistd.h>
#include <errno.h>
+#define IO read
+#include "io.h"
/*
* read -- read from a file descriptor
@@ -32,11 +32,16 @@
ssize_t read (int fd, void *buf, size_t count)
{
+#if HOSTED
gdb_parambuf_t parameters;
parameters[0] = (uint32_t) fd;
parameters[1] = (uint32_t) buf;
parameters[2] = (uint32_t) count;
- __bdm_semihost (BDM_READ, parameters);
- errno = convert_from_gdb_errno (parameters[1]);
+ __hosted (HOSTED_READ, parameters);
+ errno = __hosted_from_gdb_errno (parameters[1]);
return parameters[0];
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
}
diff --git a/libgloss/m68k/bdm-rename.c b/libgloss/m68k/io-rename.c
index 2698b7290..75e7c8748 100644
--- a/libgloss/m68k/bdm-rename.c
+++ b/libgloss/m68k/io-rename.c
@@ -1,5 +1,5 @@
/*
- * bdm-rename.c --
+ * io-rename.c --
*
* Copyright (c) 2006 CodeSourcery Inc
*
@@ -14,11 +14,11 @@
* they apply.
*/
-#include "bdm-semihost.h"
-#include "bdm-gdb.h"
#include <stdio.h>
#include <string.h>
#include <errno.h>
+#define IO rename
+#include "io.h"
/*
* rename -- rename a file
@@ -34,12 +34,17 @@
int _rename (const char *oldpath, const char *newpath)
{
+#if HOSTED
gdb_parambuf_t parameters;
parameters[0] = (uint32_t) oldpath;
parameters[1] = (uint32_t) strlen (oldpath) + 1;
parameters[2] = (uint32_t) newpath;
parameters[3] = (uint32_t) strlen (newpath) + 1;
- __bdm_semihost (BDM_RENAME, parameters);
- errno = convert_from_gdb_errno (parameters[1]);
+ __hosted (HOSTED_RENAME, parameters);
+ errno = __hosted_from_gdb_errno (parameters[1]);
return parameters[0];
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
}
diff --git a/libgloss/m68k/bdm-stat.c b/libgloss/m68k/io-stat.c
index 21c0ca3e5..a707b0d64 100644
--- a/libgloss/m68k/bdm-stat.c
+++ b/libgloss/m68k/io-stat.c
@@ -1,5 +1,5 @@
/*
- * bdm-stat.c --
+ * io-stat.c --
*
* Copyright (c) 2006 CodeSourcery Inc
*
@@ -14,13 +14,13 @@
* they apply.
*/
-#include "bdm-semihost.h"
-#include "bdm-gdb.h"
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>
+#define IO stat
+#include "io.h"
/*
* stat -- get file information
@@ -36,13 +36,18 @@
int stat (const char *filename, struct stat *buf)
{
+#if HOSTED
gdb_parambuf_t parameters;
struct gdb_stat gbuf;
parameters[0] = (uint32_t) filename;
parameters[1] = (uint32_t) strlen (filename) + 1;
parameters[2] = (uint32_t) &gbuf;
- __bdm_semihost (BDM_STAT, parameters);
- convert_from_gdb_stat (&gbuf, buf);
- errno = convert_from_gdb_errno (parameters[1]);
+ __hosted (HOSTED_STAT, parameters);
+ __hosted_from_gdb_stat (&gbuf, buf);
+ errno = __hosted_from_gdb_errno (parameters[1]);
return parameters[0];
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
}
diff --git a/libgloss/m68k/bdm-system.c b/libgloss/m68k/io-system.c
index 6aab4b1ef..7d35ed237 100644
--- a/libgloss/m68k/bdm-system.c
+++ b/libgloss/m68k/io-system.c
@@ -1,5 +1,5 @@
/*
- * bdm-system.c --
+ * io-system.c --
*
* Copyright (c) 2006 CodeSourcery Inc
*
@@ -14,12 +14,13 @@
* they apply.
*/
-#include "bdm-semihost.h"
-#include "bdm-gdb.h"
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sys/wait.h>
+#define IO _system
+#include "io.h"
+
/*
* system: execute command on (remote) host
* input parameters:
@@ -32,13 +33,14 @@
int _system (const char *command)
{
+#if HOSTED
int e;
gdb_parambuf_t parameters;
parameters[0] = (uint32_t) command;
parameters[1] = command ? (uint32_t) strlen (command) + 1 : 0;
- __bdm_semihost (BDM_SYSTEM, parameters);
- errno = convert_from_gdb_errno (parameters[1]);
+ __hosted (HOSTED_SYSTEM, parameters);
+ errno = __hosted_from_gdb_errno (parameters[1]);
e = parameters[0];
if (e >= 0 && command)
{
@@ -52,4 +54,10 @@ int _system (const char *command)
}
return e;
+#else
+ if (!command)
+ return 0;
+ errno = ENOSYS;
+ return -1;
+#endif
}
diff --git a/libgloss/m68k/io-time.c b/libgloss/m68k/io-time.c
new file mode 100644
index 000000000..8c549adef
--- /dev/null
+++ b/libgloss/m68k/io-time.c
@@ -0,0 +1,45 @@
+/*
+ * io-time.c --
+ *
+ * Copyright (c) 2006 CodeSourcery Inc
+ *
+ * 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 <sys/time.h>
+#include <errno.h>
+#define IO time
+#include "io.h"
+
+/*
+ * time -- get the current time
+ * input parameters:
+ * 0 : timeval ptr
+ * output parameters:
+ * 0 : result
+ * 1 : errno
+ */
+
+time_t time (time_t *t)
+{
+#if HOSTED
+ struct timeval tv;
+
+ if (gettimeofday (&tv, NULL))
+ return -1;
+ if (t)
+ *t = tv.tv_sec;
+ return tv.tv_sec;
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
+}
diff --git a/libgloss/m68k/bdm-unlink.c b/libgloss/m68k/io-unlink.c
index 29f807204..0e623aaf4 100644
--- a/libgloss/m68k/bdm-unlink.c
+++ b/libgloss/m68k/io-unlink.c
@@ -1,5 +1,5 @@
/*
- * bdm-unlink.c --
+ * io-unlink.c --
*
* Copyright (c) 2006 CodeSourcery Inc
*
@@ -14,11 +14,11 @@
* they apply.
*/
-#include "bdm-semihost.h"
-#include "bdm-gdb.h"
#include <stdio.h>
#include <string.h>
#include <errno.h>
+#define IO unlink
+#include "io.h"
/*
* unlink -- unlink (delete) a file
@@ -32,10 +32,15 @@
int unlink (const char *path)
{
+#if HOSTED
gdb_parambuf_t parameters;
parameters[0] = (uint32_t) path;
parameters[1] = (uint32_t) strlen (path) + 1;
- __bdm_semihost (BDM_UNLINK, parameters);
- errno = convert_from_gdb_errno (parameters[1]);
+ __hosted (HOSTED_UNLINK, parameters);
+ errno = __hosted_from_gdb_errno (parameters[1]);
return parameters[0];
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
}
diff --git a/libgloss/m68k/bdm-write.c b/libgloss/m68k/io-write.c
index b532e4cb3..bf4b7763f 100644
--- a/libgloss/m68k/bdm-write.c
+++ b/libgloss/m68k/io-write.c
@@ -1,5 +1,5 @@
/*
- * bdm-write.c --
+ * io-write.c --
*
* Copyright (c) 2006 CodeSourcery Inc
*
@@ -14,10 +14,10 @@
* they apply.
*/
-#include "bdm-semihost.h"
-#include "bdm-gdb.h"
#include <unistd.h>
#include <errno.h>
+#define IO write
+#include "io.h"
/*
* write -- write to a file descriptor
@@ -32,11 +32,16 @@
ssize_t write (int fd, const void *buf, size_t count)
{
+#if HOSTED
gdb_parambuf_t parameters;
parameters[0] = (uint32_t) fd;
parameters[1] = (uint32_t) buf;
parameters[2] = (uint32_t) count;
- __bdm_semihost (BDM_WRITE, parameters);
- errno = convert_from_gdb_errno (parameters[1]);
+ __hosted (HOSTED_WRITE, parameters);
+ errno = __hosted_from_gdb_errno (parameters[1]);
return parameters[0];
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
}
diff --git a/libgloss/m68k/bdm-gdb.h b/libgloss/m68k/io.h
index a97479c67..1ea38d7de 100644
--- a/libgloss/m68k/bdm-gdb.h
+++ b/libgloss/m68k/io.h
@@ -1,5 +1,5 @@
/*
- * bdm support for GDB's remote fileio protocol
+ * hosted & unhosted io support.
*
* Copyright (c) 2006 CodeSourcery Inc
*
@@ -14,11 +14,31 @@
* they apply.
*/
+#if HOSTED
#include <stdint.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/stat.h>
+#define HOSTED_EXIT 0
+#define HOSTED_PUTCHAR 1 /* Obsolete */
+#define HOSTED_OPEN 2
+#define HOSTED_CLOSE 3
+#define HOSTED_READ 4
+#define HOSTED_WRITE 5
+#define HOSTED_LSEEK 6
+#define HOSTED_RENAME 7
+#define HOSTED_UNLINK 8
+#define HOSTED_STAT 9
+#define HOSTED_FSTAT 10
+#define HOSTED_GETTIMEOFDAY 11
+#define HOSTED_ISATTY 12
+#define HOSTED_SYSTEM 13
+
+/* This function is provided by the board's BSP, because the precise
+ mechanism of informing gdb is board specific. */
+extern int __io_hosted (int func, void *args);
+
/* Protocol specific representation of datatypes, as specified in D.9.11
* of the GDB manual.
* Note that since the m68k is big-endian, we can use native
@@ -55,7 +75,6 @@ struct gdb_timeval {
typedef uint32_t gdb_parambuf_t[4];
-
/* open flags */
#define GDB_O_RDONLY 0x0
@@ -112,17 +131,25 @@ typedef uint32_t gdb_parambuf_t[4];
/* conversion functions */
-extern gdb_mode_t convert_to_gdb_mode_t (mode_t m);
-extern int32_t convert_to_gdb_open_flags (int f);
-extern int32_t convert_to_gdb_lseek_flags (int f);
-
-extern void convert_from_gdb_stat (const struct gdb_stat *gs,
- struct stat *s);
-extern void convert_from_gdb_timeval (const struct gdb_timeval *gt,
- struct timeval *t);
-extern int convert_from_gdb_errno (int32_t err);
-
-
-
-
-
+extern gdb_mode_t __hosted_to_gdb_mode_t (mode_t m);
+extern int32_t __hosted_to_gdb_open_flags (int f);
+extern int32_t __hosted_to_gdb_lseek_flags (int f);
+
+extern void __hosted_from_gdb_stat (const struct gdb_stat *gs,
+ struct stat *s);
+extern void __hosted_from_gdb_timeval (const struct gdb_timeval *gt,
+ struct timeval *t);
+extern int __hosted_from_gdb_errno (int32_t err);
+
+#else
+#ifdef IO
+#define IO_NAME_(IO) __hosted_##IO
+#define IO_NAME(IO) IO_NAME_(IO)
+#define IO_STRING_(IO) #IO
+#define IO_STRING(IO) IO_STRING_(IO)
+/* Emit an object that causes a gnu linker warning. */
+static const char IO_NAME (IO) []
+__attribute__ ((section (".gnu.warning"), used)) =
+"IO function '" IO_STRING (IO) "' used";
+#endif
+#endif