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:
authorJeff Johnston <jjohnstn@redhat.com>2006-12-11 22:58:01 +0300
committerJeff Johnston <jjohnstn@redhat.com>2006-12-11 22:58:01 +0300
commit12cb181da7dffe5baba2c6ff78f7d35191273b07 (patch)
treebdd0960621c8f9c401b2d6702fa4e110c6413239 /libgloss/m68k
parent7dfad3a0c6530aa075458e0d81e5039eca70abd8 (diff)
2006-12-11 Kazu Hirata <kazu@codesourcery.com>
Merge from newlib-csl-20060320-branch: 2006-12-01 Nathan Sidwell <nathan@codesourcery.com> Kazu Hirata <kazu@codesourcery.com> * m68k/Makefile.in (CF_ISRS): Use addprefix. 2006-11-01 Nathan Sidwell <nathan@codesourcery.com> * m68k/Makefile.in (CFLAGS): Do not clear. Add to all compilations. (ARFLAGS): Remove commented out definition. * m68k/configure.in (DO) Set to list of target cpu families. * m68k/configure: Rebuilt. * m68k/Makefile.in (DO): New. (UNHOSTED_BSP, UNHOSTED_OBJS, HOSTED_BSP, HOSTED_OBJS): Move later. (m5208evb, m5213evb, m52235evb, m5235evb, m5273c3, m5275evb, m5282evb, m5329evb, m5485evb): Move earlier. (all): Add all_$DO dependencies. (all_cf, all_m68k): New targets, depend on cf & m68k bsps as appropriate. (m%-ram.ld, m%-rom.ld, m%-ram-hosted.ld, m%-rom-hosted.ld): Add 'm' prefix. (install): Add install_$DO dependencies. (install_cf, install_m68k): New targets. Perform cf and m68k installs as appropriate. (install_io): New, install the io libraries. 2006-10-23 Nathan Sidwell <nathan@codesourcery.com> * m68k/Makefile.in (CF_CRT0): Rename to CF_CRT0S, separate hosted & unhosted versions. (CF_OBJS): Add cf-isv.o. (CF_SOURCES): Add cf-isv.S. (cf-hosted-crt0.o, cf-unhosted-crt0.o): New targets. * m68k/cf-isv.S: New, broken out of ... * m68k/cf-crt0.S: ... here. Add HOSTED & UNHOSTED differences. * m68k/cf-crt1.c (__start1): Add heap_limit argument. (__heap_limit): Define. * m68k/cf-sbrk.c (__heap_limit): Declare. (sbrk): Adjust for __heap_limit. * m68k/cf.sc: Use different crt0's for hosted & unhosted. Install a separate isv.o file. * m68k/io.h (HOSTED_PUTCHAR): Replace with ... (HOSTED_INIT_SIM): ... this. 2006-10-20 Nathan Sidwell <nathan@codesourcery.com> * m68k/Makefile.in (CF_BOARDS): Add m5275evb. (m5275evb): New board. 2006-10-20 Vladimir Prus <vladimir@codesourcery.com> * m68k/cf.sc: Add linkonce sections and DWARF sections. 2006-10-07 Nathan Sidwell <nathan@codesourcery.com> * 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-09-29 Nathan Sidwell <nathan@codesourcery.com> * m68k/bdm-semihost.S: Add more comments. Make instruction weirder. 2006-09-22 Nathan Sidwell <nathan@codesourcery.com> * m68k/bdm-crt1.c (hardware_init_hook): Use #defines for CACR bits. 2006-09-18 Nathan Sidwell <nathan@codesourcery.com> * m68k/Makefile.in: Don't force a frame pointer on the ISRs. * m68k/bdm-crt1.c (__start1): Don't set the VBR here. (hardeare_init_hook): Define weakly. Set VBR here, enable caching if supported. * m68k/Makefile.in (bdm-semihost.o): Build from bdm-semihost.S. * m68k/bdm-semihost.c: Remove. * m68k/bdm-semihost.S: New. * m68k/bdm-crt0.S: Don't install semihosting trap handler. * m68k/bdm-close.c, bdm-exit.c, bdm-fstat.c, bdm-gettimeofday.c, bdm-isatty.c, bdm-lseek.c, bdm-open.c, bdm-read.c, bdm-rename.c, bdm-stat.c, bdm-system.c, bdm-unlink.c, bdm-write.c): Update. * m68k/bdm-isrs.c: Update comment. * m68k/bdm-semihost.h (BDM_TRAPNUM, BDM_FUNC_REG, BDM_ARG_REG, BDM_TRAP): Remove. (__bdm_semihost): Declare. 2006-09-15 Nathan Sidwell <nathan@codesourcery.com> * m68k/Makefile.in (BDM_OTHER_OBJS): Remove sbrk.o. (BDM_SYSOBJS): Add bdm-sbrk.o. * m68k/bdm-sbrk.c: New. 2006-09-06 Nathan Sidwell <nathan@codesourcery.com> * m68k/Makefile.in (CF_SOURCES): New. (install): Install them. 2006-09-01 Nathan Sidwell <nathan@codesourcery.com> * m68k/cf.sc: Add .jcr section to .text.
Diffstat (limited to 'libgloss/m68k')
-rw-r--r--libgloss/m68k/Makefile.in201
-rw-r--r--libgloss/m68k/asm.h1
-rw-r--r--libgloss/m68k/bdm-semihost.h57
-rw-r--r--libgloss/m68k/bdm-time.c21
-rw-r--r--libgloss/m68k/cf-crt0.S47
-rw-r--r--libgloss/m68k/cf-crt1.c (renamed from libgloss/m68k/bdm-crt1.c)31
-rw-r--r--libgloss/m68k/cf-exit.c (renamed from libgloss/m68k/bdm-exit.c)7
-rw-r--r--libgloss/m68k/cf-hosted.S38
-rw-r--r--libgloss/m68k/cf-isrs.c (renamed from libgloss/m68k/bdm-isrs.c)7
-rw-r--r--libgloss/m68k/cf-isv.S (renamed from libgloss/m68k/bdm-crt0.S)12
-rw-r--r--libgloss/m68k/cf-sbrk.c50
-rw-r--r--libgloss/m68k/cf.sc39
-rwxr-xr-xlibgloss/m68k/configure1244
-rw-r--r--libgloss/m68k/configure.in17
-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.c)20
-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
30 files changed, 1820 insertions, 289 deletions
diff --git a/libgloss/m68k/Makefile.in b/libgloss/m68k/Makefile.in
index ad3f69fdf..c22ef364d 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
@@ -66,9 +66,8 @@ OBJS = close.o fstat.o getpid.o isatty.o kill.o \
lseek.o open.o print.o putnum.o read.o sbrk.o stat.o \
unlink.o write.o
-CFLAGS = -g
-# ARFLAGS = rv
-
+# What targets to build for. This is a list of {m68k,cf}
+DO = @DO@
# Here is all of the simulator stuff
SIM_SCRIPTS = sim.ld
@@ -118,46 +117,72 @@ 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 ColdFire boards
#
-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 sbrk.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-stat.o bdm-system.o bdm-time.o bdm-unlink.o bdm-write.o
-BDM_ISRS= other_interrupt reset access_error address_error \
+CF_CRT0S= cf-hosted-crt0.o cf-unhosted-crt0.o
+CF_BSP= libcf.a
+CF_OBJS= cf-isv.o 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 \
- format_error spurious_interrupt trap0 trap1 trap2 trap3 trap4 \
- trap5 trap6 trap7 trap8 trap9 trap10 trap11 trap12 trap13 trap14 \
- trap15 fp_branch_unordered fp_inexact_result fp_divide_by_zero \
- fp_underflow fp_operand_error fp_overflow fp_input_not_a_number \
- fp_input_denormalized_number unsupported_instruction
-
-CF_BOARDS := m5208evb m5213evb m52235evb m5235evb m5272c3 m5282evb \
- m5329evb m5485evb
+ format_error spurious_interrupt fp_branch_unordered \
+ fp_inexact_result fp_divide_by_zero fp_underflow fp_operand_error \
+ fp_overflow fp_input_not_a_number fp_input_denormalized_number \
+ unsupported_instruction \
+ $(addprefix trap,0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)
+
+# RAM ROM
+m5208evb := 1024M 16M 0M 2M
+m5213evb := 512M 32K 0M 256K
+m52235evb := 512M 32K 0M 256K
+m5235evb := 0M 16M 0xFFE00000 2M
+m5273c3 := 0M 4M 0xFFE00000 2M
+m5275evb := 0M 16M 0xFFE00000 2M
+m5282evb := 0M 16M 0xFFE00000 2M
+m5329evb := 1024M 32M 0M 2M
+m5485evb := 0M 64M 1024M 16M
+
+CF_BOARDS := m5208evb m5213evb m52235evb m5235evb m5272c3 m5275evb \
+ 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_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-isv.S cf-crt0.S cf-crt1.c asm.h
-# Host specific makefile fragment comes in here.
-@host_makefile_frag@
+#
+# here's all the unhosted stuff
+#
+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
#
-# build a test program for each target board. Just trying to get
-# it to link is a good test, so we ignore all the errors for now.
+# here's all the hosted stuff
#
-all: ${SIM_CRT0} ${SIM_BSP} ${CRT0} ${BCC_BSP} ${IDP_BSP} ${IDPGDB_BSP} \
- ${MVME135_BSP} ${MVME162_BSP} ${BDM_CRT0} ${BDM_BSP} ${CF_SCRIPTS}
+HOSTED_BSP= libhosted.a
+HOSTED_OBJS= hosted-gdb.o hosted-exit.o $(patsubst un%,%,$(UNHOSTED_OBJS))
+
+# Host specific makefile fragment comes in here.
+@host_makefile_frag@
+
+all :: $(DO:%=all_%)
#
# here's where we build the board support packages for each target
#
+
+.PHONY: all_m68k
+all_m68k :: ${SIM_CRT0} ${SIM_BSP} ${CRT0} ${BCC_BSP} ${IDP_BSP} \
+ ${IDPGDB_BSP} ${MVME135_BSP} ${MVME162_BSP}
+.PHONY: all_cf
+all_cf :: ${CF_CRT0S} ${CF_BSP} ${CF_SCRIPTS} ${HOSTED_BSP} ${UNHOSTED_BSP}
+
${SIM_BSP}: ${SIM_OBJS}
${AR} ${ARFLAGS} $@ ${SIM_OBJS}
${RANLIB} $@
@@ -174,10 +199,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} $@
@@ -186,52 +207,59 @@ ${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 $@
-#We need to omit the frame pointer to ensure there is no prologue.
-bdm-semihost.o : bdm-semihost.c
- $(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $< -o $@ -fomit-frame-pointer
-
-# We need to keep the frame pointer to make sure there's some
-# prologue. Otherwise we get confused with the semihosting reoutine.
-$(patsubst %,bdm-%.o,${BDM_ISRS}) : bdm-isrs.c
- $(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $< -o $@ \
- -DL_$(patsubst bdm-%.o,%,$@) -fno-omit-frame-pointer
-
-# RAM ROM
-m5208evb := 1024M 16M 0M 2M
-m5213evb := 512M 32K 0M 256K
-m52235evb := 512M 32K 0M 256K
-m5235evb := 0M 16M 0xFFE00000 2M
-m5273c3 := 0M 4M 0xFFE00000 2M
-m5282evb := 0M 16M 0xFFE00000 2M
-m5329evb := 1024M 32M 0M 2M
-m5485evb := 0M 64M 1024M 16M
-
-%-ram.ld : cf.sc Makefile
- RAM=$(word 1,$($*)) RAM_SIZE=$(word 2,$($*)) ${SHELL} $< >$@
-%-rom.ld : cf.sc Makefile
- RAM=$(word 1,$($*)) RAM_SIZE=$(word 2,$($*)) \
- ROM=$(word 3,$($*)) ROM_SIZE=$(word 4,$($*)) ${SHELL} $< >$@
+# build hosted library
+$(HOSTED_OBJS): hosted%.o: io%.c io.h
+ $(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) -DHOSTED=1 $(INCLUDES) -c $< -o $@
+$(HOSTED_BSP): $(HOSTED_OBJS)
+ ${AR} ${ARFLAGS} $@ $^
+ ${RANLIB} $@
+cf-hosted-crt0.o: cf-crt0.S
+ $(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) -DHOSTED=1 $(INCLUDES) -c $< -o $@
+
+# build unhosted library
+$(UNHOSTED_OBJS): unhosted%.o: io%.c io.h
+ $(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) -DHOSTED=0 $(INCLUDES) -c $< -o $@
+$(UNHOSTED_BSP): $(UNHOSTED_OBJS)
+ ${AR} ${ARFLAGS} $@ $^
+ ${RANLIB} $@
+cf-unhosted-crt0.o: cf-crt0.S
+ $(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) -DHOSTED=0 $(INCLUDES) -c $< -o $@
+
+# build coldfire library
+$(patsubst %,cf-%.o,${CF_ISRS}) : cf-isrs.c
+ $(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -c $< -o $@ \
+ -DL_$(patsubst cf-%.o,%,$@)
+$(CF_BSP): $(CF_OBJS)
+ ${AR} ${ARFLAGS} $@ $^
+ ${RANLIB} $@
+
+m%-ram.ld : cf.sc Makefile
+ IO=unhosted RAM=$(word 1,$(m$*)) RAM_SIZE=$(word 2,$(m$*)) \
+ ${SHELL} $< >$@
+m%-rom.ld : cf.sc Makefile
+ IO=unhosted RAM=$(word 1,$(m$*)) RAM_SIZE=$(word 2,$(m$*)) \
+ ROM=$(word 3,$(m$*)) ROM_SIZE=$(word 4,$(m$*)) ${SHELL} $< >$@
+m%-ram-hosted.ld : cf.sc Makefile
+ IO=hosted RAM=$(word 1,$(m$*)) RAM_SIZE=$(word 2,$(m$*)) \
+ ${SHELL} $< >$@
+m%-rom-hosted.ld : cf.sc Makefile
+ IO=hosted RAM=$(word 1,$(m$*)) RAM_SIZE=$(word 2,$(m$*)) \
+ ROM=$(word 3,$(m$*)) ROM_SIZE=$(word 4,$(m$*)) ${SHELL} $< >$@
leds.o: ${srcdir}/leds.c
- $(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $<
+ $(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -c $<
idp-inbyte.o: ${srcdir}/idp-inbyte.c
- $(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $<
+ $(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -c $<
idp-outbyte.o: ${srcdir}/idp-outbyte.c
- $(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $<
+ $(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -c $<
idp-gdb-outbyte.o: ${srcdir}/idp-outbyte.c
- $(CC) $(CFLAGS_FOR_TARGET) -DGDB_MONITOR_OUTPUT $(INCLUDES) -c $< -o $@
+ $(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) -DGDB_MONITOR_OUTPUT $(INCLUDES) -c $< -o $@
mc68ec.o: ${srcdir}/mc68ec.c
- $(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $<
+ $(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -c $<
test.o: ${srcdir}/test.c
@@ -250,7 +278,7 @@ test: $(OBJS) idp-test.srec mvme135-test.srec bcc-test.srec \
# symbols will get fully resolved.
idp-test.x: test.o ${CRT0} Makefile ${IDP_BSP}
- ${CC} $(CFLAGS_FOR_TARGET) -L${srcdir} -L${objdir} \
+ ${CC} $(CFLAGS_FOR_TARGET) $(CFLAGS) -L${srcdir} -L${objdir} \
test.o -o $@ $(LDFLAGS_FOR_TARGET) -N -Wl,-Tidp.ld
idp-test.srec: idp-test.x
$(OBJCOPY) -O srec idp-test.x $@
@@ -260,7 +288,7 @@ idp-test.dis: idp-test.x
idp-test: idp-test.srec idp-test.dis
idpgdb-test.x: test.o ${CRT0} Makefile ${IDPGDB_BSP}
- ${CC} $(CFLAGS_FOR_TARGET) -L${srcdir} -L${objdir} \
+ ${CC} $(CFLAGS_FOR_TARGET) $(CFLAGS) -L${srcdir} -L${objdir} \
test.o -o $@ $(LDFLAGS_FOR_TARGET) -N -Wl,-Tidpgdb.ld
idpgdb-test.srec: idpgdb-test.x
$(OBJCOPY) -O srec idpgdb-test.x $@
@@ -301,7 +329,7 @@ bcc-test: bcc-test.srec bcc-test.dis
# a C++ test case
dtor.o: $(srcdir)/dtor.C
- $(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -o $@ -c $<
+ $(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -o $@ -c $<
dtor.dis: dtor.x
@rm -fr dtor.dis
$(OBJDUMP) -d dtor.x > $@
@@ -312,7 +340,11 @@ dtor.x: dtor.o ${CRT0} ${srcdir}/mvme135.ld Makefile ${MVME135_BSP}
unlink.o: $(srcdir)/../unlink.c
.PHONY: install info dvi doc install-info clean-info
-install:
+install:: $(DO:%=install_%)
+
+
+.PHONY:install_m68k
+install_m68k::
# install SIM stuff
$(INSTALL_PROGRAM) $(SIM_CRT0) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(SIM_CRT0)
$(INSTALL_PROGRAM) $(SIM_BSP) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(SIM_BSP)
@@ -334,15 +366,28 @@ 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_PROGRAM) $(BDM_CRT0) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(BDM_CRT0)
- $(INSTALL_PROGRAM) $(BDM_BSP) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(BDM_BSP)
-
$(INSTALL_DATA) ${srcdir}/sbc5204.ld $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/sbc5204.ld
$(INSTALL_DATA) ${srcdir}/sbc5206.ld $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/sbc5206.ld
+
+.PHONY: install_cf
+install_cf:: install_io
+ # install CF stuff
+ for crt in $(CF_CRT0S) ; \
+ do $(INSTALL_DATA) $$crt $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$$crt ; \
+ done
+ $(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
+
+.PHONY: install_io
+install_io::
+ # install IO stuff
+ $(INSTALL_DATA) $(HOSTED_BSP) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(HOSTED_BSP)
+ $(INSTALL_DATA) $(UNHOSTED_BSP) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(UNHOSTED_BSP)
# target specific makefile fragment comes in here.
@target_makefile_frag@
diff --git a/libgloss/m68k/asm.h b/libgloss/m68k/asm.h
index e3413858a..9f8d43a58 100644
--- a/libgloss/m68k/asm.h
+++ b/libgloss/m68k/asm.h
@@ -79,6 +79,7 @@
#define sp REG (sp)
#define usp REG (usp)
#define vbr REG (vbr)
+#define mbb REG (mbb)
#define sr REG (sr)
#define fpcr REG (fpcr)
#define fpsr REG (fpsr)
diff --git a/libgloss/m68k/bdm-semihost.h b/libgloss/m68k/bdm-semihost.h
deleted file mode 100644
index 4d6e2b9cc..000000000
--- a/libgloss/m68k/bdm-semihost.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * bdm semihosting support.
- *
- * 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.
- */
-
-/* Semihosting uses a user trap handler containing a HALT
- instruction. This wakes the debugger to perform some action. */
-
-/* This is the semihosting trap hander */
-#define BDM_TRAPNUM 15
-
-/* This register holds the function enumeration for a semihosting
- command. */
-#define BDM_FUNC_REG "d0"
-
-/* This register holds the argument for the semihosting call. For most
- functions, this is a pointer to a block of memory that holds the input
- and output parameters for the remote file i/o operation. */
-#define BDM_ARG_REG "d1"
-
-/* Codes for BDM_FUNC_REG. */
-
-#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
-
-/* Here is the macro that generates the trap. */
-
-#define BDM_TRAP(func, arg) \
- __asm__ __volatile__ ("move.l %0,%/" BDM_ARG_REG "\n" \
- "moveq %1,%/" BDM_FUNC_REG "\n" \
- "trap %2" \
- :: "rmi" (arg), "n" (func), "n" (BDM_TRAPNUM) \
- : BDM_FUNC_REG,BDM_ARG_REG,"memory")
-
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/cf-crt0.S b/libgloss/m68k/cf-crt0.S
new file mode 100644
index 000000000..9a73ce19c
--- /dev/null
+++ b/libgloss/m68k/cf-crt0.S
@@ -0,0 +1,47 @@
+/* Initial boot
+ *
+ * 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 "asm.h"
+ .text
+
+ .extern __stack
+ .extern __heap_end
+ .weak __heap_end
+ .extern __start1
+ .globl __start
+__start:
+ /* Initialize stack */
+ move.l IMM(__stack), sp
+ move.l IMM(0), fp
+ move.l IMM(__heap_end), d1
+#if HOSTED
+ /* INIT_SIM syscall. Allows changing sp & d1. */
+ move.l IMM(1),d0
+ .align 4
+
+ /* The halt sequence must be 'nop; halt' and aligned to a 4 byte
+ boundary. */
+ nop
+ halt
+
+ /* This sentinel instruction value must be immediately after
+ the halt instruction. The debugger will adjust the pc, so
+ that it is never executed. This instruction is
+ 'movec %sp,0'. */
+ .long 0x4e7bf000
+#endif
+ move.l d1,sp@-
+ move.l fp,sp@- /* Dummy return address */
+ jmp __start1
diff --git a/libgloss/m68k/bdm-crt1.c b/libgloss/m68k/cf-crt1.c
index 159e86a79..a26acfd91 100644
--- a/libgloss/m68k/bdm-crt1.c
+++ b/libgloss/m68k/cf-crt1.c
@@ -22,7 +22,7 @@ extern const char __data_load[] __attribute__ ((aligned (4)));
extern char __data_start[] __attribute__ ((aligned (4)));
extern char __bss_start[] __attribute__ ((aligned (4)));
extern char __end[] __attribute__ ((aligned (4)));
-
+void *__heap_limit;
extern void software_init_hook (void) __attribute__ ((weak));
extern void hardware_init_hook (void) __attribute__ ((weak));
extern void __INIT_SECTION__ (void);
@@ -30,23 +30,21 @@ extern void __FINI_SECTION__ (void);
extern int main (int, char **, char **);
-/* This is called from a tiny assembly stub that just initializes the
- stack pointer. */
-void __start1 (void)
+/* This is called from a tiny assembly stub. */
+void __start1 (void *heap_limit)
{
unsigned ix;
if (hardware_init_hook)
hardware_init_hook ();
- /* Set the VBR. */
- __asm__ __volatile__ ("movec.l %0,%/vbr" :: "r" (__interrupt_vector));
-
/* Initialize memory */
if (__data_load != __data_start)
memcpy (__data_start, __data_load, __bss_start - __data_start);
memset (__bss_start, 0, __end - __bss_start);
-
+
+ __heap_limit = heap_limit;
+
if (software_init_hook)
software_init_hook ();
@@ -62,3 +60,20 @@ void __start1 (void)
while (1)
__reset ();
}
+
+/* A default hardware init hook. */
+
+void __attribute__ ((weak)) hardware_init_hook (void)
+{
+ /* Set the VBR. */
+ __asm__ __volatile__ ("movec.l %0,%/vbr" :: "r" (__interrupt_vector));
+
+#ifndef __mcf_family_5213
+ /* Flush & enable the caches */
+#define CACR_CINV (1 << 24)
+#define CACR_CENB (1 << 31)
+ __asm__ __volatile__ ("movec.l %0,%/cacr" :: "r" (CACR_CINV | CACR_CENB));
+#endif
+
+ /* Should we drop into user mode here? */
+}
diff --git a/libgloss/m68k/bdm-exit.c b/libgloss/m68k/cf-exit.c
index 5223bcd37..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_TRAP (BDM_EXIT, code);
+ __asm__ __volatile__ ("halt" ::: "memory");
__reset ();
}
}
diff --git a/libgloss/m68k/cf-hosted.S b/libgloss/m68k/cf-hosted.S
new file mode 100644
index 000000000..9cf88209c
--- /dev/null
+++ b/libgloss/m68k/cf-hosted.S
@@ -0,0 +1,38 @@
+/*
+ * cf-hosted.S --
+ *
+ * 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.
+ */
+
+/* Semihosting function. The debugger intercepts the halt, and
+ determines that it is followed by the sentinel pattern. */
+
+ .globl __hosted
+__hosted:
+ linkw %fp,#0
+ movel %fp@(8),%d0
+ movel %fp@(12),%d1
+ .align 4
+
+ /* The halt sequence must be 'nop; halt' and aligned to a 4 byte
+ boundary. */
+ nop
+ halt
+
+ /* This sentinel instruction value must be immediately after
+ the halt instruction. The debugger will adjust the pc, so
+ that it is never executed. This instruction is
+ 'movec %sp,0'. */
+ .long 0x4e7bf000
+ unlk %fp
+ rts
diff --git a/libgloss/m68k/bdm-isrs.c b/libgloss/m68k/cf-isrs.c
index 7ee9fbaa0..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
*
@@ -20,10 +20,7 @@
These interrupt handlers are entered whenever the associated
interrupt occurs. All they do is stop the debugger to give the user
- the opportunity to determine where the problem was.
-
- User trap BDM_TRAPNUM (15) is used for semi hosting support.
- If you replace this one, semihosting will cease to function. */
+ the opportunity to determine where the problem was. */
/* Each ISR is a loop containing a halt instruction */
diff --git a/libgloss/m68k/bdm-crt0.S b/libgloss/m68k/cf-isv.S
index dac6ac421..392f8da3e 100644
--- a/libgloss/m68k/bdm-crt0.S
+++ b/libgloss/m68k/cf-isv.S
@@ -13,7 +13,6 @@
* they apply.
*/
- #include "asm.h"
.text
.globl __interrupt_vector
@@ -55,7 +54,7 @@ __interrupt_vector:
.long __trap12 /* 44 */
.long __trap13 /* 45 */
.long __trap14 /* 46 */
- .long __bdm_semihosting /* 47 */
+ .long __trap15 /* 47 */
.long __fp_branch_unordered /* 48 */
.long __fp_inexact_result /* 49 */
.long __fp_divide_by_zero /* 50 */
@@ -74,12 +73,3 @@ __interrupt_vector:
.rept 256-64
.long __other_interrupt /* [64,256) */
.endr
-
- .extern __stack
- .extern __start1
- .globl __start
-__start:
- /* Initialize stack */
- movel IMM(__stack), sp
- movel IMM(0), fp
- jmp __start1
diff --git a/libgloss/m68k/cf-sbrk.c b/libgloss/m68k/cf-sbrk.c
new file mode 100644
index 000000000..1bcf3f047
--- /dev/null
+++ b/libgloss/m68k/cf-sbrk.c
@@ -0,0 +1,50 @@
+/*
+ * cf-sbrk.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 <errno.h>
+/*
+ * sbrk -- changes heap size size. Get nbytes more
+ * RAM. We just increment a pointer in what's
+ * left of memory on the board.
+ */
+
+extern char __end[] __attribute__ ((aligned (4)));
+
+/* End of heap, if non NULL. */
+extern void *__heap_limit;
+
+void *
+sbrk (int nbytes)
+{
+ static char *heap = __end;
+ char *end = __heap_limit;
+ char *base = heap;
+ char *new_heap = heap + nbytes;
+
+ if (!end)
+ {
+ /* Use sp - 256 as the heap limit. */
+ __asm__ __volatile__ ("move.l %/sp,%0" : "=r"(end));
+ end -= 256;
+ }
+ if (nbytes < 0 || (long)(end - new_heap) < 0)
+ {
+ errno = ENOMEM;
+ return (void *)-1;
+ }
+ heap = new_heap;
+ return base;
+}
diff --git a/libgloss/m68k/cf.sc b/libgloss/m68k/cf.sc
index b19dce4ce..097dc1fe0 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-${IO}-crt0.o)
OUTPUT_ARCH(m68k)
ENTRY(__start)
SEARCH_DIR(.)
-GROUP(-lc -lbdm)
+GROUP(-lc -l${IO} -lcf)
__DYNAMIC = 0;
MEMORY
@@ -28,8 +29,10 @@ SECTIONS
.text :
{
CREATE_OBJECT_SYMBOLS
- bdm-crt0.o(.text)
+ KEEP (*cf-isv.o(.text))
+ cf-${IO}-crt0.o(.text)
*(.text .text.*)
+ *(.gnu.linkonce.t.*)
. = ALIGN(0x4);
/* These are for running static constructors and destructors under ELF. */
@@ -42,7 +45,13 @@ SECTIONS
KEEP (*(SORT(.dtors.*)))
KEEP (*crtend.o(.dtors))
+ . = ALIGN(0x4);
+ KEEP (*crtbegin.o(.jcr))
+ KEEP (*(EXCLUDE_FILE (*crtend.o) .jcr))
+ KEEP (*crtend.o(.jcr))
+
*(.rodata .rodata.*)
+ *(.gnu.linkonce.r.*)
. = ALIGN(0x4);
*(.gcc_except_table)
@@ -77,6 +86,7 @@ SECTIONS
*(.got.plt) *(.got)
*(.shdata)
*(.data .data.*)
+ *(.gnu.linkonce.d.*)
. = ALIGN (4);
_edata = .;
} >ram ${ROM:+AT>rom}
@@ -86,6 +96,7 @@ SECTIONS
__bss_start = . ;
*(.shbss)
*(.bss .bss.*)
+ *(.gnu.linkonce.b.*)
*(COMMON)
. = ALIGN (8);
_end = .;
@@ -101,5 +112,27 @@ SECTIONS
{
*(.stabstr)
}
+
+ /* DWARF debug sections.
+ Symbols in the DWARF debugging sections are relative to the beginning
+ of the section so we begin them at 0. */
+ /* DWARF 1 */
+ .debug 0 : { *(.debug) }
+ .line 0 : { *(.line) }
+ /* GNU DWARF 1 extensions */
+ .debug_srcinfo 0 : { *(.debug_srcinfo) }
+ .debug_sfnames 0 : { *(.debug_sfnames) }
+ /* DWARF 1.1 and DWARF 2 */
+ .debug_aranges 0 : { *(.debug_aranges) }
+ .debug_pubnames 0 : { *(.debug_pubnames) }
+ /* DWARF 2 */
+ .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
+ .debug_abbrev 0 : { *(.debug_abbrev) }
+ .debug_line 0 : { *(.debug_line) }
+ .debug_frame 0 : { *(.debug_frame) }
+ .debug_str 0 : { *(.debug_str) }
+ .debug_loc 0 : { *(.debug_loc) }
+ .debug_macinfo 0 : { *(.debug_macinfo) }
+
}
EOF
diff --git a/libgloss/m68k/configure b/libgloss/m68k/configure
index 5f07ab96d..ad832eef3 100755
--- a/libgloss/m68k/configure
+++ b/libgloss/m68k/configure
@@ -272,7 +272,7 @@ PACKAGE_STRING=
PACKAGE_BUGREPORT=
ac_unique_file="crt0.S"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CC am__leading_dot DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE AS AR LD RANLIB ac_ct_RANLIB CCAS CCASFLAGS host_makefile_frag_path target_makefile_frag_path LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CC am__leading_dot DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE AS AR LD RANLIB ac_ct_RANLIB CCAS CCASFLAGS CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP DO host_makefile_frag_path target_makefile_frag_path LIBOBJS LTLIBOBJS'
ac_subst_files='host_makefile_frag target_makefile_frag'
# Initialize some variables set by options.
@@ -721,6 +721,26 @@ ac_env_CCASFLAGS_set=${CCASFLAGS+set}
ac_env_CCASFLAGS_value=$CCASFLAGS
ac_cv_env_CCASFLAGS_set=${CCASFLAGS+set}
ac_cv_env_CCASFLAGS_value=$CCASFLAGS
+ac_env_CC_set=${CC+set}
+ac_env_CC_value=$CC
+ac_cv_env_CC_set=${CC+set}
+ac_cv_env_CC_value=$CC
+ac_env_CFLAGS_set=${CFLAGS+set}
+ac_env_CFLAGS_value=$CFLAGS
+ac_cv_env_CFLAGS_set=${CFLAGS+set}
+ac_cv_env_CFLAGS_value=$CFLAGS
+ac_env_LDFLAGS_set=${LDFLAGS+set}
+ac_env_LDFLAGS_value=$LDFLAGS
+ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
+ac_cv_env_LDFLAGS_value=$LDFLAGS
+ac_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_env_CPPFLAGS_value=$CPPFLAGS
+ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_cv_env_CPPFLAGS_value=$CPPFLAGS
+ac_env_CPP_set=${CPP+set}
+ac_env_CPP_value=$CPP
+ac_cv_env_CPP_set=${CPP+set}
+ac_cv_env_CPP_value=$CPP
#
# Report the --help message.
@@ -807,6 +827,13 @@ Optional Features:
Some influential environment variables:
CCAS assembler compiler command (defaults to CC)
CCASFLAGS assembler compiler flags (defaults to CFLAGS)
+ CC C compiler command
+ CFLAGS C compiler flags
+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+ nonstandard directory <lib dir>
+ CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
+ headers in a nonstandard directory <include dir>
+ CPP C preprocessor
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
@@ -1946,6 +1973,1213 @@ test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS
+echo "$as_me:$LINENO: checking target cpu family" >&5
+echo $ECHO_N "checking target cpu family... $ECHO_C" >&6
+DO=m68k
+saved_LDFLAGS="$LDFLAGS"
+LDFLAGS="-nostdlib -e main"
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ CC=$ac_ct_CC
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ CC=$ac_ct_CC
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+fi
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# != 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+ fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ test -n "$ac_ct_CC" && break
+done
+
+ CC=$ac_ct_CC
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO:" \
+ "checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+ (eval $ac_compiler --version </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+ (eval $ac_compiler -v </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+ (eval $ac_compiler -V </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
+ (eval $ac_link_default) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # Find the output, starting from the most likely. This scheme is
+# not robust to junk in `.', hence go to wildcards (a.*) only as a last
+# resort.
+
+# Be careful to initialize this variable, since it used to be cached.
+# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
+ac_cv_exeext=
+# b.out is created by i960 compilers.
+for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
+do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
+ ;;
+ conftest.$ac_ext )
+ # This is the source file.
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ # FIXME: I believe we export ac_cv_exeext for Libtool,
+ # but it would be cool to find out if it's true. Does anybody
+ # maintain Libtool? --akim.
+ export ac_cv_exeext
+ break;;
+ * )
+ break;;
+ esac
+done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
+See \`config.log' for more details." >&5
+echo "$as_me: error: C compiler cannot create executables
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6
+
+# Check the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+ if { ac_try='./$ac_file'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ fi
+fi
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+rm -f a.out a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+# Check the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
+echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6
+
+echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ export ac_cv_exeext
+ break;;
+ * ) break;;
+ esac
+done
+else
+ { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
+if test "${ac_cv_objext+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_compiler_gnu=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_compiler_gnu=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+CFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_g+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_g=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_prog_cc_g=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_prog_cc_stdc=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std1 is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std1. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX -qlanglvl=ansi
+# Ultrix and OSF/1 -std1
+# HP-UX 10.20 and later -Ae
+# HP-UX older versions -Aa -D_HPUX_SOURCE
+# SVR4 -Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_stdc=$ac_arg
+break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext
+done
+rm -f conftest.$ac_ext conftest.$ac_objext
+CC=$ac_save_CC
+
+fi
+
+case "x$ac_cv_prog_cc_stdc" in
+ x|xno)
+ echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6 ;;
+ *)
+ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
+ CC="$CC $ac_cv_prog_cc_stdc" ;;
+esac
+
+# Some people use a C++ compiler to compile C. Since we use `exit',
+# in C++ we need to declare it. In case someone uses the same compiler
+# for both compiling C and C++ we need to have the C++ compiler decide
+# the declaration of exit, since it's the most demanding environment.
+cat >conftest.$ac_ext <<_ACEOF
+#ifndef __cplusplus
+ choke me
+#endif
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ for ac_declaration in \
+ '' \
+ 'extern "C" void std::exit (int) throw (); using std::exit;' \
+ 'extern "C" void std::exit (int); using std::exit;' \
+ 'extern "C" void exit (int) throw ();' \
+ 'extern "C" void exit (int);' \
+ 'void exit (int);'
+do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_declaration
+#include <stdlib.h>
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+continue
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_declaration
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+ echo '#ifdef __cplusplus' >>confdefs.h
+ echo $ac_declaration >>confdefs.h
+ echo '#endif' >>confdefs.h
+fi
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+ if test "${ac_cv_prog_CPP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # Double quotes because CPP needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether non-existent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ break
+fi
+
+ done
+ ac_cv_prog_CPP=$CPP
+
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether non-existent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ :
+else
+ { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+cat >conftest.$ac_ext <<_ACEOF
+#ifndef __mcoldfire__
+ #error we are not coldfire
+ #endif
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ DO="cf"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+rm -f conftest.err conftest.$ac_ext
+LDFLAGS=$saved_LDFLAGS
+echo "$as_me:$LINENO: result: $DO" >&5
+echo "${ECHO_T}$DO" >&6
+
+
host_makefile_frag=${srcdir}/../config/default.mh
target_makefile_frag=${srcdir}/../config/default.mt
@@ -2659,6 +3893,14 @@ s,@RANLIB@,$RANLIB,;t t
s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
s,@CCAS@,$CCAS,;t t
s,@CCASFLAGS@,$CCASFLAGS,;t t
+s,@CFLAGS@,$CFLAGS,;t t
+s,@LDFLAGS@,$LDFLAGS,;t t
+s,@CPPFLAGS@,$CPPFLAGS,;t t
+s,@ac_ct_CC@,$ac_ct_CC,;t t
+s,@EXEEXT@,$EXEEXT,;t t
+s,@OBJEXT@,$OBJEXT,;t t
+s,@CPP@,$CPP,;t t
+s,@DO@,$DO,;t t
s,@host_makefile_frag_path@,$host_makefile_frag_path,;t t
s,@target_makefile_frag_path@,$target_makefile_frag_path,;t t
s,@LIBOBJS@,$LIBOBJS,;t t
diff --git a/libgloss/m68k/configure.in b/libgloss/m68k/configure.in
index 65fe68d35..2ac56f5d5 100644
--- a/libgloss/m68k/configure.in
+++ b/libgloss/m68k/configure.in
@@ -45,6 +45,23 @@ AC_SUBST(LD)
AC_PROG_RANLIB
LIB_AM_PROG_AS
+AC_MSG_CHECKING([target cpu family])
+DO=m68k
+dnl Temporarily modify LDFLAGS so that link tests will succeed without
+dnl a C library. Note that we may not have a C librabry yet and that
+dnl autoconf automatically adds script to check whether we can create
+dnl an executable or not.
+dnl
+saved_LDFLAGS="$LDFLAGS"
+LDFLAGS="-nostdlib -e main"
+AC_PREPROC_IFELSE([#ifndef __mcoldfire__
+ #error we are not coldfire
+ #endif],
+ DO="cf",)
+LDFLAGS=$saved_LDFLAGS
+AC_MSG_RESULT($DO)
+AC_SUBST(DO)
+
host_makefile_frag=${srcdir}/../config/default.mh
target_makefile_frag=${srcdir}/../config/default.mt
diff --git a/libgloss/m68k/bdm-close.c b/libgloss/m68k/io-close.c
index 40ddf9f5e..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_TRAP (BDM_CLOSE, (uint32_t)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.c b/libgloss/m68k/io-exit.c
index c0608e1fa..3eee09d8f 100644
--- a/libgloss/m68k/bdm-semihost.c
+++ b/libgloss/m68k/io-exit.c
@@ -1,5 +1,5 @@
/*
- * bdm-semihost.c --
+ * io-exit.c --
*
* Copyright (c) 2006 CodeSourcery Inc
*
@@ -14,12 +14,16 @@
* they apply.
*/
-/* Semihosting trap. The debugger intercepts this and
- performs the semihosting action. Then the program resumes as
- usual. This function must be compiled without a frame pointer, so
- we know the halt instruction is the very first instuction. */
-
-void __attribute__ ((interrupt_handler)) __bdm_semihosting (void)
+#if HOSTED
+#include "io.h"
+
+/*
+ * _exit -- Exit from the application.
+ */
+
+void __attribute__ ((noreturn)) _exit (int code)
{
- __asm__ __volatile__ ("halt" ::: "memory");
+ while (1)
+ __hosted (HOSTED_EXIT, (void *)code);
}
+#endif
diff --git a/libgloss/m68k/bdm-fstat.c b/libgloss/m68k/io-fstat.c
index f93f854f6..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_TRAP (BDM_FSTAT, (uint32_t)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 154954244..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_TRAP (BDM_GETTIMEOFDAY, (uint32_t)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 1da79bc15..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_TRAP (BDM_ISATTY, (uint32_t)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 b8308cbff..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_TRAP (BDM_LSEEK, (uint32_t)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 878cff84d..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_TRAP (BDM_OPEN, (uint32_t)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 441a7d249..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_TRAP (BDM_READ, (uint32_t)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 3e0acf3bb..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_TRAP (BDM_RENAME, (uint32_t)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 536aeec5d..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_TRAP (BDM_STAT, (uint32_t)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 75a82e2a7..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_TRAP (BDM_SYSTEM, (uint32_t)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 05098ae7a..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_TRAP (BDM_UNLINK, (uint32_t)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 0280dcd7c..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_TRAP (BDM_WRITE, (uint32_t)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..b6b228739 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_INIT_SIM 1
+#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