diff options
420 files changed, 66815 insertions, 0 deletions
diff --git a/libgloss/ChangeLog b/libgloss/ChangeLog new file mode 100644 index 0000000..2d4c17a --- /dev/null +++ b/libgloss/ChangeLog @@ -0,0 +1,3007 @@ +Mon Jan 31 18:45:26 2000 Donald Lindsay <dlindsay@cygnus.com> + + * mips/crt0.S: If compiled into a mips2 multilib, sets processor + status register for 32 bit addressing + * mips/regs.S: Add symbols for status and config register fields. + * mips/vr5xxx.S: Variant of vr300.S with extensions to __cpu_flush() + to cope with Vr5000 secondary cache and with Vr5432 CACHE instruction. + * mips/Makefile.in: Add rule for forming vr5xxx.o. + * mips/configure.in: Add case arm for mips64vr5000 since the + default (which was previously used) should not get vr5xxx.o. + +Wed Dec 22 19:08:09 1999 Christopher Faylor <cgf@cygnus.com> + + * wince/Makefile.am: Use LDADD from configure. + * wince/Makefile.in: Regenerate. + * wince/configure.in: Determine libraries needed based (crudely) on + target. + * wince/configure: Regenerate. + +1999-12-16 Tom Tromey <tromey@cygnus.com> + + * mips/Makefile.in (jmr3904-io.o): Don't compile with `-mips3'. + + * mips/jmr3904-io.c: Actually completed merge of Andrew Haley's + patch of 1998-11-23. + + * mips/jmr3904dram-java.ld: Provide _Jv_QthreadsStackSize. Link + against -lgcjcoop, not -lqthreads. + * mips/jmr3904app-java.ld: Provide _Jv_QthreadsStackSize. + +1999-12-16 Brendan Kehoe <brendan@cygnus.com> + + * m68k/idp.ld: Only use specific .dtors and .ctors uses of KEEP, + without the bits for __{C,D}TOR_{LIST,END}__. + +1999-12-14 Geoff Keating <geoffk@cygnus.com> + + * m68k/idp.ld (.text): Put crtbegin at the start of the + constructors and destructors. + +Mon Nov 29 12:14:48 1999 Christopher Faylor <cgf@cygnus.com> + + * wince/Makefile.am: Add missing gdbdir assignment. + * wince/Makefile.in: Regenerate. + +1999-11-22 Gavin Romig-Koch <gavin@cygnus.com> + + * mips/idt.ld: Remove the OUTPUT_ARCH("mips:4000") directive. + +1999-11-15 Nick Clifton <nickc@cygnus.com> + + * configure.in: Add arm-wince-pe target. + * configure: Regenerate. + +1999-11-11 Brendan Kehoe <brendan@cygnus.com> + + * sparc/elfsim.ld (.text): Also provide __EH_FRAME_BEGIN__ since we're + not bringing in crtbegin.o. + * sparc/sparc86x.ld (.text): Likewise. Add initp support. + +1999-10-30 Geoffrey Keating <geoffk@cygnus.com> + + * mips/crt0.S: Handle -membedded-pic properly. Set the $gp much + earlier because it'll be needed. Set the high bits of the PC to + be consistent with other pointers, so that exception handling + doesn't get confused. + +1999-09-27 Jonathan Larmour <jlarmour@cygnus.co.uk> + + * sparc/crt0.s: Delete. This file is obsolete and caused problems + on case-insensitive windows filesystems. + +Wed Sep 22 15:59:17 1999 Christopher Faylor <cgf@cygnus.com> + + * configure.in: Generalize Windows CE target detection. + * configure: Regenerate. + * wince/Makefile.am: Rename CE stub filename. + * wince/Makefile.in: Regenerate. + * wince/configure.in: Allow changing of CE stub. + * wince/configure: Regenerate. + +1999-07-26 Andrew Haley <aph@cygnus.com> + + * m32r/crt0.S (_start): Use a full word immediate for __bss_start + and _end to allow them to be placed anywhere in memory. + +1999-07-08 Jason Merrill <jason@yorick.cygnus.com> + + * sparc/elfsim.ld: Provide initp support. + +1999-06-22 Nick Clifton <nickc@cygnus.com> + + * mips/dve.ld (.rdata): Rename section to .rodata. + * mips/idt.ld (.rdata): Rename section to .rodata. + * mips/jmr3904app-java.ld (.rdata): Rename section to .rodata. + * mips/jmr3904app.ld (.rdata): Rename section to .rodata. + * mips/lsi.ld (.rdata): Rename section to .rodata. + * mips/nullmon.ld (.rdata): Rename section to .rodata. + * mips/pmon.ld (.rdata): Rename section to .rodata. + * mips/r5900.ld (.rdata): Rename section to .rodata. + * mips/sky.ld (.rdata): Rename section to .rodata. + * mips/vpu.ld (.rdata): Rename section to .rodata. + +Tue Jun 01 16:57:46 1999 Jeff Johnston <jjohnstn@cygnus.com> + + * libnosys/configure.in: Added setting of ac_file + prior to calling config-ml.in. + * libnosys/configure: Regenerated. + * libnosys/Makefile.in: Added code to make install directory + for libnosys.a prior to installing. + +Wed May 26 17:22:46 1999 Christopher Faylor <cgf@cygnus.com> + + * Makefile.am: Expect the object file to be in the + current directory. + * Makefile.in: Regenerate. + +Tue May 25 14:35:21 1999 Christopher Faylor <cgf@cygnus.com> + + * configure.in: Add wince targest. + * configure: Regenerate. + * wince: New directory + * wince/Makefile.am: New file. + * wince/Makefile.in: New file. + * wince/aclocal.m4: New file. + * wince/configure: New file. + * wince/configure.in: New file. + +1999-05-24 Jim Wilson <wilson@cygnus.com> + + * sparc/elfsim.ld: Add `.data.*'. + +1999-05-22 Jason Merrill <jason@yorick.cygnus.com> + + * m68k/idp.ld: Add initp support. + * sparc/cygmon.ld.src: Likewise. + +1999-05-14 Nick Clifton <nickc@cygnus.com> + + * mcore/syscalls.S (_sbrk): Round to 8 bytes not 4. + +1999-05-13 Mark Salter <msalter@cygnus.com> + + * mcore/configure.in: Fixed multilib support. + * mcore/configure: Regenerated. + * mcore/Makefile.in: Fixed multilib problems. + Added cmb board support + * mcore/close.c: New file. + * mcore/cmb-exit.c: Ditto. + * mcore/cmb-inbyte.c: Ditto. + * mcore/cmb-outbyte.c: Ditto. + * mcore/elf-cmb.ld: Ditto. + * mcore/elf-cmb.specs: Ditto. + * mcore/fstat.c: Ditto. + * mcore/getpid.c: Ditto. + * mcore/kill.c: Ditto. + * mcore/lseek.c: Ditto. + * mcore/open.c: Ditto. + * mcore/pe-cmb.ld: Ditto. + * mcore/pe-cmb.specs: Ditto. + * mcore/print.c: Ditto. + * mcore/putnum.c: Ditto. + * mcore/raise.c: Ditto. + * mcore/read.c: Ditto. + * mcore/sbrk.c: Ditto. + * mcore/stat.c: Ditto. + * mcore/unlink.c: Ditto. + * mcore/write.c: Ditto. + * mcore/c-syscalls.c: Removed. + +1999-05-07 Nick Clifton <nickc@cygnus.com> + + * mcore/syscalls.S (_write): Use 0x50FF instead of trap 1. + Tidy up code layout. + +1999-05-06 Nick Clifton <nickc@cygnus.com> + + * mcore/Makefile.in: Fix build rule. + * mcore/syscalls.s: Rename to syscalls.S + +1999-05-04 Nick Clifton <nickc@cygnus.com> + + * mcore/configure.in: Depend upon crt0.S not crt0.s. + * mcore/configure: Regenerate. + +1999-04-29 Nick Clifton <nickc@cygnus.com> + + * mcore/crt0.S: Renamed file from crt0.s. + Only invoke init() and fini() routines for ELF builds. + Use __bss_start__ and __bss_end__ to locate .bss section. + +1999-04-26 Angela Marie Thomas <angela@cygnus.com> + + * mips/array.ld: Fix ELF ctor/dtor support. + * mips/ddb.ld: Likewise. + * mips/dve.ld: Likewise. + * mips/idt.ld: Likewise. + * mips/jmr3904app.ld: Likewise. + * mips/lsi.ld: Likewise. + * mips/nullmon.ld: Likewise. + * mips/pmon.ld: Likewise. + * mips/r5900.ld: Likewise. + * mips/sky.ld: Likewise. + * mips/vpu.ld: Likewise. + +1999-04-22 Nick Clifton <nickc@cygnus.com> + + * mcore/crt0.s: Initialise data section, call _init and _fini. + + * mcore/syscalls.s (_exit): Renamed from __exit. + + * fr30/crt0.s (_start): Initialise arg[cv] after calling _init and + atexit. + +1999-04-21 Nick Clifton <nickc@cygnus.com> + + * mcore/crt0.s (_start): Use .long directive, not .word. + + * mcore/syscalls.s (_sbrk): fix syntax. + +1999-04-20 Jason Molenda (jsm@bugshack.cygnus.com) + + * sparc/sparc86.ld: Set alignment for the .data section. + +1999-04-18 Nick Clifton <nickc@cygnus.com> + + * configure.in: Add support for mcore targets. + * configure: Regenerate. + * mcore: New directory. + * mcore/Makefile.in: New File: meta Makefile. + * mcore/configure.in: New File: meta configure file.. + * mcore/configure: New File: Generated. + * mcore/crt0.s: New File: mcore startup code. + * mcore/syscalls.s: New File: Assembler system call stubs. + * mcore/c-syscalls.c: New File: C system call stubs. + +Tue Apr 13 17:20:34 1999 Catherine Moore <clm@cygnus.com> + + * mips/array.ld: Support linkonce sections. + * mips/ddb.ld: Likewise. + * mips/dve.ld: Likewise. + * mips/idt.ld: Likewise. + * mips/jmr3904app.ld: Likewise. + * mips/jmr3904app-java.ld: Likewise. + * mips/jmr3904dram.ld: Likewise. + * mips/jmr3904dram-java.ld: Likewise. + * mips/lsi.ld: Likewise. + * mips/nullmon.ld: Likewise. + * mips/pmon.ld: Likewise. + * mips/r5900.ld: Likewise. + * mips/sky.ld: Likewise. + * mips/vpu.ld: Likewise. + +Mon Apr 12 21:01:46 1999 Catherine Moore <clm@cygnus.com> + + * mips/array.ld: Add ELF ctor/dtor support. + * mips/ddb.ld: Likewise. + * mips/dve.ld: Likewise. + * mips/idt.ld: Likewise. + * mips/jmr3904app.ld: Likewise. + * mips/lsi.ld: Likewise. + * mips/nullmon.ld: Likewise. + * mips/pmon.ld: Likewise. + * mips/r5900.ld: Likewise. + * mips/sky.ld: Likewise. + * mips/vpu.ld: Likewise. + +Sun Apr 11 00:43:34 1999 Jim Wilson <wilson@cygnus.com> + + * i960/crt0.c (_start): Increase stack size to 256K. + +Wed Mar 31 17:56:41 1999 Bob Manson <manson@charmed.cygnus.com> + + * i386/cygmon-salib.c: Add read and write syscall support. + * i386/cygmon-syscall.h: Ditto. + + * i386/cygmon-gmon.[ch]: Profile support. + +Sun Feb 28 23:39:32 1999 Geoffrey Noer <noer@cygnus.com> + + * libnosys/configure.in: Check cygwin*, not cygwin32. + * libnosys/configure: Regenerate. + +1999-02-18 Tom Tromey <tromey@cygnus.com> + + * mips/configure: Rebuilt. + * mips/configure.in (script_list): Added jmr3904dram-java and + jmr3904app-java. + * mips/jmr3904dram-java.ld: New file. + * mips/jmr3904dram.ld: Don't mention -lqthreads. + * mips/jmr3904app-java.ld: New file. + * mips/jmr3904app.ld: Don't mention -lgcjcoop. + +Wed Feb 17 13:27:24 1999 Jim Wilson <wilson@cygnus.com> + + * m68k/crt0.S (start): Use jpbl not jmi in coldfire code. + +1999-02-18 Tom Tromey <tromey@cygnus.com> + + * Merge from branch: + + Tue Feb 16 12:57:06 PST 1999 Angela Marie Thomas <angela@cygnus.com> + + * mips/jmr3904app.ld: Change -lqthreads to -lgcjcoop due to + library name change. + + Thu Feb 4 16:15:44 1999 Warren Levy <warrenl@cygnus.com> + + * mips/configure.in (script_list): Added jmr3904dram.ld. + * mips/configure: Rebuilt. + + Thu Jan 21 19:11:45 1999 Warren Levy <warrenl@cygnus.com> + + * mips/jmr3904dram.ld: Created. + + Wed Dec 30 11:15:46 1998 Anthony Green <green@cygnus.com> + + * mips/jmr3904app.ld: libgcc is dependent on libqthreads, so + it must be linked it. + + Wed Dec 30 11:04:54 1998 Anthony Green <green@cygnus.com> + + * mips/jmr3904app.ld: Make sure the stack owns all 8k plus + the padding allocated for alignment. + + 1998-11-23 Andrew Haley <aph@viagra.cygnus.co.uk> + + * mips/jmr3904-io.c: change get_mem_info() to use _mem_size + imported from the linker script. + * mips/jmr3904app.ld: Provide _mem_size. + + * mips/jmr3904app.ld: Allocate 8k bytes for stack. + + 1998-11-19 Andrew Haley <aph@viagra.cygnus.co.uk> + + * mips/crt0.S: set argc to 0 before calling main() + * get_mem_info() was incorrect; jmr3904 has 1M max of SRAM. + + Wed Nov 4 15:28:44 1998 Anthony Green <green@cygnus.com> + + * mips/jmr3904-io.c: Implement get_mem_info(). + + Wed Nov 4 15:22:41 1998 Anthony Green <green@cygnus.com> + + * mips/Makefile.in: Rename libtx39jmr.a to libjmr3904.a. + * mips/configure.in: Ditto. + * mips/configure: Regenerate. + + Tue Nov 3 15:39:14 1998 Angela Marie Thomas (angela@cygnus.com) + + * mips/configure.in: Add jmr3904app to script list for tx39. + * mips/configure: Regenerate. + +1999-02-08 Nick Clifton <nickc@cygnus.com> + + * libnosys/configure.in: Add support for StrongARM target. + * libnosys/configure: Regenerate. + +Thu Feb 4 10:56:59 1999 Jeff Johnston <jjohnstn@cygnus.com> + + * d30v/syscalls.c (time): Added code to honor argument + passed to time which is either a pointer to a time_t + value to set or is the NULL pointer. + +1999-02-03 Keith Seitz <keiths@cygnus.com> + + * m32r/m32r-lib.c (rx_char): Rename rx_uchar and return + only unsigned chars. + (getDebugChar2): Remove and integrate support into "M" + packet code. + +1999-01-29 Doug Evans <devans@casey.cygnus.com> + + * sparc/erc32-crt0.S (_exit): Set magic number for simulator. + * sparc/traps.S (win_flush): Make sure %sp is valid before flushing + all windows. + +Tue Jan 19 06:19:51 1999 Jeffrey A Law (law@cygnus.com) + + * mn10300/crt0.S: Use ".stack" for the name of the stack section, + not "._stack". Remove mn10200 support. + * mn10300/trap.S: Remove mn10200 support. + * mn10300/sim.ld: Collect *(.stack) *(._stack) input sections into + the .stack output section to be safe. + * mn10300/eval.ld: Likewise. + + * mn10200/crt0.S: Use ".stack" for the name of the stack section, + not "._stack". + * mn10200/sim.ld: Collect *(.stack) *(._stack) input sections into + the .stack output section to be safe. + * mn10200/eval.ld: Likewise. + +1999-01-14 Nick Clifton <nickc@cygnus.com> + + * fr30/Makefile.in: Set target of install to be SIM_INSTALL not + MON_INSTALL. + + * fr30/crt0.s (_start): Use atexit to call C++ global + destructors. Patch from Mark Salter <msalter@cygnus.com> + +1999-01-12 Nick Clifton <nickc@cygnus.com> + + * fr30/crt0.s: Remove .stack section - it is no longer necessary. + +1999-01-11 Nick Clifton <nickc@cygnus.com> + + * fr30/crt0.s (_start): Add calls to _init and _fini for C++ + global constructor/destructor support. + +1999-01-07 Nick Clifton <nickc@cygnus.com> + + * fr30/crt0.s (_start): Apply patch from Mark Salter + <msalter@cygnus.com> to cope with initialising .bss areas that are + not word sized. + +1998-12-23 Michael Meissner <meissner@cygnus.com> + + * m68k/idp.ld (.eh_frame): Add section to the .text segment. + (__{INIT,FINI}__SECTION__): Align to a 4 byte boundary. + (.gcc_except_table): Ditto. + +Mon Dec 21 22:45:05 1998 Mark Alexander <marka@cygnus.com> + + * sh/sh1lcevb.ld: Add DWARF sections. + * sh/sh2lcevb.ld: Ditto. + * sh/sh3lcevb.ld: Ditto. + * sh/sh3bb.ld: Ditto. + +Fri Dec 18 22:07:21 1998 Bob Manson <manson@charmed.cygnus.com> + + * i386/cygmon.ld: Make sure -lcygmon appears both before + and after -lc, so we pick up functions from there in + preference to libc functions. + + * i386/cygmon-salib.c: Add syscalls for time and gettimeofday. + Don't add __do_global_ctors () and __do_global_dtors () if + we're on a coff target. + (open): Add dummy function so plumhall will compile. + (clock): Replacement for clock () syscall that uses + gettimeofday(). + + +1998-12-18 Gavin Romig-Koch <gavin@cygnus.com> + + * mips/Makefile.in, mips/vr4300.S: Move the -mips3 into vr4300.S. + +1998-12-17 Nick Clifton <nickc@cygnus.com> + + * fr30/syscalls.c: Include ../syscall.h not ../../sim/fr30/targ-vals.h + (_open): Return file descriptor allocated by simulator. + (isatty): Always false to avoid having to cope with reads from + stdin. For Now... + +1998-12-16 Nick Clifton <nickc@cygnus.com> + + * fr30/Makefile.in: Add libraries to clean target. + + * fr30/syscalls.c (_write): Save length so that it can be returned + to caller. + + * fr30/crt0.s (_start): Initialise argc, argv and envp before + calling main(). + +1998-12-15 Gavin Romig-Koch <gavin@cygnus.com> + + * mips/ddb.ld (OUTPUT_ARCH): Remove. + +1998-12-12 Nick Clifton <nickc@cygnus.com> + + * fr30/syscalls.c: Remove stub for abort and add stubs for _kill + and _getpid. + +1998-12-11 Nick Clifton <nickc@cygnus.com> + + * configure.in: Add support for fr30 target. + * configure: Regenerate. + * fr30: New directory. + * fr30/Makefile.am: New file - build crt0.o and libsim.a + * fr30/Makefile.in: New file - generate from Makefile.am. + * fr30/configure.in: New file - support fr30 target + * fr30/configure: New file - generate from configure.in. + * fr30/crt0.s: New file - Basic executable startup code. + * fr30/syscalls.c: New file - System call emulation library. + +1998-12-11 Gavin Romig-Koch <gavin@cygnus.com> + + * mips/crt0.S (_start): Change initialization of FR. + +1998-12-08 James E Wilson <wilson@wilson-pc.cygnus.com> + + * i960/crt0.c (set_stack): Change return type to void. Init SP to + FP + 64 instead of FP. Simplify code to align ptr. + (_start): Call exit instead of _exit. Delete local variable stack. + Init stack to heap+4096. + * i960/mon960.c (abort): Ifdef out. + * i960/syscall.h: New file. + +1998-12-04 Ken Raeburn <raeburn@cygnus.com> + + * mips/cma101.c (time): Add heuristic to handle Y2K overflow. + +Tue Dec 1 17:57:52 1998 Stan Shebs <shebs@andros.cygnus.com> + + * config/ppc.mh (.s.o): Don't use CFLAGS_MRELOCATABLE when + assembling. + +Wed Nov 18 19:14:15 1998 Jim Wilson <wilson@cygnus.com> + + * mips/entry.S: Handle mips16 builds. + +1998-10-30 Ian Molee <imolee@cygnus.com> + + * m32r/trapmon0.c: New file. Mon2000 trap handler. + * m32r/trapmon0.S: Removed. + * m32/Makefile.in: Changed to reflect above-changed files. + +Wed Oct 28 07:55:55 1998 Mark Alexander <marka@cygnus.com> + + * sparc/crt0.S: Move entry point to start of text section. + Put the address of the data section at the start of the section, + so the GDB sparclite loader can find it for a.out loads. + +Mon Oct 26 13:11:41 1998 Jeffrey A Law (law@cygnus.com) + + * d30v/syscalls.c (time): Returns a time_t and accepts a pointer to + a time_t as its argument. + + * i386/cygmon-syscall.h: Fix bogus asm constraints. You must not + clobber a register that overlaps with an input or output. + +Fri Oct 23 11:06:16 1998 John Metzler <jmetzler@cygnus.com> + + * mips/jmr3904-io.c (hardware_init_hook): Add file to support + serial input and out put as required by libgloss read and write + functions. + + * mips/jmr3904app.ld : LInker script for tx39jmr3904 board. Uses + addresses per eCos conventions, not original ROM monitor. + + * configure.in: Add libtx39jmr.c to build target + + * Makefile.in: rules for libtx39jmr.a and jmr3904-io.o + +1998-10-15 Ian Molee <imolee@cygnus.com> + + * m32r/mon.specs: New file + * m32r/trapmon0.S: New file + * m32r/Makefile.in: Modified to add support for mon2000 trap0. + +Tue Oct 13 11:52:03 1998 Jeff Johnston <jjohnstn@cygnus.com> + + * libnosys/warning.h: New file. + +1998-10-06 Ken Raeburn <raeburn@cygnus.com> + + * mips/configure.in: Build nullmon stuff in default case. Don't + treat vr4100 specially. + +Tue Oct 6 15:17:42 1998 Jeff Johnston <jjohnstn@cygnus.com> + + * libnosys/sbrk.c (_sbrk): Added reference to config.h. + * libnosys/close.c (_close): Added stub warning outside of + function body and added reference to config.h. + * libnosys/execve.c (_execve): Ditto. + * libnosys/fork.c (_fork): Ditto. + * libnosys/fstat.c (_fstat): Ditto. + * libnosys/getpid.c (_getpid): Ditto. + * libnosys/gettod.c (_gettimeofday): Ditto. + * libnosys/isatty.c (_isatty): Ditto. + * libnosys/kill.c (_kill): Ditto. + * libnosys/link.c (_link): Ditto. + * libnosys/lseek.c (_lseek): Ditto. + * libnosys/open.c (_open): Ditto. + * libnosys/read.c (_read): Ditto. + * libnosys/stat.c (_stat): Ditto. + * libnosys/times.c (_times): Ditto. + * libnosys/unlink.c (_unlink): Ditto. + * libnosys/wait.c (_wait): Ditto. + * libnosys/write.c (_write): Ditto. + * libnosys/acconfig.h: New file. + * libnosys/config.h.in: New file. + * libnosys/exit.c: Removed as _exit cannot be stubbed. + * libnosys/Makefile.in: Regenerated. + * libnosys/configure.in: Configure header file specified. + * libnosys/configure: Regenerated. + +Wed Sep 30 12:45:43 1998 Bob Manson <manson@charmed.cygnus.com> + + * i386/cygmon.ld: Increase memory limits; put the initial + executable above 1MB. + +Fri Sep 25 13:49:22 1998 Bob Manson <manson@charmed.cygnus.com> + + * i386/configure.in: Changed crt0.c to cygmon-salib.c. + +Wed Sep 23 19:25:46 1998 Bob Manson <manson@charmed.cygnus.com> + + * configure.in: Add i386-*-elf* triplet. + * i386/*: Support for i386 targets. + +Wed Sep 16 19:43:52 1998 Doug Evans <devans@canuck.cygnus.com> + + * m32r/m32r-lib.c: Rename -DMSA2000 to -DREVC and reverse test. + (exceptionHandler,getExceptionHandler): Add cast to avoid warning. + +Wed Sep 9 19:22:03 1998 Mark Alexander <marka@cygnus.com> + + * sparc/Makefile.in: Remove cache86x.o, not needed any more. + * sparc/sparclite.h: (read_asr, write_asr): Define. + * sparc/cache.c (is_danlite): New function. + (cache_off, cache_on, flush_i_cache): Test for DANlite. + * sparc/salib.c (update_leds): Allow user to disable LED flashing. + * sparc/sparc86x.ld: Prevent section overlap. + +1998-09-04 Keith Seitz <keiths@cygnus.com> + + * m32r/m32r-lib.c (rx_rdy): Add support for MSA2000G01 board. + (rx_char): Ditto. + (getDebugChar2): New function to support binary downloads (gdb + remote protocol "X" command). + (exceptionHandler): Add support for MSA2000G01 board. + (getExceptionHandler): Ditto. + +1998-08-20 Michael Meissner <meissner@cygnus.com> + + * libnosys/gettod.c: Include sys/time.h so that struct timezone is + declared. + +Sun Aug 16 10:46:43 1998 Mark Alexander <marka@cygnus.com> + + * sparc/Makefile.in: Add new BSP for sparc86x (DANlite). + * sparc/salib.c (outbyte): Add hook for GDB stub. + (cache_off, cache_on, flush_i_cache): Move to cache.c. + * sparc/cache.c: New file for sparclite-specific cache code. + * sparc/cache-86x.c: New file for sparc86x-specific cache code. + * sparc/sparc86x.ld: New linker script for sparc86x. + * sparc/crt0.S: Disable broken data relocation code. + * sparc/sparcl-stub.c (outbyte_stub): New function for redirecting + standard output to GDB. + (handle_exception): Initialize outbyte hook. + +Tue Aug 11 13:27:31 1998 Jim Wilson <wilson@cygnus.com> + + * m68k/idp.ld (__INIT_SECTION__): Align to 2 byte boundary. + * m68k/bcc.ld, m68k/mvme135.ld, m68k/mvme162.ld: Likewise. + * m68k/sbc5204.ld, m68k/sbc5206.ld: Likewise. + +1998-08-11 Jason Merrill <jason@yorick.cygnus.com> + + * mn10300/{sim.ld,eval.ld}: Add init_priority support. + +Tue Aug 11 10:04:05 1998 Jeffrey A Law (law@cygnus.com) + + * mn10200/sim.ld: Rework code to insert pad before the start of the + data segment. + * mn10200/eval.ld: Likewise. + * mn10300/sim.ld: Likewise. + * mn10300/eval.ld: Likewise. + +Sat Aug 8 09:46:37 1998 Jim Wilson <wilson@cygnus.com> + + * mips/cma101.c (__sizemem): New local variable extra. Align base + to int boundary. + +Tue Jul 28 10:57:12 1998 Mark Alexander <marka@cygnus.com> + + * sparc/Makefile.in (ERC32_OBJS): Add fixctors. + * sparc/erc32-crt0.S: Call __fix_ctors just before calling main. + * sparc/fixctors.c: New file. + +Sat Jul 18 07:15:33 1998 Mark Alexander <marka@cygnus.com> + + * sparc/crt0.S (win_ovf_trap, win_unf_trap): Use correct names for + extern functions win_ovf and win_unf; fixes unresolved symbols + in COFF. + +Mon Jul 13 17:50:41 1998 Jeff Johnston <jjohnstn@cygnus.com> + + * configure.in: Added libnosys as subdir. + * configure: Rebuilt configure based on configure.in. + * libnosys/close.c (_close): Part of new libnosys stub library + to use for situations with no operating system support. + * libnosys/environ.c (environ): ditto. + * libnosys/execve.c (_execve): ditto. + * libnosys/exit.c (_exit): ditto. + * libnosys/fork.c (_fork): ditto. + * libnosys/fstat.c (_fstat): ditto. + * libnosys/getpid.c (_getpid): ditto. + * libnosys/gettod.c (_gettimeofday): ditto. + * libnosys/isatty.c (_isatty): ditto. + * libnosys/kill.c (_kill): ditto. + * libnosys/link.c (_link): ditto. + * libnosys/lseek.c (_lseek): ditto. + * libnosys/open.c (_open): ditto. + * libnosys/read.c (_read): ditto. + * libnosys/sbrk.c (_sbrk): ditto. + * libnosys/stat.c (_stat): ditto. + * libnosys/times.c (_times): ditto. + * libnosys/unlink.c (_unlink): ditto. + * libnosys/wait.c (_wait): ditto. + * libnosys/write.c (_write): ditto. + * libnosys/Makefile.in : Makefile.in for creating libnosys Makefile. + * libnosys/configure.in: configure.in to create libnosys configure. + * libnosys/configure: Configure for libnosys library. + +Mon Jul 13 14:13:07 EDT 1998 Jim Lemke <jlemke@cygnus.com> + + * sim/mips.ld: Clarify a comment. + +Tue Jul 7 21:12:41 1998 Mark Alexander <marka@cygnus.com> + + * sparc/elfsim.ld: Make it work on both a.out and ELF. + * sparc/traps.S: Rename trap_table label to work on both a.out + and ELF. Put the address of the data section at the start + of the section, so the simulator loader can find it for a.out loads. + +Thu Jun 25 09:24:53 1998 Mark Alexander <marka@cygnus.com> + + * config/mn10200.mt: New file. + +Tue Jun 23 22:45:49 1998 Mark Alexander <marka@cygnus.com> + + * mn10200/crt0.S: Don't waste top four bytes of stack. + * mn10200/eval.ld: Fix stack top address. + +Mon Jun 22 09:30:22 1998 Drew Moseley <dmoseley@cygnus.com> + + * mips/dvemon.c: Remove the close function and get it from the generic + close.o + * mips/Makefile.in (DVEOBJS): Add generic open.o and close.o to the DVEOBJS + list to ensure that the proper API's are included. + +Wed Jun 17 12:33:05 1998 Mark Alexander <marka@cygnus.com> + + * configure.in: Add mn10200 support. + * configure: Regenerate. + * mn10200/Makefile.in: New file. + * mn10200/_exit.c: New file. + * mn10200/access.c: New file. + * mn10200/chmod.c: New file. + * mn10200/chown.c: New file. + * mn10200/close.c: New file. + * mn10200/configure: New file. + * mn10200/configure.in: New file. + * mn10200/creat.c: New file. + * mn10200/crt0.S: New file. + * mn10200/crt1.c: New file. + * mn10200/eval.ld: New file. + * mn10200/execv.c: New file. + * mn10200/execve.c: New file. + * mn10200/fork.c: New file. + * mn10200/fstat.c: New file. + * mn10200/getpid.c: New file. + * mn10200/gettime.c: New file. + * mn10200/isatty.c: New file. + * mn10200/kill.c: New file. + * mn10200/lseek.c: New file. + * mn10200/open.c: New file. + * mn10200/pipe.c: New file. + * mn10200/read.c: New file. + * mn10200/sbrk.c: New file. + * mn10200/sim.ld: New file. + * mn10200/stat.c: New file. + * mn10200/test.c: New file. + * mn10200/time.c: New file. + * mn10200/times.c: New file. + * mn10200/trap.S: New file. + * mn10200/trap.h: New file. + * mn10200/unlink.c: New file. + * mn10200/utime.c: New file. + * mn10200/wait.c: New file. + * mn10200/write.c: New file. + +Fri Jun 12 17:26:56 1998 Doug Evans <devans@seba.cygnus.com> + + * m32r/sys/syscall.h: Delete. Use ./syscall.h now. + * m32r/trap0.S: Renamed from trap.S. + * m32r/eit.h: New file. + * m32r/crtsysc.c: Delete, split up into several files. + * m32r/chmod.c: New file. + * m32r/close.c: New file. + * m32r/exit.c: New file. + * m32r/fstat.c: New file. + * m32r/getpid.c: New file. + * m32r/isatty.c: New file. + * m32r/kill.c: New file. + * m32r/lseek.c: New file. + * m32r/open.c: New file. + * m32r/raise.c: New file. + * m32r/read.c: New file. + * m32r/sbrk.c: New file. + * m32r/stat.c: New file. + * m32r/unlink.c: New file. + * m32r/utime.c: New file. + * m32r/write.c: New file. + * m32r/Makefile.in (SYSCALLS): Delete. + (LIBOBJS,LIBGLOSS): New variables. + (all,install): Update. + (libgloss.a): New rule. + +Thu Jun 11 08:38:42 1998 Doug Evans <devans@seba.cygnus.com> + + * sparc/cygmon-salib.c (setitimer): Add `const' to second arg. + (gettimeofday): Change type of 2nd arg to struct timezone *. + +Tue Jun 9 12:02:21 1998 Ian Carmichael <iancarm@cygnus.com> + + * mips/syscalls.c (sbrk): Allow memory allocation to work + for configurations which don't have memory at K1BASE. + * mips/cma101.c (__sizemem): Ditto. + +Tue Jun 9 13:17:28 1998 Michael Snyder <msnyder@cleaver.cygnus.com> + + * m68k/emc-stub.c: New file, stub for the EMC Symmetrix target. + * m68k/gdbinit.emc: New file, user support for special features + supported only on the EMC Symmetrix target. + +Fri Jun 5 16:40:20 1998 Mark Alexander <marka@cygnus.com> + + * sparc/elfsim.ld: Fix ctor and dtor tables to work in both + little- and big-endian executables. + +Wed Jun 3 23:09:38 1998 Mark Alexander <marka@cygnus.com> + + * sparc/sparcl-stub.c: Include asm.h. Use STRINGSYM macro to generate + proper prefix for public assembly language labels. + * sparc/ex930.ld: Add DWARF sections. + * sparc/ex931.ld: Ditto. + * sparc/ex934.ld: Ditto. + * sparc/elfsim.ld: Simplify and clean up. + * sparc/Makefile.in: Build ex934 BSP. Allow little-endian builds. + * sparc/traps.S (win_flush): Rewrite using code from Cygmon + to eliminate register corruption. + +Mon Jun 1 15:21:05 1998 Geoffrey Noer <noer@cygnus.com> + + * sparc/cygmon-salib.c: Stop including sys/itimer.h + +Sun May 31 10:46:37 1998 Michael Meissner <meissner@cygnus.com> + + * rs6000/Makefile.in (SOLARIS_*): Don't build solaris bsp's any + more. + +Fri May 22 13:50:55 1998 Angela Marie Thomas (angela@cygnus.com) + + * mn10300/Makefile.in: Install sim.ld. + +Wed May 20 22:45:11 1998 Mark Alexander <marka@cygnus.com> + + * sparc/elfsim.ld: Add constructor and destructor tables. + +Sat May 16 17:08:17 1998 Bob Manson <manson@charmed.cygnus.com> + + * sparc/cygmon-salib.c (__getProgramArgs): Use asm constraints. + +Fri May 15 16:50:36 1998 Mark Alexander <marka@cygnus.com> + + * sparc/traps.S (win_flush): Don't destroy %g1 and %g2. + +Fri May 15 15:59:30 1998 Gavin Koch <gavin@cygnus.com> + + * mips/configure.in: Add idt to tx39 chain. + * mips/configure: Rebuild. + +Fri May 15 15:48:28 1998 Gavin Koch <gavin@cygnus.com> + + * mips/crt0.S (__stackbase): Added. + (zerobss): Initialize __stackbase. + +1998-05-13 Brendan Kehoe <brendan@cygnus.com> + + * mips/configure.in: Also grok `mipstx39*-*-*'. + * mips/configure: Regenerated. + +Mon May 11 15:07:12 1998 Bob Manson <manson@charmed.cygnus.com> + + * configure.in: Added powerpcle target. + * configure: Regenerated. + +Thu May 7 16:43:37 1998 Mark Alexander <marka@cygnus.com> + + * sparc/elfsim.ld (OUTPUT_FORMAT): Add little-endian support. + + * sparc/crt0.S (_start): Define label for ELF targets. + * sparc/salib.c: Include asm.h. Use STRINGSYM macro to generate + proper prefix for public assembly language labels. + (write, read): Disable to avoid conflict with generic versions + of these functions. + * sparc/erc32-stub.c: Move STRINGSYM macro to sparc/asm.h. + * sparc/asm.h: Move STRINGSYM macro here from sparc/erc32-stub.c + +Mon May 4 08:30:58 1998 Mark Alexander <marka@cygnus.com> + + * sparc/configure.in: Treat sparc86x as a sparclite. + * sparc/configure.in: Ditto. + * sparc/Makefile.in (slite-install): Install missing files + for simulator. + +Thu Apr 30 16:41:15 1998 John Metzler <jmetzler@cygnus.com> + + * mips/configure.in: adjust target type pattern to export nullmon.ld + * mips/configure: regenerated + +Mon Apr 27 21:38:18 1998 Mark Alexander <marka@cygnus.com> + + * configure.in: Added sparc86x configuration. + * configure: Ditto. + +Wed Apr 22 21:45:13 1998 Jeffrey A Law (law@cygnus.com) + + * mips/crt0.S: Increase stack alignment. + +Fri Apr 10 21:17:48 1998 Mark Alexander <marka@cygnus.com> + + * sparc/traps.S (win_flush): Prevent immediate window underflow + trap on return. Miscellaneous comment formatting cleanup. + +Tue Apr 7 18:34:51 1998 Mark Alexander <marka@cygnus.com> + + * sparc/elfsim.ld: Align BSS at 8-byte boundary. + +Mon Apr 6 13:12:32 1998 Mark Salter <msalter@chef.cygnus.com> + + * rs6000/ads-io.c (write): Added write(). + + * rs6000/Makefile.in: Changed objects used for libads to be + new ads specific object files instead of some mvme objects. + + * Added ads-io.c and ads-exit.c to provide function stubs which + are safe on ads board (SDS monitor). + + * rs6000/mbx-outbyte.c (outbyte): Foundry console output + is fixed, so re-enable output char quoting for mbx. + + * rs6000/mbx.specs: Added blank line to end of file. There + were link errors without it? + + * rs6000/mbx.specs: Use mbx.ld script for linking. + + * rs6000/mbx-outbyte.c: Don't quote characters. We don't want + gdb to display program output, yet. + + * rs6000/Makefile.in (install-mbx): Fixed install of mbx.specs + file. + + * rs6000/Makefile.in: Support for MBX EPPCBug monitor. + * rs6000/mbx-{exit,inbyte,outbyte,print}.c: New files for MBX. + * rs6000/mbx.ld,mbx.specs: New files for MBX. + +Wed Apr 1 21:42:40 1998 Mark Alexander <marka@cygnus.com> + + * sparc/elfsim.ld: New linker script for running ELF programs + in erc32 simulator. + * sparc/erc32-crt0.S: Disable copying of data segment. + * sparc/erc32-stub.c: Generate correct public name for breakinst. + * sparc/Makefile.in: Build erc32 library always. + +Thu Apr 2 11:24:32 1998 Andrew Cagney <cagney@b1.cygnus.com> + + * mips/syscalls.c (sbrk): Check word size correct for + get_mem_info. + +Fri Mar 27 08:55:52 1998 Mark Alexander <marka@cygnus.com> + + * mips/crt0.S: Insert NOP before _start to keep GDB happy. + * mips/dve.ld: Eliminate references to VR4300. + +Thu Mar 26 19:47:36 1998 Mark Alexander <marka@cygnus.com> + + * mn10300/eval.ld: Don't use absolute path in SEARCH_DIR. + * mn10300/sim.ld: Ditto. + +Wed Mar 25 10:49:49 1998 Bob Manson <manson@charmed.cygnus.com> + + * sparc/cygmon-salib.c (__getProgramArgs): New function. + + * sparc/cygmon-crt0.S (init): Call __getProgramArgs. + + * configure.in: Added sparc64 configuration. + + * configure: Regenerated. + +Tue Mar 24 10:44:41 1998 Mark Alexander <marka@cygnus.com> + + * mn10300/Makefile.in: Install libraries, not just linker scripts. + +Tue Mar 24 09:52:28 1998 Mark Alexander <marka@cygnus.com> + + * config/mn10300.mt: New file + * mn10300/configure.in: Use mn10300.mt as target makefile fragment + instead of nothing at all. + * mn10300/configure: Ditto. + +Tue Mar 24 16:59:06 1998 Stu Grossman <grossman@bhuna.cygnus.co.uk> + + * doc/configure: Regenerate with autoconf 2.12.1 to fix shell + issues for NT native builds. + +Mon Mar 16 18:51:11 1998 Bob Manson <manson@charmed.cygnus.com> + + * sparc/cygmon-crt0.S: Make start a global symbol (for the linker + script; we also need to make SYM(start) global). + +Wed Mar 11 10:24:39 1998 Stan Cox <scox@rtl.cygnus.com> + + * sparc/cygmon.ld.src (.debug*): Added dwarf sections. + +Fri Mar 6 23:41:54 1998 Bob Manson <manson@charmed.cygnus.com> + + * sparc/cygmon.ld.src: Use TARGET_RAM_START. + + * sparc/Makefile.in (SLITE_RAM_START): Add. + (SPARC_RAM_START): Add. + (SPARC64_RAM_START): Add. + (SLITE_ALL): Add cygmon object files and linker script. + slite-install: Install CygMon libraries and linker script. + +Mon Mar 2 19:36:12 1998 Michael Meissner <meissner@cygnus.com> + + * rs6000/ads.ld: Add default attributes to memory region. + * a29k/{p3dgps,sa29200{,b}}.ld: Ditto. + * hp74x/hppa.ld: Ditto. + * m68k/{bcc,idp,mvme{135,162},sbc520{4,6}}.ld: Ditto. + * pa/{op50n,w89k}.ld: Ditto. + * sh/{sh1{l,2,3}cevb,sh3bb}.ld: Ditto. + * sparc/{erc32,ex93{0,1,4}}.ld: Ditto. + +Fri Feb 27 17:15:35 1998 Mark Alexander <marka@cygnus.com> + + * mn10300/configure.in (AC_INIT): Use crt0.S instead of crt0-eval.S. + +Fri Feb 27 17:39:23 1998 Jeffrey A Law (law@cygnus.com) + + * configure.in: Use "mn10300" subdir for "mn10300-*-*". + +Mon Feb 23 20:29:42 1998 Mark Alexander <marka@cygnus.com> + + * mn10300/Makefile.in (GENOBJS): Remove system calls no longer + supported. + * mn10300/trap.h: Use generic syscall.h. + * mn10300/sys/syscall.h: Removed in favor of generic syscall.h. + +Mon Feb 23 16:19:17 1998 Gavin Koch <gavin@cygnus.com> + + * mips/Makefile.in (cma101.o): Add rule to explicitly use -mno-mips16. + * mips/cma101.c: Reverse my previous change. + Add #ifdef __mips16 then #error. + +Mon Feb 23 11:29:33 1998 Mark Alexander <marka@cygnus.com> + + * mn10300/Makefile.in: Add rules for building libeval.a. + * mn10300/configure: Don't use default.mt. + * mn10300/configure.in: Ditto. + * mn10300/eval.ld: Replace with modified version of default script. + + * mn10300/_exit.c: New file for libeval.a. + * mn10300/access.c: Ditto. + * mn10300/chmod.c: Ditto. + * mn10300/chown.c: Ditto. + * mn10300/close.c: Ditto. + * mn10300/creat.c: Ditto. + * mn10300/crt0.S: Ditto. + * mn10300/crt1.c: Ditto. + * mn10300/execv.c: Ditto. + * mn10300/execve.c: Ditto. + * mn10300/fork.c: Ditto. + * mn10300/fstat.c: Ditto. + * mn10300/getpid.c: Ditto. + * mn10300/gettime.c: Ditto. + * mn10300/isatty.c: Ditto. + * mn10300/kill.c: Ditto. + * mn10300/lseek.c: Ditto. + * mn10300/open.c: Ditto. + * mn10300/pipe.c: Ditto. + * mn10300/read.c: Ditto. + * mn10300/sbrk.c: Ditto. + * mn10300/sim.ld: Ditto. + * mn10300/stat.c: Ditto. + * mn10300/time.c: Ditto. + * mn10300/times.c: Ditto. + * mn10300/trap.S: Ditto. + * mn10300/trap.h: Ditto. + * mn10300/unlink.c: Ditto. + * mn10300/utime.c: Ditto. + * mn10300/wait.c: Ditto. + * mn10300/write.c: Ditto. + * mn10300/sys/syscall.h: Ditto. + +Fri Feb 20 17:19:22 1998 Gavin Koch <gavin@cygnus.com> + + * mips/cma101.c: #ifdef out whole file if mips16. + +Thu Feb 19 13:05:58 1998 Bob Manson <manson@charmed.cygnus.com> + + * i960/*: Revised. + +Wed Feb 18 12:00:20 1998 Jeff Johnston <jjohnstn@cygnus.com> + + * m68k/crt0.S (start): Fixed code that clears .bss. Code + was using dbra instruction and did not account for the fact + that the instruction branches until counter is -1, not 0. + +Tue Feb 17 18:21:52 1998 Mark Alexander <marka@cygnus.com> + + * mn10300/Makefile.in: New file for MN10300 eval board support. + * mn10300/configure: Ditto. + * mn10300/configure.in: Ditto. + * mn10300/crt0-eval.S: Ditto. + * mn10300/eval.ld: Ditto. + * mn10300/test.c: Ditto. + +Tue Feb 17 19:55:47 1998 Gavin Koch <gavin@cygnus.com> + + * mips/vr4300.S (__previous): Fix comment type-o in + previous change. + +Tue Feb 17 10:47:45 1998 Gavin Koch <gavin@cygnus.com> + + * mips/vr4300.S (__previous,baseaddr,res_baseaddr): + Figure the length of the exception handler at runtime + rather than compile time. + +Tue Feb 3 14:07:51 1998 Ian Lance Taylor <ian@cygnus.com> + + * configure.in: When running config-ml.in, put --enable-multilib + before ac_configure_args, so that --disable-multilib can override + it. + * configure: Rebuild. + +Fri Jan 9 17:10:59 1998 Mark Alexander <marka@cygnus.com> + + * mips/Makefile.in (LSIOBJS, DVEOBJS): Add part-specific objects. + +Mon Jan 5 17:01:45 1998 Mark Alexander <marka@cygnus.com> + + * config/mips.mt: Add rules for read.o and write.o. + * mips/dvemon.c: New file to support Densan DVE-R3900 board. + * mips/dve.ld: New file to support Densan DVE-R3900 board. + * mips/Makefile.in: Add rules for Densan support library libdve.a. + * mips/configure.in: Build libdve.a for tx39 targets. + * mips/configure: Ditto. + +Tue Dec 30 15:34:17 1997 Bob Manson <manson@charmed.cygnus.com> + + * sparc/Makefile.in: Add define for TARGET_CPU_$(CPU). + + * sparc/cygmon-salib.c: If TARGET_CPU_SPARC64, include + sys/types.h, and define _open_r, _close_r, etc. + +Sun Dec 28 17:15:50 1997 Bob Manson <manson@charmed.cygnus.com> + + * sparc/cygmon-salib.c (_open_r, _close_r): New functions. + (read, write): If the fd isn't 0, 1, or 2, return an error. + +Fri Dec 26 18:45:28 1997 Bob Manson <manson@charmed.cygnus.com> + + * sparc/cygmon-salib.c (_sbrk_r, _fstat_r,_brk_r): Define. + + * sparc/cygmon-crt0.S: Zero out %fp so backtraces from gdb work + properly. + + * sparc/configure.in: Set CYGMONLDSCRIPTTEMPL appropriately. + + * sparc/Makefile.in ($(objdir)/cygmon.ld): Use CYGMONLDSCRIPTTEMPL + to determine what template file we use. + +1997-12-22 Felix Lee <flee@cygnus.com> + + * rs6000/sim-errno.c (_cerror): need to return -1. + * rs6000/sol-cfuncs.c (_cerror): likewise. + +Mon Dec 22 16:54:31 1997 Bob Manson <manson@charmed.cygnus.com> + + * sparc/cygmon-crt0.S: Add stack bias code if TARGET_CPU_SPARC64 is + defined. Allocate 128 bytes for a frame if sparc64. + + * sparc/cygmon.ld.src: New file, replaced cygmon.ld. + + * sparc/Makefile.in (SPARC_OBJ_FORMAT): Added. + (SPARC64_ALL,SPARC64_INSTALL,SPARC64_OBJ_FORMAT): Added. + ($(objdir)/cygmon.ld): Create from $(objdir)/cygmon.ld.src. + + * sparc/configure.in: Add sparc64 to CPU list. + * sparc/configure: Regenerated. + * configure: Regenerated. + +Sun Dec 21 18:19:27 1997 Bob Manson <manson@charmed.cygnus.com> + + * configure.in: Added sparc64-elf configuration. + +Wed Dec 10 19:15:26 1997 Andrew Cagney <cagney@b1.cygnus.com> + + * mips/pmon.ld, mips/ddb.ld: Add handling of DWARF + sections. Copied from mips/idt.ld. + +Wed Dec 10 12:31:04 1997 Mark Alexander <marka@cygnus.com> + + * mips/configure: Add entry.o to LSI library. + * mips/configure.in: Ditto. + * mips/crt0.S: Declare init hooks as .text to avoid linker errors. + * mips/pmon.S: Don't use 64-bit instructions on 32-bit EABI machines. + * mips/entry.S: New file (MIPS16 entry/exit exception handler). + +Tue Dec 9 18:51:45 1997 Michael Meissner <meissner@cygnus.com> + + * d30v/crt0.S (_start): Don't load r1 with 32 anymore. Zero out + the 3 bss areas. + +Fri Nov 28 22:34:14 1997 Bob Manson <manson@charmed.cygnus.com> + + * sparc/cygmon-salib.c (open): New syscall. + + * sparc/cygmon.ld: Add gcc_except_table section. + + * sparc/cygmon-crt0.S: Call __install_signal_handler. + Run ctors/dtors as appropriate. + + * sparc/cygmon-salib.c (gettimeofday): New syscall. + (stime): Ditto. + (add_mapping): Ditto. + (remove_mapping): Ditto. + (__install_signal_handler): Ditto. + +Wed Nov 26 15:25:11 1997 Michael Meissner <meissner@cygnus.com> + + * rs6000/mcount.S: New file to in case no profiling module was + defined. + + * rs6000/Makefile.in (OBJS): Add mcount.o + (mcount.o): Depend on mcount.S. + +Mon Nov 24 23:25:07 1997 Bob Manson <manson@charmed.cygnus.com> + + * sparc/cygmon.ld: Add linkonce sections. + +Mon Nov 24 18:42:55 1997 Michael Meissner <meissner@cygnus.com> + + * d30v/syscalls.c (__syscall): Correct setting errno. + +Sun Nov 23 17:49:45 1997 Bob Manson <manson@charmed.cygnus.com> + + * sparc/Makefile.in: Removed TARGET_CFLAGS. + * sparc/configure.in: Ditto. + * sparc/configure: Regenerated. + +Fri Nov 21 21:21:23 1997 Michael Meissner <meissner@cygnus.com> + + * syscall.h: Remove d30v from comments. + + * d30v/syscalls.c: Use common syscall.h file, move setting errno + into common function, rather than have each stub do it. + + * d30v/Makefile.in (syscalls.c): Use common syscall.h, not the old + d30v specific version. + (clean): Properly remove libraries. + + * d30v/sys/syscall.h: Delete. + +Wed Nov 19 16:13:00 1997 Doug Evans <devans@seba.cygnus.com> + + * rs6000/Makefile.in (unlink.o): Add rule for. + + * syscall.h: New file. + +Tue Nov 18 17:22:18 1997 Doug Evans <devans@seba.cygnus.com> + + * sparc/asm.h (CONCAT1): Use __USER_LABEL_PREFIX__. + + * sparc/Makefile.in: Reorganize file. + + * sparc/Makefile.in: Rename all occurences of SIM to ERC32. + (all): Don't build erc32 support any more (never installed anyway). + * sparc/erc32-io.c: Renamed from sim-io.c. + * sparc/erc32-stub.c: Renamed from sim-stub.c. + * sparc/erc32-crt0.S: Renamed from sim-crt0.S. + * sparc/erc32.ld: Renamed from sim.ld. + * sparc/configure.in (AC_INIT): Update. + * sparc/configure: Regenerate. + +Tue Nov 18 13:54:46 1997 Michael Meissner <meissner@cygnus.com> + + * d30v/syscalls.c: New file to provide system call stubs. + * d30v/sys/syscall.h: New file to provide system call numbers. + * d30v/sim-{exit,read,write}.S: Delete, no longer used. + * d30v/Makefile.in: Remove old system stubs, and use the new ones + in syscalls.c. + +Tue Nov 18 12:38:37 1997 Michael Meissner <meissner@cygnus.com> + + * d30v/sys/syscall.h: Define for d30v system calls. + +Mon Nov 17 22:04:04 1997 Bob Manson <manson@charmed.cygnus.com> + + * configure.in: Configure the sparc directory for the sparc-elf + toolchain. + * configure: Regenerated. + + * sparc/Makefile.in: For a generic sparc toolchain, build the cygmon + crt0 and install the cygmon linker script. + + * sparc/asm.h (USER_LABEL_PREFIX): If it's already defined, don't + redefine it. + + * sparc/configure.in: Add LIB_AC_PROG_CC. Add TARGET_CFLAGS + subst variable. + * sparc/configure: Regenerated. + + * sparc/cygmon.ld: New file. + * sparc/cygmon-crt0.S: New file. + * sparc/cygmon-salib.c: New file. + +Sun Nov 16 20:22:22 1997 Michael Meissner <meissner@cygnus.com> + + * d30v/crt0.S (_start): Set up stack pointer to end of internal + memory by default. + +Tue Nov 11 17:43:06 1997 Michael Meissner <meissner@cygnus.com> + + * d30v/Makefile.in (OBJS): Use print.o, not print.c. Add sbrk.o. + +Mon Nov 10 13:57:40 1997 Michael Meissner <meissner@cygnus.com> + + * configure.in (d30v-*-*): Add configuration. + * configure: Regenerate. + + * d30v/{crt0,sim-{read,write,exit}}.S: Correct typos. + * d30v/Makefile.in: Ditto. + +Sat Nov 8 14:38:57 1997 Michael Meissner <meissner@cygnus.com> + + * d30v/crt0.S: New file for d30v port. + * d30v/configure{,.in}: Ditto. + * d30v/Makefile.in: Ditto. + * d30v/{in,out}byte.c: Ditto. + * d30v/sim-{read,write,exit}.c: Ditto. + +Tue Sep 16 15:21:08 1997 Gavin Koch <gavin@cygnus.com> + + * mips/Makefile.in (vr4300.o): Reinstate command, it's will + be necessary until all hosts properly set BSP in configure.in. + +Mon Sep 15 16:20:29 1997 Bob Manson <manson@charmed.cygnus.com> + + * m68k/*.ld: Add underscore versions of __CTOR_LIST__ and + __DTOR_LIST__. + +Mon Sep 15 12:13:34 1997 Mark Alexander <marka@cygnus.com> + + * mips/crt0.S: Declare external functions as .text to + eliminate linker warnings. + +Tue Sep 9 23:35:04 1997 Gavin Koch <gavin@cygnus.com> + + * mips/Makefile.in (SCRIPTS): Now is configurable. + (BSP): Now is configurable. + (vr4300.o): Remove unnecessary command. + * mips/configure.in: Configure the newly configuable + SCRIPTS and BSP. + * mips/configure: Re-autoconf. + + +Mon Sep 8 16:53:12 1997 Bob Manson <manson@charmed.cygnus.com> + + * mips/Makefile.in (pmon.o): Added compile command that includes + PART_SPECIFIC_DEFINES. Don't include cma101.o by default. + + * mips/configure.in (part_specific_defines): New variable + used when building pmon.o. + (part_specific_obj): Include cma101.o as well as vr4300.o, + since it is board-specific in many ways (and relies on + routines in vr4300.o). + +Mon Sep 8 14:42:44 1997 Gavin Koch <gavin@cygnus.com> + + * mips/idt.ld: Add handling of DWARF sections. + +Sun Sep 7 16:43:05 1997 Gavin Koch <gavin@cygnus.com> + + * mips/crt0.S, mips/idtmon.S, mips/vr4300.S: Handle mips16 builds. + +Thu Sep 4 19:35:12 1997 Andrew Cagney <cagney@b1.cygnus.com> + + * v850/sys/syscall.h: Match with what is in newlib. + +Mon Sep 1 12:43:50 1997 Andrew Cagney <cagney@b1.cygnus.com> + + * v850/sys/syscall.h: New file. + +Thu Aug 28 17:27:16 1997 Stan Shebs <shebs@andros.cygnus.com> + + * rs6000/ads.ld: Define ram region. + (__stack): Fix value. + * rs6000/crt0.S: Clear the sbss area as well as bss. + +Tue Aug 26 16:22:36 1997 Ian Lance Taylor <ian@cygnus.com> + + * m68k/bcc.ld: Don't use BLOCK for the section addresses. + Instead, just force . to be aligned when necessary. + * m68k/idp.ld, m68k/mvme135.ld, m68k/mvme162.ld: Likewise. + * m68k/sbc5204.ld, m68k/sbc5206: Likewise. + +Fri Aug 8 14:20:16 1997 Michael Meissner <meissner@cygnus.com> + + * rs6000/Makefile.in (install-{yellowknife,ads}): The linker + scripts are in the source directory, not the object directory. + +Fri Aug 1 12:21:31 1997 Stan Shebs <shebs@andros.cygnus.com> + + * rs6000/ads.ld: New file, linker script for 821/860 ADS board. + * rs6000/yellowknife.ld: New file, linker script for embedded + Yellowknife (CHRP/PPCP) box. + * rs6000/Makefile.in: Add rules for ADS and Yellowknife bits, + remove references to EVM, don't optimize the test program. + * rs6000/crt0.S: Renamed from mvme-crt0.S, is generic. + * rs6000/mvme-stack.S: Removed, unnecessary. + +Tue Jun 3 12:54:59 1997 Bob Manson <manson@charmed.cygnus.com> + + * mips/crt0.S: Added GCRT0 #ifdef for profiling support. + + * mips/Makefile.in (SCRIPTS): Added idtecoff. + (PCRT0): Added. + + * mips/idtecoff.ld: Added. Add crt0.o startup entry. + +Fri Apr 18 15:54:11 1997 Doug Evans <dje@canuck.cygnus.com> + + * m32r/crt0.S: Remove references to .fillinsn. + +Mon Apr 14 16:34:27 1997 Ian Lance Taylor <ian@cygnus.com> + + * testsuite/Makefile.in (INSTALL): Change install.sh to + install-sh. + +Wed Apr 9 15:41:39 1997 Mike Meissner <meissner@cygnus.com> + + * rs6000/configure.in (AC_PROG_CC): copied from configure.in. + * rs6000/configure: Regenerate. + + +Sat Mar 29 12:21:08 1997 Bob Manson <manson@charmed.cygnus.com> + + * sparc/(ex930.ld,ex931.ld,ex934.ld}: Set __end as well + as _end and end. + +Fri Mar 28 23:01:38 1997 Mark Alexander <marka@cygnus.com> + + * mips/lsi.ld: Before setting _gp, use ALIGN(8) instead + of ALIGN(16). Remove ALIGN from _gp computation. + +Mon Mar 17 10:00:29 1997 Gavin Koch <gavin@cygnus.com> + + * mips/idtmon.S: Added magic number for _flush_cache slot. + +Fri Mar 14 14:36:06 1997 J.T. Conklin <jtc@beauty.cygnus.com> + + * m68k/Makefile.in (install): Fix typo. + + * m68k/crt0.S: Changed to use correct loop condition for coldfire. + +Wed Mar 12 16:00:51 1997 Stu Grossman (grossman@critters.cygnus.com) + + * sparc/Makefile.in: Add rules for above. + (701_OBJS): Add salib-701.o, sparclet-stub.o. + [Brought over from Nov 5 change in sparclet branch.] + + * sparc/salib-701.c (flush_i_cache): Implement cache flushing to fix + intermittent problems with gdb stub and breakpoints. Fixes pr 11755. + +Wed Mar 12 15:49:30 1997 J.T. Conklin <jtc@cygnus.com> + + * m68k/sbc5204: Fix GROUP specifier. + * m68k/sbc5206: Likewise. + +Tue Mar 11 13:43:49 1997 J.T. Conklin <jtc@cygnus.com> + + * m68k/Makefile.in (all): Fix typo. + + * m68k/crt0.S: Use cmpl #0,aX instead of cmpw #0,aX as the latter + is an invalid instruction on the coldfire. + +Fri Mar 7 19:42:50 1997 Mark Alexander <marka@cygnus.com> + + * mips/lsi.ld: New file. + * mips/lsipmon.S: New file. + * Makefile.in: Add support for LSI variant of PMON (MiniRISC board). + * pmon.S: Ditto. + +Fri Mar 7 10:29:11 1997 Ian Lance Taylor <ian@cygnus.com> + + * mips/regs.S (pc): Define. + +Thu Mar 6 18:11:57 1997 Bob Manson <manson@charmed.cygnus.com> + + * mips/pmon.S (INDIRECT): For a target that uses the 64-bit + ABI, set up the stack for a 32-bit call before actually calling + PMON. + + * mips/regs.S: K1BASE needs to be a 64-bit value on a machine + with 64-bit pointers. + + * mips/syscalls.c (sbrk): Use size_t instead of unsigned int + when comparing pointers. + +Wed Mar 5 15:44:04 1997 Doug Evans <dje@seba.cygnus.com> + + * m32r/crtsysc.c (_sbrk): Change _end decl to __model__ (__medium__). + * m32r/Makefile.in (m32r-stub.o): Use MULTISRCTOP to find m32r-stub.c. + +Tue Mar 4 07:01:44 1997 J.T. Conklin <jtc@cygnus.com> + + * m68k/crt0.S: Use cmpw #0,aX instead of tstl aX, as the latter is + an invalid addressing mode on the 68000 core. + +Mon Mar 3 16:38:19 1997 Jim Wilson <wilson@cygnus.com> + + * mips/crt0.S: Subtract 24 instead of 8 when computing sp. + +Mon Mar 3 13:35:20 1997 Doug Evans <dje@canuck.cygnus.com> + + * m32r/m32r-lib.c: New file. + * m32r/{eva,eva-stub}.ld: New files. + * m32r/Makefile.in: Build and install them. + Also build and install m32r-stub.o. + +Tue Feb 25 11:59:20 1997 Gavin Koch <gavin@cygnus.com> + + * mips/configure.in (LIB_AC_PROG_CC): copied from configure.in. + * mips/configure.in (AC_PROG_CC): replaced by LIB_AC_PROG_CC + can't do final link until libs in this directory are built. + * mips/configure: regenerated. + +Tue Feb 25 00:31:27 1997 Ian Lance Taylor <ian@cygnus.com> + + * mips/crt0.S: Call hardware_init_hook and software_init_hook via + a register, to avoid relocation overflow if they are zero. + +Mon Feb 24 22:25:49 1997 Gavin Koch <gavin@cygnus.com> + + * mips/Makefile.in (IDTOBJS,PMONOBJS): Part specific modules + can now be configured by part_specific_obj. + * mips/configure.in (part_specific_obj): added. + * mips/configure: regenerate. + +Fri Feb 21 14:29:54 1997 Doug Evans <dje@canuck.cygnus.com> + + * m32r/crtsysc.c (_sbrk): Declare _end with __attribute ((__sym32__)). + +Fri Feb 21 10:10:55 1997 Jim Wilson <wilson@cygnus.com> + + * mips/ddb.ld: Align the location counter before setting _gp, and + before setting edata. Remove ALIGN from _gp computation. + * mips/idt.ld, mips/pmon.ld: Before setting _gp, use ALIGN(8) instead + of ALIGN(16). Remove ALIGN from _gp computation. + +Thu Feb 20 17:30:41 1997 Ian Lance Taylor <ian@cygnus.com> + + * mips/array.ld: Add mips16 sections. + * mips/ddb.ld, mips/idt.ld, mips/pmon.ld: Likewise. + + * mips/crt0.S (zerobss): Use subu, not sub. + +Tue Feb 18 17:25:56 1997 Mark Alexander <marka@cygnus.com> + + * mips/crt0.S: Add .ent lines for all code fragments, so + that objdump --disassemble will display them correctly. + +Fri Feb 14 11:07:20 1997 J.T. Conklin <jtc@cygnus.com> + + * m68k/mvme-stub.c: New file. Common debugger stub used for mvme- + based targets. This should eventually be merged with or replaced + by the m68k stub from gdb. + * m68k/{mvme135-stub.c, mvme162lx-stub.c}: Removed. + * m68k/Makefile.in: Updated for above change. + + * m68k/{mvme135-asm.S, mvme162lx-asm.S}: Removed all whitespace + differences and changed to consistantly use the IMM macro for + immediate constants. It is now possible to compare these two + files without having to filter out insignificant differences. + + * m68k/mvme135-stub.c (set_debug_traps): Renamed from + init_debug_traps to match documentation and other sample debugger + stubs. + + * m68k/sbc5204.ld: New file, linker script for Arnewsh SBC5204. + + * m68k/sbc5206.ld: New file, linker script for Arnewsh SBC5206. + + * m68k/Makefile.in (DBUG_OBJ, DBUG_BSP): New BSP for coldfire + targets running the dbug monitor. + + * m68k/{dbug-exit.S,dbug-inbyte.S,dbug-outbyte.S}: New files. + +Thu Feb 6 13:31:06 1997 Bob Manson <manson@charmed.cygnus.com> + + * m68k/crt0.S: Don't use SYM to refer to symbols defined + in the linker script. + +Thu Jan 16 10:34:36 1997 Jim Wilson <wilson@cygnus.com> + + * mips/{ddb.ld,idt.ld,pmon.ld}: Readd OUTPUT_FORMAT definition. + +Wed Jan 8 14:49:26 1997 Jim Wilson <wilson@cygnus.com> + + * mips/crt0.S (_start): Don't try to use FPU registers if + __mips_soft_float is defined. + +Fri Dec 27 15:41:08 1996 Bob Manson <manson@charmed.cygnus.com> + + * sparc/Makefile.in (splet-install): Add tsc701.ld. + +Thu Dec 26 14:59:34 1996 Michael Snyder <msnyder@cleaver.cygnus.com> + + * sparc/sparclet-stub.c: Add support for "P" protocol command. + Add support for %cc coprocessor registers, %asr registers. + Work-around broken SAVE instruction on sparclet. + +Tue Dec 24 22:15:53 1996 Angela Marie Thomas (angela@cygnus.com) + + * mips/pmon.S: add an INDIRECT for _flush_cache to be the + same as mon_flush_cache. This fixes failures in "make check" + +Mon Dec 23 18:08:05 1996 Jim Wilson <wilson@cygnus.com> + + * mips/syscalls.c (__errno, _raise): Delete. + +Wed Dec 18 17:29:28 1996 Ian Lance Taylor <ian@cygnus.com> + + * mips/idt.ld: Align the location counter before setting _gp, and + before setting edata. + * mips/pmon.ld: Likewise. + +Sat Dec 14 21:52:40 1996 Ian Lance Taylor <ian@cygnus.com> + + * configure.in: Use a special version of AC_PROG_CC. Autoconf + 2.12 introduced a check for whether the compiler works, and that + check will fail for a cross compilers without a complete set of + libraries. + +Fri Dec 13 10:40:14 1996 Rob Savoye <rob@chinadoll.cygnus.com> + + * sbrk.c: Set the heap pointer to the address of _end, not the + value. + +Wed Dec 11 15:26:50 1996 Jim Wilson <wilson@cygnus.com> + + * mips/{ddb.ld,idt.ld,pmon.ld}: Delete OUTPUT_FORMAT definition. + +Fri Dec 6 15:52:36 1996 Jim Wilson <wilson@cygnus.com> + + * mips/crt0.S: Delete unreachable instruction after exit call. + Move exit call before .end _start. + +Tue Nov 26 15:05:26 1996 Doug Evans <dje@rtl.cygnus.com> + + * configure: Regenerate with autoconf 2.12. + +Mon Nov 11 15:12:08 1996 Michael Meissner <meissner@tiktok.cygnus.com> + + * config/ppc.mh: New PowerPC eabi target specific config file. + Always use -mrelocatable-lib -mno-eabi. + + * rs6000/configure.in (host_makefile_frag): Use config/ppc.mh. + * rs6000/configure: Regenerate. + + * rs6000/{mvme,sim}-crt0.o (_start): Make initial stack frame 64 + bytes, not 56 so that it is aligned to a 16 byte boundary. + +Tue Nov 5 10:24:29 1996 Doug Evans <dje@canuck.cygnus.com> + + * sparc/Makefile.in (crt0-701.o): Use default rule to build. + * sparc/crt0-701.S: Second pass at little endian support. + +Tue Nov 5 10:08:40 1996 Dawn Perchik <dawn@critters.cygnus.com> + + * sparc/{salib-701.c,sparclet-stub.c,tsc701.ld}: New files. + * sparc/Makefile.in: Add rules for above. + (701_OBJS): Add salib-701.o, sparclet-stub.o. + +Fri Nov 1 21:50:12 1996 Angela Marie Thomas (angela@cygnus.com) + + * mips/ddb.ld: rename cairo.ld to ddb.ld + * mips/Makefile.in: rename cairo to ddb + +Thu Oct 31 13:54:58 1996 Stan Shebs <shebs@andros.cygnus.com> + + * sh/sh1lcevb.ld, sh/sh2lcevb.ld, sh/sh3lcevb.ld: New files, + linker scripts for Hitachi eval boards. + +Thu Oct 31 12:39:53 1996 Doug Evans <dje@seba.cygnus.com> + + * m32r/crt0.S: Set up fp. Speed up zeroing of bss. + +Sun Oct 27 20:34:27 1996 Mark Alexander <marka@cygnus.com> + + * mips/crt0.S: Initialize gp register correctly. + +Tue Oct 22 12:02:19 1996 Doug Evans <dje@canuck.cygnus.com> + + * m32r/sys/syscall.h: New file. + * m32r/crt0.S: Rewrite. + * m32r/crtsysc.c (__trap): Adjust literal and comment syntax. + +Thu Oct 17 13:47:54 1996 Doug Evans <dje@canuck.cygnus.com> + + * m32r/syscalls.c: Deleted, renamed to + * m32r/crtsysc.c: this. + * m32r/Makefile.in: Updated. + +Mon Sep 30 11:42:08 1996 Doug Evans <dje@canuck.cygnus.com> + + * m32r/{Makefile.in,configure.in,configure}: New files. + * m32r/{crt0.S,syscalls.c,trap.S}: New files. + * configure.in: Recognize m32r-*-*. + * configure: Regenerated. + +Thu Sep 26 10:59:25 1996 James G. Smith <jsmith@cygnus.co.uk> + + * mips/crt0.S (_exit): Update terminating break instruction to use + an explicit high value. + +Mon Sep 23 19:02:32 1996 Stan Shebs <shebs@andros.cygnus.com> + + * sh: New directory, Hitachi SH libgloss support. + * sh/sh3bb.ld: New file, SH3 big box linker script. + +Thu Sep 19 12:02:23 1996 Ian Lance Taylor <ian@cygnus.com> + + * mips/crt0.S (zerobss): Use bltu in zerobss loop, not bne, in + case the end symbol is not aligned. + +Sun Sep 15 12:23:47 1996 James G. Smith <jsmith@cygnus.co.uk> + + * mips/vr4300.S (__cpu_flush): Fix lui constant. + * mips/crt0.S (init): Fix passing of arg0 through exit() and + _exit(). + * mips/syscalls.c (__errno): Return address of errno, rather than + NULL. + +Wed Sep 11 10:45:13 1996 Stu Grossman (grossman@critters.cygnus.com) + + * m68k/bcc.ls, m68k/idp.ld, m68k/mvme135.ld, m68k/mvme162.ld: + Merge .init and .fini sections into .text to fix a.out. + +Sun Sep 8 09:50:08 1996 Stu Grossman (grossman@critters.cygnus.com) + + * m68k/bcc.ls, m68k/idp.ld, m68k/mvme135.ld, m68k/mvme162.ld: + Many fixes for problems discovered during testing. Make stack end + at end of ram. Force __CTOR_LIST__ and __DTOR_LIST__ to be + longword aligned. Move .shdata out of .text section. Put .rodata + and .gcc_except_table into .text section. Get rid of .shbss + section, load it into .bss. Remove bogus start address + calculation for .bss. Force all sections to be longword aligned. + Create .init and .fini sections (including function prologues and + epilogues) for ELF support. + * cpu32bug.S cpu32bug.h: Move defs for cpu32bug monitor into + cpu32bug.h. Make sure that cpu32bug function codes aren't global. + Remove creation of vbr_table. Fix function prologue in _exit. + Use fp instead of a6. Add .text pseudo-op to the beginning of + each function. + * crt0.S: Remove global symbols zeroboss, init and launch. Make + main, exit, hardware_init_hook, software_init_hook, atexit and + __do_global_dtors extern, not global. Fix logic error when + initializing stack pointer. It now loads sp if __stack is non- + zero. Reverse order of software and hardware init hooks. + Hardware now comes first. Add call to __INIT_SECTION__, and + register __FINI_SECTION__ with atexit. This is needed to make ELF + static constructors and destructors work right. + +Tue Sep 3 11:55:01 1996 Ian Lance Taylor <ian@cygnus.com> + + * m68k/bcc.ld: Set address of .stab and .stabstr to 0, not `.'. + * m68k/idp.ld, m68k/mvme135.ld, m68k/mvme162.ld: Likewise. + * hp74x/hppa.c, rs6000/evm.ld, sparc/ex930.ld: Likewise. + * sparc/ex931.ld, sparc/ex934.ld, sparc/sim.ld: Likewise. + +Fri Aug 30 15:57:37 1996 James G. Smith <jsmith@cygnus.co.uk> + + * mips/Makefile.in (SCRIPTS): Add cairo. + (vr4300.o:): Force build with target CFLAGS to ensure correct + multilib endianness. The -Tcairo.ld target uses libpmon.a aswell + as the -Tpmon.ld target. + * mips/{idt.ld,pmon.ld}: Remove explicit crt0.o include. + * mips/cairo.ld: Added. + * mips/crt0.S: Restore atexit() call. Fix startup stack + initialisation. + * mips/pmon.S: Fix monitor indirection to be 64bit clean. + * mips/vr4300.s: Added simple bus error handler to cope with + sizing memory that doesn't ghost, but does abort. + * mips/cma101.c: Improve the memory sizer. + * mips/regs.S: Add definitions for SR_KX, SR_SX and SR_UX. + +Thu Aug 29 17:07:45 1996 Michael Meissner <meissner@tiktok.cygnus.com> + + * a29k/configure.in (i[345]86-*-*): Recognize i686 for pentium + pro. + * testsuite/libgloss.all/configure.in (i[345]86-*-*): Ditto. + * a29k/configure: Regenerate. + +Thu Aug 22 10:31:38 1996 Michael Meissner <meissner@tiktok.cygnus.com> + + * rs6000/Makefile.in (install{,-linux,-solaris}): Add install of + Linux, Solaris libraries if built. + +Fri Aug 16 10:12:48 1996 Rob Savoye <rob@chinadoll.cygnus.com> + + * m68k/Makefile.in: Add -nostdlib to the test targets. + * m68k/{idp,bcc,mvme135,mvme162}.ld: Move the CTORS and DTORS from + .data to .text where they really belong. + * m68k/crt0.S(launch): Don't put __do_global_dtors into atexit, + GCC is supposed to do this in __main. + +Mon Aug 5 15:04:34 1996 Doug Evans <dje@canuck.cygnus.com> + + * sparc/libsys/isatty.c: New file. + +Sun Aug 4 22:32:14 1996 Rob Savoye <rob@chinadoll.cygnus.com> + + * pa/Makefile.in: Build the test case as seperate targets. + * pa/{w89k,op50n}.ld: Use GROUP rather than INPUT to get all the + libraries. + +Fri Aug 2 18:25:07 1996 J.T. Conklin <jtc@rtl.cygnus.com> + + * m68k/Makefile.in: Install common crt0.o, remove old references + to per-bsp crt0's. + +Tue Jul 30 21:48:05 1996 Rob Savoye <rob@chinadoll.cygnus.com> + + * sparc/Makefile.in: Built crt0.S, not crto.s. + * sparc/crt0.S: Don't use REGS macro, use % always. + * sparc/salib.c: Add a prototype for putDebugChar. + +Tue Jul 23 15:12:42 1996 Doug Evans <dje@canuck.cygnus.com> + + * sparc/{sysc-701.c,crt0-701.S}: New files. + * sparc/Makefile.in (all): Build them. + ($(701_BSP),crt0-701.o): New targets. + ($(CRT0),$(SIM_CRT0),dtor.o): Don't use $<, for sunos make. + (all): Depend on $($(CPU)_ALL). + (install): Use $(INSTALL_DATA), not $(INSTALL_PROGRAM). + Depend on $($(CPU)_INSTALL). + * sparc/configure.in (libgloss_topdir): Delete unnecessary $(srcdir). + (AC_CONFIG_AUX_DIR): Call. + (CPU): Define. + * sparc/configure: Regenerated. + +Mon Jul 22 14:32:39 1996 Doug Evans <dje@canuck.cygnus.com> + + * config/{default.mt,mips.mt}: Don't use $<, for sunos make. + +Mon Jul 22 15:54:02 1996 Ian Lance Taylor <ian@cygnus.com> + + * m68k/crt0.S (zerobss): Don't use dbra if __mcf5200__. + +Sun Jul 14 16:47:14 1996 Michael Meissner <meissner@tiktok.cygnus.com> + + * lseek.c (lseek): Don't use SET_ERRNO. + * open.c (open): Ditto. + +Wed Jul 3 18:19:10 1996 Stu Grossman (grossman@critters.cygnus.com) + + * sparc/Makefile.in: Install ex930/931/934.ld files. + * sparc/configure, sparc/configure.in: Use AC_CANONICAL_SYSTEM to + define target_alias to make install work from this directory. + +Wed Jul 3 18:04:49 1996 Ian Lance Taylor <ian@cygnus.com> + + * Makefile.in: Make sure we always have an argument to for. Make + sure rootpre and srcrootpre are always set before using + FLAGS_TO_PASS. + +Tue Jul 2 18:04:31 1996 J.T. Conklin <jtc@hippo.cygnus.com> + + * glue.h (SET_ERRNO): Removed. + * sbrk.c, stat.c, unlink.c: Don't use SET_ERRNO. + +Mon Jul 1 14:24:51 1996 Michael Meissner <meissner@tiktok.cygnus.com> + + * rs6000/Makefile.in: Add $(srcdir)/.. dependencies for all files + in the toplevel. + +Sat Jun 29 23:26:39 1996 James G. Smith <jsmith@cygnus.co.uk> + + * mips/cma101.c (DOSYNC): Explicitly select -mips2 for the + assembly of the "sync" instruction. + * mips/Makefile.in: Removed special cma101.o build. Seperate + install.sh invocations for the BSP libraries. + +Sat Jun 29 08:17:52 1996 Michael Meissner <meissner@tiktok.cygnus.com> + + * doc/porting.texi (GNU remote protocol): Fix bad texinfo. + +Fri Jun 28 23:16:37 1996 Rob Savoye <rob@chinadoll> + + * sparc/traps.S: Don't use REGS macro, use % always. + * sparc/Makefile.in: Add -nostdlib when building the test cases, + as gcc keeps thinks it wants two crt0.o. + * sparc/asm.h: Don't define the REGS macro, we'll use explicit + register prefixes. Always define USER_LABEL_PREFIX cause gcc is + broken, and I doubt it'll get fixed. + +Sat Jun 29 05:05:15 1996 James G. Smith <jsmith@cygnus.co.uk> + + * mips/crt0.S (zerobss): Fix the stack-pointer calculation. + +Thu Jun 27 17:23:33 1996 Ian Lance Taylor <ian@cygnus.com> + + * mips/Makefile.in (vr4300.o): Pass -mips3 after $(ASFLAGS). + (cma101.o): Pass -mips2 after $(CFLAGS). + +Tue Jun 25 22:48:15 1996 Jason Molenda (crash@godzilla.cygnus.co.jp) + + * Makefile.in (bindir, libdir): Use autoconf-set values. + * configure: Rebuilt. + + * doc/Makefile.in (mandir, infodir): Use autoconf-set values. + * doc/configure.in (AC_PREREQ): autoconf 2.5 or higher. + * doc/configure: Rebuilt. + + * {a29k,hp74x,i960,m68k,mips,pa,rs6000,sparc,sparc/libsys}/Makefile.in + (bindir, libdir): Use autoconf-set values. + * {a29k,hp74x,i960,m68k,mips,pa,rs6000,sparc,sparc/libsys}/configure.in + (AC_PREREQ): autoconf 2.5 or higher. + * {a29k,hp74x,i960,m68k,mips,pa,rs6000,sparc,sparc/libsys}/configure: + Rebuilt. + +Mon Jun 24 22:01:11 1996 Rob Savoye <rob@chinadoll.cygnus.com> + + * sparc/crt0.S: Set the stack to the upper part of memory. Execute + hardware_init_hook and software_init_hook if they exist with a + legit address. Drop into exit after main. Zero the bss section. + * sparc/ex930.ld: PROVIDE hardware_init_hook and + software_init_hook. + +Mon Jun 24 19:44:45 1996 Ian Lance Taylor <ian@cygnus.com> + + * mips/Makefile.in (cma101.o): Use -mips2 option when compiling. + +Wed Jun 19 13:57:36 1996 Rob Savoye <rob@darkstar.cygnus.com> + + * debug.[ch]: New files for GDB stub support. + * config/default.mt: Add rules for debug.o. + * config/default.mh: Add rule for building C++ source. Add $srcdir + to INCLUDES so shared header files can be found. + + * sparc/salib.c(exceptionHandler): Range check the vector number + so we get a legit %tbr value. Add wrappers so inbyte and outbyte + work. + * sparc/crt0.s: Handle cpus that don't have FP support. + * sparc/Makefile.in: Add multilib support. Add variable for + objcopy and objdump. Build the BSPs as archive libraries, not + object files. Add support for the SIS sparc simulator. Build the + test case srecords and dissasembly as seperate makefile + targets. Also optionally build the C++ test case. Use a target + makefile fragment. + * sparc/configure.in: Add multilib support. + * sparc/configure: Regenerated. + * sparc/asm.h: Macros to deal with aout and coff formats portably. + * sparc/slite.h: Sparclite specific stuff. + * sparc/{sim-crt0.S,sim-stub.c,sim-io.c,sim.ld}: New support for + the SIS sparc simulator. + * sparc/traps.S: Generic trap handlers for SIS and ex93x targets. + * sparc/tests.c: Test case for linking and GDB protocol. + +Tue Jun 18 20:06:16 1996 Rob Savoye <rob@chinadoll.cygnus.com> + + * pa/Makefile.in: Build the test case srecords and dissasembly + as seperate makefile targets. Also optionally build the C++ test + case. + * pa/crt0.S: If __stack and __globals have a legit address, use + that for %sp and %gp. Execute hardware_init_hook and + software_init_hook if they exist with a legit address. Add + __do_global_dtors() to the atexit array. + * pa/{w89k,op50n}.ld: Use GROUP rather than INPUT to get the + libraries. Allocate the stack and global spaces from the top of + memory. PROVIDE hardware_init_hook and software_init_hook. + + * m68k/Makefile.in: Build the test case srecords and dissasembly + as seperate makefile targets. Also optionally build the C++ test + case. + * m68k/asm.h: Don't define __USER_LABEL_PREFIX__ and + __REGISTER_PREFIX__ ourselves since suprisingly gcc sets them + correctly for a change. + * m68k/{bcc,mvme135,mvme162,idp}.ld: Use the same crt0 rather than + building seperate ones. PROVIDE hardware_init_hook and + software_init_hook. Stick the Constructors and Destructors in + .data cause they don't work in .text (which is where they should + really be). + * m68k/cpu32bug: Add a few more traps to support the older ABug + monitor. + * m68k/crt0.S: If __stack is isn't set, set the stack to the top + of memory. Excecute hardware_init_hook and software_init_hook if + they exist with a legit address. Add __do_global_dtors() to the + atexit array. + + * rs6000/Makefile.in: Use the linker script to build the test + case. Also build a C++ test case. + * rs6000/dtor.C: Test contructors and destructors. + * rs6000/{sim,mvme}.ld: New linkers scripts for the simulator and + the mvme board. + * rs6000/evm.ld: Provide hardware_init_hook and software_init_hook + so we can test for them in the crt0.S. + * rs6000/crto.S: Excecute hardware_init_hook and + software_init_hook if they exist with a legit address. + +Mon Jun 17 18:39:17 1996 Rob Savoye <rob@chinadoll.cygnus.com> + + * mips/Makefile.in: Replace the "test" target with seperate + targets for the dissasembled file, and the srecord. + * mips/configure.in: Use a target makefile fragment. + * mips/configure: Regenerate. + * mips/idt.ld: Add a comment on producing srecords. Setup a space + for the stack. PROVIDE hardware_init_hook and software_init_hook. + * mips/crt0.S: Make a small stack. Run memsize() using the temp + stack, and then set the stack to the top of memory. Also grab some + space for the globals. Add __do_global_dtors() to the atexit + array. Call _exit from newlib so the atexit array gets run, then + exits. + +Thu Jun 13 15:44:46 1996 Ian Lance Taylor <ian@cygnus.com> + + * mips/Makefile.in (vr4300.o): Use -mips3 option when assembling. + +Sat Jun 1 16:27:53 1996 Michael Meissner <meissner@wogglebug.tiac.net> + + * rs6000/simulator.S (open, close, lseek): Add system calls. + * rs6000/Makefile.in (OBJS): Don't put open.o, close.o, lseek.o + here. + (SIM_OBJS): Put them here instead. + +Tue Apr 30 20:01:08 1996 Rob Savoye <rob@chinadoll.cygnus.com> + + * m68k/crt0.S: Don't allocate __stack in the .bss section. + * m68k/{idp,mvme135,mvme162,bcc}.ld: Set __stack to a word below + the top of memory. Use "-l" in GROUP rather than the full name so + it'll get found using the path lookup in LD. Also link in libgcc + too. Don't set __lstack anymore. + * m68k/Makefile.in: Build test as a series of Makefile targets, + rather than as a big loop. + +Thu Apr 25 08:38:15 1996 Michael Meissner <meissner@tiktok.cygnus.com> + + * rs6000/mvme-stack.S: New file, define __stack. + * rs6000/mvme-crt0.S (_start): If __stack is not 0, use that for + the stack address. + +Thu Apr 25 06:42:02 1996 Rob Savoye <rob@chinadoll.cygnus.com> + + * rs6000/Makefile.in: Add support for multilib. + * rs6000/configure.in: Ditto. + * rs6000/configure: Regenerate. + +Wed Apr 24 11:02:33 1996 Doug Evans <dje@blues.cygnus.com> + + * sparc/libsys/Makefile.in (isatty.o): Add rule for SunOS VPATH. + +Fri Apr 19 13:23:31 1996 Rob Savoye <rob@chinadoll.cygnus.com> + + * {mips,a29k,pa}/configure.in: Add support for multilibs + by using config-ml.in. + * {mips,a29k,pa}/configure: Regenerate. + * {mips,a29k,pa}/Makefile.in: Build archive libraries, + not objects for the BSPs. + +Fri Apr 19 12:33:25 1996 Michael Meissner <meissner@tiktok.cygnus.com> + + * rs6000/sol-crt0.c: Delete, file moved into gcc directory. + +Mon Apr 15 14:09:26 1996 Michael Meissner <meissner@tiktok.cygnus.com> + + * rs6000/simulator.S: Call _cerror to save errno if an error + occurred. + * rs6000/sim-errno.c (_cerrno): New function to set errno. + +Thu Apr 11 14:19:01 1996 Michael Meissner <meissner@tiktok.cygnus.com> + + * rs6000/sol-{crt0.c,syscall.S,cfuncs.c}: New files to support + libgloss on PowerPC Solaris. + + * rs6000/Makefile.in: Add Solaris support. + +Tue Apr 16 17:43:06 1996 Rob Savoye <rob@chinadoll.cygnus.com> + + * Makefile.in: Don't do anything if SUBDIRS is empty. + +Mon Apr 15 15:37:52 1996 Rob Savoye <rob@chinadoll.cygnus.com> + + * configure.in, m68k/configure.in: Add support for multilibs by + using config-ml.in. + * m68k/crt0.S: If a value for __stack hasn't been specified, + initialize %sp to some memory in .bss. + * m68k/Makefile.in: Build archive libraries, not objects for the + BSPs. Build multiple copies of the crt0.o, one for each target. Add + support to build multilibs. + * idp.ld, bcc.ld, mvme135.ld, mvme162.ld: Use GROUP to look for + libc.a and the BSP rather than INPUT an object. Get the right + crt0.o. + +Tue Apr 9 23:31:53 1996 Ian Lance Taylor <ian@cygnus.com> + + * m68k/cpu32bug.S (getDebugChar): Use extw/extl rather than + extbl, so it can be used on a 68000. + +Wed Mar 27 17:18:01 1996 Michael Meissner <meissner@tiktok.cygnus.com> + + * rs6000/{mvme-exit,simulator}.S (_exit): Loop on a trap + instruction following the _exit system call. This also makes sure + that the debugger reports the address as being in _exit, rather + than whatever function follows _exit. + +Fri Mar 15 12:30:02 1996 J.T. Conklin <jtc@rtl.cygnus.com> + + * i960/{Makefile.in,asm.h,configure,configure.in,mon-read.c, + mon-syscalls.S,mon-write.c}: Initial support for MON960. + * configure.in: Add support for i960. + * configure: Rebuild with autoconf 2.8. + +Fri Mar 8 18:12:52 1996 Ian Lance Taylor <ian@cygnus.com> + + * a29k/configure.in: Call AC_CONFIG_AUX_DIR. + * a29k/configure: Rebuild with autoconf 2.7. + * m68k/configure.in: Call AC_CONFIG_AUX_DIR before + AC_CANONICAL_SYSTEM. + * mips/configure.in, pa/configure.in: Likewise. + * rs6000/configure.in: Likewise. + * m68k/configure, mips/configure, pa/configure: Rebuild. + * rs6000/configure: Rebuild. + +Fri Mar 8 08:11:14 1996 Doug Evans <dje@charmed.cygnus.com> + + * sparc/libsys/sbrk.S (curbrk): Moved from here, + * sparc/libsys/cerror.S (curbrk): To here. + +Thu Mar 7 11:39:09 1996 James G. Smith <jsmith@cygnus.co.uk> + + * mips/crt0.S (bssloop): Updated comment to reflect the source. + +Wed Mar 6 18:12:25 1996 Doug Evans <dje@charmed.cygnus.com> + + * configure.in (sparclet-*-aout*): Add entry. + * configure: Regenerated. + * sparc/libsys/{Makefile.in,configure.in,configure,isatty.c, + libsys-crt0.S,sbrk.S,syscall.h,syscallasm.h,template.S,template_r.S}: + New files. + +Fri Feb 23 22:21:07 1996 Rob Savoye <rob@chinadoll.cygnus.com> + + * a29k: New dir for a29k-coff support for the AMSAT Phase-3D + satellite. (doesn't use udi) + * a29k/{29200-io.c,Makefile.in,configure,configure.in,README,crt0.s, + p3dgps.ld,sa29200.ld,sa29200b.ld,test.c: New files for a29k + support. + * a29k/sys/{cpudef.h,intrinsi.h,macros.h,romdcl.h,sysmac.h, + fpsymbol.h,libconfig.h,proreg.h,smartmac.h}: New files for a29k + support. + * configure.in: Add support for a29k. + * configure: Rebuild. + +Thu Feb 22 13:32:28 1996 Michael Meissner <meissner@tiktok.cygnus.com> + + * rs6000/mvme-read.c (read): New file, if large read, do a .INLN + system call, instead of sucessive .INCHR system calls. Map \r on + input to \n. + + * rs6000/mvme-inbyte.S: Add stub for new input system calls. + + * rs6000/Makefile.in (MVME_OBJS): Add mvme-read.o, delete read.o + +Wed Feb 21 16:45:19 1996 Michael Meissner <meissner@tiktok.cygnus.com> + + * rs6000/mvme-print.c: New file, map write into sequences of + .OUTLN/.OUTCHR/.PCRLF rather than just using .OUTCHR. + + * rs6000/mvme-outbyte.S: Add stubs for new output system calls. + + * rs6000/Makefile.in (MVME_OBJS): Add mvme-print.o, delete print.o + and write.o. + +Thu Feb 15 11:37:02 1996 James G. Smith <jsmith@cygnus.co.uk> + + * mips/{mipsidt,mipspmon}.ld: Added OUTPUT_ARCH definition. + * mips/cma101.c (time): Added time() function. + +Tue Feb 13 10:36:07 1996 James G. Smith <jsmith@cygnus.co.uk> + + * mips/vr4300.S (__cpu_flush): Fix loop counter. + +Tue Jan 30 15:41:19 1996 James G. Smith <jsmith@cygnus.co.uk> + + * mips/syscalls.c: Used include file, rather than local manifest + definitions. + * mips/crt0.S: Removed IDT monitor entry points. + * mips/Makefile.in: Construct mipsidt and mipspmon BSP files. + * mips/{cma101.c,idtmon.S,pmon.S,regs.S,vr4300.S}: Added. + * mips/{mipspmon.ld}: Added. + +Sun Jan 28 08:01:31 1996 Michael Meissner <meissner@tiktok.cygnus.com> + + * rs6000/configure.in (AC_INIT): Use sim-crt0.S, not crt0.s. + * rs6000/configure: Regenerate. + +Wed Jan 24 14:26:01 1996 Michael Meissner <meissner@tiktok.cygnus.com> + + * rs6000/{mvme,sim}-crt0.S (__atexit): Put the __atexit variable + in the .sdata section, and provide a fixup for the address, in + order to support the new -msdata compiler flag. + +Thu Jan 11 11:24:25 1996 Michael Meissner <meissner@tiktok.cygnus.com> + + * rs6000/{mvme,sim}-crt0.S (__atexit): Provide address of atexit, + so eabi-ctors in libgcc.a can know to register the function to + call all of the destructors. + +Sat Dec 30 14:31:37 1995 Doug Evans <dje@canuck.cygnus.com> + + * configure.in (AC_CONFIG_AUX_DIR): Adjust to new build tree layout. + * {doc,hp74x,m68k,mips,pa,rs6000,sparc}/configure.in + (AC_CONFIG_AUX_DIR): Define + * {,doc,hp74x,m68k,mips,pa,rs6000,sparc}/configure: Regenerated. + +Mon Dec 11 12:20:24 1995 Ian Lance Taylor <ian@cygnus.com> + + * Makefile.in (FLAGS_TO_PASS): Add INSTALL, INSTALL_PROGRAM, + and INSTALL_DATA. + +Fri Dec 1 16:54:15 1995 James G. Smith <jsmith@cygnus.co.uk> + + * mips/syscalls.c (sbrk): Fixed memory addressing. System call + returns size, not (last address + 1). + +Thu Nov 16 13:47:57 1995 Ian Lance Taylor <ian@cygnus.com> + + * config/default.mh: Don't define CC_FOR_TARGET, AS_FOR_TARGET, + AR_FOR_TARGET, LD_FOR_TARGET, RANLIB_FOR_TARGET, NM_FOR_TARGET, + OBJDUMP_FOR_TARGET, or OBJCOPY_FOR_TARGET. Change the build rules + to use CC, etc., instead of CC_FOR_TARGET, etc. + * configure.in, */configure.in: Get values for CC, AS, AR, LD, and + RANLIB. Always use default.mh. + * Makefile.in (FLAGS_TO_PASS): Pass down LD. + * Makefile.in, */Makefile.in: Let CC, AS, AR, LD, and RANLIB by + substituted by the autoconf configure script. Use them instead of + the *_FOR_TARGET variants. + * hp74x/configure.in: Don't call AC_CANONICAL_SYSTEM. + * m68k/configure.in: Call AC_ARG_PROGRAM. + * mips/configure.in, pa/configure.in: Likewise. + * rs6000/configure.in: Likewise. + * m68k/Makefile.in: Set program_transform_name, OBJDUMP, and + OBJCOPY. + * mips/Makefile.in, pa/Makefile.in, rs6000/Makefile.in: Likewise. + * mips/Makefile.in: Split new test target from all target. + * configure, */configure: Rebuild. + +Tue Nov 14 12:04:36 1995 Angela Marie Thomas (angela@cygnus.com) + + * Makefile.in: Added prefix, exec-prefix and tooldir to + FLAGS_TO_PASS so vaulting works correctly. + +Tue Nov 14 18:32:41 1995 James G. Smith <jsmith@cygnus.co.uk> + + * mips/mipsidt.ld: Added. + * mips/syscalls.c: Added. + * mips/crt0.S: Added FPU presence check, and entry points into IDT + monitor. + * mips/Makefile.in (all): Updated to build generic IDT monitor + crt0.o file. + * mips/test.c (main): Removed unnecessary prototypes. + * configure.in (configdirs): Removed mips64vr4300 target. + * configure: Re-generated. + * config/default.mh (OBJDUMP_FOR_TARGET): Added missing parent + directory path element. + * mipsidt: Directory removed. + +Fri Nov 10 12:50:03 1995 Ian Lance Taylor <ian@cygnus.com> + + * configure.in, */configure.in: Don't call AC_ARG_PROGRAM. + * configure, */configure: Rebuild. + * Makefile.in, */Makefile.in: Don't set program_transform_name. + +Wed Nov 8 16:19:31 1995 James G. Smith <jsmith@pasanda.cygnus.co.uk> + + * configure.in (configdirs): Add mips*vr4300*-*-* target. + + * configure: Re-generated. + + * mipsidt/crt0.S: Check for FPU presence. + + * mipsidt/mipsidt.ld: Removed explicit crt0.o from link. + + * mipsidt/Makefile.in: Explicitly link against crt0.o file. + +Thu Nov 2 23:27:28 1995 Rob Savoye <rob@chinadoll.cygnus.com> + + * config/default.mh: Add additional "../" to path used to find + comp-tools binaries in an object tree. + +Mon Oct 30 18:10:47 1995 Michael Meissner <meissner@tiktok.cygnus.com> + + * rs6000/mvme-crt0.S (_start): Zero out bss before the the program + starts. + +Tue Oct 24 10:07:50 1995 Michael Meissner <meissner@tiktok.cygnus.com> + + * rs6000/mvme-{exit,outbyte,inbyte}.S: Use hex for the system + calls, not decimal, since formatting the disk when you intend to + write out a character is not nice. + +Mon Oct 23 22:17:12 1995 Michael Meissner <meissner@tiktok.cygnus.com> + + * rs6000/mvme-crt0.S (_start): Bump sp by -4 before storing end of + stack chain to avoid last word indebugger's memory. + + * rs6000/mvme-{exit,inbyte,outbyte}.S: System call number goes in + r10, not r0. + +Mon Oct 23 17:57:23 1995 James G. Smith <jsmith@jaalfrezi.cygnus.co.uk> + + * mipsidt/Makefile.in: Removed the LDFLAGS_FOR_TARGET in the test + program link. + + * mipsidt/crt0.S: Changed monitor entry sequence. + + * mipsidt/syscalls.c: Added local sbrk() function, derived from + (libgloss/sbrk.c), but using the monitor routine to ascertain the + amount of memory available. + +Mon Oct 23 11:58:04 1995 James G. Smith <jsmith@pasanda.cygnus.co.uk> + + * mipsidt: Added (directory). This is a simple crt0 module for the + IDT MIPS monitor. The existing "libgloss/mips" directory is for a + specific R3000 board, so it was safer creating a new target + directory. + * mipsidt/Makefile.in: Added. + * mipsidt/configure: Added. + * mipsidt/configure.in: Added. + * mipsidt/crt0.S: Added. + + * mipsidt/syscalls.c: Added. + * mipsidt/test.c: Added. + + * configure (mips*vr4300*-*-*): Use new mipsidt target directory. + +Mon Oct 9 21:07:08 1995 Michael Meissner <meissner@cygnus.com> + + * rs6000/Makefile (all asm rules): Remove asm.h dependency. + * rs6000/asm.h: File deleted, moved to gcc directory as ppc-asm.h. + * rs6000/mvme-{crt0,exit,inbyte,outbyte}.S: Include ppc-asm.h, not + asm.h. + * rs6000/sim{-crt0,ulator}.S: Ditto. + + * rs6000/{mvme,sim}-crt0.S (_start): Don't use FUNC_START/FUNC_END + for _start, since the linker needs to see this. + +Mon Oct 9 12:08:12 1995 Stu Grossman (grossman@cygnus.com) + + * sparc/sparc-stub.c: include sparclite.h to get access to register + fondling macros. + * (trap_low): Save and restore FP regs if necessary. Also, clean + up save and restore of debug unit regs. + * (hard_trap_info): Add more architecturally defined traps. + * (set_debug_traps): Only set FP disabled trap if FP is disabled. + * (get_in_break_mode): Clean up. Get rid of calls to + set_hw_breakpoint_trap(). Also, use write_asi macro + * (handle_exception): Clean up `g' and `G' commands. Add `P' + command. + * (hw_breakpoint): Why was this here!? It's gone now... + * sparc/crt0.s: Speed up prom copy loop. Clean up window over/under + flow setup. Call main instead of jumping to it. + * sparc/salib.c (get_uart_status rcv_char flush_i_cache): Use new + and improved read_asi macro. + * (win_ovf win_unf): Parameterize window size. + * sparclite.h (read_asi): Rewrite so that macro returns an rval. + * (read_psr write_psr): New macros to do the obvious. + * Add conditionalized code for 933 window size. + +Fri Oct 6 15:35:01 1995 Michael Meissner <meissner@tiktok.cygnus.com> + + * rs6000/simulator.S (abort): Delete abort. + * rs6000/sim-abort.c: New file, to print message that abort was + called. + * rs6000/Makefile.in (SIM_OBJS): Add sim-abort.o. + + * rs6000/asm.h (FUNC_NAME, FUNC_START, FUNC_END): New macros that + give the start and end of a function written in assembler. If + -mcall-aixdesc or -mcall-nt, create a function descriptor and name + the real function with one or two leading periods. + + * rs6000/{simulator,sim-crt0}.S: Use new function macros. + * rs6000/mvme-{crt0,exit,inbyte,outbyte}.S: Ditto. + + * rs6000/Makefile.in: Add asm.h as a dependent for all .S files. + Compile the .S files with gcc, so that -mcall-* flags define the + appropriate macros. + +Thu Sep 28 13:49:45 1995 Ian Lance Taylor <ian@cygnus.com> + + * sparc/ex93x.ld: Remove crt0.o from INPUT; gcc will normally pass + crt0.o anyhow. Add leading underscore to __CTOR_LIST__, et. al. + * sparc/salib.c (__main): Comment out empty function. + +Wed Sep 20 14:36:12 1995 Ian Lance Taylor <ian@cygnus.com> + + * Makefile.in (maintainer-clean): New synonym for realclean. + * hp74x/Makefile.in (maintainer-clean): Likewise. + * m68k/Makefile.in (maintainer-clean): Likewise. + * pa/Makefile.in (maintainer-clean): Likewise. + * mips/Makefile.in (maintainer-clean): Likewise. + * rs6000/Makefile.in (maintainer-clean): Likewise. + * sparc/Makefile.in (maintainer-clean): Likewise. + * doc/Makefile.in (maintainer-clean): Likewise. + * testsuite/Makefile.in (maintainer-clean): Likewise. + * testsuite/libgloss.all/Makefile.in (maintainer-clean): Likewise. + +Sat Sep 16 23:04:11 1995 Michael Meissner <meissner@tiktok.cygnus.com> + + * rs6000/Makefile.in (all): Fix typo preventing simulator from + being built. + +Tue Sep 12 10:43:41 1995 J.T. Conklin <jtc@rtl.cygnus.com> + + * rs6000/Makefile.in: Misc mvme support fixes. + + * rs6000/{mvme-exit.S, mvme-inbyte.S, mvme-outbyte.S}: Strip + leading underscores from identifiers. + + * m68k/asm.h: New file, macro definitions helpful for assembly + language programming. + * m68k/{cpu32bug.S, crt0.S, mvme.S, mvme135-asm.S, mvme162lx-asm.S}: + Use asm.h. + + * rs6000/{mvme-crt0.S, mvme-exit.S, mvme-inbyte.S, mvme-outbyte.S}: + New files, preliminary support for motorola mvme targets running + the ppcbug monitor. + * rs6000/Makefile.in: Build mvme support. + + * rs6000/asm.h: New file, macro definitions helpful for assembly + language programming. + * rs6000/{sim-crt0.S, simulator.S}: Use asm.h. + +Fri Sep 8 18:51:29 1995 Michael Meissner <meissner@wogglebug.tiac.net> + + * rs6000/sim-sbrk.c (sbrk): Add cast to silence warning. + +Fri Sep 8 13:03:12 1995 Brendan Kehoe <brendan@lisa.cygnus.com> + + * m68k/idp-inbyte.c (READREG): Add volatile to the cast, to avoid + reordered insns that can end up being an infinite loop. + * m68k/idp-outbyte.c (READREG): Likewise. + +Wed Sep 6 10:01:33 1995 Michael Meissner <meissner@tiktok.cygnus.com> + + * rs6000/sim-sbrk.c (sbrk): Use the brk system call, instead of + using a large static area for the break area. + +Thu Aug 24 14:57:28 1995 Michael Meissner <meissner@tiktok.cygnus.com> + + * rs6000/Makefile.in (install*): Add separate installation rules + for sim and evm targets. + +Wed Aug 23 16:49:02 1995 Michael Meissner <meissner@tiktok.cygnus.com> + + * rs6000/sim*: Add PowerPC simulator support. + +Tue Aug 22 11:52:40 1995 Jeff Law (law@snake.cs.utah.edu) + + * pa/hp-milli.s: Add entry/exit pseudo-ops around all exported + code. Fix callinfo directives to include "millicode" attribute. + + * pa/hp-milli.s (divU): Fix bug found by arith-rand1.c testing. + +Mon Aug 21 23:31:42 1995 Jeff Law (law@snake.cs.utah.edu) + + * pa/crt0.S ($START$): Use local label prefix for local label + "bssloop". + +Mon Aug 14 11:57:46 1995 Kung Hsu <kung@mexican.cygnus.com> + + * ex93x/sparclite.h: add __WINSIZE. + * ex93x/salib.c: Use __WINSIZE, implements write with $O command of + stub protocol. + +Thu Aug 3 14:40:12 1995 J.T. Conklin <jtc@rtl.cygnus.com> + + * Makefile.in: Updated to reflect filename changes. + + * m68k/mc68681-duart.h: Renamed to m68681reg.h. + * m68k/mc68681-duart.c: Split up and renamed to idp-inbyte.c and + idp-outbyte.c + +Fri Jul 28 11:23:24 1995 J.T. Conklin <jtc@rtl.cygnus.com> + + * m68k/mc68681-duart.h: Removed everything except register offsets. + Changed offsets so they reflect actual chip instead of how device + is mapped into the IDP address space. + * m68k/mc68681-duart.c (DUART_ADDR): New macro, base address. + (READREG, WRITEREG): Changed to correspond to unusual way the + device is mapped (ie. base address + (reg offset * 4) + 3)). + (duart_status, duart_mode, duart_init, duart_restore): Removed, + these interfaces were never used and didn't work. + (outbyte): Removed unconditional delay. + + * m68k/crt0.S: Use SYM(_end) instead of end. This completes my + change of April 18th which makes the "_end" symbol compatible + with both a.out and coff toolchains. + (zerobss): Handle zero-length bss. + +Thu Jul 27 15:35:37 1995 J.T. Conklin <jtc@rtl.cygnus.com> + + * configure, {doc, hp74x, m68k, mips, pa, sparc}/configure: + regenerated with autoconf 2.4.2. + +Wed Jul 26 13:42:27 1995 J.T. Conklin <jtc@rtl.cygnus.com> + + * doc/porting.texi: Fix typos and spelling errors. + +Mon Jun 26 09:23:23 1995 Jeffrey A. Law <law@rtl.cygnus.com> + + * pa/Makefile.in: Enable HP supplied millicode routines. + * pa/hp-milli.s: Make sure copyright notice gets included + in objects files. + + * pa/crt0.S ($START$): Use "%" instead of "'" to avoid losing whe + run through cpp. + +Fri Jun 16 18:40:22 1995 Jeffrey A. Law <law@rtl.cygnus.com> + + * pa/crt0.S ($START$): Use long-calls to call main and exit. + +Tue Jun 13 16:05:13 1995 Rob Savoye <rob@darkstar.cygnus.com> + + * pa/crt0.S: Call exit() after returning from main. + +Tue Jun 13 10:43:14 1995 J.T. Conklin <jtc@rtl.cygnus.com> + + * Makefile.in, {doc, hp74x, m68k, mips, pa, sparc}/Makefile.in + (distclean, realclean): Remove autoconf-generated config.cache + and config.log files. + +Mon Jun 5 15:56:22 1995 J.T. Conklin <jtc@rtl.cygnus.com> + + * config/{default.mh, dos.mh} (CFLAGS_FOR_TARGET): Added -O2. + (.c.o, .s.o, .S.o, etc.): Don't use @ to hide how the compiler + is invoked, it makes it much more difficult to debug. + +Tue May 30 19:07:59 1995 Rob Savoye <rob@darkstar.cygnus.com> + + * testsuite/libgloss.all/math.c: Add additional tests for modulo. + +Mon May 29 13:03:39 1995 Rob Savoye <rob@darkstar.cygnus.com> + + * stat.c: Add const so it works with newlib's stat.h. + +Thu May 25 16:28:42 1995 Rob Savoye <rob@darkstar.cygnus.com> + + * m68k/mvme.S: Extend sign using two instructions rather than one + so it'll work on a stock mc68000. + +Tue May 23 18:12:19 1995 Rob Savoye <rob@darkstar.cygnus.com> + + * close.c, stat.c, fstat.c, open.c, lseek.c, print.c, putnum.c, + unlink.c read.c, sbrk.c, getpid.x, kill.c: New files that used to + be glue.c. + * {m68k,pa,mips}/Makefile.in: Build using broken up glue.c. + * pa/Makefile.in: Make all just build BSP, add seperate test + target. + * most files: add Cygnus BSD-style copyright message. + +Tue May 23 12:58:03 1995 J.T. Conklin <jtc@rtl.cygnus.com> + + * configure.in, {hp74x, m68k, mips, pa, sparc}/configure.in: + Use changequote() to temporarily turn off m4 quoting so that + i[345]86-*-go32 pattern in case statement remains unchanged. + * configure, {hp74x, m68k, mips, pa, sparc}/configure: + regenerated. + +Tue May 23 11:15:52 1995 Angela Marie Thomas <angela@cirdan.cygnus.com> + + * mips/Makefile.in (SCRIPT): added "SCRIPT = array.ld" so installs + work correctly. + +Mon May 22 21:33:49 1995 Rob Savoye <rob@darkstar.cygnus.com> + + * ex93x: renamed to sparc. + * r3000: renamed to mips. + * hppro: renamed to pa. + * configure.in, configure: Use new directory names. + * config/default.mh: Remove '' in sed program_transform_name so + it actually works. + * doc/porting.texi: update doc. + +Wed May 17 17:25:53 1995 J.T. Conklin <jtc@rtl.cygnus.com> + + * doc/configure.in: converted to autoconf. + * doc/configure: New file, generated with autoconf 2.3. + + * Makefile.in, config/{ex93x, hp74x, hppro, m68k, + r3000}/Makefile.in (Makefile.in): Added config.status to + dependency list. + (config.status): New target. + + * m68k/Makefile.in: Build M68332BCC BSP. + +Wed May 10 18:43:21 1995 Stu Grossman (grossman@andros.cygnus.com) + + * glue.c: Change decl of end to char[] for some reason. + * (sbrk): Rewrite sbrk so that it works. + * (fstat): Return status indicating fd is for a tty. Makes stdio + work better. + * hppro/crt0.S (_sr4export): Retrieve rp from -24(sp), not + -18(sp). Note that -24 decimal == -18 hex... + * hppro/op50n-io.S: Add read and write interfaces to the rom + monitor. Unfortunately, the monitor doesn't seem to work... + * hppro/op50n.ld: Clean up lots of stuff. Define memory in a + nice way. Define stack and reserve space. Put heap after stack. + +Thu May 4 10:28:01 1995 J.T. Conklin <jtc@rtl.cygnus.com> + + * configure.in (AC_PREREQ): Changed to 2.3, since autoconf + versions prior to this generate code that AIX 4.X's sh can't + hack. + + * m68k/Makefile.in (BCC_BSP, BCC_OBJS): New BSP for M68332BCC. + * m68k/cpu32bug.S: New file, support for cpu32bug monitor used by + bcc. + * m68k/bcc.ld: Link with bcc.o + +Fri Apr 21 16:17:17 1995 Torbjorn Granlund <tege@rtl.cygnus.com> + + * hppro/{milli.S,divide.S,divI.S,divU.S,multiply.S,test-div.c, + test-dyncall.c,test-mul.c,remI.S,remU.S,dyncall.S}: Delete. + * hppro/divcnst-generic/*: Delete. + * hppro/divcnst-fast/*: Delete. + * hppro/Makefile.in: Delete junk. + +Tue Apr 18 11:22:47 1995 J.T. Conklin <jtc@rtl.cygnus.com> + + * m68k/{bcc.ld idp.ld, mvme135.ld, mvme162lx.ld}: Removed stack + section, moved __stack definition to the top level and set it + explicitly to the value appropriate to the target board. + Added __end symbol (needed for a.out toolchains). + +Mon Apr 17 12:48:48 1995 Stu Grossman (grossman@andros.cygnus.com) + + * hppro/w89k.ld: Move _stack to before `end' and `_end' so that + malloc doesn't trash the stack. + * hppro/w89k-io.c (outbyte): Make this be void, and remove return + value, which is useless anyway. + +Mon Apr 17 06:13:55 1995 J.T. Conklin <jtc@rtl.cygnus.com> + + * m68k/bcc.ld: New file, linker script for M68332BCC Business Card + Computer. + * m68k/Makefile.in: Install BCC linker script. + + * Makefile.in: Fixed typo. + + * hppro/configure.in: Changed AC_INIT file from crt0.s to crt0.S. + * hppro/configure: regenerated. + +Mon Apr 17 00:02:15 1995 Stu Grossman (grossman@andros.cygnus.com) + + * hppro/op50n.ld: Define _stack explicitly instead of implicitly + via common. + * hppro/{w89k-io.c w89k.h}: Use pointers to volatile for inp and + outp. Use correct port numbers for COM1 serial port. + +Fri Apr 14 16:56:35 1995 Ken Raeburn <raeburn@cujo.cygnus.com> + + * m68k/mc68ec.c (_exit): Use extended asm construct to get the + proper immediate-operand syntax for whatever the target assembler + configuration is. + * m68k/mvme.S (__IMMEDIATE_PREFIX__, IMM): Copy and use macro + definitions as in m68k/crt0.S. + +Thu Apr 13 16:48:46 1995 Angela Marie Thomas <angela@cirdan.cygnus.com> + + * Makefile.in: fixed clean rules such that they do not try to + clean ${SUBDIRS} if libgloss not supported on that target. + +Thu Apr 13 13:39:46 1995 J.T. Conklin <jtc@rtl.cygnus.com> + + * configure.in: Append new subdirectories to ${configdirs}. + (go32-*-*): Removed. + * configure: Regenerated. + + * m68k/mvme162lx.ld: Put __stack in ram, even though it's not + loaded. + + * m68k/Makefile.in: Don't hide how BSP objects are built. + + * glue.c (print, putnum): declared void. + + * {hppro,m68k}/Makefile.in: Use ${CC_FOR_TARGET} to link executables. + (LIBS_FOR_TARGET): Removed. + + * config/{default.mh, dos.mh} (NEWLIB_CFLAGS, NEWLIB_LDFLAGS): New + make variables, expands to compiler flags to find headers and + libraries if ${objroot}/newlib is present. + (CFLAGS_FOR_TARGET): Added ${NEWLIB_CFLAGS}. + (LDFLAGS_FOR_TARGET): Added ${NEWLIB_LDFLAGS}. + (LIBC_FOR_TARGET, LIBM_FOR_TARGET, LIBGCC_FOR_TARGET, + LIBS_FOR_TARGET): Removed. + +Thu Apr 13 11:51:17 1995 Torbjorn Granlund <tege@adder.cygnus.com> + + * m68k/Makefile.in (install): Use correct names for MVME* variables. + * configure.in: Delete `unknown' from m68* case. + +Thu Apr 13 11:47:01 1995 J.T. Conklin <jtc@rtl.cygnus.com> + + * m68k/crt0.S: initialize stack pointer to __stack before creating + inital stack frame. + + * m68k/{idp.ld, mvme135.ld, mvme162lx.ld}: Move __stack out of + bss, and into its own segment with an address at top of RAM. + +Wed Apr 12 12:36:28 1995 J.T. Conklin <jtc@rtl.cygnus.com> + + * {.,ex93x,hp74x,hppro,m68k,r3000}/{Makefile,configure}.in: + converted to autoconf. + * {.,ex93x,hp74x,hppro,m68k,r3000}/configure: New files, generated + from configure.in with autoconf 2.3. + +Mon Apr 10 22:50:48 1995 J.T. Conklin (jtc@rtl.cygnus.com) + + * m68k/{idp.ld, mvme135.ld, mvme162lx.ld}: Revert last change, + CONSTRUCTING and RELOCATING only work for linker scripts built + from ld/scripttmpl/*. + + * m68k/{idp.ld, mvme135.ld, mvme162lx.ld}: Changed to use + CONSTRUCTING and RELOCATING expressions so that the ctor/dtor + tables and etext, edata, and end variables are only done when + appropriate. + +Fri Apr 7 17:30:35 1995 Stu Grossman (grossman@andros.cygnus.com) + + * config/default.mh: Use $${srcroot} instead of ${SRCROOT} to get + inherited value. + * hppro/crt0.S: Remove static definitions of _stack and $global$. + Let the linker script define them in the BSS segment. + * hppro/w89k.ld: Use MEMORY to define memory regions. Add defs + for $global$ and _stack in the appropriate segments. + +Tue Apr 4 18:27:37 1995 Jason Molenda (phydeaux@cygnus.com) + + * Makefile.in (FLAGS_TO_PASS): pass down MAKEINFO. + +Thu Mar 30 18:10:53 1995 Kung Hsu <kung@mexican.cygnus.com> + + * ex93x/ex93x.ld: Add crt0.o in INPUT. + * ex93x/sparcl-stub.c: Add nop after bg insn. + * ex93x/sparc-stub.c: Add & 0x7f mask to all character input. + +Thu Mar 30 15:22:31 1995 Rob Savoye <rob@rtl.cygnus.com> + + * {hppro,m68k,ex93x,testsuite/libgloss}/configure.in: Add SRCROOT + variable. + * {hppro,m68k,ex93x,testsuite/libgloss}/Makefile.in: Add SRCROOT + variable. + * config/default.mh: Use SRCROOT to find the newlib includes. + +Tue Mar 28 19:54:26 1995 Rob Savoye <rob@darkstar.cygnus.com> + + * configure.in, testsuite/configure.in: Add SRCROOT variable. + * glue.c: Change "char *path" to "const char *path" so it works + with the changes stat.h. + +Fri Mar 24 17:29:08 1995 Kung Hsu <kung@mexican.cygnus.com> + + * ex93x/ex93x.ld: The stubs module now can have different names for + different SPARClite chips. Use default one which is slite930.o. + +Mon Mar 20 15:49:46 1995 J.T. Conklin <jtc@rtl.cygnus.com> + + * m68k/mc68ec.c (_exit): Changed to take integer status argument. + +Fri Mar 17 17:48:42 1995 Kung Hsu <kung@mexican.cygnus.com> + + * config/default.h: add -I. to INCLUDES. + * ex93x/salib.c: to include sparclite.h. + * ex93x/sparclite.h: new file copied from gdb/sparclite. + + * config/default.mh: Fix INCLUDES to one level less '../'. + +Mon Mar 13 17:05:35 1995 Rob Savoye <rob@darkstar.cygnus.com> + + * testsuite/libgloss.all/misc.c: Misc bug reports, mostly + soft-float tests. + +Wed Mar 8 19:00:18 1995 Rob Savoye <rob@darkstar.cygnus.com> + + * m68k/{crt0.S, mvem135.ld, mvme162lx.ld, idp.ld}: Setup the stack + in the linker script. Use a macro to cover using '#' or '&' for + immediate values. + * m68k/{mvme135-asm.S, mvme162lx-asm.S}: Use a macro to cover + using '#' or '&' for immediate values. + * testsuite/libgloss.all/io.c: Add a test for read(). + +Thu Feb 16 21:13:34 1995 Rob Savoye <rob@darkstar.cygnus.com> + + * glue.c: Make use _ansi.h, move to top level libgloss directory + form all other directories. + * Makefile.in: All Makefiles had SCRIPTS and OBJROOT added. + * {m68k,hppro,r3000)/Makefile.in: All build the test the same way + using OBJROOT. + * configure.in: All configure.in now edit the value to OBJROOT in + the Makefiles they produce. + * config/default.mh: Use OBJROOT for paths to test for fresh + binaries. + * configure.in: Add the testsuite directory. + * testsuite/config/{m68k.mt,mips.mt}: New target support for + MVME135, IDP, and Array targets. + +Thu Feb 9 21:45:33 1995 Rob Savoye <rob@darkstar.cygnus.com> + + * testsuite/libgloss.all{varargs.c,varargs2.c}: Test cases for + traditional and ANSI varargs. (which currently fail) + * Makefile.in: Build intelligently and use dependancies so we + don't rebuild the world for each test run. + * configure.in: Make a .gdbinit file to run the tests and load via + gdb. + +Wed Mar 8 22:35:29 1995 Ken Raeburn <raeburn@cujo.cygnus.com> + + * m68k/idp.ld: Omit STARTUP line, since crt0.o is being supplied + by gcc. + +Thu Feb 23 12:08:19 1995 Ken Raeburn <raeburn@cujo.cygnus.com> + + * m68k/crt0.S: Use '&' instead of '#' for immediate operands. + * m68k/mc68ec.c: Ditto, in asm statements. + * m68k/mvme.S: Ditto. + +Wed Feb 1 23:55:39 1995 Angela Marie Thomas <angela@cirdan.cygnus.com> + + * Makefile.in (all): added "else" statements for Ultrix to work + +Fri Jan 27 10:48:20 1995 Rob Savoye <rob@darkstar.cygnus.com> + + * testuite/{config,lib,libgloss.all}: DejaGnu testing support. + * testsuite/config/support.c: A minimal testing API for minimal + targets. + * testsuite/config/hppa.mt: Set build flags for PRO targets. + * libgloss.all/{float.c,memory.c,io.c,double.c,math.c,array.c}: + Test cases for libgloss and soft-float. + + * hppro/{w89k.ld,op50n.ld}: Set .text here now. + +Wed Jan 25 21:16:38 1995 Rob Savoye <rob@darkstar.cygnus.com> + + * testsuite/{config,lib,libgloss.all}: The beginnings of a test + suite for low level stuff. A few test cases now all build. + +Thu Jan 12 13:02:12 1995 Rob Savoye <rob@darkstar.cygnus.com> + + * config/default.mh: Change default path for linking in a freshly + built libc.a, libm.a, libgcc.a to work with -msift-float. + + * hppro/Makefile.in: Set MULTILIB so the -msoft-float safe + libraries get used. + + * m68k/Makefile.in: Use explicit rules, rather than redefining + .c.o. This is to force compiling with -m68000. + +Mon Jan 9 15:28:10 1995 Rob Savoye <rob@darkstar.cygnus.com> + + * {hppro,m68k,r3000}/glue.c: Return correct value on receiving a + '\n' or '\r'. + +Fri Dec 30 15:05:03 1994 Rob Savoye <rob@darkstar.cygnus.com> + + * doc, doc/Makefile.in, configure.in: New directory. + * doc/porting.texi: New manual that explains porting the GNU tools + to embedded systems. + +Mon Dec 19 16:05:37 1994 Kung Hsu <kung@mexican.cygnus.com> + + * ex93x/Makefile.in: Use sparcl-stub.c instaed of sparc-stub.c, + which has hardware breakpoint support. + * ex93x/Makefile.in: Also generate slite930.o and slite931.o, instead + slite.o. + * ex93x/sparcl-stub.c: New file. + * ex93x/sparc-stub.c: Use latest from gdb/sparclite directory. + +Fri Dec 16 15:17:14 1994 Rob Savoye <rob@darkstar.cygnus.com> + + * r3000/crt0.S: Zero the bss section by words. + + * r3000/Makefile.in: Add in the rest of the support code for the + Array Tech board. + + * r3000/array.ld: Set the memory map for the Array Tech LSI + prototype. + + * r3000/array-io.c: Lowest level I/O code for Array Tech LSI + prototype using ROM entry points. + +Wed Dec 14 10:23:41 1994 Rob Savoye <rob@darkstar.cygnus.com> + + * hppro/crt0.S: Add _sr4export function so GDB calls work. + + * hppro/Makefile.in: Link in libc.a twice so atexit works(). + + * hppro/glue.c: Don't stub out __main anymore. + +Tue Dec 13 15:42:23 1994 Rob Savoye <rob@darkstar.cygnus.com> + + * r3000/Makefile.in: Look for both libgcc2 and libgcc. + + * r3000/glue.c,crt0.S,test.c: New support for for mips. + + * configure.in: Configure r3000 dir for a mips chip. + +Tue Dec 6 15:24:41 1994 Rob Savoye <rob@darkstar.cygnus.com> + + * hppro/divcnst-generic/*.S. Add .exit and .procend so it'll + compile. + + * hppro/Makefile.in: Link in the rest of the millicode routines. + +Mon Nov 21 20:21:48 1994 Rob Savoye <rob@darkstar.cygnus.com> + + * hppro/configure.in,config/dos.mh: Work for a canadian cross, + since xgcc is for the wrong architecture. + +Thu Nov 17 21:07:52 1994 Rob Savoye <rob@darkstar.cygnus.com> + + * config/default.mh: Find the corrrect libgcc2.a. + + * Makefile.in: Link in libgcc2.a by default. Build new millicode + routines. + + * divI.S, divU.S, multiply.S, remI.S, remU.S, test-div.c, + test-dyncall.c, test-mul.c: New millicode files for low level math + support. + + * test.c: Use printf so millicode gets exercised. + + * divcnst-fast/divU_10.S, divU_12.S, divU_3.S, divU_5.S, divU_6.S, + divU_9.S: Fast versions of some division routines. + + * divcnst-generic/divI_14.S, divI_5.S, divI_9.S, divU_14.S + divU_5.S, divU_9.S divI_10.S, divI_15.S, divI_6.S, divU_10.S, + divU_15.S, divU_6.S divI_12.S, divI_3.S, divI_7.S, divU_12.S, + divU_3.S, divU_7.S: Yet more millicode routines. + +Wed Nov 16 15:25:03 1994 Rob Savoye (rob@cygnus.com) + + * config/default.mh: Add default searches for the correct libc and + libm. + + * Makefile.in: Use ${LIBC_FOR_TARGET} and ${LIBM_FOR_TARGET} + + * hppro/w89k.ld,op50n.ld,Makefile.in: Don't try to link in libc + for the test program. + +Tue Nov 8 17:12:35 1994 Rob Savoye <rob@rtl.cygnus.com> + + * m68k/glue.c: Remove errno so there's no libc dependancies. + + * m68k/mvme135-asm.S: Moved setup_vectors and exceptionHandler + from mvme.S so the library can link without the stub. + + * m68k: New directory. Merge the idp, shared, and mvme135 + directories into one place. + + * config/default.mh: Use CC_FOR_TARGET for .S files so the + preprocessor actually gets run. + + * ex93x/crt0.s, ex93x/salib.c: Migrate changes from gdb/sparclite. + +Fri Sep 16 21:22:57 1994 Rob Savoye (rob@darkstar.cygnus.com) + + * shared, idp, mvme135: Support for Motorola IDP and MVME135 m68k + based target boards. Moved from newlib/stub. + + * ex93x: Move from newlib/stub/ex93x. Sparclite ex93x + board support. + + * hp74x, hppro: Add HP 742 & hp743 code "as is" with a working but + unfinished gdb stub. Add hppro for the WinBind and Oki Pa target + boards. + + * libgloss: Creation. A library for board support packages. The + Gnu low-level OS Support. Move mvme135/ChangeLog to here. + +Wed Sep 29 20:42:34 1993 Rob Savoye (rob@darkstar.cygnus.com) + + * mvme135/crt0.S, mvme135/glue.c: Moved to ../shared. + +Thu Apr 1 13:18:15 1993 Ian Lance Taylor (ian@cygnus.com) + + * mvme135/mvme.S: Renamed exceptionhandler to exceptionHandler, which is + what mvme135-stub.c expects. + +Tue Mar 30 18:44:43 1993 Doug Evans (dje@poseidon.cygnus.com) + + * mvme135/mvme135-stub.c (initializeRemcomErrorFrame): Remove reference to + __STDC__. + +Tue Dec 29 10:15:33 1992 Ian Lance Taylor (ian@cygnus.com) + + * mvme135/mvme135-asm.S: new file. + mvme135-stub.c: moved all assembler routines into mvme135-asm.S. + Makefile.in: build mvme135-stub.o. + + * ChangeLog: created. diff --git a/libgloss/Makefile.in b/libgloss/Makefile.in new file mode 100644 index 0000000..4e9c4c4 --- /dev/null +++ b/libgloss/Makefile.in @@ -0,0 +1,185 @@ +# Top level makefile for libgloss +# +# Copyright (c) 1995, 1996 Cygnus Support +# +# The authors hereby grant permission to use, copy, modify, distribute, +# and license this software and its documentation for any purpose, provided +# that existing copyright notices are retained in all copies and that this +# notice is included verbatim in any distributions. No written agreement, +# license, or royalty fee is required for any of the authorized uses. +# Modifications to this software may be copyrighted by their authors +# and need not follow the licensing terms described here, provided that +# the new terms are clearly indicated on the first page of each file where +# they apply. +# + +VPATH = @srcdir@ +srcdir = @srcdir@ +objdir = . +srcroot = $(srcdir)/../.. +objroot = $(objdir)/../.. + +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +host_alias = @host_alias@ +target_alias = @target_alias@ + +bindir = @bindir@ +libdir = @libdir@ +tooldir = $(exec_prefix)/$(target_alias) + +TOP = . +SRCTOP = . + +# Multilib support variables. +# TOP is used instead of MULTI{BUILD,SRC}TOP. +MULTISRCTOP = +MULTIBUILDTOP = +MULTIDIRS = +MULTISUBDIR = +MULTIDO = true +MULTICLEAN = true + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ + +SHELL = /bin/sh + +CC = @CC@ + +AS = @AS@ +AR = @AR@ +LD = @LD@ +RANLIB = @RANLIB@ + +AR_FLAGS = qv +BISON = bison +MAKEINFO = makeinfo + +SUBDIRS = @subdirs@ + +.NOEXPORT: +MAKEOVERRIDES= + +# Host specific makefile fragment comes in here. +@host_makefile_frag@ + +# These are roughly topologically sorted in order to make porting more +# streamlined. +FLAGS_TO_PASS = \ + "CC=$(CC)" \ + "CFLAGS=$(CFLAGS)" \ + "AR=$(AR)" \ + "RANLIB=$(RANLIB)" \ + "AR_FLAGS=$(AR_FLAGS)" \ + "MAKEINFO=$(MAKEINFO)" \ + "AS=$(AS)" \ + "LD=$(LD)" \ + "CROSS_CFLAGS=$(CROSS_CFLAGS)" \ + "TARGET_CFLAGS=$(TARGET_CFLAGS)" \ + "exec_prefix=$(exec_prefix)" \ + "prefix=$(prefix)" \ + "tooldir=$(tooldir)" \ + "INSTALL=$(INSTALL)" \ + "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \ + "INSTALL_DATA=$(INSTALL_DATA)" + +all: stmp-bsp force + @rootpre=`pwd`/; export rootpre; \ + srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \ + $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all + +stmp-bsp: force + @rootpre=`pwd`/; export rootpre; \ + srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \ + for dir in .. ${SUBDIRS}; do \ + if [ x$$dir != x.. ]; then \ + if [ -d $$dir ]; then \ + (cd $$dir; $(MAKE) $(FLAGS_TO_PASS)); \ + else true; fi; \ + else true; fi; \ + done + +install: force + @rootpre=`pwd`/; export rootpre; \ + srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \ + for dir in .. ${SUBDIRS}; do \ + if [ x$$dir != x.. ]; then \ + if [ -d $$dir ]; then \ + (cd $$dir; $(MAKE) $(FLAGS_TO_PASS) install); \ + else true; fi; \ + else true; fi; \ + done + @rootpre=`pwd`/; export rootpre; \ + srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \ + $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install + +test: force + @rootpre=`pwd`/; export rootpre; \ + srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \ + for dir in .. ${SUBDIRS}; do \ + if [ x$$dir != x.. ]; then \ + if [ -d $$dir ]; then \ + (cd $$dir; $(MAKE) $(FLAGS_TO_PASS) test); \ + else true; fi; \ + else true; fi; \ + done + @rootpre=`pwd`/; export rootpre; \ + srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \ + $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=test + +clean-here: + -rm -f *~ core *.o a.out xgdb *.x + +clean mostlyclean: clean-here + rootpre=`pwd`/; export rootpre; \ + srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \ + $(MAKE) DO=$@ DODIRS="$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do; \ + $(MULTICLEAN) multi-clean DO=$@ + +distclean maintainer-clean realclean: clean-here + -rm -f Makefile config.cache config.log config.status + -rm -f *-init.exp site.* + -rm -fr *.log summary detail *.sum + rootpre=`pwd`/; export rootpre; \ + srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \ + $(MAKE) DO=$@ DODIRS="$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do; \ + $(MULTICLEAN) multi-clean DO=$@ + +.PHONY: info install-info clean-info +subdir_do: + @rootpre=`pwd`/; export rootpre; \ + srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \ + for i in .. $(DODIRS); do \ + if [ x$$i != x.. ]; then \ + if [ -f ./$$i/Makefile ]; then \ + if (cd ./$$i; $(MAKE) $(FLAGS_TO_PASS) $(DO)); then \ + true; \ + else \ + exit 1; \ + fi; \ + else true; fi; \ + else true; fi; \ + done + +info dvi docs: + rootpre=`pwd`/; export rootpre; \ + srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \ + $(MAKE) DO=$@ DODIRS=doc $(FLAGS_TO_PASS) subdir_do + +install-info: + rootpre=`pwd`/; export rootpre; \ + srcrootpre=`cd $(srcdir); pwd`/; export srcrootpre; \ + $(MAKE) DO=$@ DODIRS=doc $(FLAGS_TO_PASS) subdir_do + +clean-info: + +force: + +Makefile: Makefile.in config.status @host_makefile_frag_path@ + $(SHELL) config.status + +config.status: configure + $(SHELL) config.status --recheck diff --git a/libgloss/README b/libgloss/README new file mode 100644 index 0000000..197980b --- /dev/null +++ b/libgloss/README @@ -0,0 +1,5 @@ +sparc - Fujitsu Sparclite board. Works on the ex930, ex931, ex933 +hp74x - Hewlett Packard HP742 board. Also some support for the hp743. +m68k - Motorola MVME135 and IDP board. For CPU32 systems. +pa - WinBond and Oki boards with a PA. +mips - R3000 support. Array Tech LSI33k based RAID disk controller. diff --git a/libgloss/close.c b/libgloss/close.c new file mode 100644 index 0000000..7aafcea --- /dev/null +++ b/libgloss/close.c @@ -0,0 +1,25 @@ +/* close.c -- close a file descriptor. + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include "glue.h" + +/* + * close -- We don't need to do anything, but pretend we did. + */ +int +_DEFUN (close ,(fd), + int fd) +{ + return (0); +} diff --git a/libgloss/config/default.mh b/libgloss/config/default.mh new file mode 100644 index 0000000..915c4f6 --- /dev/null +++ b/libgloss/config/default.mh @@ -0,0 +1,31 @@ +NEWLIB_CFLAGS = `if [ -d ${objroot}/newlib ]; then echo -I${objroot}/newlib/targ-include -I${srcroot}/newlib/libc/include; fi` +NEWLIB_LDFLAGS = `if [ -d ${objroot}/newlib ]; then echo -B${objroot}/newlib/ -L${objroot}/newlib/; fi` + +INCLUDES = -I. -I$(srcdir)/.. +# Note that when building the library, ${MULTILIB} is not the way multilib +# options are passed; they're passed in $(CFLAGS). +CFLAGS_FOR_TARGET = -O2 -g ${MULTILIB} ${INCLUDES} ${NEWLIB_CFLAGS} +LDFLAGS_FOR_TARGET = ${MULTILIB} ${NEWLIB_LDFLAGS} +AR_FLAGS = qc + +.c.o: + $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $< + +.C.o: + $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $< +.s.o: + $(AS) $(ASFLAGS_FOR_TARGET) $(INCLUDES) $(ASFLAGS) -o $*.o $< + +# +# GCC knows to run the preprocessor on .S files before it assembles them. +# +.S.o: + $(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) $(CFLAGS) -c $< + +# +# this is a bogus target that'll produce an assembler from the +# C source with the right compiler options. this is so we can +# track down code generation or debug symbol bugs. +# +.c.s: + $(CC) $(CFLAGS_FOR_TARGET) -S $(INCLUDES) $(CFLAGS) $< diff --git a/libgloss/config/default.mt b/libgloss/config/default.mt new file mode 100644 index 0000000..d587247 --- /dev/null +++ b/libgloss/config/default.mt @@ -0,0 +1,33 @@ +# +# these are the minimum required stubs to support newlib +# +close.o: ${srcdir}/../close.c + $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? +fstat.o: ${srcdir}/../fstat.c + $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? +getpid.o: ${srcdir}/../getpid.c + $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? +isatty.o: ${srcdir}/../isatty.c + $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? +kill.o: ${srcdir}/../kill.c + $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? +lseek.o: ${srcdir}/../lseek.c + $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? +open.o: ${srcdir}/../open.c + $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? +print.o: ${srcdir}/../print.c + $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? +putnum.o: ${srcdir}/../putnum.c + $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? +read.o: ${srcdir}/../read.c + $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? +sbrk.o: ${srcdir}/../sbrk.c + $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? +stat.o: ${srcdir}/../stat.c + $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? +unlink.o: ${srcdir}/../unlink.c + $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? +write.o: ${srcdir}/../write.c + $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? +debug.o: ${srcdir}/../debug.c ${srcdir}/../debug.h + $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) ${srcdir}/../debug.c diff --git a/libgloss/config/dos.mh b/libgloss/config/dos.mh new file mode 100644 index 0000000..c5874cb --- /dev/null +++ b/libgloss/config/dos.mh @@ -0,0 +1,57 @@ +NEWLIB_CFLAGS = `if [ -d ${objroot}/newlib ]; then echo -I${objroot}/newlib/targ-include -I${srcroot}/newlib/libc/include; fi` +NEWLIB_LDFLAGS = `if [ -d ${objroot}/newlib ]; then echo -B${objroot}/newlib/; fi` + +INCLUDES = -I. +# Note that when building the library, ${MULTILIB} is not the way multilib +# options are passed; they're passed in $(CFLAGS). +CFLAGS_FOR_TARGET = -O2 -g ${MULTILIB} ${INCLUDES} ${NEWLIB_CFLAGS} +LDFLAGS_FOR_TARGET = ${MULTILIB} ${NEWLIB_LDFLAGS} +ARFLAGS_FOR_TARGET = qc + +# find the tools used to build libgloss. As this is a DOS build in a +# 3way cross, we have to specify the name as it lives prebuilt in Unix +# land. The freshly built tools are for the wrong architecture. +CC_FOR_TARGET = `t='$(program_transform_name)'; echo gcc | sed -e $$t` + +AS_FOR_TARGET = `t='$(program_transform_name)'; echo as | sed -e $$t` + +AR_FOR_TARGET = `t='$(program_transform_name)'; echo ar | sed -e $$t` + +LD_FOR_TARGET = `t='$(program_transform_name)'; echo ld | sed -e $$t` + +RANLIB_FOR_TARGET = `t='$(program_transform_name)'; echo ranlib | sed -e $$t` + +OBJDUMP_FOR_TARGET = `t='$(program_transform_name)'; echo objdump | sed -e $$t` + +OBJCOPY_FOR_TARGET = `t='$(program_transform_name)'; echo objcopy | sed -e $$t` + + +# Using CFLAGS here may be confusing if the user has given a special +# CFLAGS intended for use on the host, since we are passing it to the +# cross-compiler; I'm not sure what to do about this. INCLUDES is +# from the top level Makefile. +# FIXME: But isn't CFLAGS what is used to pass multilib options when +# building the library? + +.c.o: + rootme=`pwd` ; \ + echo CC_FOR_TARGET is ${CC_FOR_TARGET} ; \ + $(CC_FOR_TARGET) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $< + +.c.s: + rootme=`pwd` ; \ + echo CC_FOR_TARGET is ${CC_FOR_TARGET} ; \ + $(CC_FOR_TARGET) $(CFLAGS_FOR_TARGET) -S $(INCLUDES) $< + +.S.o: + rootme=`pwd` ; \ + echo CC_FOR_TARGET is ${CC_FOR_TARGET} ; \ + $(CC_FOR_TARGET) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $< + +.s.o: + rootme=`pwd` ; \ + echo AS_FOR_TARGET is ${AS_FOR_TARGET} ; \ + $(AS_FOR_TARGET) $(ASFLAGS_FOR_TARGET) $(INCLUDES) -o $*.o $< + + + diff --git a/libgloss/config/mips.mt b/libgloss/config/mips.mt new file mode 100644 index 0000000..6ae84b4 --- /dev/null +++ b/libgloss/config/mips.mt @@ -0,0 +1,31 @@ +# +# These are the minimum required stubs to support newlib +# for embedded MIPS targets. Note that although read.o and write.o +# are mentioned here, they are not used for all targets. +# +close.o: ${srcdir}/../close.c + $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? +fstat.o: ${srcdir}/../fstat.c + $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? +getpid.o: ${srcdir}/../getpid.c + $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? +isatty.o: ${srcdir}/../isatty.c + $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? +kill.o: ${srcdir}/../kill.c + $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? +lseek.o: ${srcdir}/../lseek.c + $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? +open.o: ${srcdir}/../open.c + $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? +print.o: ${srcdir}/../print.c + $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? +putnum.o: ${srcdir}/../putnum.c + $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? +read.o: ${srcdir}/../read.c + $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? +stat.o: ${srcdir}/../stat.c + $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? +unlink.o: ${srcdir}/../unlink.c + $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? +write.o: ${srcdir}/../write.c + $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $? diff --git a/libgloss/config/mn10200.mt b/libgloss/config/mn10200.mt new file mode 100644 index 0000000..cf565c1 --- /dev/null +++ b/libgloss/config/mn10200.mt @@ -0,0 +1,3 @@ +# Dummy target-specific Makefile fragment for MN10200. We can't +# use default.mt because it refers to generic source files whose +# names conflict with the MN10200-specific sources. diff --git a/libgloss/config/mn10300.mt b/libgloss/config/mn10300.mt new file mode 100644 index 0000000..6b4c522 --- /dev/null +++ b/libgloss/config/mn10300.mt @@ -0,0 +1,3 @@ +# Dummy target-specific Makefile fragment for MN10300. We can't +# use default.mt because it refers to generic source files whose +# names conflict with the MN10300-specific sources. diff --git a/libgloss/config/ppc.mh b/libgloss/config/ppc.mh new file mode 100644 index 0000000..b5b8c30 --- /dev/null +++ b/libgloss/config/ppc.mh @@ -0,0 +1,35 @@ +NEWLIB_CFLAGS = `if [ -d ${objroot}/newlib ]; then echo -I${objroot}/newlib/targ-include -I${srcroot}/newlib/libc/include; fi` +NEWLIB_LDFLAGS = `if [ -d ${objroot}/newlib ]; then echo -B${objroot}/newlib/ -L${objroot}/newlib/; fi` + +# For the PowerPC, always add -mrelocatable-lib -mno-eabi. These are set for the +# multilibs, but are ignored when building the toplevel directory. +CFLAGS_MRELOCATABLE = -mrelocatable-lib -mno-eabi + +INCLUDES = -I. -I$(srcdir)/.. +# Note that when building the library, ${MULTILIB} is not the way multilib +# options are passed; they're passed in $(CFLAGS). +CFLAGS_FOR_TARGET = -O2 -g ${MULTILIB} ${INCLUDES} ${NEWLIB_CFLAGS} +LDFLAGS_FOR_TARGET = ${MULTILIB} ${NEWLIB_LDFLAGS} +AR_FLAGS = qc + +.c.o: + $(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS_MRELOCATABLE) -O2 $(INCLUDES) -c $(CFLAGS) $< + +.C.o: + $(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS_MRELOCATABLE) -O2 $(INCLUDES) -c $(CFLAGS) $< +.s.o: + $(AS) $(ASFLAGS_FOR_TARGET) $(INCLUDES) $(ASFLAGS) -o $*.o $< + +# +# GCC knows to run the preprocessor on .S files before it assembles them. +# +.S.o: + $(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS_MRELOCATABLE) $(INCLUDES) $(CFLAGS) -c $< + +# +# this is a bogus target that'll produce an assembler from the +# C source with the right compiler options. this is so we can +# track down code generation or debug symbol bugs. +# +.c.s: + $(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS_MRELOCATABLE) -S $(INCLUDES) $(CFLAGS) $< diff --git a/libgloss/configure b/libgloss/configure new file mode 100755 index 0000000..17845c9 --- /dev/null +++ b/libgloss/configure @@ -0,0 +1,1403 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.13 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +sitefile= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --site-file=FILE use FILE as the site file + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -site-file | --site-file | --site-fil | --site-fi | --site-f) + ac_prev=sitefile ;; + -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*) + sitefile="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.13" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=README + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$sitefile"; then + if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi + fi +else + CONFIG_SITE="$sitefile" +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +ac_exeext= +ac_objext=o +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + +if test "${enable_shared}" = "yes" ; then + echo "Shared libraries not supported for cross compiling, ignored" +fi + +if test "${srcdir}" = "." ; then + if test "${with_target_subdir}" != "." ; then + libgloss_topdir="${srcdir}/${with_multisrctop}../.." + else + libgloss_topdir="${srcdir}/${with_multisrctop}.." + fi +else + libgloss_topdir="${srcdir}/.." +fi +ac_aux_dir= +for ac_dir in $libgloss_topdir $srcdir/$libgloss_topdir; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $libgloss_topdir $srcdir/$libgloss_topdir" 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:582: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + + +# Do some error checking and defaulting for the host and target type. +# The inputs are: +# configure --host=HOST --target=TARGET --build=BUILD NONOPT +# +# The rules are: +# 1. You are not allowed to specify --host, --target, and nonopt at the +# same time. +# 2. Host defaults to nonopt. +# 3. If nonopt is not specified, then host defaults to the current host, +# as determined by config.guess. +# 4. Target and build default to nonopt. +# 5. If nonopt is not specified, then target and build default to host. + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +case $host---$target---$nonopt in +NONE---*---* | *---NONE---* | *---*---NONE) ;; +*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;; +esac + + +# Make sure we can run config.sub. +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi + +echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:663: checking host system type" >&5 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + +echo $ac_n "checking target system type""... $ac_c" 1>&6 +echo "configure:684: checking target system type" >&5 + +target_alias=$target +case "$target_alias" in +NONE) + case $nonopt in + NONE) target_alias=$host_alias ;; + *) target_alias=$nonopt ;; + esac ;; +esac + +target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias` +target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$target" 1>&6 + +echo $ac_n "checking build system type""... $ac_c" 1>&6 +echo "configure:702: checking build system type" >&5 + +build_alias=$build +case "$build_alias" in +NONE) + case $nonopt in + NONE) build_alias=$host_alias ;; + *) build_alias=$nonopt ;; + esac ;; +esac + +build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` +build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$build" 1>&6 + +test "$host_alias" != "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + + +if test -z "${with_multisubdir}" ; then + configdirs="doc libnosys" +else + configdirs="libnosys" +fi + +case "${target}" in + i386-*-elf*) + configdirs="${configdirs} i386 testsuite"; + ;; + m32r-*-*) + configdirs="${configdirs} m32r testsuite" + ;; + m68*-*-*) + configdirs="${configdirs} m68k testsuite" + ;; + hppa*-*-pro*) + configdirs="${configdirs} pa testsuite" + ;; + i960-*-coff) + configdirs="${configdirs} i960 testsuite" + ;; + sparc-*-elf*) + configdirs="${configdirs} sparc testsuite" + ;; + sparc64-*-elf*) + configdirs="${configdirs} sparc testsuite" + ;; + sparc86x-*-*) + configdirs="${configdirs} sparc testsuite" + ;; + sparclite-*-*) + configdirs="${configdirs} sparc testsuite" + ;; + sparclet-*-aout*) + configdirs="${configdirs} sparc sparc/libsys testsuite" + ;; + *arm-wince-pe) + configdirs="wince" + ;; + sh*-*-pe) + configdirs="wince" + ;; + mips*-*-pe) + configdirs="wince" + ;; + mips*-*-*) + configdirs="${configdirs} mips testsuite" + ;; + powerpc-*-*|powerpcle-*-*) + configdirs="${configdirs} rs6000 testsuite" + ;; + mn10200-*-*) + configdirs="${configdirs} mn10200 testsuite" + ;; + mn10300-*-*) + configdirs="${configdirs} mn10300 testsuite" + ;; + d30v-*-*) + configdirs="${configdirs} d30v testsuite" + ;; + fr30-*-*) + configdirs="${configdirs} fr30 testsuite" + ;; + mcore-*-*) + configdirs="${configdirs} mcore testsuite" + ;; +esac + +# temporarily strip out testsuite +configdirs=`echo $configdirs | sed 's/testsuite//'` + +subdirs="$configdirs" + + +# FIXME: We temporarily define our own version of AC_PROG_CC. This is +# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We +# are probably using a cross compiler, which will not be able to fully +# link an executable. This should really be fixed in autoconf +# itself. + + + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:826: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:856: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +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 $# -gt 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 + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:905: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <<EOF +#ifdef __GNUC__ + yes; +#endif +EOF +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:914: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:929: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi + +AS=${AS-as} + +# Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:961: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_AR="ar" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_AR" && ac_cv_prog_AR=":" +fi +fi +AR="$ac_cv_prog_AR" +if test -n "$AR"; then + echo "$ac_t""$AR" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +AR=${AR-ar} + +LD=${LD-ld} + +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:995: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +host_makefile_frag=${srcdir}/config/default.mh + +host_makefile_frag_path=$host_makefile_frag + + + +# for now, only add multilibs for specific targets +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs + + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS <<EOF +#! /bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.13" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS <<EOF + +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; + s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@FFLAGS@%$FFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@host@%$host%g +s%@host_alias@%$host_alias%g +s%@host_cpu@%$host_cpu%g +s%@host_vendor@%$host_vendor%g +s%@host_os@%$host_os%g +s%@target@%$target%g +s%@target_alias@%$target_alias%g +s%@target_cpu@%$target_cpu%g +s%@target_vendor@%$target_vendor%g +s%@target_os@%$target_os%g +s%@build@%$build%g +s%@build_alias@%$build_alias%g +s%@build_cpu@%$build_cpu%g +s%@build_vendor@%$build_vendor%g +s%@build_os@%$build_os%g +s%@subdirs@%$subdirs%g +s%@CC@%$CC%g +s%@AS@%$AS%g +s%@AR@%$AR%g +s%@LD@%$LD%g +s%@RANLIB@%$RANLIB%g +s%@host_makefile_frag_path@%$host_makefile_frag_path%g +/@host_makefile_frag@/r $host_makefile_frag +s%@host_makefile_frag@%%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <<EOF + +CONFIG_FILES=\${CONFIG_FILES-"Makefile"} +EOF +cat >> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +EOF +cat >> $CONFIG_STATUS <<EOF +srcdir=${srcdir} +target=${target} +with_multisubdir=${with_multisubdir} +ac_configure_args="--enable-multilib ${ac_configure_args}" +CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} +libgloss_topdir=${libgloss_topdir} + +EOF +cat >> $CONFIG_STATUS <<\EOF +. ${libgloss_topdir}/config-ml.in +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + +if test "$no_recursion" != yes; then + + # Remove --cache-file and --srcdir arguments so they do not pile up. + ac_sub_configure_args= + ac_prev= + for ac_arg in $ac_configure_args; do + if test -n "$ac_prev"; then + ac_prev= + continue + fi + case "$ac_arg" in + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + ;; + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + ;; + *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;; + esac + done + + for ac_config_dir in $configdirs; do + + # Do not complain, so a configure script can configure whichever + # parts of a large source tree are present. + if test ! -d $srcdir/$ac_config_dir; then + continue + fi + + echo configuring in $ac_config_dir + + case "$srcdir" in + .) ;; + *) + if test -d ./$ac_config_dir || mkdir ./$ac_config_dir; then :; + else + { echo "configure: error: can not create `pwd`/$ac_config_dir" 1>&2; exit 1; } + fi + ;; + esac + + ac_popdir=`pwd` + cd $ac_config_dir + + # A "../" for each directory in /$ac_config_dir. + ac_dots=`echo $ac_config_dir|sed -e 's%^\./%%' -e 's%[^/]$%&/%' -e 's%[^/]*/%../%g'` + + case "$srcdir" in + .) # No --srcdir option. We are building in place. + ac_sub_srcdir=$srcdir ;; + /*) # Absolute path. + ac_sub_srcdir=$srcdir/$ac_config_dir ;; + *) # Relative path. + ac_sub_srcdir=$ac_dots$srcdir/$ac_config_dir ;; + esac + + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_sub_srcdir/configure; then + ac_sub_configure=$ac_sub_srcdir/configure + elif test -f $ac_sub_srcdir/configure.in; then + ac_sub_configure=$ac_configure + else + echo "configure: warning: no configuration information is in $ac_config_dir" 1>&2 + ac_sub_configure= + fi + + # The recursion is here. + if test -n "$ac_sub_configure"; then + + # Make the cache file name correct relative to the subdirectory. + case "$cache_file" in + /*) ac_sub_cache_file=$cache_file ;; + *) # Relative path. + ac_sub_cache_file="$ac_dots$cache_file" ;; + esac + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo "running ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir" + # The eval makes quoting arguments work. + if eval ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir + then : + else + { echo "configure: error: $ac_sub_configure failed for $ac_config_dir" 1>&2; exit 1; } + fi + fi + + cd $ac_popdir + done +fi + + + + diff --git a/libgloss/configure.in b/libgloss/configure.in new file mode 100644 index 0000000..9d9edd0 --- /dev/null +++ b/libgloss/configure.in @@ -0,0 +1,168 @@ +dnl Process this file with autoconf to produce a configure script. +AC_PREREQ(2.7)dnl +AC_INIT(README) + +if test "${enable_shared}" = "yes" ; then + echo "Shared libraries not supported for cross compiling, ignored" +fi + +if test "${srcdir}" = "." ; then + if test "${with_target_subdir}" != "." ; then + libgloss_topdir="${srcdir}/${with_multisrctop}../.." + else + libgloss_topdir="${srcdir}/${with_multisrctop}.." + fi +else + libgloss_topdir="${srcdir}/.." +fi +AC_CONFIG_AUX_DIR($libgloss_topdir) + +AC_PROG_INSTALL + +AC_CANONICAL_SYSTEM + +if test -z "${with_multisubdir}" ; then + configdirs="doc libnosys" +else + configdirs="libnosys" +fi + +case "${target}" in + i386-*-elf*) + configdirs="${configdirs} i386 testsuite"; + ;; + m32r-*-*) + configdirs="${configdirs} m32r testsuite" + ;; + m68*-*-*) + configdirs="${configdirs} m68k testsuite" + ;; + hppa*-*-pro*) + configdirs="${configdirs} pa testsuite" + ;; + i960-*-coff) + configdirs="${configdirs} i960 testsuite" + ;; + sparc-*-elf*) + configdirs="${configdirs} sparc testsuite" + ;; + sparc64-*-elf*) + configdirs="${configdirs} sparc testsuite" + ;; + sparc86x-*-*) + configdirs="${configdirs} sparc testsuite" + ;; + sparclite-*-*) + configdirs="${configdirs} sparc testsuite" + ;; + sparclet-*-aout*) + configdirs="${configdirs} sparc sparc/libsys testsuite" + ;; + *arm-wince-pe) + configdirs="wince" + ;; + sh*-*-pe) + configdirs="wince" + ;; + mips*-*-pe) + configdirs="wince" + ;; + mips*-*-*) + configdirs="${configdirs} mips testsuite" + ;; + powerpc-*-*|powerpcle-*-*) + configdirs="${configdirs} rs6000 testsuite" + ;; + mn10200-*-*) + configdirs="${configdirs} mn10200 testsuite" + ;; + mn10300-*-*) + configdirs="${configdirs} mn10300 testsuite" + ;; + d30v-*-*) + configdirs="${configdirs} d30v testsuite" + ;; + fr30-*-*) + configdirs="${configdirs} fr30 testsuite" + ;; + mcore-*-*) + configdirs="${configdirs} mcore testsuite" + ;; +esac + +# temporarily strip out testsuite +configdirs=`echo $configdirs | sed 's/testsuite//'` + +AC_CONFIG_SUBDIRS($configdirs) + +# FIXME: We temporarily define our own version of AC_PROG_CC. This is +# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We +# are probably using a cross compiler, which will not be able to fully +# link an executable. This should really be fixed in autoconf +# itself. + +AC_DEFUN(LIB_AC_PROG_CC, +[AC_BEFORE([$0], [AC_PROG_CPP])dnl +AC_CHECK_PROG(CC, gcc, gcc) +if test -z "$CC"; then + AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) + test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) +fi + +AC_PROG_CC_GNU + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +dnl Check whether -g works, even if CFLAGS is set, in case the package +dnl plays around with CFLAGS (such as to build both debugging and +dnl normal versions of a library), tasteless as that idea is. + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + AC_PROG_CC_G + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi +]) + +LIB_AC_PROG_CC +AS=${AS-as} +AC_SUBST(AS) +AC_CHECK_PROG(AR, ar, ar, :) +AR=${AR-ar} +AC_SUBST(AR) +LD=${LD-ld} +AC_SUBST(LD) +AC_PROG_RANLIB + +host_makefile_frag=${srcdir}/config/default.mh + +dnl We have to assign the same value to other variables because autoconf +dnl doesn't provide a mechanism to substitute a replacement keyword with +dnl arbitrary data or pathnames. +dnl +host_makefile_frag_path=$host_makefile_frag +AC_SUBST(host_makefile_frag_path) +AC_SUBST_FILE(host_makefile_frag) + +# for now, only add multilibs for specific targets +AC_OUTPUT(Makefile, +. ${libgloss_topdir}/config-ml.in, +srcdir=${srcdir} +target=${target} +with_multisubdir=${with_multisubdir} +ac_configure_args="--enable-multilib ${ac_configure_args}" +CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} +libgloss_topdir=${libgloss_topdir} +) + + + diff --git a/libgloss/d30v/Makefile.in b/libgloss/d30v/Makefile.in new file mode 100644 index 0000000..b652016 --- /dev/null +++ b/libgloss/d30v/Makefile.in @@ -0,0 +1,128 @@ +# Copyright (c) 1997 Cygnus Support +# +# The authors hereby grant permission to use, copy, modify, distribute, +# and license this software and its documentation for any purpose, provided +# that existing copyright notices are retained in all copies and that this +# notice is included verbatim in any distributions. No written agreement, +# license, or royalty fee is required for any of the authorized uses. +# Modifications to this software may be copyrighted by their authors +# and need not follow the licensing terms described here, provided that +# the new terms are clearly indicated on the first page of each file where +# they apply. +# + +# +# This currently works with the D30V simulator. +# + +VPATH = @srcdir@ @srcdir@/.. +srcdir = @srcdir@ +objdir = . +srcroot = $(srcdir)/../.. +objroot = $(objdir)/../.. + +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +host_alias = @host_alias@ +target_alias = @target_alias@ + +bindir = @bindir@ +libdir = @libdir@ +tooldir = $(exec_prefix)/$(target_alias) + +# Multilib support variables. +# TOP is used instead of MULTI{BUILD,SRC}TOP. +MULTIDIRS = +MULTISUBDIR = +MULTIDO = true +MULTICLEAN = true + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ + +SHELL = /bin/sh + +CC = @CC@ + +AS = @AS@ +AR = @AR@ +LD = @LD@ +RANLIB = @RANLIB@ + +OBJDUMP = `if [ -f ${objroot}/../binutils/objdump ] ; \ + then echo ${objroot}/../binutils/objdump ; \ + else t='$(program_transform_name)'; echo objdump | sed -e $$t ; fi` +OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \ + then echo ${objroot}/../binutils/objcopy ; \ + else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi` + +OBJS = isatty.o print.o putnum.o sbrk.o +CFLAGS = -g +SCRIPTS = ${SIM_SCRIPTS} + +# Here is all of the simulator stuff +SIM_SCRIPTS = +SIM_LDFLAGS = +SIM_BSP = libsim.a +SIM_CRT0 = crt0.o +SIM_OBJS = syscalls.o outbyte.o inbyte.o +SIM_TEST = +SIM_INSTALL = install-sim + +# Host specific makefile fragment comes in here. +@host_makefile_frag@ + +# +# 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. +# +all: ${SIM_CRT0} ${SIM_BSP} + +# +# here's where we build the board support packages for each target +# + +${SIM_BSP}: ${OBJS} ${SIM_OBJS} + ${AR} ${ARFLAGS} $@ ${SIM_OBJS} ${OBJS} + ${RANLIB} $@ + +# +# here's where we build the test programs for each target +# +.PHONY: test +test: ${SIM_TEST} + +crt0.o: crt0.S +syscalls.o: syscalls.c $(srcdir)/../syscall.h +outbyte.o: outbyte.c +inbyte.o: inbyte.c + +isatty.o: $(srcdir)/../isatty.c +print.o: $(srcdir)/../print.c +putnum.o: $(srcdir)/../putnum.c +sbrk.o: $(srcdir)/../sbrk.c + +clean mostlyclean: + rm -f a.out core *.[oais] *-test *.srec *.dis *.x syscall.h + +distclean maintainer-clean realclean: clean + rm -f Makefile config.status *~ + +.PHONY: install info install-info clean-info +install: ${SIM_INSTALL} + +install-sim: + set -e; for x in ${SIM_CRT0} ${SIM_BSP} ${SIM_SCRIPTS}; do ${INSTALL_DATA} $$x ${tooldir}/lib${MULTISUBDIR}/$$x; done + +doc: +info: +install-info: +clean-info: + +Makefile: Makefile.in config.status @host_makefile_frag_path@ + $(SHELL) config.status + +config.status: configure + $(SHELL) config.status --recheck diff --git a/libgloss/d30v/configure b/libgloss/d30v/configure new file mode 100755 index 0000000..c314876 --- /dev/null +++ b/libgloss/d30v/configure @@ -0,0 +1,1191 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.12.1 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.12.1" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=crt0.S + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + +if test "${enable_shared}" = "yes" ; then + echo "Shared libraries not supported for cross compiling, ignored" +fi + +if test "$srcdir" = "." ; then + if test "${with_target_subdir}" != "." ; then + libgloss_topdir="${srcdir}/${with_multisrctop}../../.." + else + libgloss_topdir="${srcdir}/${with_multisrctop}../.." + fi +else + libgloss_topdir="${srcdir}/../.." +fi +ac_aux_dir= +for ac_dir in $libgloss_topdir $srcdir/$libgloss_topdir; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $libgloss_topdir $srcdir/$libgloss_topdir" 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + + + +# Do some error checking and defaulting for the host and target type. +# The inputs are: +# configure --host=HOST --target=TARGET --build=BUILD NONOPT +# +# The rules are: +# 1. You are not allowed to specify --host, --target, and nonopt at the +# same time. +# 2. Host defaults to nonopt. +# 3. If nonopt is not specified, then host defaults to the current host, +# as determined by config.guess. +# 4. Target and build default to nonopt. +# 5. If nonopt is not specified, then target and build default to host. + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +case $host---$target---$nonopt in +NONE---*---* | *---NONE---* | *---*---NONE) ;; +*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;; +esac + + +# Make sure we can run config.sub. +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi + +echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:584: checking host system type" >&5 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + +echo $ac_n "checking target system type""... $ac_c" 1>&6 +echo "configure:605: checking target system type" >&5 + +target_alias=$target +case "$target_alias" in +NONE) + case $nonopt in + NONE) target_alias=$host_alias ;; + *) target_alias=$nonopt ;; + esac ;; +esac + +target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias` +target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$target" 1>&6 + +echo $ac_n "checking build system type""... $ac_c" 1>&6 +echo "configure:623: checking build system type" >&5 + +build_alias=$build +case "$build_alias" in +NONE) + case $nonopt in + NONE) build_alias=$host_alias ;; + *) build_alias=$nonopt ;; + esac ;; +esac + +build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` +build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$build" 1>&6 + +test "$host_alias" != "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + +if test "$program_transform_name" = s,x,x,; then + program_transform_name= +else + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed +s,\\,\\\\,g; s,\$,$$,g +EOF_SED + program_transform_name="`echo $program_transform_name|sed -f conftestsed`" + rm -f conftestsed +fi +test "$program_prefix" != NONE && + program_transform_name="s,^,${program_prefix},; $program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" + +# sed with no file args requires a program. +test "$program_transform_name" = "" && program_transform_name="s,x,x," + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:676: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + for ac_prog in ginstall installbsd scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + # OSF/1 installbsd also uses dspmsg, but is usable. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +# FIXME: We temporarily define our own version of AC_PROG_CC. This is +# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We +# are probably using a cross compiler, which will not be able to fully +# link an executable. This should really be fixed in autoconf +# itself. + + + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:737: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:766: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + ac_prog_rejected=no + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +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 $# -gt 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 + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:814: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <<EOF +#ifdef __GNUC__ + yes; +#endif +EOF +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:823: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:838: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi + + +AS=${AS-as} + +AR=${AR-ar} + +LD=${LD-ld} + +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:875: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +host_makefile_frag=${srcdir}/../config/default.mh + +host_makefile_frag_path=$host_makefile_frag + + + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs + + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS <<EOF +#! /bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.12.1" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS <<EOF + +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; + s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@host@%$host%g +s%@host_alias@%$host_alias%g +s%@host_cpu@%$host_cpu%g +s%@host_vendor@%$host_vendor%g +s%@host_os@%$host_os%g +s%@target@%$target%g +s%@target_alias@%$target_alias%g +s%@target_cpu@%$target_cpu%g +s%@target_vendor@%$target_vendor%g +s%@target_os@%$target_os%g +s%@build@%$build%g +s%@build_alias@%$build_alias%g +s%@build_cpu@%$build_cpu%g +s%@build_vendor@%$build_vendor%g +s%@build_os@%$build_os%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@CC@%$CC%g +s%@AS@%$AS%g +s%@AR@%$AR%g +s%@LD@%$LD%g +s%@RANLIB@%$RANLIB%g +s%@host_makefile_frag_path@%$host_makefile_frag_path%g +/@host_makefile_frag@/r $host_makefile_frag +s%@host_makefile_frag@%%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <<EOF + +CONFIG_FILES=\${CONFIG_FILES-"Makefile"} +EOF +cat >> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +EOF +cat >> $CONFIG_STATUS <<EOF +srcdir=${srcdir} +target=${target} +ac_configure_args="${ac_configure_args} --enable-multilib" +CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} +libgloss_topdir=${libgloss_topdir} + +EOF +cat >> $CONFIG_STATUS <<\EOF +. ${libgloss_topdir}/config-ml.in +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + diff --git a/libgloss/d30v/configure.in b/libgloss/d30v/configure.in new file mode 100644 index 0000000..877f6a0 --- /dev/null +++ b/libgloss/d30v/configure.in @@ -0,0 +1,90 @@ +dnl Process this file with autoconf to produce a configure script. +AC_PREREQ(2.5)dnl +AC_INIT(crt0.S) + +if test "${enable_shared}" = "yes" ; then + echo "Shared libraries not supported for cross compiling, ignored" +fi + +if test "$srcdir" = "." ; then + if test "${with_target_subdir}" != "." ; then + libgloss_topdir="${srcdir}/${with_multisrctop}../../.." + else + libgloss_topdir="${srcdir}/${with_multisrctop}../.." + fi +else + libgloss_topdir="${srcdir}/../.." +fi +AC_CONFIG_AUX_DIR($libgloss_topdir) + +AC_CANONICAL_SYSTEM +AC_ARG_PROGRAM + +AC_PROG_INSTALL + +# FIXME: We temporarily define our own version of AC_PROG_CC. This is +# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We +# are probably using a cross compiler, which will not be able to fully +# link an executable. This should really be fixed in autoconf +# itself. + +AC_DEFUN(LIB_AC_PROG_CC, +[AC_BEFORE([$0], [AC_PROG_CPP])dnl +AC_CHECK_PROG(CC, gcc, gcc) +if test -z "$CC"; then + AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) + test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) +fi + +AC_PROG_CC_GNU + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +dnl Check whether -g works, even if CFLAGS is set, in case the package +dnl plays around with CFLAGS (such as to build both debugging and +dnl normal versions of a library), tasteless as that idea is. + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + AC_PROG_CC_G + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi +]) + +LIB_AC_PROG_CC + +AS=${AS-as} +AC_SUBST(AS) +AR=${AR-ar} +AC_SUBST(AR) +LD=${LD-ld} +AC_SUBST(LD) +AC_PROG_RANLIB + +host_makefile_frag=${srcdir}/../config/default.mh + +dnl We have to assign the same value to other variables because autoconf +dnl doesn't provide a mechanism to substitute a replacement keyword with +dnl arbitrary data or pathnames. +dnl +host_makefile_frag_path=$host_makefile_frag +AC_SUBST(host_makefile_frag_path) +AC_SUBST_FILE(host_makefile_frag) + +AC_OUTPUT(Makefile, +. ${libgloss_topdir}/config-ml.in, +srcdir=${srcdir} +target=${target} +ac_configure_args="${ac_configure_args} --enable-multilib" +CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} +libgloss_topdir=${libgloss_topdir} +) diff --git a/libgloss/d30v/crt0.S b/libgloss/d30v/crt0.S new file mode 100644 index 0000000..e2ca8a5 --- /dev/null +++ b/libgloss/d30v/crt0.S @@ -0,0 +1,56 @@ +/* + * crt0.S -- startup file for D30V systems. + * + * Copyright (c) 1997 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + + .file "crt0.S" + .text + .globl _start + .extern main + .extern exit + .extern __stack + .extern __sbss_start + .extern __sbss_end + .extern __ebss_start + .extern __ebss_end + .extern __bss_start + .extern __bss_end + .extern memset + .type _start,@function + +_start: or.l sp,r0,__stack + + /* Zero the .sbss area */ + or.l r2,r0,__sbss_start + or.l r4,r0,__sbss_end + sub r4,r4,r2 || or.s r3,r0,0 + bsrtnz.l r4,(memset) + + /* Zero the .ebss area */ + or.l r2,r0,__ebss_start + or.l r4,r0,__ebss_end + sub r4,r4,r2 || or.s r3,r0,0 + bsrtnz.l r4,(memset) + + /* Zero the .bss area */ + or.l r2,r0,__bss_start + or.l r4,r0,__bss_end + sub r4,r4,r2 || or.s r3,r0,0 + bsrtnz.l r4,(memset) + + or.s r2,r0,0 || or.s r3,r0,0 + or r4,r0,0 || nop + jsr.l (main) + jsr.l (exit) + .size _start,.-_start diff --git a/libgloss/d30v/inbyte.c b/libgloss/d30v/inbyte.c new file mode 100644 index 0000000..8a2001c --- /dev/null +++ b/libgloss/d30v/inbyte.c @@ -0,0 +1,24 @@ +/* inbyte -- read a single byte. + * + * Copyright (c) 1997 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +int +inbyte (void) +{ + char ch; + if (read (0, &ch, 1) == 1) + return ch; + + return -1; +} diff --git a/libgloss/d30v/outbyte.c b/libgloss/d30v/outbyte.c new file mode 100644 index 0000000..4421eff --- /dev/null +++ b/libgloss/d30v/outbyte.c @@ -0,0 +1,21 @@ +/* outbyte -- write a single byte. + * + * Copyright (c) 1997 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +void +outbyte (int byte) +{ + char ch = byte; + write (1, &ch, 1); +} diff --git a/libgloss/d30v/syscalls.c b/libgloss/d30v/syscalls.c new file mode 100644 index 0000000..58c738c --- /dev/null +++ b/libgloss/d30v/syscalls.c @@ -0,0 +1,146 @@ +/* + * syscalls.c -- provide system call support via trap 31 + * + * Copyright (c) 1997 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + * + * Read bytes, using simulator trap 31. + */ + +#include <stdlib.h> +#include "syscall.h" + +extern int *__errno(), errno; + +__asm__ ( +" .globl __syscall + .type __syscall,@function +__syscall: + trap 31 || nop + cmpge f0,r2,0 -> jmp/tx link + bra __set_errno + .size __syscall,.-__syscall +"); + +int +__set_errno (int new_errno) +{ + errno = new_errno; + *(__errno)() = errno; + return -1; +} + +void +_exit (int status) +{ + __syscall (status, 0, 0, 0, SYS_exit); +} + +int +open (const char *filename, int flags, int mode) +{ + return __syscall (filename, flags, mode, 0, SYS_open); +} + +int +close (int filedes) +{ + return __syscall (filedes, 0, 0, 0, SYS_close); +} + +int +read (int filedes, void *buffer, size_t length) +{ + return __syscall (filedes, buffer, length, 0, SYS_read); +} + +int +write (int filedes, void *buffer, size_t length) +{ + return __syscall (filedes, buffer, length, 0, SYS_write); +} + +long +lseek (int filedes, long offset, int whence) +{ + return __syscall (filedes, offset, whence, 0, SYS_lseek); +} + +int +unlink (const char *filename) +{ + return __syscall (filename, 0, 0, 0, SYS_unlink); +} + +int +getpid (void) +{ + return __syscall (0, 0, 0, 0, SYS_getpid); +} + +int +kill (int signal, int pid) +{ + return __syscall (signal, pid, 0, 0, SYS_kill); +} + +int +fstat (int filedes, void *info) +{ + return __syscall (filedes, info, 0, 0, SYS_fstat); +} + +int +__argvlen (void) +{ + return __syscall (0, 0, 0, 0, SYS_argvlen); +} + +int +__argv (void) +{ + return __syscall (0, 0, 0, 0, SYS_argv); +} + +int +chdir (char *dir) +{ + return __syscall (dir, 0, 0, 0, SYS_chdir); +} + +int +stat (const char *filename, void *info) +{ + return __syscall (filename, info, 0, 0, SYS_stat); +} + +int +chmod (const char *filename, int mode) +{ + return __syscall (filename, mode, 0, 0, SYS_chmod); +} + +int +utime (const char *filename, void *packet) +{ + return __syscall (filename, packet, 0, 0, SYS_utime); +} + +time_t +time (time_t *time_ptr) +{ + time_t result; + result = (time_t) __syscall (time_ptr, 0, 0, 0, SYS_time); + if (time_ptr != NULL) + *time_ptr = result; + return result; +} diff --git a/libgloss/debug.c b/libgloss/debug.c new file mode 100644 index 0000000..3b1c8ff --- /dev/null +++ b/libgloss/debug.c @@ -0,0 +1,848 @@ +/* + * Copyright (c) 1995, 1996 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +/* + * A debug packet whose contents are <data> looks like: + * + * $ <data> # CSUM1 CSUM2 + * + * <data> must be ASCII alphanumeric and cannot include characters + * '$' or '#'. If <data> starts with two characters followed by + * ':', then the existing stubs interpret this as a sequence number. + * + * CSUM1 and CSUM2 are ascii hex representation of an 8-bit + * checksum of <data>, the most significant nibble is sent first. + * the hex digits 0-9,a-f are used. + * + * We respond with: + * + * + - if CSUM is correct and ready for next packet + * - - if CSUM is incorrect + * + * <data> is as follows: + * Most values are encoded in ascii hex digits. + */ + +#include "debug.h" +#include <signal.h> + +/* + * buffers that hold the packets while they're being constructed. + */ +char packet_in_buf[BUFMAX]; +char packet_out_buf[BUFMAX]; +int packet_index; + +/* + * indicate to caller of mem2hex or hex2mem that there has been an error. + * 0 means ok, 1 means error + */ +volatile int mem_err = 0; + +/* + * 1 means print debugging messages from the target, 0 means be quiet. This is + * changed by gdb_debug(). + */ +int remote_debug = 0; + +/* + * indicate whether the debug vectors ahave been initialized + * 0 means not yet, 1 means yep, it's ready. + */ +int initialized = 0; + +/* + * These variables are instantialted in the GDB stub code. + */ + +/* this is a list of signal to exception mappings. */ +extern struct trap_info hard_trap_info[]; + +/* this is a memory fault exception handler, used by mem2hex & hex2mem */ +extern void set_mem_fault_trap(); + +/* + * print debugging messages. This uses print, rather than one of the + * stdio routines, cause if there are stack or memory problems, the + * stdio routines don't work. + * params are the debug level, and the string to print + * it doesn't return anything. + */ +void +debuglog(int level, char *msg) +{ + char *p; + unsigned char buf[BUFMAX]; + char newmsg[BUFMAX]; + int i; + + if (level > remote_debug) + return; + + if ((level <0) || (level > 100)) { + print ("ERROR: debug print level out of range"); + return; + } + + /* convert some characters so it'll look right in the log */ + p = newmsg; + for (i = 0 ; msg[i] != '\0'; i++) { + if (i > BUFMAX) + print ("\r\nERROR: Debug message too long\r\n"); + switch (msg[i]) { + case '\n': /* newlines */ + *p++ = '\\'; + *p++ = 'n'; + continue; + case '\r': /* carriage returns */ + *p++ = '\\'; + *p++ = 'r'; + continue; + case '\033': /* escape */ + *p++ = '\\'; + *p++ = 'e'; + continue; + case '\t': /* tab */ + *p++ = '\\'; + *p++ = 't'; + continue; + case '\b': /* backspace */ + *p++ = '\\'; + *p++ = 'b'; + continue; + default: /* no change */ + *p++ = msg[i]; + } + + if (msg[i] < 26) { /* modify control characters */ + *p++ = '^'; + *p++ = msg[i] + 'A'; + continue; + } + if (msg[i] >= 127) { /* modify control characters */ + *p++ = '!'; + *p++ = msg[i] + 'A'; + continue; + } + } + *p = '\0'; /* terminate the string */ + print (newmsg); + print ("\r\n"); +} + +/* + * convert an ascii hex digit to a number. + * param is hex digit. + * returns a decimal digit. + */ +int +hex2digit (int digit) +{ + if (digit == 0) + return 0; + + if (digit >= '0' && digit <= '9') + return digit - '0'; + if (digit >= 'a' && digit <= 'f') + return digit - 'a' + 10; + if (digit >= 'A' && digit <= 'F') + return digit - 'A' + 10; + + /* shouldn't ever get this far */ + return ERROR; +} + +/* + * convert number NIB to a hex digit. + * param is a decimal digit. + * returns a hex digit. + */ +char +digit2hex(int digit) +{ + if (digit < 10) + return '0' + digit; + else + return 'a' + digit - 10; +} + +/* + * Convert the memory pointed to by mem into hex, placing result in buf. + * Return a pointer to the last char put in buf (null), in case of mem fault, + * return 0. + * If MAY_FAULT is non-zero, then we will handle memory faults by returning + * a 0, else treat a fault like any other fault in the stub. + */ +unsigned char * +mem2hex(unsigned char *mem, unsigned char *buf, int count, int may_fault) +{ + unsigned char ch; + + DEBUG (1, "In mem2hex"); + + set_mem_fault_trap(MAY_FAULT); + + while (count-- > 0) { + ch = *mem++; + if (mem_err) { + DEBUG (1, "memory fault in mem2hex"); + return 0; + } + *buf++ = digit2hex(ch >> 4); + *buf++ = digit2hex(ch & 0xf); + } + + *buf = 0; + + set_mem_fault_trap(OK); + + return buf; +} + +/* + * Convert the hex array pointed to by buf into binary to be placed in mem + * return a pointer to the character AFTER the last byte written + */ +unsigned char * +hex2mem(unsigned char *buf, unsigned char *mem, int count, int may_fault) +{ + int i; + unsigned char ch; + + DEBUG (1, "In hex2mem"); + + set_mem_fault_trap(may_fault); + + for (i=0; i<count; i++) { + ch = hex2digit(*buf++) << 4; + ch |= hex2digit(*buf++); + *mem++ = ch; + if (mem_err) + return 0; + } + + set_mem_fault_trap(0); + + return mem; +} + +/* + * while we find nice hex chars, build an int. + * param is a pointer to the string. + * returns the int in the param field, and the number of chars processed. + */ +int +hex2int (char **ptr, int *intValue) +{ + int numChars = 0; + int hexValue; + + *intValue = 0; + + while (**ptr) + { + hexValue = hex2digit(**ptr); + if (hexValue < 0) + break; + + *intValue = (*intValue << 4) | hexValue; + numChars ++; + (*ptr)++; + } + return (numChars); +} + +/* + * Scan for the sequence $<data>#<checksum> + */ +void +getpacket(unsigned char *buffer) +{ + unsigned char checksum; + unsigned char xmitcsum; + int i; + int count; + unsigned char ch; + + do { + /* wait around for the start character, ignore all other characters */ + while ((ch = (inbyte() & 0x7f)) != '$') ; + + checksum = 0; + xmitcsum = -1; + + count = 0; + + /* now, read until a # or end of buffer is found */ + while (count < BUFMAX) { + ch = inbyte() & 0x7f; + if (ch == '#') + break; + checksum = checksum + ch; + buffer[count] = ch; + count = count + 1; + } + + if (count >= BUFMAX) + continue; + + buffer[count] = 0; + + if (ch == '#') { + xmitcsum = hex2digit(inbyte() & 0x7f) << 4; + xmitcsum |= hex2digit(inbyte() & 0x7f); +#if 1 + /* Humans shouldn't have to figure out checksums to type to it. */ + outbyte ('+'); + return; +#endif + if (checksum != xmitcsum) + outbyte('-'); /* failed checksum */ + else { + outbyte('+'); /* successful transfer */ + /* if a sequence char is present, reply the sequence ID */ + if (buffer[2] == ':') { + outbyte(buffer[0]); + outbyte(buffer[1]); + /* remove sequence chars from buffer */ + count = strlen(buffer); + for (i=3; i <= count; i++) + buffer[i-3] = buffer[i]; + } + } + } + } + while (checksum != xmitcsum); +} + +/* + * Send the packet in buffer. + */ +void +putpacket(unsigned char *buffer) +{ + unsigned char checksum; + int count; + unsigned char ch; + + /* $<packet info>#<checksum>. */ + do { + outbyte('$'); + checksum = 0; + count = 0; + + while (ch = buffer[count]) { + if (! outbyte(ch)) + return; + checksum += ch; + count += 1; + } + + outbyte('#'); + outbyte(digit2hex(checksum >> 4)); + outbyte(digit2hex(checksum & 0xf)); + + } + while ((inbyte() & 0x7f) != '+'); +} + +/* + * + */ +void +gdb_event_loop(int sigval, unsigned long *registers) +{ + int addr; + int length; + unsigned char *ptr; + ptr = packet_out_buf; + + DEBUG (1, "In gdb_event_loop"); + + while (1) { + packet_out_buf[0] = 0; + + getpacket(packet_in_buf); + ptr = &packet_in_buf[1]; + + switch (packet_in_buf[0]) { + case '?': /* get the last known signal */ + gdb_last_signal(sigval); + break; + + case 'd': /* toggle debug messages from the stub */ + gdb_toggle(); + break; + + case 'g': /* return the value of the CPU registers */ + target_read_registers(registers); + break; + + case 'G': /* set the value of the CPU registers - return OK */ + target_write_registers(registers); + break; + + case 'm': /* mAA..AA,LLLL Read LLLL bytes at address AA..AA */ + /* Try to read %x,%x. */ + if (hex2int((char **)&ptr, &addr) + && *ptr++ == ',' + && hex2int((char **)&ptr, &length)) { + gdb_read_memory(addr, length); + } else { + make_return_packet(1); + } + break; + + case 'M': /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */ + /* Try to read '%x,%x:'. */ + if (hex2int((char **)&ptr, &addr) + && *ptr++ == ',' + && hex2int((char **)&ptr, &length) + && *ptr++ == ':') { + gdb_write_memory (addr, length, ptr); + } else { + make_return_packet(2); + } + break; + + case 'c': /* cAA..AA Continue at address AA..AA(optional) */ + /* try to read optional parameter, pc unchanged if no parm */ + if (hex2int((char **)&ptr, &addr)) { + write_pc(registers, addr); + } + + /* + * we need to flush the instruction cache here, as we may have + * deposited a breakpoint, and the icache probably has no way of + * knowing that a data ref to some location may have changed + * something that is in the instruction cache. + */ + + flush_i_cache(); + /* by returning, we pick up execution where we left off */ + return; + + /* kill the program */ + case 'k' : + gdb_kill(); + break; + case 'r': /* Reset */ + target_reset(); + break; + } /* switch */ + + /* reply to the request */ + putpacket(packet_out_buf); + } + DEBUG (1, "Leaving handle_exception()"); +} + +/* Convert the hardware trap type code to a unix signal number. */ + +int +computeSignal(int tt) +{ + struct trap_info *ht; + + for (ht = hard_trap_info; ht->tt && ht->signo; ht++) + if (ht->tt == tt) + return ht->signo; + + return SIGHUP; /* default for things we don't know about */ +} + +/* + * Set up exception handlers for tracing and breakpoints + */ +void +set_debug_traps() +{ + struct trap_info *ht; + + DEBUG (1, "Entering set_debug_traps()"); + + if (hard_trap_info->tt == 0) { + print ("ERROR: ARG#$@%^&*!! no hard trap info!!\r\n"); + } + + for (ht = hard_trap_info; ht->tt && ht->signo; ht++) { + exception_handler(ht->tt, (unsigned long)default_trap_hook); + } + + /* In case GDB is started before us, ack any packets (presumably + "$?#xx") sitting there. */ + + outbyte ('+'); + initialized = 1; + + DEBUG (1, "Leaving set_debug_traps()"); +} + +/* + * make a return packet. + * param is the value to return. + * 0 = OK, any other value is converted to a two digit hex number. + * returns a string or "OK" or "ENN", where NN is the error number. Each N + * is an ASCII encoded hex digit. + */ +char * +make_return_packet(int val) +{ + if (val == 0) { + packet_out_buf[0] = 'O'; + packet_out_buf[1] = 'K'; + packet_out_buf[2] = 0; + } else { + packet_out_buf[0] = 'E'; + packet_out_buf[1] = digit2hex((val >> 4) & 0xf); + packet_out_buf[2] = digit2hex(val & 0xf); + packet_out_buf[3] = 0; + } + return(packet_out_buf); +} + +/* + * g - read registers. + * no params. + * returns a vector of words, size is NUM_REGS. + */ +char * +gdb_read_registers() +{ +} + +/* + * G - write registers. + * param is a vector of words, size is NUM_REGS. + * returns an OK or an error number. + */ +char * +gdb_write_registers(char *regs) +{ +} + +/* + * m - read memory. + * params are the address to start the read at and the number of + * bytes to read. + * returns a vector of nbytes or an error number. + * Can be fewer bytes than requested if able to read only part of the + * data. + */ +char * +gdb_read_memory(long addr, int nbytes) +{ + if (mem2hex((char *)addr, packet_out_buf, nbytes, MAY_FAULT)) + return(packet_out_buf); + else { + return(make_return_packet(3)); + } +} + +/* + * M write memory + * params are the address to start writing to, the number of + * bytes to write, and the new values of the bytes. + * returns an OK or an error number. + */ +char * +gdb_write_memory(long addr, int nbytes, char *mem) +{ + if (hex2mem(mem, (char *)addr, nbytes, MAY_FAULT)) + return(make_return_packet(OK)); + else { + return(make_return_packet(3)); + } +} + +/* + * c - continue at address. + * param is the address to start at, and an optional signal. If + * sig is zero, then ignore it. + * returns an OK or an error number. + */ +char * +gdb_continue(int sig, long addr) +{ +} + +/* + * s - step instruction(s) + * param is the address to start at, and an optional signal. If + * sig is zero, then ignore it. + * returns an OK or an error number. + */ +char * +gdb_step(int sig, long addr) +{ +} + +/* + * k - kill program. + * no params. + * returns an OK or an error number. + */ +char * +gdb_kill() +{ + /* generically, we can't do anything for this command */ + return(make_return_packet(OK)); +} + +/* + * ? - last signal. + * no params. + * returns the last signal number. + */ +char * +gdb_last_signal(int val) +{ + DEBUG (1, "Entering gdb_last_signal()"); + + packet_out_buf[0] = 'S'; + packet_out_buf[1] = digit2hex(val >> 4); + packet_out_buf[2] = digit2hex(val & 0xf); + packet_out_buf[3] = 0; + + DEBUG (1, "Leaving gdb_last_signal()"); + return (packet_out_buf); +} + +/* + * b - change baud rate. + * param is the new baudrate + * returns the baud rate. + */ +char * +gdb_baudrate(int baud) +{ + /* generically, we can't do anything for this command */ + return(make_return_packet(OK)); +} + +/* + * T - dump state. + * no params. + * returns the signal number, the registers, the thread ID, and + * possible extensions in a vector that looks like: + * TAAn...:r...;n...:r...;n...:r...; where: + * AA = signal number + * n... = register number (hex) + * r... = register contents + * n... = `thread' + * r... = thread process ID. This is a hex integer. + * n... = other string not starting with valid hex digit. + * gdb should ignore this n,r pair and go on to + * the next. This way we can extend the protocol. + */ +char * +gdb_dump_state() +{ +} + +/* + * D - host requests a detach + * no params. + * returns either a S, T, W, or X command. + * returns an OK or an error number. + */ +char * +gdb_detach() +{ +} + +/* + * H - set thread. + * params are the command to execute and the thread ID. + * cmd = 'c' for thread used in step and continue; + * cmd = 'g' for thread used in other operations. + * tid = -1 for all threads. + * tid = zero, pick a thread,any thread. + * returns an OK or an error number. + */ +char * +gdb_set_thread(int cmd, int tid) +{ + /* generically, we can't do anything for this command */ + return(make_return_packet(OK)); +} + +/* + * p - read one register. + * param is the register number. + * returns the register value or ENN. + */ +char * +gdb_read_reg(int reg) +{ + /* generically, we can't do anything for this command */ + return(make_return_packet(OK)); +} + +/* + * P - write one register. + * params are the register number, and it's new value. + * returns the register value or ENN. + */ +char * +gdb_write_reg(int reg, long val) +{ + /* generically, we can't do anything for this command */ + + return(make_return_packet(OK)); +} + +/* + * W - process exited. + * no params. + * returns the exit status. + */ +char * +gdb_exited() +{ + /* generically, we can't do anything for this command */ + return(make_return_packet(OK)); +} + +/* + * X - process terminated. + * no params. + * returns the last signal. + */ +char * +gdb_terminated() +{ +} + +/* + * O - hex encoding. + * params are a vector of bytes, and the number of bytes to encode. + * returns a vector of ASCII encoded hex numbers. + */ +char * +gdb_hex(char *str, int nbytes) +{ +} + +/* + * A - tread alive request. + * param is the thread ID. + * returns an OK or an error number. + */ +char * +gdb_thread_alive(int tid) +{ + /* generically, we can't do anything for this command */ + return(make_return_packet(OK)); +} + +/* + * ! - extended protocol. + * no params. + * returns an OK or an error number. + */ +char * +gdb_extended() +{ + /* generically, we can't do anything for this command */ + return(make_return_packet(OK)); +} + +/* + * d - toggle gdb stub diagnostics. + * no params. + * returns an OK or an error number. + */ +char * +gdb_debug() +{ + if (remote_debug > 0) + remote_debug = 0; + else + remote_debug = 1; + + return(make_return_packet(OK)); +} + +/* + * d - toggle gdb stub. + * no params. + * returns an OK or an error number. + */ +char * +gdb_toggle() +{ + static int level = 0; + + if (remote_debug) { + level = remote_debug; + remote_debug = 0; + } else { + remote_debug = level; + } + + return(make_return_packet(OK)); +} + +/* + * r - reset target + * no params. + * returns an OK or an error number. + */ +char * +gdb_reset() +{ + /* generically, we can't do anything for this command */ + return(make_return_packet(OK)); +} + +/* + * t - search backwards. + * params are the address to start searching from, a pattern to match, and + * the mask to use. + * FIXME: not entirely sure what this is supposed to return. + */ +char * +gdb_search(long addr, long pat, long mask) +{ + /* generically, we can't do anything for this command */ + return(make_return_packet(OK)); +} + +/* + * q - general get query. + * param is a string, that's the query to be executed. + * FIXME: not entirely sure what this is supposed to return. + */ +char * +gdb_get_query(char *query) +{ + /* generically, we can't do anything for this command */ + return(make_return_packet(OK)); +} + +/* + * Q - general set query + * param is a string, that's the query to be executed. + * FIXME: not entirely sure what this means. + * returns an OK or an error number. + */ +char * +gdb_set(char *query) +{ + /* generically, we can't do anything for this command */ + return(make_return_packet(OK)); +} + + diff --git a/libgloss/debug.h b/libgloss/debug.h new file mode 100644 index 0000000..9535341 --- /dev/null +++ b/libgloss/debug.h @@ -0,0 +1,150 @@ +/* + * Copyright (c) 1995, 1996 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +static const char hexchars[]="0123456789abcdef"; + +typedef void (*exception_t)(int); /* pointer to function with int parm */ + +/* + * This is the default function handler to be called with all exceptions. + */ +extern exception_t default_trap_hook; + +/* this is used to make Unix style signale nukbers to an exception */ +struct trap_info +{ + unsigned char tt; /* exception number */ + unsigned char signo; /* corresponding signal number */ +}; + +/* + * prototypes for the functions in debug.c. As these'll only be used with GCC, + * we don't worry about no stinkin K&R comilers. + */ +extern void exception_handler (int, unsigned long); +extern unsigned char *mem2hex(unsigned char *, unsigned char *, int, int); +extern unsigned char *hex2mem(unsigned char *, unsigned char *, int, int); +extern void getpacket(unsigned char *); +extern void putpacket(unsigned char *); +extern char *make_return_packet(int); +extern void set_debug_traps(); +extern int computeSignal(int); +extern char digit2hex(int); +extern int hex2digit(int); +extern void debuglogs(int level, char *msg); +extern int hex2int(); +extern char *int2hex(int); +extern void gdb_event_loop(int, unsigned long *); + +extern char *gdb_read_registers(); /* g - read registers */ +extern char *gdb_write_registers(char *); /* G - write registers */ +extern char *gdb_read_memory(long, int); /* m - read memory */ +extern char *gdb_write_memory(long, int, char *);/* M write memory */ +extern char *gdb_continue(int, long ); /* c - continue */ +extern char *gdb_step(int, long); /* s - step instruction(s) */ +extern char *gdb_kill(); /* k - kill program */ +extern char *gdb_last_signal(); /* ? - last signal */ +extern char *gdb_baudrate(int); /* b - change baud rate */ +extern char *gdb_dump_state(); /* T - dump state */ +extern char *gdb_set_thread(int, int); /* H - set thread */ +extern char *gdb_detach(); /* D - detach */ +extern char *gdb_read_reg(int); /* p - read one register */ +extern char *gdb_write_reg(int, long); /* P - write one register */ +extern char *gdb_exited(); /* W - process exited */ +extern char *gdb_terminated(); /* X - process terminated */ +extern char *gdb_hex(); /* O - hex encoding */ +extern char *gdb_thread_alive(int); /* A - tread alive request */ +extern char *gdb_extended(); /* ! - extended protocol */ +extern char *gdb_debug(); /* d - toggle stub diagnostics */ +extern char *gdb_toggle(); /* unsupported, toggle stub on/off */ +extern char *gdb_reset(); /* r - reset target */ +extern char *gdb_search(long, long, long); /* t - search backwards */ +extern char *gdb_query(char *); /* q - general query */ +extern char *gdb_set(char *); /* Q - set value */ + +/* + * indicate to caller of mem2hex or hex2mem that there has been an error. + * 0 means ok, 1 means error + */ +extern int mem_err; + +/* + * indicate whether the debug vectors have been initialized + * 0 means not yet, 1 means yep, it's ready. + */ +extern int initialized; + +/* + * 1 means print debugging messages from the target, 0 means be quiet. + */ +extern int remote_debug; + +/* + * Set up the command processing required for GDB + */ + +struct gdb_ops { + /* + * these functions are the most minimal working subset top get full + * functionality for remote debugging + */ + char *(*gdb_read_registers); /* g - read registers */ + char *(*gdb_write_registers)(char *); /* G - write registers */ + char *(*gdb_read_memory)(long, int); /* m - read memory */ + char *(*gdb_write_memory)(long, int, char *);/* M write memory */ + char *(*gdb_continue)(int, long ); /* c - continue */ + char *(*gdb_step)(int, long); /* s - step instruction(s) */ + char *(*gdb_kill); /* k - kill program */ + char *(*gdb_last_signal); /* ? - last signal */ + char *(*gdb_baudrate)(int); /* b - change baud rate */ + char *(*gdb_dump_state); /* T - dump state */ + /* + * these functions are for a more sophisticated target, typically + * running a simple RTOS. + */ + char *(*gdb_set_thread)(int, int); /* H - set thread */ + char *(*gdb_detach); /* D - detach */ + char *(*gdb_read_reg)(int); /* p - read one register */ + char *(*gdb_write_reg)(int, long); /* P - write one register */ + char *(*gdb_exited); /* W - process exited */ + char *(*gdb_terminated); /* X - process terminated */ + char *(*gdb_hex); /* O - hex encoding */ + char *(*gdb_thread_alive)(int); /* A - tread alive request */ + /* FIXME: not standard yet */ + char *(*gdb_extended); /* ! - extended protocol */ + char *(*gdb_debug); /* d - toggle stub diagnostics */ + char *(*gdb_toggle); /* unsupported, toggle stub on/off */ + char *(*gdb_reset); /* r - reset target */ + char *(*gdb_search)(long, long, long); /* t - search backwards */ + char *(*gdb_query)(char *); /* q - general query */ + char *(*gdb_set)(long); /* Q - set value */ +}; + +/* + * BUFMAX defines the maximum number of characters in inbound/outbound buffers + * at least NUMREGBYTES*2 are needed for register packets + */ +#define BUFMAX 2048 +extern char packet_in_buf[BUFMAX]; +extern char packet_out_buf[BUFMAX]; +extern int packet_index; + +#define DEBUG(x, y) debuglog(x, y); +#define set_debug_level(x) remote_debug = x; +#define OK 0 +#define ERROR -1 +#define ENN(x) "x" + +#define MAY_FAULT 1 +#define NO_FAULT 0 diff --git a/libgloss/doc/Makefile.in b/libgloss/doc/Makefile.in new file mode 100644 index 0000000..0432e02 --- /dev/null +++ b/libgloss/doc/Makefile.in @@ -0,0 +1,147 @@ +# Copyright (c) 1995, 1996 Cygnus Support +# +# The authors hereby grant permission to use, copy, modify, distribute, +# and license this software and its documentation for any purpose, provided +# that existing copyright notices are retained in all copies and that this +# notice is included verbatim in any distributions. No written agreement, +# license, or royalty fee is required for any of the authorized uses. +# Modifications to this software may be copyrighted by their authors +# and need not follow the licensing terms described here, provided that +# the new terms are clearly indicated on the first page of each file where +# they apply. +# + +srcdir = @srcdir@ +VPATH = @srcdir@ + +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +mandir = @mandir@ +man1dir = $(mandir)/man1 +infodir = @infodir@ + +MAKEINFO = makeinfo +TEXI2DVI = TEXINPUTS=$(TEXIDIR):$(srcdir):$$TEXINPUTS texi2dvi + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ + +# Where to find texinfo.tex to format docn with TeX +TEXIDIR = $(srcdir)/../../texinfo + +MANPAGES = + +all: + +info: porting.info + +dvi: porting.dvi + +ps: porting.ps + +doc: info dvi + +porting: porting.dvi porting.info + +###################################################################### +# DOCUMENTATION TARGETS +# TeX output +porting.dvi: $(srcdir)/porting.texi $(srcdir)/porting.texi + $(TEXI2DVI) $(srcdir)/porting.texi + +# info file for online browsing +porting.info: $(srcdir)/porting.texi $(srcdir)/porting.texi + $(MAKEINFO) -I $(srcdir) -o porting.info $(srcdir)/porting.texi + +porting.ps: porting.dvi + dvips -f porting.dvi > porting.ps + +# different targets for -ms, -mm, -me +# Try to use a recent texi2roff. v2 was put on prep in jan91. +# If you want an index, see texi2roff doc for postprocessing +# and add -i to texi2roff invocations below. +# Workarounds for texi2roff-2 (probably fixed in later texi2roff's, delete +# correspondint -e lines when later texi2roff's are current) +# + @ifinfo's deleted explicitly due to texi2roff-2 bug w nested constructs. +# + @c's deleted explicitly because texi2roff sees texinfo commands in them +# + @ (that's at-BLANK) not recognized by texi2roff, turned into blank +# + @alphaenumerate is ridiculously new, turned into @enumerate + +# roff output (-ms) +porting.ms: $(srcdir)/porting.texi + sed -e '/\\input texinfo/d' \ + -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \ + -e '/^@ifinfo/,/^@end ifinfo/d' \ + -e '/^@c/d' \ + -e 's/{.*,,/{/' \ + -e 's/@ / /g' \ + -e 's/^@alphaenumerate/@enumerate/g' \ + -e 's/^@end alphaenumerate/@end enumerate/g' \ + $(srcdir)/porting.texi | \ + $(TEXI2ROFF) -ms | \ + sed -e 's/---/\\(em/g' \ + >porting.ms + +# roff output (-mm) +# '@noindent's removed due to texi2roff-2 mm bug; if yours is newer, +# try leaving them in +porting.mm: $(srcdir)/porting.texi + sed -e '/\\input texinfo/d' \ + -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \ + -e '/^@ifinfo/,/^@end ifinfo/d' \ + -e '/^@c/d' \ + -e 's/{.*,,/{/' \ + -e '/@noindent/d' \ + -e 's/@ / /g' \ + -e 's/^@alphaenumerate/@enumerate/g' \ + -e 's/^@end alphaenumerate/@end enumerate/g' \ + $(srcdir)/porting.texi | \ + $(TEXI2ROFF) -mm | \ + sed -e 's/---/\\(em/g' \ + >porting.mm + +# roff output (-me) +porting.me: $(srcdir)/porting.texi + sed -e '/\\input texinfo/d' \ + -e '/@c TEXI2ROFF-KILL/,/@c END TEXI2ROFF-KILL/d' \ + -e '/^@ifinfo/,/^@end ifinfo/d' \ + -e '/^@c/d' \ + -e 's/{.*,,/{/' \ + -e 's/@ / /g' \ + -e 's/^@alphaenumerate/@enumerate/g' \ + -e 's/^@end alphaenumerate/@end enumerate/g' \ + $(srcdir)/porting.texi | \ + $(TEXI2ROFF) -me | \ + sed -e 's/---/\\(em/g' \ + >porting.me + + +###################################################################### + +clean mostlyclean: + -rm -f *.o *~ \#* core *.aux *.cp *.dvi *.fn *.ky *.log *.pg *.toc \ + *.tp *.vr *.cps *.fns *.kys *.pgs *.tps *.vrs *.info* *.1 *.ps + +maintainer-clean realclean: clean + -rm -f + +install: + +install-info: info + for i in *.info* ; do \ + $(INSTALL_DATA) $$i $(infodir)/$$i ; \ + done + +clean-info: + -rm -rf *.info* + +distclean: clean + -rm -f Makefile config.cache config.log config.status + +Makefile: Makefile.in config.status + $(SHELL) config.status + +config.status: configure + $(SHELL) config.status --recheck diff --git a/libgloss/doc/configure b/libgloss/doc/configure new file mode 100755 index 0000000..8d18863 --- /dev/null +++ b/libgloss/doc/configure @@ -0,0 +1,887 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.12.1 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.12.1" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=porting.texi + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + +if test "$srcdir" = "." ; then + mdir=`echo "${with_multisubdir}/" \ + | sed -e 's,\([^/][^/]*\),..,g' -e 's,^/$,,'` + ac_aux_dir= +for ac_dir in ${mdir}../../.. $srcdir/${mdir}../../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in ${mdir}../../.. $srcdir/${mdir}../../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + +else + ac_aux_dir= +for ac_dir in ${srcdir}/../.. $srcdir/${srcdir}/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in ${srcdir}/../.. $srcdir/${srcdir}/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + +fi + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:580: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set) 2>&1 | grep ac_space` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs + + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS <<EOF +#! /bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.12.1" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS <<EOF + +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; + s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_DATA@%$INSTALL_DATA%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <<EOF + +CONFIG_FILES=\${CONFIG_FILES-"Makefile"} +EOF +cat >> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +EOF +cat >> $CONFIG_STATUS <<EOF + +EOF +cat >> $CONFIG_STATUS <<\EOF + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + diff --git a/libgloss/doc/configure.in b/libgloss/doc/configure.in new file mode 100644 index 0000000..570b337 --- /dev/null +++ b/libgloss/doc/configure.in @@ -0,0 +1,15 @@ +dnl Process this file with autoconf to produce a configure script. +AC_PREREQ(2.5)dnl +AC_INIT(porting.texi) + +if test "$srcdir" = "." ; then + mdir=`echo "${with_multisubdir}/" \ + | sed -e 's,\([[^/]][[^/]]*\),..,g' -e 's,^/$,,'` + AC_CONFIG_AUX_DIR(${mdir}../../..) +else + AC_CONFIG_AUX_DIR(${srcdir}/../..) +fi + +AC_PROG_INSTALL + +AC_OUTPUT(Makefile) diff --git a/libgloss/doc/porting.texi b/libgloss/doc/porting.texi new file mode 100644 index 0000000..babc22e --- /dev/null +++ b/libgloss/doc/porting.texi @@ -0,0 +1,2053 @@ +\input texinfo @c -*- Texinfo -*- +@setfilename porting.info +@settitle Embed with GNU + +@c +@c This file documents the process of porting the GNU tools to an +@c embedded environment. +@c + +@finalout +@setchapternewpage off +@iftex +@raggedbottom +@global@parindent=0pt +@end iftex + +@titlepage +@title Embed With GNU +@subtitle Porting The GNU Tools To Embedded Systems +@sp 4 +@subtitle Spring 1995 +@subtitle Very *Rough* Draft +@author Rob Savoye - Cygnus Support +@page + +@vskip 0pt plus 1filll +Copyright @copyright{} 1993, 1994, 1995 Cygnus Support + +Permission is granted to make and distribute verbatim copies of +this manual provided the copyright notice and this permission notice +are preserved on all copies. + +Permission is granted to copy and distribute modified versions of this +manual under the conditions for verbatim copying, provided also that +the entire resulting derived work is distributed under the terms of a +permission notice identical to this one. + +Permission is granted to copy and distribute translations of this manual +into another language, under the above conditions for modified versions. +@end titlepage + +@ifinfo +@format +START-INFO-DIR-ENTRY +* Embed with GNU: (porting-). Embed with GNU +END-INFO-DIR-ENTRY +@end format +Copyright (c) 1993, 1994, 1995 Cygnus Support + +Permission is granted to make and distribute verbatim copies of +this manual provided the copyright notice and this permission notice +are preserved on all copies. + +Permission is granted to copy and distribute modified versions of this +manual under the conditions for verbatim copying, provided also that +the entire resulting derived work is distributed under the terms of a +permission notice identical to this one. + +Permission is granted to copy and distribute translations of this manual +into another language, under the above conditions for modified versions. + +@node Top +@top Embed with GNU + +@end ifinfo +@strong{Rough Draft} + +The goal of this document is to gather all the information needed to +port the GNU tools to a new embedded target in one place. This will +duplicate some info found in the other manual for the GNU tools, but +this should be all you'll need. + +@menu +* Libgloss:: Libgloss, a library of board support packages. +* GCC:: Porting GCC/G++ to a new embedded target. +* Libraries:: Making Newlib run on an new embedded target. +* GDB:: Making GDB understand a new back end. +* Binutils:: Using the GNU binary utilities. +* Code Listings:: Listings of the commented source code from the + text. +@end menu + +@node Libgloss, GCC, Top, Top +@chapter Libgloss +Libgloss is a library for all the details that usually get glossed over. +This library refers to things like startup code, and usually I/O support +for @code{gcc} and @code{C library}. The C library used through out +this manual is @code{newlib}. Newlib is a ANSI conforming C library +developed by Cygnus Support. Libgloss could easily be made to +support other C libraries, and it can be used standalone as well. The +standalone configuration is typically used when bringing up new +hardware, or on small systems. + +For a long time, these details were part of newlib. This approach worked +well when a complete tool chain only had to support one system. A tool +chain refers to the series of compiler passes required to produce a +binary file that will run on an embedded system. For C, the passes are +cpp, gcc, gas, ld. Cpp is the preprocessor, which process all the header +files and macros. Gcc is the compiler, which produces assembler from the +processed C files. Gas assembles the code into object files, and then ld +combines the object files and binds the code to addresses and produces +the final executable image. + +Most of the time a tool chain does only have to support one target +execution environment. An example of this would be a tool chain for the +AMD 29k processor family. All of the execution environments for this +processor are have the same interface, the same memory map, and the same +I/O code. In this case all of the support code is in newlib/sys/FIXME. +Libgloss's creation was forced initially be the @code{cpu32} processor +family. There are many different execution environments for this line, +and they vary wildly. newlib itself has only has a few dependencies that +it needs for each target. These are explained later in this doc. The +hardware dependent part of newlib was reorganized into a separate +directory structure within newlib called the stub dirs. It was initially +called this because most of the routines newlib needs for a target were +simple stubs that do nothing, but return a value to the application. They +only exist so the linker can produce a final executable image. This work +was done during the early part of 1993. + +After a while it became apparent that this approach of isolating the +hardware and systems files together made sense. Around this same time +the stub dirs were made to run standalone, mostly so it could also be +used to support GDB's remote debugging needs. At this time it was +decided to move the stub dirs out of newlib and into it's own separate +library so it could be used standalone, and be included in various other +GNU tools without having to bring in all of newlib, which is large. The +new library is called Libgloss, for Gnu Low-level OS support. + +@menu +* Supported targets:: What targets libgloss currently + supports. +* Building libgloss:: How to configure and built libgloss + for a target. +@end menu + +@node Supported targets, Building libgloss, Libgloss, Libgloss +@subsection Supported Targets +Currently libgloss is being used for the following targets: + +@menu +* Sparclite:: Fujitsu's sparclite. +* CPU32:: Various m68k based targets. +* Mips:: Mips code based targets. +* PA-RISC:: Precision Risc Organization.. +@end menu + +@node Sparclite, CPU32, , Supported targets +@subsection Sparclite Targets Supported +@c FIXME: put links to the docs in etc/targetdoc +This is for the Fujitsu Sparclite family of processors. Currently this +covers the ex930, ex931, ex932, ex933, and the ex934. In addition to the +I/O code a startup file, this has a GDB debug-stub that gets linked into +your application. This is an exception handler style debug stub. For +more info, see the section on Porting GDB. @ref{GDB,,Porting GDB}. + +The Fujitsu eval boards use a host based terminal program to load and +execute programs on the target. This program, @code{pciuh} is relatively +new (in 1994) and it replaced the previous ROM monitor which had the +shell in the ROM. GDB uses the the GDB remote protocol, the relevant +source files from the gdb sources are remote-sparcl.c. The debug stub is +part of libgloss and is called sparcl-stub.c. + +@node CPU32, Mips, Sparclite, Supported targets +@subsection Motorola CPU32 Targets supported +This refers to Motorola's m68k based CPU32 processor family. The crt0.S +startup file should be usable with any target environment, and it's +mostly just the I/O code and linker scripts that vary. Currently there +is support for the Motorola MVME line of 6U VME boards and IDP +line of eval boards. All of the +Motorola VME boards run @code{Bug}, a ROM based debug monitor. +This monitor has the feature of using user level traps to do I/O, so +this code should be portable to other MVME boards with little if any +change. The startup file also can remain unchanged. About the only thing +that varies is the address for where the text section begins. This can +be accomplished either in the linker script, or on the command line +using the @samp{-Ttext [address]}. + +@c FIXME: Intermetrics or ISI wrote rom68k ? +There is also support for the @code{rom68k} monitor as shipped on +Motorola's IDP eval board line. This code should be portable across the +range of CPU's the board supports. There is also GDB support for this +target environment in the GDB source tree. The relevant files are +gdb/monitor.c, monitor.h, and rom58k-rom.c. The usage of these files is +discussed in the GDB section. + +@node Mips, PA-RISC, CPU32, Supported targets +@subsection Mips core Targets Supported +The Crt0 startup file should run on any mips target that doesn't require +additional hardware initialization. The I/O code so far only supports a +custom LSI33k based RAID disk controller board. It should easy to +change to support the IDT line of eval boards. Currently the two +debugging protocols supported by GDB for mips targets is IDT's mips +debug protocol, and a customized hybrid of the standard GDB remote +protocol and GDB's standard ROM monitor support. Included here is the +debug stub for the hybrid monitor. This supports the LSI33k processor, +and only has support for the GDB protocol commands @code{g}, @code{G}, +@code{m}, @code{M}, which basically only supports the register and +memory reading and writing commands. This is part of libgloss and is +called lsi33k-stub.c. + +The crt0.S should also work on the IDT line of eval boards, but has only +been run on the LSI33k for now. There is no I/O support for the IDT eval +board at this time. The current I/O code is for a customized version of +LSI's @code{pmon} ROM monitor. This uses entry points into the monitor, +and should easily port to other versions of the pmon monitor. Pmon is +distributed in source by LSI. + +@node PA-RISC, , Mips, Supported targets +@subsection PA-RISC Targets Supported +This supports the various boards manufactured by the HP-PRO consortium. +This is a group of companies all making variations on the PA-RISC +processor. Currently supported are ports to the WinBond @samp{Cougar} +board based around their w89k version of the PA. Also supported is the +Oki op50n processor. + +There is also included, but never built an unfinished port to the HP 743 +board. This board is the main CPU board for the HP700 line of industrial +computers. This target isn't exactly an embedded system, in fact it's +really only designed to load and run HP-UX. Still, the crt0.S and I/O +code are fully working. It is included mostly because their is a barely +functioning exception handler GDB debug stub, and I hope somebody could +use it. The other PRO targets all use GDB's ability to talk to ROM +monitors directly, so it doesn't need a debug stub. There is also a +utility that will produce a bootable file by HP's ROM monitor. This is +all included in the hopes somebody else will finish it. :-) + +Both the WinBond board and the Oki board download srecords. The WinBond +board also has support for loading the SOM files as produced by the +native compiler on HP-UX. WinBond supplies a set of DOS programs that +will allow the loading of files via a bidirectional parallel port. This +has never been tested with the output of GNU SOM, as this manual is +mostly for Unix based systems. + +@node Building libgloss, , Supported targets, Libgloss +@subsection Configuring and building libgloss. + +Libgloss uses an autoconf based script to configure. Autoconf scripts +are portable shell scripts that are generated from a configure.in file. +Configure input scripts are based themselves on m4. Most configure +scripts run a series of tests to determine features the various +supported features of the target. For features that can't be determined +by a feature test, a makefile fragment is merged in. The configure +process leaves creates a Makefile in the build directory. For libgloss, +there are only a few configure options of importance. These are --target +and --srcdir. + +Typically libgloss is built in a separate tree just for objects. In this +manner, it's possible to have a single source tree, and multiple object +trees. If you only need to configure for a single target environment, +then you can configure in the source tree. The argument for --target is +a config string. It's usually safest to use the full canonical opposed +to the target alias. So, to configure for a CPU32 (m68k) with a separate +source tree, use: + +@smallexample +../src/libgloss/configure --verbose --target m68k-coff +@end smallexample + +The configure script is in the source tree. When configure is invoked +it will determine it's own source tree, so the --srcdir is would be +redundant here. + +Once libgloss is configured, @code{make} is sufficient to build it. The +default values for @code{Makefiles} are typically correct for all +supported systems. The test cases in the testsuite will also built +automatically as opposed to a @code{make check}, where test binaries +aren't built till test time. This is mostly cause the libgloss +testsuites are the last thing built when building the entire GNU source +tree, so it's a good test of all the other compilation passes. + +The default values for the Makefiles are set in the Makefile fragment +merged in during configuration. This fragment typically has rules like + +@smallexample +CC_FOR_TARGET = `if [ -f $$@{OBJROOT@}/gcc/xgcc ] ; \ + then echo $@{OBJROOT@}/gcc/xgcc -B$@{OBJROOT@}/gcc/ ; \ + else t='$@{program_transform_name@}'; echo gcc | sed -e '' $$t ; fi` +@end smallexample + +Basically this is a runtime test to determine whether there are freshly +built executables for the other main passes of the GNU tools. If there +isn't an executable built in the same object tree, then +@emph{transformed}the generic tool name (like gcc) is transformed to the +name typically used in GNU cross compilers. The names are +typically based on the target's canonical name, so if you've configured +for @code{m68k-coff} the transformed name is @code{m68k-coff-gcc} in +this case. If you install with aliases or rename the tools, this won't +work, and it will always look for tools in the path. You can force the a +different name to work by reconfiguring with the +@code{--program-transform-name} option to configure. This option takes a +sed script like this @code{-e s,^,m68k-coff-,} which produces tools +using the standard names (at least here at Cygnus). + +The search for the other GNU development tools is exactly the same idea. +This technique gets messier when build options like @code{-msoft-float} +support are used. The Makefile fragments set the @code{MUTILIB} +variable, and if it is set, the search path is modified. If the linking +is done with an installed cross compiler, then none of this needs to be +used. This is done so libgloss will build automatically with a fresh, +and uninstalled object tree. It also makes it easier to debug the other +tools using libgloss's test suites. + +@node GCC, Libraries, Libgloss, Top +@chapter Porting GCC + +Porting GCC requires two things, neither of which has anything to do +with GCC. If GCC already supports a processor type, then all the work in +porting GCC is really a linker issue. All GCC has to do is produce +assembler output in the proper syntax. Most of the work is done by the +linker, which is described elsewhere. + +Mostly all GCC does is format the command line for the linker pass. The +command line for GCC is set in the various config subdirectories of gcc. +The options of interest to us are @code{CPP_SPEC} and +@code{STARTFILE_SPEC}. CPP_SPEC sets the builtin defines for your +environment. If you support multiple environments with the same +processor, then OS specific defines will need to be elsewhere. +@c FIXME: Check these names + +@code{STARTFILE_SPEC} + +Once you have linker support, GCC will be able to produce a fully linked +executable image. The only @emph{part} of GCC that the linker wants is a +crt0.o, and a memory map. If you plan on running any programs that do +I/O of any kind, you'll need to write support for the C library, which +is described elsewhere. + +@menu +* Overview:: An overview as to the compilation passes. +* Options:: Useful GCC options for embedded systems. +@end menu + +@node Overview, Options, , GCC +@subsection Compilation passes + +GCC by itself only compiles the C or C++ code into assembler. Typically +GCC invokes all the passes required for you. These passes are cpp, cc1, +gas, ld. @code{cpp} is the C preprocessor. This will merge in the +include files, expand all macros definitions, and process all the +@code{#ifdef} sections. To see the output of ccp, invoke gcc with the +@code{-E} option, and the preprocessed file will be printed on the +stdout. cc1 is the actual compiler pass that produces the assembler for +the processed file. GCC is actually only a driver program for all the +compiler passes. It will format command line options for the other passes. +The usual command line GCC uses for the final link phase will have LD +link in the startup code and additional libraries by default. + +GNU AS started it's life to only function as a compiler pass, but +these days it can also be used as a source level assembler. When used as +a source level assembler, it has a companion assembler preprocessor +called @code{gasp}. This has a syntax similar to most other assembler +macros packages. GAS emits a relocatable object file from the assembler +source. The object file contains the executable part of the application, +and debug symbols. + +LD is responsible for resolving the addresses and symbols to something +that will be fully self-contained. Some RTOS's use relocatable object +file formats like @code{a.out}, but more commonly the final image will +only use absolute addresses for symbols. This enables code to be burned +into PROMS as well. Although LD can produce an executable image, there +is usually a hidden object file called @code{crt0.o} that is required as +startup code. With this startup code and a memory map, the executable +image will actually run on the target environment. @ref{Crt0,,Startup +Files}. + +The startup code usually defines a special symbol like @code{_start} +that is the default base address for the application, and the first +symbol in the executable image. If you plan to use any routines from the +standard C library, you'll also need to implement the functions that +this library is dependent on. @ref{Libraries,,Porting Newlib}. + +@node Options, , Overview, GCC +@c FIXME: Need stuff here about -fpic, -Ttext, etc... + +Options for the various development tools are covered in more detail +elsewhere. Still, the amount of options can be an overwhelming amount of +stuff, so the options most suited to embedded systems are summarized +here. If you use GCC as the main driver for all the passes, most of the +linker options can be passed directly to the compiler. There are also +GCC options that control how the GCC driver formats the command line +arguments for the linker. + +@menu +* GCC Options:: Options for the compiler. +* GAS Options:: Options for the assembler. +* LD Options:: Options for the linker. +@end menu + +@node GCC Options, GAS Options, , Options +Most of the GCC options that we're interested control how the GCC driver +formats the options for the linker pass. + +@c FIXME: this section is still under work. +@table @code +@item -nostartfiles +@item -nostdlib +@item -Xlinker +Pass the next option directly to the linker. + +@item -v +@item -fpic +@end table + +@node GAS Options, LD Options, GCC Options, Options +@c FIXME: Needs stuff here + +@node LD Options, , GAS Options, Options +@c FIXME: Needs stuff here + + +@node Libraries, GDB, GCC, Top +@chapter Porting newlib + +@menu +* Crt0:: Crt0.S. +* Linker Scripts:: Linker scripts for memory management. +* What to do now:: Tricks for manipulating formats. +* Libc:: Making libc work. +@end menu + +@node Crt0, Linker Scripts, , Libraries +@section Crt0, the main startup file + +To make a program that has been compiled with GCC to run, you +need to write some startup code. The initial piece of startup code is +called a crt0. (C RunTime 0) This is usually written in assembler, and +it's object gets linked in first, and bootstraps the rest of the +application when executed. This file needs to do the following things. + +@enumerate +@item +Initialize anything that needs it. This init section varies. If you are +developing an application that gets download to a ROM monitor, then +there is usually no need for any special initialization. The ROM monitor +handles it for you. + +If you plan to burn your code in a ROM, then the crt0 typically has to +do all the hardware initialization that is required to run an +application. This can include things like initializing serial ports or +run a memory check. It all depends on the hardware. + +@item +Zero the BSS section. This is for uninitialized data. All the addresses in +this section need to be initialized to zero so that programs that forget +to check new variables default value will get unpredictable results. + +@item +Call main() +This is what basically starts things running. If your ROM monitor +supports it, then first setup argc and argv for command line arguments +and an environment pointer. Then branch to main(). For G++ the the main +routine gets a branch to __main inserted by the code generator at the +very top. __main() is used by G++ to initialize it's internal tables. +__main() then returns back to your original main() and your code gets +executed. + +@item +Call exit() +After main() has returned, you need to cleanup things and return control +of the hardware from the application. On some hardware, there is nothing +to return to, especially if your program is in ROM. Sometimes the best +thing to do in this case is do a hardware reset, or branch back to the +start address all over again. + +When there is a ROM monitor present, usually a user trap can be called +and then the ROM takes over. Pick a safe vector with no side +effects. Some ROMs have a builtin trap handler just for this case. +@end enumerate +portable between all the m68k based boards we have here. +@ref{crt0.S,,Example Crt0.S}. + + +@smallexample +/* ANSI concatenation macros. */ + +#define CONCAT1(a, b) CONCAT2(a, b) +#define CONCAT2(a, b) a ## b +@end smallexample +These we'll use later. + +@smallexample +/* These are predefined by new versions of GNU cpp. */ + +#ifndef __USER_LABEL_PREFIX__ +#define __USER_LABEL_PREFIX__ _ +#endif + +/* Use the right prefix for global labels. */ +#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x) + +@end smallexample + +These macros are to make this code portable between both @emph{COFF} and +@emph{a.out}. @emph{COFF} always has an @var{_ (underline)} prepended on +the front of all global symbol names. @emph{a.out} has none. + +@smallexample +#ifndef __REGISTER_PREFIX__ +#define __REGISTER_PREFIX__ +#endif + +/* Use the right prefix for registers. */ +#define REG(x) CONCAT1 (__REGISTER_PREFIX__, x) + +#define d0 REG (d0) +#define d1 REG (d1) +#define d2 REG (d2) +#define d3 REG (d3) +#define d4 REG (d4) +#define d5 REG (d5) +#define d6 REG (d6) +#define d7 REG (d7) +#define a0 REG (a0) +#define a1 REG (a1) +#define a2 REG (a2) +#define a3 REG (a3) +#define a4 REG (a4) +#define a5 REG (a5) +#define a6 REG (a6) +#define fp REG (fp) +#define sp REG (sp) +@end smallexample + +This is for portability between assemblers. Some register names have a +@var{%} or @var{$} prepended to the register name. + +@smallexample +/* + * Set up some room for a stack. We just grab a chunk of memory. + */ + .set stack_size, 0x2000 + .comm SYM (stack), stack_size +@end smallexample + +Set up space for the stack. This can also be done in the linker script, +but it typically gets done here. + +@smallexample +/* + * Define an empty environment. + */ + .data + .align 2 +SYM (environ): + .long 0 +@end smallexample + +Set up an empty space for the environment. This is bogus on any most ROM +monitor, but we setup a valid address for it, and pass it to main. At +least that way if an application checks for it, it won't crash. + +@smallexample + .align 2 + .text + .global SYM (stack) + + .global SYM (main) + .global SYM (exit) +/* + * This really should be __bss_start, not SYM (__bss_start). + */ + .global __bss_start +@end smallexample + +Setup a few global symbols that get used elsewhere. @var{__bss_start} +needs to be unchanged, as it's setup by the linker script. + +@smallexample +/* + * start -- set things up so the application will run. + */ +SYM (start): + link a6, #-8 + moveal #SYM (stack) + stack_size, sp + +/* + * zerobss -- zero out the bss section + */ + moveal #__bss_start, a0 + moveal #SYM (end), a1 +1: + movel #0, (a0) + leal 4(a0), a0 + cmpal a0, a1 + bne 1b +@end smallexample + +The global symbol @code{start} is used by the linker as the default +address to use for the @code{.text} section. then it zeros the +@code{.bss} section so the uninitialized data will all be cleared. Some +programs have wild side effects from having the .bss section let +uncleared. Particularly it causes problems with some implementations of +@code{malloc}. + +@smallexample +/* + * Call the main routine from the application to get it going. + * main (argc, argv, environ) + * We pass argv as a pointer to NULL. + */ + pea 0 + pea SYM (environ) + pea sp@@(4) + pea 0 + jsr SYM (main) + movel d0, sp@@- +@end smallexample + +Setup the environment pointer and jump to @code{main()}. When +@code{main()} returns, it drops down to the @code{exit} routine below. + +@smallexample +/* + * _exit -- Exit from the application. Normally we cause a user trap + * to return to the ROM monitor for another run. + */ +SYM (exit): + trap #0 +@end smallexample + +Implementing @code{exit} here is easy. Both the @code{rom68k} and @code{bug} +can handle a user caused exception of @code{zero} with no side effects. +Although the @code{bug} monitor has a user caused trap that will return +control to the ROM monitor, this solution has been more portable. + +@node Linker Scripts, What to do now, Crt0, Libraries +@section Linker scripts for memory management + +The linker script sets up the memory map of an application. It also +sets up default values for variables used elsewhere by sbrk() and the +crt0. These default variables are typically called @code{_bss_start} and +@code{_end}. + +For G++, the constructor and destructor tables must also be setup here. +The actual section names vary depending on the object file format. For +@code{a.out} and @code{coff}, the three main sections are @code{.text}, +@code{.data}, and @code{.bss}. + +Now that you have an image, you can test to make sure it got the +memory map right. You can do this by having the linker create a memory +map (by using the @code{-Map} option), or afterwards by using @code{nm} to +check a few critical addresses like @code{start}, @code{bss_end}, and +@code{_etext}. + +Here's a breakdown of a linker script for a m68k based target board. +See the file @code{libgloss/m68k/idp.ld}, or go to the appendixes in +the end of the manual. @ref{idp.ld,,Example Linker Script}. + +@smallexample +STARTUP(crt0.o) +OUTPUT_ARCH(m68k) +INPUT(idp.o) +SEARCH_DIR(.) +__DYNAMIC = 0; +@end smallexample + +The @code{STARTUP} command loads the file specified so that it's +first. In this case it also doubles to load the file as well, because +the m68k-coff configuration defaults to not linking in the crt0.o by +default. It assumes that the developer probably has their own crt0.o. +This behavior is controlled in the config file for each architecture. +It's a macro called @code{STARTFILE_SPEC}, and if it's set to +@code{null}, then when @code{gcc} formats it's command line, it doesn't +add @code{crto.o}. Any file name can be specified here, but the default +is always @code{crt0.o}. + +Course if you only use @code{ld} to link, then the control of whether or +not to link in @code{crt0.o} is done on the command line. If you have +multiple crto files, then you can leave this out all together, and link +in the @code{crt0.o} in the makefile, or by having different linker +scripts. Sometimes this is done for initializing floating point +optionally, or to add device support. + +The @code{OUTPUT_ARCH} sets architecture the output file is for. + +@code{INPUT} loads in the file specified. In this case, it's a relocated +library that contains the definitions for the low-level functions need +by libc.a. This could have also been specified on the command line, but +as it's always needed, it might as well be here as a default. +@code{SEARCH_DIR} specifies the path to look for files, and +@code{_DYNAMIC} means in this case there are no shared libraries. + +@c FIXME: Check the linker manual to make sure this is accurate. +@smallexample +/* + * Setup the memory map of the MC68ec0x0 Board (IDP) + * stack grows up towards high memory. This works for + * both the rom68k and the mon68k monitors. + */ +MEMORY +@{ + ram : ORIGIN = 0x10000, LENGTH = 2M +@} +@end smallexample + +This specifies a name for a section that can be referred to later in the +script. In this case, it's only a pointer to the beginning of free RAM +space, with an upper limit at 2M. If the output file exceeds the upper +limit, it will produce an error message. + +@smallexample +/* + * stick everything in ram (of course) + */ +SECTIONS +@{ + .text : + @{ + CREATE_OBJECT_SYMBOLS + *(.text) + etext = .; + __CTOR_LIST__ = .; + LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) + *(.ctors) + LONG(0) + __CTOR_END__ = .; + __DTOR_LIST__ = .; + LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) + *(.dtors) + LONG(0) + __DTOR_END__ = .; + *(.lit) + *(.shdata) + @} > ram + .shbss SIZEOF(.text) + ADDR(.text) : @{ + *(.shbss) + @} +@end smallexample + +Set up the @code{.text} section. In a @code{COFF} file, .text is where +all the actual instructions are. This also sets up the @emph{CONTRUCTOR} +and the @emph{DESTRUCTOR} tables for @code{G++}. Notice that the section +description redirects itself to the @emph{ram} variable setup earlier. + +@smallexample + .talias : @{ @} > ram + .data : @{ + *(.data) + CONSTRUCTORS + _edata = .; + @} > ram +@end smallexample + +Setup the @code{.data} section. In a @code{coff} file, this is where all +he initialized data goes. @code{CONSTRUCTORS} is a special command used +by @code{ld}. + +@smallexample + .bss SIZEOF(.data) + ADDR(.data) : + @{ + __bss_start = ALIGN(0x8); + *(.bss) + *(COMMON) + end = ALIGN(0x8); + _end = ALIGN(0x8); + __end = ALIGN(0x8); + @} + .mstack : @{ @} > ram + .rstack : @{ @} > ram + .stab . (NOLOAD) : + @{ + [ .stab ] + @} + .stabstr . (NOLOAD) : + @{ + [ .stabstr ] + @} +@} +@end smallexample + +Setup the @code{.bss} section. In a @code{COFF} file, this is where +unitialized data goes. The symbols @code{_bss_start} and @code{_end} +are setup here for use by the @code{crt0.o} when it zero's the +@code{.bss} section. + + +@node What to do now, Libc, Linker Scripts, Libraries +@section What to do when you have a binary image + +A few ROM monitors load binary images, typically @code{a.out}, but most all +will load an @code{srecord}. An srecord is an ASCII representation of a binary +image. At it's simplest, an srecord is an address, followed by a byte +count, followed by the bytes, and a 2's compliment checksum. A whole +srecord file has an optional @emph{start} record, and a required @emph{end} +record. To make an srecord from a binary image, the GNU @code{objcopy} program +is used. This will read the image and make an srecord from it. To do +this, invoke objcopy like this: @code{objcopy -O srec infile outfile}. Most +PROM burners also read srecords or a similar format. Use @code{objdump -i} to +get a list of support object files types for your architecture. + +@node Libc, , What to do now, Libraries +@section Libraries + +This describes @code{newlib}, a freely available libc replacement. Most +applications use calls in the standard C library. When initially linking +in libc.a, several I/O functions are undefined. If you don't plan on +doing any I/O, then you're OK, otherwise they need to be created. These +routines are read, write, open, close. sbrk, and kill. Open & close +don't need to be fully supported unless you have a filesystems, so +typically they are stubbed out. Kill is also a stub, since you can't do +process control on an embedded system. + +Sbrk() is only needed by applications that do dynamic memory +allocation. It's uses the symbol @code{_end} that is setup in the linker +script. It also requires a compile time option to set the upper size +limit on the heap space. This leaves us with read and write, which are +required for serial I/O. Usually these two routines are written in C, +and call a lower level function for the actual I/O operation. These two +lowest level I/O primitives are inbyte() and outbyte(), and are also +used by GDB back ends if you've written an exception handler. Some +systems also implement a havebyte() for input as well. + +Other commonly included functions are routines for manipulating +LED's on the target (if they exist) or low level debug help. Typically a +putnum() for printing words and bytes as a hex number is helpful, as +well as a low-level print() to output simple strings. + +As libg++ uses the I/O routines in libc.a, if read and write work, +then libg++ will also work with no additional changes. + +@menu +* I/O Support:: Functions that make serial I/O work. +* Memory Support:: Memory support. +* Misc Support:: Other needed functions. +* Debugging:: Useful Debugging Functions +@end menu + +@node I/O Support, Memory Support, , Libc +@subsection Making I/O work + +@node Memory Support, Misc Support, I/O Support, Libc +@subsection Routines for dynamic memory allocation +To support using any of the memory functions, you need to implement +sbrk(). @code{malloc()}, @code{calloc()}, and @code{realloc()} all call +@code{sbrk()} at there lowest level. @code{caddr_t} is defined elsewhere +as @code{char *}. @code{RAMSIZE} is presently a compile time option. All +this does is move a pointer to heap memory and check for the upper +limit. @ref{glue.c,,Example libc support code}. @code{sbrk()} returns a +pointer to the previous value before more memory was allocated. + +@smallexample +/* _end is set in the linker command file * +extern caddr_t _end;/ + +/* just in case, most boards have at least some memory */ +#ifndef RAMSIZE +# define RAMSIZE (caddr_t)0x100000 +#endif + +/* + * sbrk -- changes heap size size. Get nbytes more + * RAM. We just increment a pointer in what's + * left of memory on the board. + */ +caddr_t +sbrk(nbytes) + int nbytes; +@{ + static caddr_t heap_ptr = NULL; + caddr_t base; + + if (heap_ptr == NULL) @{ + heap_ptr = (caddr_t)&_end; + @} + + if ((RAMSIZE - heap_ptr) >= 0) @{ + base = heap_ptr; + heap_ptr += nbytes; + return (base); + @} else @{ + errno = ENOMEM; + return ((caddr_t)-1); + @} +@} +@end smallexample + +@node Misc Support, Debugging, Memory Support, Libc +@subsection Misc support routines + +These are called by @code{newlib} but don't apply to the embedded +environment. @code{isatty()} is self explanatory. @code{kill()} doesn't +apply either in an environment withno process control, so it justs +exits, which is a similar enough behavior. @code{getpid()} can safely +return any value greater than 1. The value doesn't effect anything in +@code{newlib} because once again there is no process control. + +@smallexample +/* + * isatty -- returns 1 if connected to a terminal device, + * returns 0 if not. Since we're hooked up to a + * serial port, we'll say yes and return a 1. + */ +int +isatty(fd) + int fd; +@{ + return (1); +@} + +/* + * getpid -- only one process, so just return 1. + */ +#define __MYPID 1 +int +getpid() +@{ + return __MYPID; +@} + +/* + * kill -- go out via exit... + */ +int +kill(pid, sig) + int pid; + int sig; +@{ + if(pid == __MYPID) + _exit(sig); + return 0; +@} +@end smallexample + +@node Debugging, , Misc Support, Libc +@subsection Useful debugging functions + +There are always a few useful functions for debugging your project in +progress. I typically implement a simple @code{print()} routine that +runs standalone in liblgoss, with no @code{newlib} support. The I/O +function @code{outbyte()} can also be used for low level debugging. Many +times print will work when there are problems that cause @code{printf()} to +cause an exception. @code{putnum()} is just to print out values in hex +so they are easier to read. + +@smallexample +/* + * print -- do a raw print of a string + */ +int +print(ptr) +char *ptr; +@{ + while (*ptr) @{ + outbyte (*ptr++); + @} +@} + +/* + * putnum -- print a 32 bit number in hex + */ +int +putnum (num) +unsigned int num; +@{ + char buffer[9]; + int count; + char *bufptr = buffer; + int digit; + + for (count = 7 ; count >= 0 ; count--) @{ + digit = (num >> (count * 4)) & 0xf; + + if (digit <= 9) + *bufptr++ = (char) ('0' + digit); + else + *bufptr++ = (char) ('a' - 10 + digit); + @} + + *bufptr = (char) 0; + print (buffer); + return; +@} +@end smallexample + +If there are LEDs on the board, they can also be put to use for +debugging when the serial I/O code is being written. I usually implement +a @code{zylons()} function, which strobes the LEDS (if there is more +than one) in sequence, creating a rotating effect. This is convenient +between I/O to see if the target is still alive. Another useful LED +function is @code{led_putnum()}, which takes a digit and displays it as +a bit pattern or number. These usually have to be written in assembler +for each target board. Here are a number of C based routines that may be +useful. + +@code{led_putnum()} puts a number on a single digit segmented +LED display. This LED is set by setting a bit mask to an address, where +1 turns the segment off, and 0 turns it on. There is also a little +decimal point on the LED display, so it gets the leftmost bit. The other +bits specify the segment location. The bits look like: + +@smallexample + [d.p | g | f | e | d | c | b | a ] is the byte. +@end smallexample + +The locations are set up as: + +@smallexample + a + ----- + f | | b + | g | + ----- + | | + e | | c + ----- + d +@end smallexample + +This takes a number that's already been converted to a string, and +prints it. + +@smallexample +#define LED_ADDR 0xd00003 + +void +led_putnum ( num ) +char num; +@{ + static unsigned char *leds = (unsigned char *)LED_ADDR; + static unsigned char num_bits [18] = @{ + 0xff, /* clear all */ + 0xc0, 0xf9, 0xa4, 0xb0, 0x99, 0x92, 0x82, 0xf8, 0x80, 0x98, /* numbers 0-9 */ + 0x98, 0x20, 0x3, 0x27, 0x21, 0x4, 0xe /* letters a-f */ + @}; + + if (num >= '0' && num <= '9') + num = (num - '0') + 1; + + if (num >= 'a' && num <= 'f') + num = (num - 'a') + 12; + + if (num == ' ') + num = 0; + + *leds = num_bits[num]; +@} + +/* + * zylons -- draw a rotating pattern. NOTE: this function never returns. + */ +void +zylons() +@{ + unsigned char *leds = (unsigned char *)LED_ADDR; + unsigned char curled = 0xfe; + + while (1) + @{ + *leds = curled; + curled = (curled >> 1) | (curled << 7); + delay ( 200 ); + @} +@} +@end smallexample + + +@node GDB, Binutils, Libraries, Top +@chapter Writing a new GDB backend + +Typically, either the low-level I/O routines are used for debugging, or +LEDs, if present. It is much easier to use GDb for debugging an +application. There are several different techniques used to have GDB work +remotely. Commonly more than one kind of GDB interface is used to cober +a wide variety of development needs. + +The most common style of GDB backend is an exception handler for +breakpoints. This is also called a @emph{gdb stub}, and is requires the +two additional lines of init code in your @code{main()} routine. The GDB +stubs all use the GDB @emph{remote protocol}. When the application gets a +breakpoint exception, it communicates to GDB on the host. + +Another common style of interfacing GDB to a target is by using an +existing ROM monitor. These break down into two main kinds, a similar +protocol to the GDB remote protocol, and an interface that uses the ROM +monitor directly. This kind has GDB simulating a human operator, and all +GDB does is work as a command formatter and parser. + +@menu +* GNU remote protocol:: The standard remote protocol. +* Exception handler:: A linked in exception handler. +* ROM monitors:: Using a ROM monitor as a backend. +* Other remote protocols:: Adding support for new protocols. +@end menu + +@node GNU remote protocol, Exception handler, ,GDB +@section The standard remote protocol + +The standard remote protocol is a simple, packet based scheme. A debug +packet whose contents are @emph{<data>} is encapsulated for transmission +in the form: + +@smallexample + $ <data> # CSUM1 CSUM2 +@end smallexample + +@emph{<data>} must be ASCII alphanumeric and cannot include characters +@code{$} or @code{#}. If @emph{<data>} starts with two characters +followed by @code{:}, then the existing stubs interpret this as a +sequence number. For example, the command @code{g} is used to read the +values of the registers. So, a packet to do this would look like + +@smallexample + $g#67 +@end smallexample + +@emph{CSUM1} and @emph{CSUM2} are an ascii representation in hex of an +8-bit checksum of @emph{<data>}, the most significant nibble is sent first. +the hex digits 0-9,a-f are used. + +A simple protocol is used when communicating with the target. This is +mainly to give a degree of error handling over the serial cable. For +each packet transmitted successfully, the target responds with a +@code{+} (@code{ACK}). If there was a transmission error, then the target +responds with a @code{-} (@code{NAK}). An error is determined when the +checksum doesn't match the calculated checksum for that data record. +Upon reciept of the @code{ACK}, @code{GDB} can then transmit the next +packet. + +Here is a list of the main functions that need to be supported. Each data +packet is a command with a set number of bytes in the command packet. +Most commands either return data, or respond with a @code{NAK}. Commands +that don't return data respond with an @code{ACK}. All data values are +ascii hex digits. Every byte needs two hex digits to represent t. This +means that a byte with the value @samp{7} becomes @samp{07}. On a 32 bit +machine this works out to 8 characters per word. All of the bytes in a +word are stored in the target byte order. When writing the host side of +the GDB protocol, be careful of byte order, and make sure that the code +will run on both big and little endian hosts and produce the same answers. + +These functions are the minimum required to make a GDB backend work. All +other commands are optional, and not supported by all GDB backends. + +@table @samp +@item read registers @code{g} + +returns @code{XXXXXXXX...} + +Registers are in the internal order for GDB, and the bytes in a register +are in the same order the machine uses. All values are in sequence +starting with register 0. All registers are listed in the same packet. A +sample packet would look like @code{$g#}. + +@item write registers @code{GXXXXXXXX...} +@code{XXXXXXXX} is the value to set the register to. Registers are in +the internal order for GDB, and the bytes in a register are in the same +order the machine uses. All values are in sequence starting with +register 0. All registers values are listed in the same packet. A sample +packet would look like @code{$G000000001111111122222222...#} + +returns @code{ACK} or @code{NAK} + +@item read memory @code{mAAAAAAAA,LLLL} +@code{AAAAAAAA} is address, @code{LLLL} is length. A sample packet would +look like @code{$m00005556,0024#}. This would request 24 bytes starting +at address @emph{00005556} + +returns @code{XXXXXXXX...} +@code{XXXXXXXX} is the memory contents. Fewer bytes than requested will +be returned if only part of the data can be read. This can be determined +by counting the values till the end of packet @code{#} is seen and +comparing that with the total count of bytes that was requested. + +@item write memory @code{MAAAAAAAA,LLLL:XXXXXXXX} +@code{AAAAAAAA} is the starting address, @code{LLLL} is the number of +bytes to be written, and @code{XXXXXXXX} is value to be written. A +sample packet would look like +@code{$M00005556,0024:101010101111111100000000...#} + +returns @code{ACK} or @code{NAK} for an error. @code{NAK} is also +returned when only part of the data is written. + +@item continue @code{cAAAAAAAAA} +@code{AAAAAAAA} is address to resume execution at. If @code{AAAAAAAA} is +omitted, resume at the curent address of the @code{pc} register. + +returns the same replay as @code{last signal}. There is no immediate +replay to @code{cont} until the next breakpoint is reached, and the +program stops executing. + +@item step sAA..AA +@code{AA..AA} is address to resume +If @code{AA..AA} is omitted, resume at same address. + +returns the same replay as @code{last signal}. There is no immediate +replay to @code{step} until the next breakpoint is reached, and the +program stops executing. + +@item last signal @code{?} + +This returns one of the following: + +@itemize @bullet +@item @code{SAA} +Where @code{AA} is the number of the last signal. +Exceptions on the target are converted to the most similar Unix style +signal number, like @code{SIGSEGV}. A sample response of this type would +look like @code{$S05#}. + +@item TAAnn:XXXXXXXX;nn:XXXXXXXX;nn:XXXXXXXX; +@code{AA} is the signal number. +@code{nn} is the register number. +@code{XXXXXXXX} is the register value. + +@item WAA +The process exited, and @code{AA} is the exit status. This is only +applicable for certains sorts of targets. + +@end itemize + +These are used in some GDB backends, but not all. + +@item write reg @code{Pnn=XXXXXXXX} +Write register @code{nn} with value @code{XXXXXXXX}. + +returns @code{ACK} or @code{NAK} + +@item kill request k + +@item toggle debug d +toggle debug flag (see 386 & 68k stubs) + +@item reset r +reset -- see sparc stub. + +@item reserved @code{other} +On other requests, the stub should ignore the request and send an empty +response @code{$#<checksum>}. This way we can extend the protocol and GDB +can tell whether the stub it is talking to uses the old or the new. + +@item search @code{tAA:PP,MM} +Search backwards starting at address @code{AA} for a match with pattern +PP and mask @code{MM}. @code{PP} and @code{MM} are 4 bytes. + +@item general query @code{qXXXX} +Request info about XXXX. + +@item general set @code{QXXXX=yyyy} +Set value of @code{XXXX} to @code{yyyy}. + +@item query sect offs @code{qOffsets} +Get section offsets. Reply is @code{Text=xxx;Data=yyy;Bss=zzz} + +@item console output Otext +Send text to stdout. The text gets display from the target side of the +serial connection. + +@end table + +Responses can be run-length encoded to save space. A @code{*}means that +the next character is an ASCII encoding giving a repeat count which +stands for that many repetitions of the character preceding the @code{*}. +The encoding is n+29, yielding a printable character where n >=3 +(which is where run length encoding starts to win). You can't use a +value of where n >126 because it's only a two byte value. An example +would be a @code{0*03} means the same thing as @code{0000}. + +@node Exception handler, ROM monitors, GNU remote protocol, GDB +@section A linked in exception handler + +A @emph{GDB stub} consists of two parts, support for the exception +handler, and the exception handler itself. The exception handler needs +to communicate to GDB on the host whenever there is a breakpoint +exception. When GDB starts a program running on the target, it's polling +the serial port during execution looking for any debug packets. So when +a breakpoint occurs, the exception handler needs to save state, and send +a GDB remote protocol packet to GDB on the host. GDB takes any output +that isn't a debug command packet and displays it in the command window. + +Support for the exception handler varies between processors, but the +minimum supported functions are those needed by GDB. These are functions +to support the reading and writing of registers, the reading and writing +of memory, start execution at an address, single step, and last signal. +Sometimes other functions for adjusting the baud rate, or resetting the +hardware are implemented. + +Once GDB gets the command packet from the breakpoint, it will read a few +registers and memory locations an then wait for the user. When the user +types @code{run} or @code{continue} a @code{continue} command is issued +to the backend, and control returns from the breakpoint routine to the +application. + +@node ROM monitors, Other remote protocols, Exception handler, GDB +@section Using a ROM monitor as a backend +GDB also can mimic a human user and use a ROM monitors normal debug +commands as a backend. This consists mostly of sending and parsing +@code{ASCII} strings. All the ROM monitor interfaces share a common set +of routines in @code{gdb/monitor.c}. This supports adding new ROM +monitor interfaces by filling in a structure with the common commands +GDB needs. GDb already supports several command ROM monitors, including +Motorola's @code{Bug} monitor for their VME boards, and the Rom68k +monitor by Integrated Systems, Inc. for various m68k based boards. GDB +also supports the custom ROM monitors on the WinBond and Oki PA based +targets. There is builtin support for loading files to ROM monitors +specifically. GDB can convert a binary into an srecord and then load it +as an ascii file, or using @code{xmodem}. + +@c FIXME: do I need trademark somethings here ? Is Integrated the right +@c company? + +@node Other remote protocols, ,ROM monitors, GDB +@section Adding support for new protocols +@c FIXME: write something here + +@node Binutils, Code Listings, GDB, Top + +@node Code Listings, idp.ld, Binutils, Top +@appendix Code Listings + +@menu +* idp.ld:: A m68k linker script. +* crt0.S:: Crt0.S for an m68k. +* glue.c:: C based support for for Stdio functions. +* mvme.S:: Rom monitor based I/O support in assembler. +* io.c:: C based for memory mapped I/O. +* leds.c:: C based LED routines. +@end menu + +@node idp.ld, crt0.S, Code Listings, Code Listings +@section Linker script for the IDP board + +This is the linker script script that is used on the Motorola IDP board. + +@example +STARTUP(crt0.o) +OUTPUT_ARCH(m68k) +INPUT(idp.o) +SEARCH_DIR(.) +__DYNAMIC = 0; +/* + * Setup the memory map of the MC68ec0x0 Board (IDP) + * stack grows up towards high memory. This works for + * both the rom68k and the mon68k monitors. + */ +MEMORY +@{ + ram : ORIGIN = 0x10000, LENGTH = 2M +@} +/* + * stick everything in ram (of course) + */ +SECTIONS +@{ + .text : + @{ + CREATE_OBJECT_SYMBOLS + *(.text) + etext = .; + __CTOR_LIST__ = .; + LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) + *(.ctors) + LONG(0) + __CTOR_END__ = .; + __DTOR_LIST__ = .; + LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) + *(.dtors) + LONG(0) + __DTOR_END__ = .; + *(.lit) + *(.shdata) + @} > ram + .shbss SIZEOF(.text) + ADDR(.text) : @{ + *(.shbss) + @} + .talias : @{ @} > ram + .data : @{ + *(.data) + CONSTRUCTORS + _edata = .; + @} > ram + + .bss SIZEOF(.data) + ADDR(.data) : + @{ + __bss_start = ALIGN(0x8); + *(.bss) + *(COMMON) + end = ALIGN(0x8); + _end = ALIGN(0x8); + __end = ALIGN(0x8); + @} + .mstack : @{ @} > ram + .rstack : @{ @} > ram + .stab . (NOLOAD) : + @{ + [ .stab ] + @} + .stabstr . (NOLOAD) : + @{ + [ .stabstr ] + @} +@} +@end example + +@node crt0.S, glue.c, idp.ld, Code Listings +@section crt0.S - The startup file + +@example +/* + * crt0.S -- startup file for m68k-coff + * + */ + + .title "crt0.S for m68k-coff" + +/* These are predefined by new versions of GNU cpp. */ + +#ifndef __USER_LABEL_PREFIX__ +#define __USER_LABEL_PREFIX__ _ +#endif + +#ifndef __REGISTER_PREFIX__ +#define __REGISTER_PREFIX__ +#endif + +/* ANSI concatenation macros. */ + +#define CONCAT1(a, b) CONCAT2(a, b) +#define CONCAT2(a, b) a ## b + +/* Use the right prefix for global labels. */ + +#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x) + +/* Use the right prefix for registers. */ + +#define REG(x) CONCAT1 (__REGISTER_PREFIX__, x) + +#define d0 REG (d0) +#define d1 REG (d1) +#define d2 REG (d2) +#define d3 REG (d3) +#define d4 REG (d4) +#define d5 REG (d5) +#define d6 REG (d6) +#define d7 REG (d7) +#define a0 REG (a0) +#define a1 REG (a1) +#define a2 REG (a2) +#define a3 REG (a3) +#define a4 REG (a4) +#define a5 REG (a5) +#define a6 REG (a6) +#define fp REG (fp) +#define sp REG (sp) + +/* + * Set up some room for a stack. We just grab a chunk of memory. + */ + .set stack_size, 0x2000 + .comm SYM (stack), stack_size + +/* + * Define an empty environment. + */ + .data + .align 2 +SYM (environ): + .long 0 + + .align 2 + .text + .global SYM (stack) + + .global SYM (main) + .global SYM (exit) +/* + * This really should be __bss_start, not SYM (__bss_start). + */ + .global __bss_start + +/* + * start -- set things up so the application will run. + */ +SYM (start): + link a6, #-8 + moveal #SYM (stack) + stack_size, sp + +/* + * zerobss -- zero out the bss section + */ + moveal #__bss_start, a0 + moveal #SYM (end), a1 +1: + movel #0, (a0) + leal 4(a0), a0 + cmpal a0, a1 + bne 1b + +/* + * Call the main routine from the application to get it going. + * main (argc, argv, environ) + * We pass argv as a pointer to NULL. + */ + pea 0 + pea SYM (environ) + pea sp@@(4) + pea 0 + jsr SYM (main) + movel d0, sp@@- + +/* + * _exit -- Exit from the application. Normally we cause a user trap + * to return to the ROM monitor for another run. + */ +SYM (exit): + trap #0 +@end example + +@node glue.c, mvme.S, crt0.S, Code Listings +@section C based "glue" code. + +@example + +/* + * glue.c -- all the code to make GCC and the libraries run on + * a bare target board. These should work with any + * target if inbyte() and outbyte() exist. + */ + +#include <sys/types.h> +#include <sys/stat.h> +#include <errno.h> +#ifndef NULL +#define NULL 0 +#endif + +/* FIXME: this is a hack till libc builds */ +__main() +@{ + return; +@} + +#undef errno +int errno; + +extern caddr_t _end; /* _end is set in the linker command file */ +extern int outbyte(); +extern unsigned char inbyte(); +extern int havebyte(); + +/* just in case, most boards have at least some memory */ +#ifndef RAMSIZE +# define RAMSIZE (caddr_t)0x100000 +#endif + +/* + * read -- read bytes from the serial port. Ignore fd, since + * we only have stdin. + */ +int +read(fd, buf, nbytes) + int fd; + char *buf; + int nbytes; +@{ + int i = 0; + + for (i = 0; i < nbytes; i++) @{ + *(buf + i) = inbyte(); + if ((*(buf + i) == '\n') || (*(buf + i) == '\r')) @{ + (*(buf + i)) = 0; + break; + @} + @} + return (i); +@} + +/* + * write -- write bytes to the serial port. Ignore fd, since + * stdout and stderr are the same. Since we have no filesystem, + * open will only return an error. + */ +int +write(fd, buf, nbytes) + int fd; + char *buf; + int nbytes; +@{ + int i; + + for (i = 0; i < nbytes; i++) @{ + if (*(buf + i) == '\n') @{ + outbyte ('\r'); + @} + outbyte (*(buf + i)); + @} + return (nbytes); +@} + +/* + * open -- open a file descriptor. We don't have a filesystem, so + * we return an error. + */ +int +open(buf, flags, mode) + char *buf; + int flags; + int mode; +@{ + errno = EIO; + return (-1); +@} + +/* + * close -- close a file descriptor. We don't need + * to do anything, but pretend we did. + */ +int +close(fd) + int fd; +@{ + return (0); +@} + +/* + * sbrk -- changes heap size size. Get nbytes more + * RAM. We just increment a pointer in what's + * left of memory on the board. + */ +caddr_t +sbrk(nbytes) + int nbytes; +@{ + static caddr_t heap_ptr = NULL; + caddr_t base; + + if (heap_ptr == NULL) @{ + heap_ptr = (caddr_t)&_end; + @} + + if ((RAMSIZE - heap_ptr) >= 0) @{ + base = heap_ptr; + heap_ptr += nbytes; + return (base); + @} else @{ + errno = ENOMEM; + return ((caddr_t)-1); + @} +@} + +/* + * isatty -- returns 1 if connected to a terminal device, + * returns 0 if not. Since we're hooked up to a + * serial port, we'll say yes and return a 1. + */ +int +isatty(fd) + int fd; +@{ + return (1); +@} + +/* + * lseek -- move read/write pointer. Since a serial port + * is non-seekable, we return an error. + */ +off_t +lseek(fd, offset, whence) + int fd; + off_t offset; + int whence; +@{ + errno = ESPIPE; + return ((off_t)-1); +@} + +/* + * fstat -- get status of a file. Since we have no file + * system, we just return an error. + */ +int +fstat(fd, buf) + int fd; + struct stat *buf; +@{ + errno = EIO; + return (-1); +@} + +/* + * getpid -- only one process, so just return 1. + */ +#define __MYPID 1 +int +getpid() +@{ + return __MYPID; +@} + +/* + * kill -- go out via exit... + */ +int +kill(pid, sig) + int pid; + int sig; +@{ + if(pid == __MYPID) + _exit(sig); + return 0; +@} + +/* + * print -- do a raw print of a string + */ +int +print(ptr) +char *ptr; +@{ + while (*ptr) @{ + outbyte (*ptr++); + @} +@} + +/* + * putnum -- print a 32 bit number in hex + */ +int +putnum (num) +unsigned int num; +@{ + char buffer[9]; + int count; + char *bufptr = buffer; + int digit; + + for (count = 7 ; count >= 0 ; count--) @{ + digit = (num >> (count * 4)) & 0xf; + + if (digit <= 9) + *bufptr++ = (char) ('0' + digit); + else + *bufptr++ = (char) ('a' - 10 + digit); + @} + + *bufptr = (char) 0; + print (buffer); + return; +@} +@end example + +@node mvme.S, io.c, glue.c, Code Listings +@section I/O assembler code sample + +@example +/* + * mvme.S -- board support for m68k + */ + + .title "mvme.S for m68k-coff" + +/* These are predefined by new versions of GNU cpp. */ + +#ifndef __USER_LABEL_PREFIX__ +#define __USER_LABEL_PREFIX__ _ +#endif + +#ifndef __REGISTER_PREFIX__ +#define __REGISTER_PREFIX__ +#endif + +/* ANSI concatenation macros. */ + +#define CONCAT1(a, b) CONCAT2(a, b) +#define CONCAT2(a, b) a ## b + +/* Use the right prefix for global labels. */ + +#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x) + +/* Use the right prefix for registers. */ + +#define REG(x) CONCAT1 (__REGISTER_PREFIX__, x) + +#define d0 REG (d0) +#define d1 REG (d1) +#define d2 REG (d2) +#define d3 REG (d3) +#define d4 REG (d4) +#define d5 REG (d5) +#define d6 REG (d6) +#define d7 REG (d7) +#define a0 REG (a0) +#define a1 REG (a1) +#define a2 REG (a2) +#define a3 REG (a3) +#define a4 REG (a4) +#define a5 REG (a5) +#define a6 REG (a6) +#define fp REG (fp) +#define sp REG (sp) +#define vbr REG (vbr) + + .align 2 + .text + .global SYM (_exit) + .global SYM (outln) + .global SYM (outbyte) + .global SYM (putDebugChar) + .global SYM (inbyte) + .global SYM (getDebugChar) + .global SYM (havebyte) + .global SYM (exceptionHandler) + + .set vbr_size, 0x400 + .comm SYM (vbr_table), vbr_size + +/* + * inbyte -- get a byte from the serial port + * d0 - contains the byte read in + */ + .align 2 +SYM (getDebugChar): /* symbol name used by m68k-stub */ +SYM (inbyte): + link a6, #-8 + trap #15 + .word inchr + moveb sp@@, d0 + extbl d0 + unlk a6 + rts + +/* + * outbyte -- sends a byte out the serial port + * d0 - contains the byte to be sent + */ + .align 2 +SYM (putDebugChar): /* symbol name used by m68k-stub */ +SYM (outbyte): + link fp, #-4 + moveb fp@@(11), sp@@ + trap #15 + .word outchr + unlk fp + rts + +/* + * outln -- sends a string of bytes out the serial port with a CR/LF + * a0 - contains the address of the string's first byte + * a1 - contains the address of the string's last byte + */ + .align 2 +SYM (outln): + link a6, #-8 + moveml a0/a1, sp@@ + trap #15 + .word outln + unlk a6 + rts + +/* + * outstr -- sends a string of bytes out the serial port without a CR/LF + * a0 - contains the address of the string's first byte + * a1 - contains the address of the string's last byte + */ + .align 2 +SYM (outstr): + link a6, #-8 + moveml a0/a1, sp@@ + trap #15 + .word outstr + unlk a6 + rts + +/* + * havebyte -- checks to see if there is a byte in the serial port, + * returns 1 if there is a byte, 0 otherwise. + */ +SYM (havebyte): + trap #15 + .word instat + beqs empty + movel #1, d0 + rts +empty: + movel #0, d0 + rts + +/* + * These constants are for the MVME-135 board's boot monitor. They + * are used with a TRAP #15 call to access the monitor's I/O routines. + * they must be in the word following the trap call. + */ + .set inchr, 0x0 + .set instat, 0x1 + .set inln, 0x2 + .set readstr, 0x3 + .set readln, 0x4 + .set chkbrk, 0x5 + + .set outchr, 0x20 + .set outstr, 0x21 + .set outln, 0x22 + .set write, 0x23 + .set writeln, 0x24 + .set writdln, 0x25 + .set pcrlf, 0x26 + .set eraseln, 0x27 + .set writd, 0x28 + .set sndbrk, 0x29 + + .set tm_ini, 0x40 + .set dt_ini, 0x42 + .set tm_disp, 0x43 + .set tm_rd, 0x44 + + .set redir, 0x60 + .set redir_i, 0x61 + .set redir_o, 0x62 + .set return, 0x63 + .set bindec, 0x64 + + .set changev, 0x67 + .set strcmp, 0x68 + .set mulu32, 0x69 + .set divu32, 0x6A + .set chk_sum, 0x6B + +@end example + +@node io.c, leds.c, mvme.S, Code Listings +@section I/O code sample + +@example +#include "w89k.h" + +/* + * outbyte -- shove a byte out the serial port. We wait till the byte + */ +int +outbyte(byte) + unsigned char byte; +@{ + while ((inp(RS232REG) & TRANSMIT) == 0x0) @{ @} ; + return (outp(RS232PORT, byte)); +@} + +/* + * inbyte -- get a byte from the serial port + */ +unsigned char +inbyte() +@{ + while ((inp(RS232REG) & RECEIVE) == 0x0) @{ @}; + return (inp(RS232PORT)); +@} +@end example + +@node leds.c, ,io.c, Code Listings +@section Led control sample + +@example +/* + * leds.h -- control the led's on a Motorola mc68ec0x0 board. + */ + +#ifndef __LEDS_H__ +#define __LEDS_H__ + +#define LED_ADDR 0xd00003 +#define LED_0 ~0x1 +#define LED_1 ~0x2 +#define LED_2 ~0x4 +#define LED_3 ~0x8 +#define LED_4 ~0x10 +#define LED_5 ~0x20 +#define LED_6 ~0x40 +#define LED_7 ~0x80 +#define LEDS_OFF 0xff +#define LEDS_ON 0x0 + +#define FUDGE(x) ((x >= 0xa && x <= 0xf) ? (x + 'a') & 0x7f : (x + '0') & 0x7f) + +extern void led_putnum( char ); + +#endif /* __LEDS_H__ */ + +/* + * leds.c -- control the led's on a Motorola mc68ec0x0 (IDP)board. + */ +#include "leds.h" + +void zylons(); +void led_putnum(); + +/* + * led_putnum -- print a hex number on the LED. the value of num must be a char with + * the ascii value. ie... number 0 is '0', a is 'a', ' ' (null) clears + * the led display. + * Setting the bit to 0 turns it on, 1 turns it off. + * the LED's are controlled by setting the right bit mask in the base + * address. + * The bits are: + * [d.p | g | f | e | d | c | b | a ] is the byte. + * + * The locations are: + * + * a + * ----- + * f | | b + * | g | + * ----- + * | | + * e | | c + * ----- + * d . d.p (decimal point) + */ +void +led_putnum ( num ) +char num; +@{ + static unsigned char *leds = (unsigned char *)LED_ADDR; + static unsigned char num_bits [18] = @{ + 0xff, /* clear all */ + 0xc0, 0xf9, 0xa4, 0xb0, 0x99, 0x92, 0x82, 0xf8, 0x80, 0x98, /* numbers 0-9 */ + 0x98, 0x20, 0x3, 0x27, 0x21, 0x4, 0xe /* letters a-f */ + @}; + + if (num >= '0' && num <= '9') + num = (num - '0') + 1; + + if (num >= 'a' && num <= 'f') + num = (num - 'a') + 12; + + if (num == ' ') + num = 0; + + *leds = num_bits[num]; +@} + +/* + * zylons -- draw a rotating pattern. NOTE: this function never returns. + */ +void +zylons() +@{ + unsigned char *leds = (unsigned char *)LED_ADDR; + unsigned char curled = 0xfe; + + while (1) + @{ + *leds = curled; + curled = (curled >> 1) | (curled << 7); + delay ( 200 ); + @} +@} +@end example + +@page +@contents +@c second page break makes sure right-left page alignment works right +@c with a one-page toc, even though we don't have setchapternewpage odd. +@page +@bye diff --git a/libgloss/fr30/Makefile.in b/libgloss/fr30/Makefile.in new file mode 100644 index 0000000..d318093 --- /dev/null +++ b/libgloss/fr30/Makefile.in @@ -0,0 +1,143 @@ +# +# + +VPATH = @srcdir@ @srcdir@/.. +srcdir = @srcdir@ +objdir = . +srcroot = $(srcdir)/../.. +objroot = $(objdir)/../.. + +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +host_alias = @host_alias@ +target_alias = @target_alias@ + +bindir = @bindir@ +libdir = @libdir@ +tooldir = $(exec_prefix)/$(target_alias) + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ + +# Multilib support variables. +# TOP is used instead of MULTI{BUILD,SRC}TOP. +MULTIDIRS = +MULTISUBDIR = + +SHELL = /bin/sh + +CC = @CC@ + +AS = @AS@ +AR = @AR@ +LD = @LD@ +RANLIB = @RANLIB@ + +OBJDUMP = `if [ -f ${objroot}/../binutils/objdump ] ; \ + then echo ${objroot}/../binutils/objdump ; \ + else t='$(program_transform_name)'; echo objdump | sed -e $$t ; fi` +OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \ + then echo ${objroot}/../binutils/objcopy ; \ + else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi` + +OBJS = putnum.o unlink.o +CFLAGS = -g +SCRIPTS = + +# Here is all of the simulator stuff +SIM_SCRIPTS = +SIM_LDFLAGS = +SIM_BSP = libsim.a +SIM_CRT0 = crt0.o +SIM_OBJS = syscalls.o +SIM_TEST = sim-test +SIM_INSTALL = install-sim + +# Here is all of the mon960 stuff +MON_LDFLAGS = +MON_BSP = libmon960.a +MON_CRT0 = crt0.o +MON_OBJS = +MON_SCRIPTS = mon960.ld +MON_TEST = +MON_INSTALL = install-mon + +# Host specific makefile fragment comes in here. +@host_makefile_frag@ + +# +# 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. +# +# all: ${MON_CRT0} ${MON_BSP} +all: ${SIM_CRT0} ${SIM_BSP} + +# +# here's where we build the board support packages for each target +# +${SIM_BSP}: ${OBJS} ${SIM_OBJS} + ${AR} ${ARFLAGS} ${SIM_BSP} ${SIM_OBJS} ${OBJS} + ${RANLIB} ${SIM_BSP} + +${MON_BSP}: ${OBJS} ${MON_OBJS} + ${AR} ${ARFLAGS} ${MON_BSP} ${MON_OBJS} ${OBJS} + ${RANLIB} ${MON_BSP} + +# +# here's where we build the test programs for each target +# +.PHONY: test +test: ${SIM_TEST} ${MVME_TEST} ${EVM_TEST} + +sim-test: sim-test.x sim-test.dis + +sim-test.x: test.o ${SIM_CRT0} ${SIM_BSP} + ${CC} ${LDFLAGS_FOR_TARGET} -L${objdir} \ + ${SIM_CRT0} test.o \ + -o sim-test.x ${LIBS_FOR_TARGET} -lc ${SIM_BSP} + +sim-test.dis: sim-test.x + ${OBJDUMP} -d sim-test.x > sim-test.dis + + +# +# +# +.c.S: + ${CC} ${CFLAGS_FOR_TARGET} -c $< + +simulator.o: simulator.S +sim-crt0.o: sim-crt0.S +mvme-crt0.o: mvme-crt0.S +mvme-exit.o: mvme-exit.S +mvme-inbyte.o: mvme-inbyte.S +mvme-outbyte.o: mvme-outbyte.S + +clean mostlyclean: + rm -f a.out core *.i *.o *-test *.srec *.dis *.x $(SIM_BSP) $(MON_BSP) + +distclean maintainer-clean realclean: clean + rm -f Makefile config.status *~ + +.PHONY: install info install-info clean-info +install: ${SIM_INSTALL} + +install-mon: + set -e; for x in ${MON_CRT0} ${MON_BSP}; do ${INSTALL_DATA} $$x ${tooldir}/lib${MULTISUBDIR}/$$x; done + set -e; for x in ${MON_SCRIPTS}; do ${INSTALL_DATA} ${srcdir}/$$x ${tooldir}/lib${MULTISUBDIR}/$$x; done + +install-sim: + set -e; for x in ${SIM_CRT0} ${SIM_BSP} ${SIM_SCRIPTS}; do ${INSTALL_DATA} $$x ${tooldir}/lib/$$x; done + +doc: +info: +install-info: +clean-info: + +Makefile: Makefile.in config.status @host_makefile_frag_path@ + $(SHELL) config.status + +config.status: configure + $(SHELL) config.status --recheck diff --git a/libgloss/fr30/configure b/libgloss/fr30/configure new file mode 100755 index 0000000..d0e7f7c --- /dev/null +++ b/libgloss/fr30/configure @@ -0,0 +1,1219 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.12.1 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.12.1" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=crt0.s + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + + +# Do some error checking and defaulting for the host and target type. +# The inputs are: +# configure --host=HOST --target=TARGET --build=BUILD NONOPT +# +# The rules are: +# 1. You are not allowed to specify --host, --target, and nonopt at the +# same time. +# 2. Host defaults to nonopt. +# 3. If nonopt is not specified, then host defaults to the current host, +# as determined by config.guess. +# 4. Target and build default to nonopt. +# 5. If nonopt is not specified, then target and build default to host. + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +case $host---$target---$nonopt in +NONE---*---* | *---NONE---* | *---*---NONE) ;; +*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;; +esac + + +# Make sure we can run config.sub. +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi + +echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:571: checking host system type" >&5 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + +echo $ac_n "checking target system type""... $ac_c" 1>&6 +echo "configure:592: checking target system type" >&5 + +target_alias=$target +case "$target_alias" in +NONE) + case $nonopt in + NONE) target_alias=$host_alias ;; + *) target_alias=$nonopt ;; + esac ;; +esac + +target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias` +target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$target" 1>&6 + +echo $ac_n "checking build system type""... $ac_c" 1>&6 +echo "configure:610: checking build system type" >&5 + +build_alias=$build +case "$build_alias" in +NONE) + case $nonopt in + NONE) build_alias=$host_alias ;; + *) build_alias=$nonopt ;; + esac ;; +esac + +build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` +build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$build" 1>&6 + +test "$host_alias" != "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + +if test "$program_transform_name" = s,x,x,; then + program_transform_name= +else + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed +s,\\,\\\\,g; s,\$,$$,g +EOF_SED + program_transform_name="`echo $program_transform_name|sed -f conftestsed`" + rm -f conftestsed +fi +test "$program_prefix" != NONE && + program_transform_name="s,^,${program_prefix},; $program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" + +# sed with no file args requires a program. +test "$program_transform_name" = "" && program_transform_name="s,x,x," + + +if test "$srcdir" = "." ; then + mdir=`echo "${with_multisubdir}/" \ + | sed -e 's,\([^/][^/]*\),..,g' -e 's,^/$,,'` + ac_aux_dir= +for ac_dir in ${mdir}../../.. $srcdir/${mdir}../../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in ${mdir}../../.. $srcdir/${mdir}../../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + +else + ac_aux_dir= +for ac_dir in ${srcdir}/../.. $srcdir/${srcdir}/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in ${srcdir}/../.. $srcdir/${srcdir}/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + +fi + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:708: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +# FIXME: We temporarily define our own version of AC_PROG_CC. This is +# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We +# are probably using a cross compiler, which will not be able to fully +# link an executable. This should really be fixed in autoconf +# itself. + + + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:770: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:799: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + ac_prog_rejected=no + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +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 $# -gt 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 + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:847: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <<EOF +#ifdef __GNUC__ + yes; +#endif +EOF +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:856: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:871: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi + +AS=${AS-as} + +AR=${AR-ar} + +LD=${LD-ld} + +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:907: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +host_makefile_frag=${srcdir}/../config/default.mh + +host_makefile_frag_path=$host_makefile_frag + + + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs + + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS <<EOF +#! /bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.12.1" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS <<EOF + +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; + s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@host@%$host%g +s%@host_alias@%$host_alias%g +s%@host_cpu@%$host_cpu%g +s%@host_vendor@%$host_vendor%g +s%@host_os@%$host_os%g +s%@target@%$target%g +s%@target_alias@%$target_alias%g +s%@target_cpu@%$target_cpu%g +s%@target_vendor@%$target_vendor%g +s%@target_os@%$target_os%g +s%@build@%$build%g +s%@build_alias@%$build_alias%g +s%@build_cpu@%$build_cpu%g +s%@build_vendor@%$build_vendor%g +s%@build_os@%$build_os%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@CC@%$CC%g +s%@AS@%$AS%g +s%@AR@%$AR%g +s%@LD@%$LD%g +s%@RANLIB@%$RANLIB%g +s%@host_makefile_frag_path@%$host_makefile_frag_path%g +/@host_makefile_frag@/r $host_makefile_frag +s%@host_makefile_frag@%%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <<EOF + +CONFIG_FILES=\${CONFIG_FILES-"Makefile"} +EOF +cat >> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +EOF +cat >> $CONFIG_STATUS <<EOF + +EOF +cat >> $CONFIG_STATUS <<\EOF + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + diff --git a/libgloss/fr30/configure.in b/libgloss/fr30/configure.in new file mode 100644 index 0000000..5824402 --- /dev/null +++ b/libgloss/fr30/configure.in @@ -0,0 +1,75 @@ +dnl Process this file with autoconf to produce a configure script. +AC_PREREQ(2.5)dnl +AC_INIT(crt0.s) + +AC_CANONICAL_SYSTEM +AC_ARG_PROGRAM + +if test "$srcdir" = "." ; then + mdir=`echo "${with_multisubdir}/" \ + | sed -e 's,\([[^/]][[^/]]*\),..,g' -e 's,^/$,,'` + AC_CONFIG_AUX_DIR(${mdir}../../..) +else + AC_CONFIG_AUX_DIR(${srcdir}/../..) +fi + +AC_PROG_INSTALL + +# FIXME: We temporarily define our own version of AC_PROG_CC. This is +# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We +# are probably using a cross compiler, which will not be able to fully +# link an executable. This should really be fixed in autoconf +# itself. + +AC_DEFUN(LIB_AC_PROG_CC, +[AC_BEFORE([$0], [AC_PROG_CPP])dnl +AC_CHECK_PROG(CC, gcc, gcc) +if test -z "$CC"; then + AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) + test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) +fi + +AC_PROG_CC_GNU + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +dnl Check whether -g works, even if CFLAGS is set, in case the package +dnl plays around with CFLAGS (such as to build both debugging and +dnl normal versions of a library), tasteless as that idea is. + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + AC_PROG_CC_G + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi +]) + +LIB_AC_PROG_CC +AS=${AS-as} +AC_SUBST(AS) +AR=${AR-ar} +AC_SUBST(AR) +LD=${LD-ld} +AC_SUBST(LD) +AC_PROG_RANLIB + +host_makefile_frag=${srcdir}/../config/default.mh + +dnl We have to assign the same value to other variables because autoconf +dnl doesn't provide a mechanism to substitute a replacement keyword with +dnl arbitrary data or pathnames. +dnl +host_makefile_frag_path=$host_makefile_frag +AC_SUBST(host_makefile_frag_path) +AC_SUBST_FILE(host_makefile_frag) + +AC_OUTPUT(Makefile) diff --git a/libgloss/fr30/crt0.s b/libgloss/fr30/crt0.s new file mode 100644 index 0000000..e83a308 --- /dev/null +++ b/libgloss/fr30/crt0.s @@ -0,0 +1,46 @@ +# FR30 startup code + + .section .text + .global _start +_start: + + ;; Initialise the stack pointer + ldi:32 __stack, r0 + mov r0, sp + mov r0, fp + + ;; Zero the data space + ldi:32 #_edata, r0 + ldi:32 #_end, r1 + ldi:8 #0, r2 +.L0: + st r2, @r0 + add #4, r0 + cmp r1, r0 + blt .L0 + + ;; Call global and static constructors + ldi:32 _init, r0 + call @r0 + + ;; Setup destrcutors to be called from exit. + ;; (Just in case main never returns....) + ldi:32 atexit, r0 + ldi:32 _fini, r4 + call @r0 + + ;; Initialise argc, argv and envp to empty + ldi:8 #0, r4 + ldi:8 #0, r5 + ldi:8 #0, r6 + + ;; Call main + ldi:32 main, r0 + call @r0 + + ;; Jump to exit + ldi:32 exit, r0 + call @r0 + + ;; Should never reach here + int #9 diff --git a/libgloss/fr30/syscalls.c b/libgloss/fr30/syscalls.c new file mode 100644 index 0000000..e59a144 --- /dev/null +++ b/libgloss/fr30/syscalls.c @@ -0,0 +1,162 @@ +/* FR30 system call emulation code + Copyright (C) 1998 Free Software Foundation, Inc. + Contributed by Cygnus Solutions. + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#include <sys/stat.h> +#include "../syscall.h" + +int +_read (file, ptr, len) + int file; + char * ptr; + int len; +{ + asm ("ldi:8 %0, r0" :: "i" (SYS_read) : "r0"); + asm ("int #10"); + + return; +} + +int +_lseek (file, ptr, dir) + int file; + int ptr; + int dir; +{ + asm ("ldi:8 %0, r0" :: "i" (SYS_lseek) : "r0"); + asm ("int #10"); + + return; +} + +int +_write (file, ptr, len) + int file; + char * ptr; + int len; +{ + asm ("ldi:8 %0, r0" :: "i" (SYS_write) : "r0"); + asm ("int #10"); + + return; +} + +int +_open (path, flags) + const char * path; + int flags; +{ + asm ("ldi:8 %0, r0" :: "i" (SYS_open) : "r0"); + asm ("int #10"); + + return; +} + +int +_close (file) + int file; +{ + asm ("ldi:8 %0, r0" :: "i" (SYS_close) : "r0"); + asm ("int #10"); + + return 0; +} + +void +_exit (n) + int n; +{ + asm ("ldi:8 %0, r0" :: "i" (SYS_exit) : "r0"); + asm ("int #10"); +} + + +caddr_t +_sbrk (incr) + int incr; +{ + extern char end asm ("_end"); /* Defined by the linker */ + extern int __stack; /* Defined by linker script. */ + static char * heap_end; + char * prev_heap_end; + + if (heap_end == NULL) + heap_end = & end; + + prev_heap_end = heap_end; +#if 0 + if (heap_end + incr > __stack) + { + _write ( 1, "_sbrk: Heap and stack collision\n", 32); + abort (); + } +#endif + heap_end += incr; + + return (caddr_t) prev_heap_end; +} + +int +_fstat (file, st) + int file; + struct stat * st; +{ + st->st_mode = S_IFCHR; + return 0; +} + +int +_unlink () +{ + return -1; +} + +int +isatty (fd) + int fd; +{ + return 0; +} + +int +_raise () +{ + return 0; +} + +int +_times () +{ + return 0; +} + +int +_kill (pid, sig) + int pid; + int sig; +{ + return 0; +} + +int +_getpid (void) +{ + return 0; +} diff --git a/libgloss/fstat.c b/libgloss/fstat.c new file mode 100644 index 0000000..8082d63 --- /dev/null +++ b/libgloss/fstat.c @@ -0,0 +1,30 @@ +/* fstat.c -- get status of a file. + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include <sys/stat.h> +#include "glue.h" + +/* + * fstat -- Since we have no file system, we just return an error. + */ +int +_DEFUN (fstat, (fd, buf), + int fd _AND + struct stat *buf) +{ + buf->st_mode = S_IFCHR; /* Always pretend to be a tty */ + buf->st_blksize = 0; + + return (0); +} diff --git a/libgloss/getpid.c b/libgloss/getpid.c new file mode 100644 index 0000000..07f7f92 --- /dev/null +++ b/libgloss/getpid.c @@ -0,0 +1,25 @@ +/* getpid.c -- get the current process id. + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include "glue.h" + +/* + * getpid -- only one process, so just return 1. + */ +int +_DEFUN (getpid, (), + ) +{ + return __MYPID; +} diff --git a/libgloss/glue.h b/libgloss/glue.h new file mode 100644 index 0000000..0a7e36d --- /dev/null +++ b/libgloss/glue.h @@ -0,0 +1,31 @@ +/* glue.h -- common definitions for "glue" fucntions. + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include <_ansi.h> + +#ifndef NULL +# define NULL 0 +#endif + +#ifdef __NO_UNDERSCORE__ +# define _end end +# define _exit exit +#endif + +extern char _end[]; /* _end is set in the linker command file */ + +/* only one prcess support, as this is OS dependant */ +#define __MYPID 1 + + diff --git a/libgloss/hp74x/Makefile.in b/libgloss/hp74x/Makefile.in new file mode 100644 index 0000000..5a90c9b --- /dev/null +++ b/libgloss/hp74x/Makefile.in @@ -0,0 +1,215 @@ +# +# Makefile +# Copyright (C) 1990, 1991, 1992, 1993 ,1994 Free Software Foundation +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +# + +# +# Makefile for newlib/libc/stub/hppa. This is the board support code +# for the HP-PRO hppa embedded boards. <rob@cygnus.com> +# + +VPATH = @srcdir@ +srcdir = @srcdir@ +objdir = . +srcroot = $(srcdir)/../.. +objroot = $(objdir)/../.. + +prefix = @prefix +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +libdir = @libdir@ +tooldir = $(exec_prefix)/$(target_alias) + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ + +SHELL = /bin/sh + +CC = @CC@ + +AS = @AS@ +AR = @AR@ +LD = @LD@ +RANLIB = @RANLIB@ + +# +# As the boot process only deals with LIF volumes, here's the src +# where we borrow existing code modules and where we put our +# boot image if we can bvuild one. +# +LIF_SRC = /usr/tftpdir/srcboot.lif +LIF_DEST = /usr/tftpdir/romboot.lif + +HPDEFS = -D_INCLUDE_POSIX_SOURCE -D_INCLUDE_XOPEN_SOURCE \ + -D_INCLUDE_HPUX_SOURCE -DPCXT + +LIBS_FOR_TARGET = -lc + +# +# The original flags used by HP for the boot ROMS were +# CFLAGS_FOR_TARGET = -c -Aa +O3 +OS -Wc,-DA1.0 -Wc,-DS1.0 +ESfic +ESsfc ${HPDEFS} +CFLAGS_FOR_TARGET = -c -Wd,-a -g +# the original value for -R was 0 +LDFLAGS_FOR_TARGET = -v -t -N -R 10000 -a archive +INCLUDES = -I${srcdir} + +BSP_OBJS= pa_stub.o debugger.o iva_table.o io.o +STUBCRT0=crt0.o +STUBLIB=hppa.o +LDSCRIPT=hppa.ld +SHARED_DIR= +SHARED_OBJS= +# SHARED_OBJS=$(SHARED_DIR) + +# Host specific makefile fragment comes in here. +@host_makefile_frag@ + +all: boot + +# this target is only for testing +test: ${STUBCRT0} $(STUBLIB) test.o $(BSP_OBJS) +# ${LD} $(LDFLAGS_FOR_TARGET) ${STUBCRT0} test.o $(BSP_OBJS) -o test $(LIBS_FOR_TARGET) + rootme=`pwd` ; \ + ${LD} $(LDFLAGS_FOR_TARGET) ${STUBCRT0} test.o pa_stub.o debugger.o iva_table.o io.o -o test $(LIBS_FOR_TARGET) + +$(STUBLIB): $(BSP_OBJS) + ${LD} -r $(BSP_OBJS) $(SHARED_OBJS) -o $(STUBLIB) + +checksum: $(srcdir)/checksum.c + $(CC) -g $(srcdir)/checksum.c -o checksum + +# this is the target from HP's Makefile, it may be bogus +hpstub: $(OBJS) + $(LD) $(LDFLAGS_FOR_TARGET) -e main -o $@ $(LIBRARY)/crt1.o \ + $(OBJS) -lc -m >stub.map + +install: + $(INSTALL_PROGRAM) $(STUBLIB) $(tooldir)/lib/$(MULTISUBDIR)$(STUBLIB) + $(INSTALL_PROGRAM) $(SHARED_DIR)/$(STUBCRT0) $(tooldir)/lib/$(MULTISUBDIR)$(STUBCRT0) + $(INSTALL_PROGRAM) $(srcdir)/$(LDSCRIPT) $(tooldir)/lib/$(LDSCRIPT) + +.c.o: + $(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $< + +.c.s: + $(CC) $(CFLAGS_FOR_TARGET) -S $(INCLUDES) $< +# $(CC) $(CFLAGS_FOR_TARGET) $(NEWLIB_CFLAGS) $(INCLUDES) -c $< + +.s.o: + $(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $< +# $(AS) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $< + +.SUFFIXES: .S .c .o .s .lif +# +# lifinit -- +# -vnnn Sets volume size to nnn bytes. +# nnn must be a multiple of 256. +# -d Sets directory size to nnn file entries. +# nnn must be a multiple of 8. +# -nsss Sets the volume name to be sss. +# -Knnn Forces the directory start location to be the +# nearest multiple of nnn x 1024 bytes. +# -snnn set the initial system load (ISL) start address to +# nnn in the volume label +# -lnnn Specifies the length in bytes of the ISL code. +# -ennn Set the ISL entry point to nnn bytes from the +# beginning of the ISL +# +# lifcp -- +# -r Forces RAW mode copying. +# -T Sets the file type of the directory entry. +# ASCII is 1 +# BIN is -23951 +# BINARY is -2 +# -Knnn forces each file copied in to begin on a nnn x +# 1024-byte boundary from the beginning of the volume +# Note: the word echoed below MUST be 10 characters exactly. +# +# somxtract infile outfile -- +# converts a series 800 file *only* into a raw image +# +LIF_VOL = this_lif +# 65532 +boot: test checksum +# FIXME: This fills up the hard disk unless "-R" is used + @rm -f ${LIF_VOL} ${LIF_DEST} + @ipl_entry=`nm -t d $< | grep "T .START." | sed -e 's/T .START.//' -e 's/^0*//'` ; \ + echo "Entry point is at $${ipl_entry}" ; \ + if test x"$${ipl_entry}" != x ; then \ + ipl_entry=`expr $${ipl_entry} - 65536` ; \ + echo "Entry point offset is $${ipl_entry}" ; \ + cp $< $<.raw ; \ + rm -f $<.dis ; \ + objdump -d $< > $<.dis ; \ + somxtract $< $<.raw ; \ + ipl_size=`checksum -s $<.raw $<.image | sed -e 's/ is the.*//'` ; \ + echo "IPL_SIZE is $${ipl_size}" ; \ + lifinit -v64000000 -d64 -n"CYGNUS " -K2 -s4096 -l$${ipl_size} -e$${ipl_entry} ${LIF_DEST} ;\ + else \ + echo "ERROR: \$$START\$$ symbol not found" ; \ + fi + @chmod a+rw $<.image + @lifcp -r -K2 $<.image ${LIF_DEST}:TEST + @rm -f $<.image $<.dis + @lifls -l ${LIF_DEST} + @objdump -d $< > $<.dis + +.S.o: + rm -f $*.s + ${CPP} $< > $*.s + $(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $*.s +# $(CC) $(CFLAGS_FOR_TARGET) $(NEWLIB_CFLAGS) $(INCLUDES) -c $< + +.c.list: + $(CC) $(CFLAGS) $*.c -S + $(AS) $(AFLAGS) $*.s -Wa,-l > $*.list + rm $*.s + +.s.list: + $(AS) $(AFLAGS) $*.s -Wa,-l > $*.list + +doc: + +clean mostlyclean: + rm -f *~ *.map *.list stub romboot.lif a.out *.raw *.image + rm -f *.o $(STUBLIB) $(STUBCRT0) checksum *.dis test + +distclean maintainer-clean realclean: clean + rm -f Makefile config.cache config.log config.status + +pa_stub.o: $(srcdir)/pa_stub.c +debugger.o: $(srcdir)/debugger.s +iva_table.o: $(srcdir)/iva_table.s +io.o: $(srcdir)/io.c +crt0.o: $(srcdir)/crt0.s +test.o: $(srcdir)/test.c +term_in.o: $(srcdir)/term_in.s +term_out.o: $(srcdir)/term_out.s +term_init.o: $(srcdir)/term_init.s + +.PHONY: info install-info clean-info +info: +install-info: +clean-info: + +Makefile: Makefile.in config.status @host_makefile_frag_path@ + $(SHELL) config.status + +config.status: configure + $(SHELL) config.status --recheck diff --git a/libgloss/hp74x/README b/libgloss/hp74x/README new file mode 100644 index 0000000..f27af18 --- /dev/null +++ b/libgloss/hp74x/README @@ -0,0 +1,156 @@ +*** Registers + GR0 *always zero + GR1 scratch + GR2 normal return register + GR27 Global Data Pointer (Must be set in crt0) + GR30 SP stack pointer + GR31 milicode return pointer + + SR* Space registers + + CR24-31 Temporary Control Registers + CR14 Vector Table Register (like VBR on an m68020) + CR0 Put in a count, causes exception when decremented to 0. + +FORTH's magic number is 031240 + +*** + Series 700/800 + The following options are also supported: + + -snnn set the initial system load (ISL) start address to + nnn in the volume label. This is useful when + building boot media for Series 700/800 systems. + + -lnnn specifies the length in bytes of the ISL code in + the LIF volume. + + -ennn set the ISL entry point to nnn bytes from the + beginning of the ISL. For example, specifying - + e3272 means that the ISL entry point is 3272 + (decimal) bytes from the beginning of the ISL + object module. + + -Knnn forces the directory start location to be the + nearest multiple of nnn x 1024 bytes from the + beginning of the volume. This is necessary for + booting Series 700/800 systems from LIF media. + + -n xxx Sets the volume name to be xxx. + lifinit -v64000000 -d64 -nISL10 -K2 -s4096 -l61440 -e5336 this_lif + +# lifcp -- +# -r Forces RAW mode copying. (file type BIN (-23951)) +# -T Sets the file type of the directory entry. +# -Knnn forces each file copied in to begin on a nnn x +# 1024-byte boundary from the beginning of the volume +# Note: the word echoed below MUST be 10 characters exactly. +# + (echo "FORTH ") | lifcp -r -T-030001 -K2 - this_lif:AUTO + + +# +# somxtract infile outfile -- +# converts a series 800 file *only* into a raw image + +It turns out the native cc and our current gcc produce series 700 +output, so in this case it runs till if fills up the hard disk. + +*** rombootlf5 is a FORTH interpreter in a "boot" image. (it won't run on +the HP742 board) + +lifls -l rombootlf5 +volume ISL10 data size 249984 directory size 8 94/04/20 10:26:36 +filename type start size implement created +=============================================================== +ISL -12800 16 240 0 94/04/20 10:26:36 +HPUX -12928 256 496 0 94/04/20 10:26:37 + IOMAP -12960 752 1504 0 94/04/20 10:26:37 +AUTO -12289 2256 1 0 94/04/20 10:26:38 +FORTH -12960 2264 208 0 94/04/20 10:26:38 +HPFORTH ASCII 2472 420 0 94/04/20 10:26:38 +BOOTROM ASCII 2896 3849 0 94/04/20 10:26:40 +PAD1 -12290 6752 1172 0 94/04/20 10:26:40 + +*** The ISL is only needed when booting the raw hardware. As we're runing +on a monitor (barely) all we need is a crt0 that initiallizes the GR27 +Global Data Pointer and zero's bss. + +*** Initial Program Load +-------------------- +From page 11-56, architecture book. +0x00000000 +------------------------------------+ 0 + | LIF_MAGIC | | +0x00000004 +------------------------------------+ 4 + | | +0x000000F0 +------------------------------------+ 240 + | IPL_ADDR | +0x000000F4 +------------------------------------+ 244 + | IPL_SIZE | +0x000000F8 +------------------------------------+ 248 + | IPL_ENTRY | +0x000000FC +------------------------------------+ 252 + | | +IPL_ADDR +------------------------------------+ IPL_ADDR + | Position Independant | + | IPL Code | + | (including IPL_CHECKSUM) | + +------------------------------------+ IPL_ADDR + IPL_SIZE + | | + +------------------------------------+ + +IPL_ADDR 2 Kbyte aligned, nonzero +IPL_SIZE Multiple of 2Kbytes, <= 256 Kbytes +IPL_ENTRY Word aligned, less than IPL_SIZE + +Loads at IPL_START + +This is based on Cobra/Coral hardware: + LED register at 0xf080024 + I/O status register at 0xf0800000 + EEPROM at 0xf0810000 (LAN ID begins at byte 0) + +Here's a dump of the LIF volume header using "xd" (od with hex output) + +* +00000f0 0000 1000 0000 9800 0000 0000 0000 0000 + ^^^^ + This is the size +* +0000800 5445 5354 2020 2020 2020 a271 0000 0010 + ^^^^ ^^^^ ^^^^ ^^^^ ^^^^ ^^^^<-- this is the ipl offset + this is the vol name ^^^^<- this is the type + +0000810 0000 0098 9407 1919 1426 8001 0000 0000 + ^^^^ + This is the ipl size + +Interupts +--------- +The vector table is access by %iva (%cr14). The address here must be a +multiple of 2048. The indexes are: +1 high-priority +2 power failure +3 recovery counter +4 external interrupt +5 low-priority machine check +6 instruction TLB miss/instruction page fault +7 instruction memory protection +8 illegal instruction +9 break instruction +10 priviledged operation +11 priviledged register +12 overflow +13 conditional +14 assist exception +15 data TLB miss fault/data page fault +16 non access instruction TLB miss fault +17 non access page TLB miss fault/non access data page fault +18 data memory protection/unaligned data reference +19 data memory break +20 TLB dirty bit +21 page reference +22 assist emulation +23 higher-priority transfer +24 lower-priority transfe +25 taken branch diff --git a/libgloss/hp74x/checksum.c b/libgloss/hp74x/checksum.c new file mode 100644 index 0000000..4a2b331 --- /dev/null +++ b/libgloss/hp74x/checksum.c @@ -0,0 +1,150 @@ +#include <stdio.h> +#include <fcntl.h> + +#define USAGE "USAGE: checkum -[vhcs] infile outfile\n\t-v\tverbose\n\ +\t-h\thelp\n\t-c\tcheck checksum\n\t-s\tprint the ipl size" +static int verbose = 0; +static int verify = 0; +static int size = 0; + +typedef int word_t; +#define WORDSIZE (sizeof(word_t)) + +main(argc, argv) + int argc; + char **argv; +{ + char *infile; + char *outfile; + int infd; + int outfd; + word_t checksum = 0; + int nbytes; + word_t buf; + int i = 1; + int filesize = 0; + + while (*argv[i] == '-') { + switch (*(argv[i]+1)) { + case 'v': + verbose++; + break; + case 'c': + verify++; + puts ("Sorry, unimplemented for now"); + exit(1); + break; + case 's': + size++; + break; + case 'h': + puts (USAGE); + exit(0); + default: + printf ("\"%s\", Illegal option\n", argv[i]); + puts (USAGE); + exit(1); + } + i++; + } + infile = *(argv + i); + outfile = *(argv + i+1); + + /* see it there were file names on the command line */ + if (infile == 0x0) { + puts("Didn't specify an input file name"); + exit(1); + } + if (outfile == 0x0) { + puts("Didn't specify an output file name"); + exit(1); + } + + /* try to open the files */ + infd = open(infile, O_RDONLY); + if (infd == -1) { + printf("Couldn't open %s\n", infile); + exit(1); + } + + outfd = open(outfile, O_WRONLY|O_CREAT|O_TRUNC); + if (outfd == -1) { + printf("Couldn't open %s\n", outfile); + exit(1); + } + + if (verbose > 2) + putchar('\n'); + + /* calculate the checksum */ + while ((nbytes = read(infd, &buf, WORDSIZE)) == WORDSIZE) { + if (verbose > 2) + putchar('.'); + checksum+= buf; + filesize+= WORDSIZE; + if (write(outfd, &buf, WORDSIZE) != WORDSIZE) { + puts("Couldn't write"); + } + if (verbose > 3) + putchar('+'); + } + if (verbose > 2) + putchar('\n'); + + /* write the last byte read */ + if (nbytes > 0) { + write(outfd, &buf, nbytes); + checksum+= buf; /* calculate the last word */ + filesize+= nbytes; + } + /* write the checksum */ + buf = -checksum; + write(outfd, &buf, WORDSIZE); + filesize+= WORDSIZE; /* checksum increase the size */ + + if (verbose > 0) + printf("The calculated checksum is:\n\t0x%x,\n\t%u\n", -checksum, -checksum); + + /* calculate the extra 2K here */ + buf = 0; + while ((filesize % 2048) !=0) { + filesize+=WORDSIZE; + write(outfd, &buf, WORDSIZE); + } + if (size > 0) { + printf ("%u is the new file size\n", filesize); + } + close(outfd); + close(infd); + exit(0); +} + +#if 0 +/* Calculate a simple checksum and concatenate it to the end of BUF. */ +void +compute_and_concatenate_checksum (word *buf, size_t bufsize_in_words) +{ + size_t i; + word sum; + sum = buf[0] + for (i = 1; i < bufsize_in_words; i++) + sum += buf[i]; + buf[bufsize_in_words] = -sum; +} + +/* Calculate a simple checksum and verify it. NOTE: bufsize_in_words should + include the checksum, i.e., it should be one larger than when the + checksum was calculated using compute_and_concatenate_checksum! */ +int +compute_and_and_verify_checksum (word *buf, size_t bufsize_in_words) +{ + size_t i; + word sum; + sum = buf[0]; + for (i = 1; i < bufsize_in_words; i++) + sum += buf[i]; + if (sum != 0) + return ERROR; + return SUCCESS; +} +#endif diff --git a/libgloss/hp74x/configure b/libgloss/hp74x/configure new file mode 100755 index 0000000..2c80b3d --- /dev/null +++ b/libgloss/hp74x/configure @@ -0,0 +1,991 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.10 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.10" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set LANG and LC_ALL to C if already set. +# These must not be set unconditionally because not all systems understand +# e.g. LANG=C (notably SCO). +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LANG+set}" = set; then LANG=C; export LANG; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=crt0.s + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' + +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + +if test "$srcdir" = "." ; then + mdir=`echo "${with_multisubdir}/" \ + | sed -e 's,\([^/][^/]*\),..,g' -e 's,^/$,,'` + ac_aux_dir= +for ac_dir in ${mdir}../../.. $srcdir/${mdir}../../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in ${mdir}../../.. $srcdir/${mdir}../../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + +else + ac_aux_dir= +for ac_dir in ${srcdir}/../.. $srcdir/${srcdir}/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in ${srcdir}/../.. $srcdir/${srcdir}/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + +fi + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + for ac_prog in ginstall installbsd scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + # OSF/1 installbsd also uses dspmsg, but is usable. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_ifs" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + ac_prog_rejected=no + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +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 $# -gt 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 + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <<EOF +#ifdef __GNUC__ + yes; +#endif +EOF +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:707: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 +if test $ac_cv_prog_gcc = yes; then + GCC=yes + if test "${CFLAGS+set}" != set; then + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_gcc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_gcc_g=yes +else + ac_cv_prog_gcc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_gcc_g" 1>&6 + if test $ac_cv_prog_gcc_g = yes; then + CFLAGS="-g -O" + else + CFLAGS="-O" + fi + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi + +AS=${AS-as} + +AR=${AR-ar} + +LD=${LD-ld} + +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +host_makefile_frag=${srcdir}/../config/default.mh + +host_makefile_frag_path=$host_makefile_frag + + + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1='\2'}/p" \ + >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs + + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS <<EOF +#! /bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.10" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS <<EOF + +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; + s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@CC@%$CC%g +s%@AS@%$AS%g +s%@AR@%$AR%g +s%@LD@%$LD%g +s%@RANLIB@%$RANLIB%g +s%@host_makefile_frag_path@%$host_makefile_frag_path%g +/@host_makefile_frag@/r $host_makefile_frag +s%@host_makefile_frag@%%g + +CEOF +EOF +cat >> $CONFIG_STATUS <<EOF + +CONFIG_FILES=\${CONFIG_FILES-"Makefile"} +EOF +cat >> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust relative srcdir, etc. for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" -f conftest.subs $ac_given_srcdir/$ac_file_in > $ac_file +fi; done +rm -f conftest.subs + + + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + diff --git a/libgloss/hp74x/configure.in b/libgloss/hp74x/configure.in new file mode 100644 index 0000000..892ba81 --- /dev/null +++ b/libgloss/hp74x/configure.in @@ -0,0 +1,34 @@ +dnl Process this file with autoconf to produce a configure script. +AC_PREREQ(2.5)dnl +AC_INIT(crt0.s) + +if test "$srcdir" = "." ; then + mdir=`echo "${with_multisubdir}/" \ + | sed -e 's,\([[^/]][[^/]]*\),..,g' -e 's,^/$,,'` + AC_CONFIG_AUX_DIR(${mdir}../../..) +else + AC_CONFIG_AUX_DIR(${srcdir}/../..) +fi + +AC_PROG_INSTALL + +AC_PROG_CC +AS=${AS-as} +AC_SUBST(AS) +AR=${AR-ar} +AC_SUBST(AR) +LD=${LD-ld} +AC_SUBST(LD) +AC_PROG_RANLIB + +host_makefile_frag=${srcdir}/../config/default.mh + +dnl We have to assign the same value to other variables because autoconf +dnl doesn't provide a mechanism to substitute a replacement keyword with +dnl arbitrary data or pathnames. +dnl +host_makefile_frag_path=$host_makefile_frag +AC_SUBST(host_makefile_frag_path) +AC_SUBST_FILE(host_makefile_frag) + +AC_OUTPUT(Makefile) diff --git a/libgloss/hp74x/crt0.s b/libgloss/hp74x/crt0.s new file mode 100644 index 0000000..b5986e6 --- /dev/null +++ b/libgloss/hp74x/crt0.s @@ -0,0 +1,177 @@ +/* + * crt0.S -- startup file for hppa. + * rob@cygnus.com (Rob Savoye) + */ + .VERSION "0.2" + .COPYRIGHT "crt0.S for hppa" + +;sp .equ %r30 ; stack pointer +;dp .equ %r27 ; global data pointer +;arg0 .equ %r26 ; argument +;arg1 .equ %r25 ; argument or high part of double argument +;arg2 .equ %r24 ; argument +;arg3 .equ %r23 ; argument or high part of double argument + +#define IMM(a,b) ldil L%a,b ! ldo R%a(b),b +#define imm(i,t) ldil LS%i,t ! addi RS%i,t,t + + .DATA + +/**** + * FIXME: these are just a gross hack so this will assemble + ****/ +_bss_start .WORD +_bss_end .WORD +_foobar + .STRINGZ "Foo Bar...\r\n" + +;;_SYSTEM_ID .WORD +;; .EXPORT _SYSTEM_ID ; FIXME this is only so it'll + ; link + +/* + * Set up the standard spaces (sections) These definitions come + * from /lib/pcc_prefix.s. + */ + .space $TEXT$,0 + + .SUBSPA $BOOT$,QUAD=0,ALIGN=8,ACCESS=0x2c,SORT=4 + .IMPORT _start + +/* + * stuff we need that's defined elsewhere. + */ + .IMPORT main, CODE + .IMPORT _bss_start, DATA + .IMPORT _bss_end, DATA + .IMPORT environ, DATA + +/* + * start -- set things up so the application will run. + * + */ + .PROC + .CALLINFO SAVE_SP, FRAME=48 + .EXPORT $START$,ENTRY +$START$ + + /* FIXME: this writes to page zero */ + ;; setup the %30 (stack pointer) with some memory + ldil L%_stack+48,%r30 + ldo R%_stack+48(%r30),%r30 ; should be %r30 (sp) but then + ; we'd kill our test program :-) + ;; we need to set %r27 (global data pointer) here too + ldil L%$global$,%r27 + ldo R%$global$(%r27),%r27 ; same problem as above + +/* + * zerobss -- zero out the bss section + */ + ; load the start of bss + ldil L%_bss_start,%r4 + ldo R%_bss_start(%r4),%r4 + + ; load the end of bss + ldil L%_bss_end,%r5 + ldo R%_bss_end(%r5),%r5 + + +bssloop + addi -1,%r5,%r5 ; decrement _bss_end + stb %r0,0(0,%r5) ; we do this by bytes for now even + ; though it's slower, it's safer + combf,= %r4,%r5, bssloop + nop + + ldi 1,%ret0 + +/* + * Call the main routine from the application to get it going. + * main (argc, argv, environ) + * We pass argv as a pointer to NULL. + */ + + bl main,%r2 + nop + + .PROCEND +/* + * _exit -- Exit from the application. Normally we cause a user trap + * to return to the ROM monitor for another run, but with + * this monitor we can't. Still, "C" wants this symbol, it + * should be here. Jumping to 0xF0000004 jumps back into the + * firmware, while writing a 5 to 0xFFFE0030 causes a reset. + */ + .EXPORT _exit, ENTRY +_exit + .PROC + .CALLINFO + .ENTRY +;; ldil L%0xf0000004,%r1 +;; bl %r1, %r2 + + ldil L'4026531844,%r19 + ldo R'4026531844(%r19),%r19 + blr %r19, %r2 + nop + + ;; This just causes a breakpoint exception +;; break 0x0e,0xa5a +;; bv,n (%rp) + nop + .EXIT + .PROCEND + + .subspa $UNWIND_START$,QUAD=0,ALIGN=8,ACCESS=0x2c,SORT=56 + .export $UNWIND_START +$UNWIND_START + .subspa $UNWIND$,QUAD=0,ALIGN=8,ACCESS=0x2c,SORT=64 + .subspa $UNWIND_END$,QUAD=0,ALIGN=8,ACCESS=0x2c,SORT=72 + .export $UNWIND_END +$UNWIND_END + .subspa $RECOVER_START$,QUAD=0,ALIGN=4,ACCESS=0x2c,SORT=73 + .export $RECOVER_START +$RECOVER_START + .subspa $RECOVER$,QUAD=0,ALIGN=4,ACCESS=0x2c,SORT=80 + .subspa $RECOVER_END$,QUAD=0,ALIGN=4,ACCESS=0x2c,SORT=88 + .export $RECOVER_END +$RECOVER_END + +; The following declarations are, by default in the data space ($PRIVATE$) + +;; .space $PRIVATE$,1 + +/* + * Here we set up the standard date sub spaces. + * _dp is for the WinBond board. + * + * Set up some room for a stack. We just grab a chunk of memory. + * We also setup some space for the global variable space, which + * must be done using the reserved name "$global$" so "C" code + * can find it. The stack grows towards the higher addresses. + */ + + .subspa $DATA$,QUAD=1,ALIGN=8,ACCESS=0x1f,SORT=16 + .subspa $SHORTDATA$,QUAD=1,ALIGN=8,ACCESS=0x1f,SORT=24 + .subspa $GLOBAL$,QUAD=1,ALIGN=8,ACCESS=0x1f,SORT=40 + .export $global$ + .export _dp +$global$ +_dp + .subspa $SHORTBSS$,QUAD=1,ALIGN=8,ACCESS=0x1f,SORT=80,ZERO + .subspa $BSS$,QUAD=1,ALIGN=8,ACCESS=0x1f,SORT=82,ZERO + + .subspa $STACK$,QUAD=1,ALIGN=8,ACCESS=0x1f,SORT=88,ZERO + .export _stack +_stack + .BLOCK 0x2000 + +/* + * The heap follows the stack. To use dynamic memory routines in an + * application, some space MUST be assigned to the stack. + */ + + .subspa $HEAP$,QUAD=1,ALIGN=8,ACCESS=0x1f,SORT=96,ZERO + .export _heap +_heap + .end diff --git a/libgloss/hp74x/debugger.h b/libgloss/hp74x/debugger.h new file mode 100644 index 0000000..2c73598 --- /dev/null +++ b/libgloss/hp74x/debugger.h @@ -0,0 +1,127 @@ +/**************************************************************************** + + THIS SOFTWARE IS NOT COPYRIGHTED + + HP offers the following for use in the public domain. HP makes no + warranty with regard to the software or it's performance and the + user accepts the software "AS IS" with all faults. + + HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD + TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + +****************************************************************************/ + + /* Debugger register array offets */ + +#define R_gr0 0 +#define R_gr1 4 +#define R_gr2 8 +#define R_gr3 12 +#define R_gr4 16 +#define R_gr5 20 +#define R_gr6 24 +#define R_gr7 28 +#define R_gr8 32 +#define R_gr9 36 +#define R_gr10 40 +#define R_gr11 44 +#define R_gr12 48 +#define R_gr13 52 +#define R_gr14 56 +#define R_gr15 60 +#define R_gr16 64 +#define R_gr17 68 +#define R_gr18 72 +#define R_gr19 76 +#define R_gr20 80 +#define R_gr21 84 +#define R_gr22 88 +#define R_gr23 92 +#define R_gr24 96 +#define R_gr25 100 +#define R_gr26 104 +#define R_gr27 108 +#define R_gr28 112 +#define R_gr29 116 +#define R_gr30 120 +#define R_gr31 124 + +#define R_sr0 128 +#define R_sr1 132 +#define R_sr2 136 +#define R_sr3 140 +#define R_sr4 144 +#define R_sr5 148 +#define R_sr6 152 +#define R_sr7 156 + +#define R_cr0 160 +#define R_cr1 164 +#define R_cr2 168 +#define R_cr3 172 +#define R_cr4 176 +#define R_cr5 180 +#define R_cr6 184 +#define R_cr7 188 +#define R_cr8 192 +#define R_cr9 196 +#define R_cr10 200 +#define R_cr11 204 +#define R_cr12 208 +#define R_cr13 212 +#define R_cr14 216 +#define R_cr15 220 +#define R_cr16 224 +#define R_cr17H 228 +#define R_cr18H 232 +#define R_cr19 236 +#define R_cr20 240 +#define R_cr21 244 +#define R_cr22 248 +#define R_cr23 252 +#define R_cr24 256 +#define R_cr25 260 +#define R_cr26 264 +#define R_cr27 268 +#define R_cr28 272 +#define R_cr29 276 +#define R_cr30 280 +#define R_cr31 284 + +#define R_cr17T 288 +#define R_cr18T 292 + +#define R_cpu0 296 + +#define R_SIZE 300 + +#define min_stack 64 + +; ----------------------------------------------------------- +; ------ ASCII control codes +; ----------------------------------------------------------- + +#define NULL 0x00 /* <break> soft-reset (input only) */ +#define DELP 0x03 /* <ctrl>C del-collapse (input only, non-std) */ +#define DELE 0x04 /* <ctrl>D del-to_eol (input only, non-std) */ +#define BELL 0x07 /* <ctrl>G bell - audio */ +#define BS 0x08 /* <ctrl>H back space (left arrow) */ +#define HT 0x09 /* <ctrl>I horizontal tab */ +#define LF 0x0a /* <ctrl>J line feed (down arrow) */ +#define VT 0x0b /* <ctrl>K vertical tab (up arrow) */ +#define FF 0x0c /* <ctrl>L form feed (right arrow) */ +#define RTN 0x0d /* <ctrl>M carrage return */ +#define CR 0x0d /* <ctrl>M carrage return */ +#define INSC 0x0e /* <ctrl>N insert char (input only, non-std) */ +#define XON 0x11 /* <ctrl>Q DC1 - continue */ +#define BT 0x12 /* <ctrl>R reverse tab (input only, non-std) */ +#define XOFF 0x13 /* <ctrl>S DC3 - wait */ +#define INSE 0x16 /* <ctrl>V insert-expand (input only, non-std) */ +#define DELC 0x18 /* <ctrl>X delete char (input only, non-std) */ +#define CLRH 0x1a /* <ctrl>Z clear/home (input only) */ +#define ESC 0x1b /* <ctrl>[ escape (must call key again) */ +#define ENDL 0x1c /* <ctrl>\ cursor-to-eol (input only, non-std) */ +#define HOME 0x1e /* <ctrl>^ cursor home (input only) */ +#define DEL 0x7f /* <shift>BS destructive backspace */ + diff --git a/libgloss/hp74x/debugger.s b/libgloss/hp74x/debugger.s new file mode 100644 index 0000000..edf4e4b --- /dev/null +++ b/libgloss/hp74x/debugger.s @@ -0,0 +1,585 @@ +/**************************************************************************** + + THIS SOFTWARE IS NOT COPYRIGHTED + + HP offers the following for use in the public domain. HP makes no + warranty with regard to the software or it's performance and the + user accepts the software "AS IS" with all faults. + + HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD + TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + +****************************************************************************/ + .space $TEXT$ + .subspa $CODE$,access=0x2c + +#if 1 +#include "diagnose.h" +#endif + +i13BREAK .equ 0xa5a ; im13 field for specified functions +i5REG .equ 0x06 ; Init registers +i5BP .equ 0x09 ; GDB breakpoin +i5PSW .equ 0x0b ; Get PSW +i5INLINE .equ 0x0e ; Get INLINE +R_gr0 .equ 0 +R_gr1 .equ 4 +R_gr2 .equ 8 +R_gr3 .equ 12 +R_gr4 .equ 16 +R_gr5 .equ 20 +R_gr6 .equ 24 +R_gr7 .equ 28 +R_gr8 .equ 32 +R_gr9 .equ 36 +R_gr10 .equ 40 +R_gr11 .equ 44 +R_gr12 .equ 48 +R_gr13 .equ 52 +R_gr14 .equ 56 +R_gr15 .equ 60 +R_gr16 .equ 64 +R_gr17 .equ 68 +R_gr18 .equ 72 +R_gr19 .equ 76 +R_gr20 .equ 80 +R_gr21 .equ 84 +R_gr22 .equ 88 +R_gr23 .equ 92 +R_gr24 .equ 96 +R_gr25 .equ 100 +R_gr26 .equ 104 +R_gr27 .equ 108 +R_gr28 .equ 112 +R_gr29 .equ 116 +R_gr30 .equ 120 +R_gr31 .equ 124 + +R_sr0 .equ 128 +R_sr1 .equ 132 +R_sr2 .equ 136 +R_sr3 .equ 140 +R_sr4 .equ 144 +R_sr5 .equ 148 +R_sr6 .equ 152 +R_sr7 .equ 156 + +R_cr0 .equ 160 +R_cr1 .equ 164 +R_cr2 .equ 168 +R_cr3 .equ 172 +R_cr4 .equ 176 +R_cr5 .equ 180 +R_cr6 .equ 184 +R_cr7 .equ 188 +R_cr8 .equ 192 +R_cr9 .equ 196 +R_cr10 .equ 200 +R_cr11 .equ 204 +R_cr12 .equ 208 +R_cr13 .equ 212 +R_cr14 .equ 216 +R_cr15 .equ 220 +R_cr16 .equ 224 +R_cr17H .equ 228 +R_cr18H .equ 232 +R_cr19 .equ 236 +R_cr20 .equ 240 +R_cr21 .equ 244 +R_cr22 .equ 248 +R_cr23 .equ 252 +R_cr24 .equ 256 +R_cr25 .equ 260 +R_cr26 .equ 264 +R_cr27 .equ 268 +R_cr28 .equ 272 +R_cr29 .equ 276 +R_cr30 .equ 280 +R_cr31 .equ 284 + +R_cr17T .equ 288 +R_cr18T .equ 292 + +R_cpu0 .equ 296 + +R_SIZE .equ 300 + +min_stack .equ 64 + + .import handle_exception + .import $global$, data + .IMPORT putnum, code + .IMPORT led_putnum, code + .IMPORT delay, code + + .export FICE + .export DEBUG_GO + .export DEBUG_SS + .export STUB_RESTORE + + .export save_regs + .export RegBlk + .export Exception_index + +;------------------------------------------------------------------------------- + .EXPORT breakpoint,ENTRY,ARGW0=GR,RTNVAL=GR +breakpoint + .PROC + .CALLINFO CALLER,FRAME=128,SAVE_RP + .ENTRY + + stw %r2,-20(0,%r30) ; stash the return pointer + ldo 128(%r30),%r30 ; push up the stack pointer + +;;; debug + ldi 6, %r26 + bl,n led_putnum,%r2 + nop + ldil L'900000,%r26 + ldo R'900000(%r26),%r26 + bl,n delay,%r2 + nop +;;; + break i5INLINE,i13BREAK +;;; more debug + ldi 7, %r26 + bl,n led_putnum,%r2 + nop + ldil L'900000,%r26 + ldo R'900000(%r26),%r26 + bl,n delay,%r2 + nop +;;; + +FICE fice 0(0,%r26) ; Flush the i cache entry + sync + + ldw -148(0,%r30),%r2 ; retrieve the return pointer + ldo -128(%r30),%r30 ; reset the stack pointer + bv,n 0(%r2) ; return to caller + nop + + .EXIT + .PROCEND + +;------------------------------------------------------------------------------- +DEBUG_GO + or,tr %r0,%r0,%r10 ; if go, do not set R-bit to 1 + +DEBUG_SS + ldi 1,%r10 ; else set R-bit to 1 + +DEBUG_EXEC + + bl DGO_0,%r8 ; r8 points to register block + addil L%RegBlk-DGO_0,%r8 +DGO_0 + ldo R%RegBlk-DGO_0(%r1),%r8 + +; load space registers + + ldw R_sr0(%r8),%r1 + mtsp %r1,%sr0 + ldw R_sr1(%r8),%r1 + mtsp %r1,%sr1 + ldw R_sr2(%r8),%r1 + mtsp %r1,%sr2 + ldw R_sr3(%r8),%r1 + mtsp %r1,%sr3 + ldw R_sr4(%r8),%r1 + mtsp %r1,%sr4 + ldw R_sr5(%r8),%r1 + mtsp %r1,%sr5 + ldw R_sr6(%r8),%r1 + mtsp %r1,%sr6 + ldw R_sr7(%r8),%r1 + mtsp %r1,%sr7 + +; clear Q-bit for rfi + + rsm 0x08,%r0 + +; load control registers + + ldw R_cr0(%r8),%r1 + or,= %r10,%r0,%r0 ; if single step + copy %r0,%r1 ; set %cr0 to 0 + mtctl %r1,%cr0 + ldw R_cr8(%r8),%r1 + mtctl %r1,%cr8 + ldw R_cr9(%r8),%r1 + mtctl %r1,%cr9 + ldw R_cr10(%r8),%r1 + mtctl %r1,%cr10 + ldw R_cr11(%r8),%r1 + mtctl %r1,%cr11 + ldw R_cr12(%r8),%r1 + mtctl %r1,%cr12 + ldw R_cr13(%r8),%r1 + mtctl %r1,%cr13 + ldw R_cr14(%r8),%r1 + mtctl %r1,%cr14 + ldw R_cr15(%r8),%r1 + mtctl %r1,%cr15 + ldw R_cr16(%r8),%r1 + mtctl %r1,%cr16 + ldw R_cr17H(%r8),%r1 ; load iiasq.head + mtctl %r1,%cr17 + ldw R_cr18H(%r8),%r1 ; load iiaoq.head + mtctl %r1,%cr18 + ldw R_cr17T(%r8),%r1 ; load iiasq.tail + mtctl %r1,%cr17 + ldw R_cr18T(%r8),%r1 ; load iiaoq.tail + mtctl %r1,%cr18 + ldw R_cr19(%r8),%r1 + mtctl %r1,%cr19 + ldw R_cr20(%r8),%r1 + mtctl %r1,%cr20 + ldw R_cr21(%r8),%r1 + mtctl %r1,%cr21 + ldw R_cr22(%r8),%r1 + dep %r10,27,1,%r1 ; set R-bit if applicable + mtctl %r1,%cr22 + ldw R_cr23(%r8),%r1 + mtctl %r1,%cr23 + ldw R_cr24(%r8),%r1 + mtctl %r1,%cr24 + ldw R_cr25(%r8),%r1 + mtctl %r1,%cr25 + ldw R_cr26(%r8),%r1 + mtctl %r1,%cr26 + ldw R_cr27(%r8),%r1 + mtctl %r1,%cr27 + ldw R_cr28(%r8),%r1 + mtctl %r1,%cr28 + ldw R_cr29(%r8),%r1 + mtctl %r1,%cr29 + ldw R_cr30(%r8),%r1 + mtctl %r1,%cr30 + ldw R_cr31(%r8),%r1 + mtctl %r1,%cr31 + +; load diagnose registers + + ldw R_cpu0(%r8),%r1 + ldil L%CPU0_MASK,%r2 + ldo R%CPU0_MASK(%r2),%r2 + xor %r1,%r2,%r1 ; xor the read/clear bits + nop + mtcpu %r1,0 + mtcpu %r1,0 + +; load general registers + + ldw R_gr1(%r8),%r1 + ldw R_gr2(%r8),%r2 + ldw R_gr3(%r8),%r3 + ldw R_gr4(%r8),%r4 + ldw R_gr5(%r8),%r5 + ldw R_gr6(%r8),%r6 + ldw R_gr7(%r8),%r7 + ldw R_gr9(%r8),%r9 + ldw R_gr10(%r8),%r10 + ldw R_gr11(%r8),%r11 + ldw R_gr12(%r8),%r12 + ldw R_gr13(%r8),%r13 + ldw R_gr14(%r8),%r14 + ldw R_gr15(%r8),%r15 + ldw R_gr16(%r8),%r16 + ldw R_gr17(%r8),%r17 + ldw R_gr18(%r8),%r18 + ldw R_gr19(%r8),%r19 + ldw R_gr20(%r8),%r20 + ldw R_gr21(%r8),%r21 + ldw R_gr22(%r8),%r22 + ldw R_gr23(%r8),%r23 + ldw R_gr24(%r8),%r24 + ldw R_gr25(%r8),%r25 + ldw R_gr26(%r8),%r26 + ldw R_gr27(%r8),%r27 + ldw R_gr28(%r8),%r28 + ldw R_gr29(%r8),%r29 + ldw R_gr30(%r8),%r30 + ldw R_gr31(%r8),%r31 + ldw R_gr8(%r8),%r8 + +; execute user program + + nop + rfi ; switch to user code + nop + +;------------------------------------------------------------------------------- + +STUB_RESTORE + copy %r1,%r9 ; save exception index + bl SR_00,%r8 + addil L%Exception_index-SR_00,%r8 +SR_00 + ldo R%Exception_index-SR_00(%r1),%r8 + stw %r9,(%r8) + + bl save_regs,%r25 + nop + +#ifdef DEBUG_DEBUGGER1 + stwm %r1,8(%sp) + bl putc,%rp + ldi CR,%arg0 + bl putc,%rp + ldi LF,%arg0 + bl printit,%mrp + mfctl %pcoq,%arg0 + + mfctl %pcoq,%r1 + mtctl %r1,%pcoq + mfctl %pcoq,%arg0 + bl printit,%mrp + mtctl %arg0,%pcoq + + bl printit,%mrp + ldw -8(%sp),%arg0 + + ldwm -8(%sp),%r1 +#endif + +#ifdef DEBUG_DEBUGGER2 + stwm %r1,8(%sp) + bl putc,%rp + ldi LF,%arg0 + ldwm -8(%sp),%r1 +#endif + +#ifdef DEBUG_DEBUGGER3 + bl printit,%mrp + copy iptr,%arg0 + bl printit,%mrp + copy rstack,%arg0 + bl printit,%mrp + copy gspace,%arg0 + bl printit,%mrp + copy dstack,%arg0 + bl printit,%mrp + copy nextptr,%arg0 + bl printit,%mrp + copy %dp,%arg0 + bl printit,%mrp + copy %sp,%arg0 + bl printit,%mrp + mfctl %rctr,%arg0 + bl printit,%mrp + mfctl %iva,%arg0 + bl printit,%mrp + mfctl %eiem,%arg0 + bl printit,%mrp + mfctl %ipsw,%arg0 + bl printit,%mrp + copy %r0,%arg0 +#endif + bl SR_1,%sp + addil L%Stub_stack-SR_1,%sp +SR_1 + ldo R%Stub_stack-SR_1(%r1),%sp ; set the stack pointer + + bl SR_2,%arg0 + addil L%RegBlk-SR_2,%arg0 +SR_2 + ldo R%RegBlk-SR_2(%r1),%arg0 ; set arg0 (save register area) + + bl SR_3,%arg1 + addil L%Exception_index-SR_3,%arg1 ; set arg1 address +SR_3 + ldo R%Exception_index-SR_3(%r1),%arg1 ; set arg1 address + + addi min_stack,%sp,%sp ; allocate min stack frame + + bl handle_exception,%r2 + ldw 0(%arg1),%arg1 ; load arg1 + addi -min_stack,%sp,%sp ; de allocate min stack frame + + b DEBUG_EXEC ; + copy %r28,%r10 +;------------------------------------------------------------------------------- + +save_regs ; return address is in %r25 + + bl SR_0,%r1 ; r1 points to Register block + addil L%RegBlk-SR_0,%r1 +SR_0 + ldo R%RegBlk-SR_0(%r1),%r1 + +; save general registers + + stw %r0,R_gr0(%r1) + ; don't store %r1 yet + stw %r2,R_gr2(%r1) + stw %r3,R_gr3(%r1) + stw %r4,R_gr4(%r1) + stw %r5,R_gr5(%r1) + stw %r6,R_gr6(%r1) + stw %r7,R_gr7(%r1) + ; don't store %r8 yet + ; don't store %r9 yet + stw %r10,R_gr10(%r1) + stw %r11,R_gr11(%r1) + stw %r12,R_gr12(%r1) + stw %r13,R_gr13(%r1) + stw %r14,R_gr14(%r1) + stw %r15,R_gr15(%r1) + ; don't store %r16 yet + ; don't store %r17 yet + stw %r18,R_gr18(%r1) + stw %r19,R_gr19(%r1) + stw %r20,R_gr20(%r1) + stw %r21,R_gr21(%r1) + stw %r22,R_gr22(%r1) + stw %r23,R_gr23(%r1) + ; don't store %r24 yet + ; don't store %r25 yet + stw %r26,R_gr26(%r1) + stw %r27,R_gr27(%r1) + stw %r28,R_gr28(%r1) + stw %r29,R_gr29(%r1) + stw %r30,R_gr30(%r1) + stw %r31,R_gr31(%r1) + +; restore general registers from shadow registers and save them + + copy %r1,%r10 ; hold Register block pointer + copy %r25,%rp ; hold return pointer + shdw_gr + shdw_gr + stw %r1,R_gr1(%r10) + stw %r8,R_gr8(%r10) + stw %r9,R_gr9(%r10) + stw %r16,R_gr16(%r10) + stw %r17,R_gr17(%r10) + stw %r24,R_gr24(%r10) + stw %r25,R_gr25(%r10) + +; save control registers + + mfctl %cr0,%r1 + stw %r1,R_cr0(%r10) + stw %r0,R_cr1(%r10) + stw %r0,R_cr2(%r10) + stw %r0,R_cr3(%r10) + stw %r0,R_cr4(%r10) + stw %r0,R_cr5(%r10) + stw %r0,R_cr6(%r10) + stw %r0,R_cr7(%r10) + mfctl %cr8,%r1 + stw %r1,R_cr8(%r10) + mfctl %cr9,%r1 + stw %r1,R_cr9(%r10) + mfctl %cr10,%r1 + stw %r1,R_cr10(%r10) + mfctl %cr11,%r1 + stw %r1,R_cr11(%r10) + mfctl %cr12,%r1 + stw %r1,R_cr12(%r10) + mfctl %cr13,%r1 + stw %r1,R_cr13(%r10) + mfctl %cr14,%r1 + stw %r1,R_cr14(%r10) + mfctl %cr15,%r1 + stw %r1,R_cr15(%r10) + mfctl %cr16,%r1 + stw %r1,R_cr16(%r10) + mfctl %cr17,%r1 + stw %r1,R_cr17H(%r10) + mtctl %r1,%cr17 + mfctl %cr17,%r1 + stw %r1,R_cr17T(%r10) + mtctl %r1,%cr17 + mfctl %cr18,%r1 + stw %r1,R_cr18H(%r10) + mtctl %r1,%cr18 + mfctl %cr18,%r1 + stw %r1,R_cr18T(%r10) + mtctl %r1,%cr18 + mfctl %cr19,%r1 + stw %r1,R_cr19(%r10) + mfctl %cr20,%r1 + stw %r1,R_cr20(%r10) + mfctl %cr21,%r1 + stw %r1,R_cr21(%r10) + mfctl %cr22,%r1 + stw %r1,R_cr22(%r10) + mfctl %cr23,%r1 + stw %r1,R_cr23(%r10) + mfctl %cr24,%r1 + stw %r1,R_cr24(%r10) + mfctl %cr25,%r1 + stw %r1,R_cr25(%r10) + mfctl %cr26,%r1 + stw %r1,R_cr26(%r10) + mfctl %cr27,%r1 + stw %r1,R_cr27(%r10) + mfctl %cr28,%r1 + stw %r1,R_cr28(%r10) + mfctl %cr29,%r1 + stw %r1,R_cr29(%r10) + mfctl %cr30,%r1 + stw %r1,R_cr30(%r10) + mfctl %cr31,%r1 + stw %r1,R_cr31(%r10) + +; save diagnose registers + + mfcpu_c 0,%r1 + mfcpu_c 0,%r1 + stw %r1,R_cpu0(%r10) + +; save space registers + + mfsp %sr0,%r1 + stw %r1,R_sr0(%r10) + mfsp %sr1,%r1 + stw %r1,R_sr1(%r10) + mfsp %sr2,%r1 + stw %r1,R_sr2(%r10) + mfsp %sr3,%r1 + stw %r1,R_sr3(%r10) + mfsp %sr4,%r1 + stw %r1,R_sr4(%r10) + mfsp %sr5,%r1 + stw %r1,R_sr5(%r10) + mfsp %sr6,%r1 + stw %r1,R_sr6(%r10) + mfsp %sr7,%r1 + bv (%rp) + stw %r1,R_sr7(%r10) + +#ifdef DEBUG_DEBUGGER +;------------------------------------------------------------------------------- +printit + mtctl %rp,%tr0 + mtctl %r1,%tr1 + bl putnum,%rp + copy %rp,%arg0 + + mtctl %mrp,%tr2 + bl putc,%rp + ldi CR,%arg0 + bl putc,%rp + ldi LF,%arg0 + mfctl %tr2,%mrp + mfctl %tr1,%r1 + bv (%mrp) + mfctl %tr0,%rp +#endif + .space $PRIVATE$ + .subspa $DATA$,align=4,access=0x1f + +Exception_index + .word 0 + +RegBlk + .block R_SIZE ; register block + +Stub_stack + .block 1024 + + .end diff --git a/libgloss/hp74x/diagnose.h b/libgloss/hp74x/diagnose.h new file mode 100644 index 0000000..23eb847 --- /dev/null +++ b/libgloss/hp74x/diagnose.h @@ -0,0 +1,168 @@ +/**************************************************************************** + + THIS SOFTWARE IS NOT COPYRIGHTED + + HP offers the following for use in the public domain. HP makes no + warranty with regard to the software or it's performance and the + user accepts the software "AS IS" with all faults. + + HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD + TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + +****************************************************************************/ + + /* Diagnose register definitions */ + + +#ifdef PCXL + +#define CPU_DIAG_0_L2IHPMC_BIT 6 /* Level 2 I-cache error flag */ +#define CPU_DIAG_0_L2DHPMC_BIT 8 /* Level 2 D-cache error flag */ +#define CPU_DIAG_0_L1IHPMC_BIT 10 /* Level 1 I-cache error flag */ +#define CPU_DIAG_0_L2PARERR_BIT 15 /* rightmost bit */ +#define CPU_DIAG_0_PREV_HPMC_PREP_BIT 16 /* Previous HPMC finished */ +#define CPU_DIAG_0_PWR_FAIL_BIT 17 +#define CPU_DIAG_0_EXPECT_HPMC_BIT 18 /* Expecting HPMC */ + + /* Mask for Read/clear bits in CPU diagnose register 0 */ +#define CPU0_MASK 0x02AF0000 + +#else /* PCXT */ + +#define CPU_DIAG_0_PREV_HPMC_PREP_BIT 3 /* Previous HPMC finished */ +#define CPU_DIAG_0_BOOTING_BIT 4 +#define CPU_DIAG_0_EXPECT_HPMC_BIT 5 /* Expecting HPMC */ + +#define CPU_DIAG_0_DHPMC_BIT 10 +#define CPU_DIAG_0_ILPMC_BIT 14 +#define CPU_DIAG_0_HTOC_BIT 23 + + /* Mask for Read/clear bits in CPU diagnose register 0 */ +#define CPU0_MASK 0x00220100 + +#endif + + /* Diagnose instruction macros */ + +#ifdef PCXL + +/*** Different PCXL diagnose commands ***/ + +/* Original mfcpu replaced with the two commands mfcpu_t & mfcpu_c */ +mfcpu_t .macro diag_reg,gen_reg + { 0 .. 5} = 0x5 {26 .. 31} + { 6 .. 10} = diag_reg {27 .. 31} + {11 .. 15} = 0x0 {27 .. 31} + {16 .. 18} = 0x0 {29 .. 31} + {19 .. 26} = 0xa0 {24 .. 31} + {27 .. 31} = gen_reg {27 .. 31} + .endm + +mfcpu_c .macro diag_reg,gen_reg + { 0 .. 5} = 0x5 {26 .. 31} + { 6 .. 10} = diag_reg {27 .. 31} + {11 .. 15} = gen_reg {27 .. 31} + {16 .. 18} = 0x0 {29 .. 31} + {19 .. 26} = 0x30 {24 .. 31} + {27 .. 31} = 0x0 {27 .. 31} + .endm + +mtcpu .macro gen_reg,diag_reg + { 0 .. 5} = 0x5 {26 .. 31} + { 6 .. 10} = diag_reg {27 .. 31} + {11 .. 15} = gen_reg {27 .. 31} + {16 .. 18} = 0x0 {29 .. 31} + {19 .. 26} = 0x12 {24 .. 31} + {27 .. 31} = 0x0 {27 .. 31} + .endm + +shdw_gr .macro + { 0 .. 5} = 0x5 {26 .. 31} + { 6 .. 10} = 0x0 {27 .. 31} + {11 .. 15} = 0x0 {27 .. 31} + {16 .. 18} = 0x0 {29 .. 31} + {19 .. 26} = 0xd0 {24 .. 31} + {27 .. 31} = 0x0 {27 .. 31} + .endm + +gr_shdw .macro + { 0 .. 5} = 0x5 {26 .. 31} + { 6 .. 10} = 0x0 {27 .. 31} + {11 .. 15} = 0x0 {27 .. 31} + {16 .. 18} = 0x0 {29 .. 31} + {19 .. 26} = 0xd2 {24 .. 31} + {27 .. 31} = 0x0 {27 .. 31} + .endm + +#else + +/*** original PCXT version ***/ + +/* Originally was mfcpu without the _c */ +mfcpu_c .macro diag_reg,gen_reg + { 0 .. 5} = 0x5 {26 .. 31} + { 6 .. 10} = diag_reg {27 .. 31} + {11 .. 15} = gen_reg {27 .. 31} + {16 .. 18} = 0x0 {29 .. 31} + {19 .. 26} = 0xd0 {24 .. 31} + {27 .. 31} = 0x0 {27 .. 31} + .endm + +mtcpu .macro gen_reg,diag_reg + { 0 .. 5} = 0x5 {26 .. 31} + { 6 .. 10} = diag_reg {27 .. 31} + {11 .. 15} = gen_reg {27 .. 31} + {16 .. 18} = 0x0 {29 .. 31} + {19 .. 26} = 0xb0 {24 .. 31} + {27 .. 31} = 0x0 {27 .. 31} + .endm + +shdw_gr .macro + { 0 .. 5} = 0x5 {26 .. 31} + { 6 .. 10} = 0x2 {27 .. 31} + {11 .. 15} = 0x0 {27 .. 31} + {16 .. 18} = 0x1 {29 .. 31} + {19 .. 26} = 0x30 {24 .. 31} + {27 .. 31} = 0x0 {27 .. 31} + .endm + +gr_shdw .macro + { 0 .. 5} = 0x5 {26 .. 31} + { 6 .. 10} = 0x2 {27 .. 31} + {11 .. 15} = 0x0 {27 .. 31} + {16 .. 18} = 0x0 {29 .. 31} + {19 .. 26} = 0x31 {24 .. 31} + {27 .. 31} = 0x0 {27 .. 31} + .endm + +#endif + + + /* Actual commands used doubled instructions for cpu timing */ + + +#define SHDW_GR shdw_gr ! \ + shdw_gr + + + /* Break instruction definitions */ + +#define i13BREAK 0xa5a /* im13 field for specified functions */ +#define i5REG 0x06 /* Init registers */ +#define i5BP 0x09 /* GDB breakpoint */ +#define i5PSW 0x0b /* Get PSW */ +#define i5INLINE 0x0e /* Get INLINE */ + +BR_INIT_REGS .macro + break i5REG,i13BREAK + .endm + +BR_GET_PSW .macro + break i5PSW,i13BREAK + .endm + +BR_INLINE .macro + break i5INLINE,i13BREAK + .endm + diff --git a/libgloss/hp74x/hppa-defs.h b/libgloss/hp74x/hppa-defs.h new file mode 100644 index 0000000..5bbaeef --- /dev/null +++ b/libgloss/hp74x/hppa-defs.h @@ -0,0 +1,123 @@ +/* + * PDC support + */ +#define OPT_PDC_CACHE 5 +#define OPT_PDC_ADD_VALID 12 +#define OPT_PDC_CHASSIS 2 /* LED's */ +#define OPT_PDC_IODC 8 /* console I/O */ +#define IODC_CONSOLE_OUT 3 /* bytes out serial port */ +#define IODC_CONSOLE_IN 2 /* bytes in serial port */ + +#define PGZ_MEM_PDC 0x0388 /* location of PDC_ENTRY in memory */ +#define PGZ_CONSOLE_STRUCT 0x3A0 /* console config info */ +#define CALL_PDC (*(int (*)())((int *)(*((int *)PGZ_MEM_PDC)))) + +#define putDebugChar outbyte +#define getDebugChar inbyte + +/* + * IODC support + */ +#define MAX_BUS_CONVERTERS 6 +#define MAX_LAYERS 6 +#define IO_CONSOLE_INPUT 2 +#define IO_CONSOLE_OUTPUT 3 + +struct _dev { + unsigned char flags; /* auto-search and auto-boot */ + unsigned char bus_convert[MAX_BUS_CONVERTERS]; + unsigned char pm; /* fixed field of HPA */ + unsigned int layer[MAX_LAYERS]; /* device dependent layers */ + unsigned int hpa; /* device HPA */ + unsigned int spa; /* device SPA */ + unsigned int *iodc_io; /* address of ENTRY_IO in mem */ + unsigned int class; /* device class */ +}; + +/* + * Register defintions + */ +#define gr0 %r0 /* always ZERO */ +#define gr1 %r1 /* ADDIL results only */ +#define gr2 %r2 /* return address */ +#define gr3 %r3 /* scratch registers */ +#define gr4 %r4 +#define gr5 %r5 +#define gr6 %r6 +#define gr7 %r7 +#define gr8 %r8 +#define gr9 %r9 +#define gr10 %r10 +#define gr11 %r11 +#define gr12 %r12 +#define gr13 %r13 +#define gr14 %r14 +#define gr15 %r15 +#define gr16 %r16 +#define gr17 %r17 +#define gr18 %r18 +#define gr19 %r19 /* 4th temp register */ +#define gr20 %r20 /* 3rd temp register */ +#define gr21 %r21 /* 2rd temp register */ +#define gr22 %r22 /* 1rd temp register */ +#define gr23 %r23 /* argument 3 */ +#define gr24 %r24 /* argument 2 */ +#define gr25 %r25 /* argument 1 */ +#define gr26 %r26 /* argument 0 */ +#define gr27 %r27 /* global data pointer */ +#define gr28 %r28 /* return value */ +#define gr29 %r29 /* return value, static link */ +#define gr30 %r30 /* stack pointer */ +#define gr31 %r31 /* millicode return pointer */ + +/* + * extra definitions, calling conventions + */ +#define rp gr2 /* return address */ +#define sp gr30 /* stack pointer */ +#define dp gr27 /* global data area pointer */ + +/* + * extra definitions, argument passing + */ +#define Arg0 gr26 /* pdc function to perform */ +#define Arg1 gr25 /* args to the pdc function */ +#define Arg2 gr24 +#define Arg3 gr23 + +/* + * Special Processor Registers + */ +#define SAR %cr11 /* shift amount register */ +#define IVA %cr14 /* Interruption Vector Address */ +#define EIEM %cr15 /* EIEM reg */ +#define EIR %cr23 /* EIR reg */ +#define TIMER %cr16 /* interval timer */ +#define CCR %cr10 /* coprocessor control reg. */ + +/* + * ASCII escape code + */ +#define NULL 0x00 /* <break> soft-reset (input only) */ +#define DELP 0x03 /* <ctrl>C del-collapse (input only, non-std) */ +#define DELE 0x04 /* <ctrl>D del-to_eol (input only, non-std) */ +#define BELL 0x07 /* <ctrl>G bell - audio */ +#define BS 0x08 /* <ctrl>H back space (left arrow) */ +#define HT 0x09 /* <ctrl>I horizontal tab */ +#define LF 0x0a /* <ctrl>J line feed (down arrow) */ +#define VT 0x0b /* <ctrl>K vertical tab (up arrow) */ +#define FF 0x0c /* <ctrl>L form feed (right arrow) */ +#define RTN 0x0d /* <ctrl>M carrage return */ +#define CR 0x0d /* <ctrl>M carrage return */ + +#define INSC 0x0e /* <ctrl>N insert char (input only, non-std) */ +#define XON 0x11 /* <ctrl>Q DC1 - continue */ +#define BT 0x12 /* <ctrl>R reverse tab (input only, non-std) */ +#define XOFF 0x13 /* <ctrl>S DC3 - wait */ +#define INSE 0x16 /* <ctrl>V insert-expand (input only, non-std) */ +#define DELC 0x18 /* <ctrl>X delete char (input only, non-std) */ +#define CLRH 0x1a /* <ctrl>Z clear/home (input only) */ +#define ESC 0x1b /* <ctrl>[ escape (must call key again) */ +#define ENDL 0x1c /* <ctrl>\ cursor-to-eol (input only, non-std) */ +#define HOME 0x1e /* <ctrl>^ cursor home (input only) */ +#define DEL 0x7f /* <shift>BS destructive backspace */ diff --git a/libgloss/hp74x/hppa.ld b/libgloss/hp74x/hppa.ld new file mode 100644 index 0000000..37b733b --- /dev/null +++ b/libgloss/hp74x/hppa.ld @@ -0,0 +1,64 @@ +STARTUP(crt0-hppa.o) +OUTPUT_ARCH(hppa) +/*** INPUT(hppa.o) ***/ +SEARCH_DIR(.) +__DYNAMIC = 0; + +/* + * Setup the memory map of the MC68ec0x0 Board (IDP) + * stack grows up towards high memory. This works for + * both the rom68k and the mon68k monitors. + */ +MEMORY +{ + ram (rwx) : ORIGIN = 0x10000, LENGTH = 32M +} + +/* + * stick everything in ram (of course) + */ +SECTIONS +{ + .text : + { + CREATE_OBJECT_SYMBOLS + *(.text) + etext = .; + __CTOR_LIST__ = .; + LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) + *(.ctors) + LONG(0) + __CTOR_END__ = .; + __DTOR_LIST__ = .; + LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) + *(.dtors) + LONG(0) + __DTOR_END__ = .; + *(.lit) + *(.shdata) + } > ram + .shbss SIZEOF(.text) + ADDR(.text) : { + *(.shbss) + } + .data : { + *(.data) + CONSTRUCTORS + _edata = .; + } > ram + + .bss SIZEOF(.data) + ADDR(.data) : + { + _bss_start = ALIGN(0x8); + *(.bss) + *(COMMON) + _bss_end = ALIGN(0x8); + } + .stab 0 (NOLOAD) : + { + [ .stab ] + } + .stabstr 0 (NOLOAD) : + { + [ .stabstr ] + } +} diff --git a/libgloss/hp74x/io.c b/libgloss/hp74x/io.c new file mode 100644 index 0000000..054d90c --- /dev/null +++ b/libgloss/hp74x/io.c @@ -0,0 +1,338 @@ +/* + * io.c -- all the code to make GCC and the libraries run on + * a bare target board. + */ + +#include <sys/types.h> +#include <sys/stat.h> +#include <errno.h> + +#include "hppa-defs.h" + +extern char *_end; /* _end is set in the linker command file */ + +/* just in case, most boards have at least some memory */ +#ifndef RAMSIZE +# define RAMSIZE (char *)0x100000 +#endif + +int +print(ptr) +char *ptr; +{ + while (*ptr) + outbyte (*ptr++); +} + +int +putnum (Num) +unsigned int Num; +{ + char Buffer[9]; + int Count; + char *BufPtr = Buffer; + int Digit; + + for (Count = 7 ; Count >= 0 ; Count--) { + Digit = (Num >> (Count * 4)) & 0xf; + + if (Digit <= 9) + *BufPtr++ = (char) ('0' + Digit); + else + *BufPtr++ = (char) ('a' - 10 + Digit); + } + + *BufPtr = (char) 0; + print (Buffer); + return; +} + +int +delay (x) + int x; +{ + int y = 17; + while (x-- !=0) + y = y^2; +} + +/* + * strobe -- do a zylons thing, toggling each led in sequence forever... + */ +int +zylons() +{ + while (1) { + strobe(); + } +} + +/* + * strobe -- toggle each led in sequence up and back once. + */ +int +strobe() +{ + static unsigned char curled = 1; + static unsigned char dir = 0; + + curled = 1; + dir = 0; + while (curled != 0) { + led_putnum (curled); + delay (70000); + if (dir) + curled >>= 1; + else + curled <<= 1; + + if (curled == 128) { + dir = ~dir; + } + } + curled = 1; + dir = 0; +} + +/* + * iodc_io_call -- this makes a call into the IODC routine + */ +int +iodc_io_call(ep_address,arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11) +int ep_address, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11; +{ + int (*iodc_entry_point)(); + + iodc_entry_point = (int (*)())ep_address; + + return ((*iodc_entry_point)(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11)); +} + +/* + * pdc_call -- this makes a call into the PDC routine + */ +int +pdc_call(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11) + int arg0, arg1, arg2, arg3, arg4, arg5; + int arg6, arg7, arg9, arg10, arg11; +{ + return ( CALL_PDC(arg0,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11)); +} + +/* + * put_led -- put a bit pattern on the LED's. + */ +int +led_putnum (byte) + unsigned short byte; +{ + return (pdc_call(OPT_PDC_CHASSIS,0,byte)); +} + + +/* + * outbyte -- shove a byte out the serial port + */ +int +outbyte(byte) + unsigned char byte; +{ + int status; + int R_addr[32]; + struct _dev *console = (struct _dev *)PGZ_CONSOLE_STRUCT; + + status = iodc_io_call(console->iodc_io, console->hpa, IO_CONSOLE_OUTPUT, console->spa, + console->layer[0], R_addr, 0, &byte, 1, 0); + + switch(status) + { + case 0: return(1); + default: return (-1); + } +} + +/* + * inbyte -- get a byte from the serial port + */ +unsigned char +inbyte() +{ + int status; + int R_addr[32]; + char inbuf; + struct _dev *console = (struct _dev *)PGZ_CONSOLE_STRUCT; + + while (status == 0) { + status = iodc_io_call(console->iodc_io, console->hpa, IO_CONSOLE_INPUT, console->spa, + console->layer[0], R_addr, 0, &inbuf, 1, 0); + + switch (status) { + case 0: + case 2: /* recoverable error */ + if (R_addr[0] != 0) { /* found a character */ + return(inbuf); + } + else + break; /* error, no character */ + default: /* error, no character */ + return(0); + } + } +} + +/* + * read -- read bytes from the serial port. Ignore fd, since + * we only have stdin. + */ +int +read(fd, buf, nbytes) + int fd; + char *buf; + int nbytes; +{ + int i = 0; + + for (i = 0; i < nbytes; i++) { + *(buf + i) = inbyte(); + if ((*(buf + i) == '\n') || (*(buf + i) == '\r')) { + (*(buf + i)) = 0; + break; + } + } + return (i); +} + +/* + * write -- write bytes to the serial port. Ignore fd, since + * stdout and stderr are the same. Since we have no filesystem, + * open will only return an error. + */ +int +write(fd, buf, nbytes) + int fd; + char *buf; + int nbytes; +{ + int i; + + for (i = 0; i < nbytes; i++) { + if (*(buf + i) == '\n') { + outbyte ('\r'); + } + outbyte (*(buf + i)); + } + return (nbytes); +} + +/* + * open -- open a file descriptor. We don't have a filesystem, so + * we return an error. + */ +int +open(buf, flags, mode) + char *buf; + int flags; + int mode; +{ + errno = EIO; + return (-1); +} + +/* + * close -- close a file descriptor. We don't need + * to do anything, but pretend we did. + */ +int +close(fd) + int fd; +{ + return (0); +} + +/* + * sbrk -- changes heap size size. Get nbytes more + * RAM. We just increment a pointer in what's + * left of memory on the board. + */ +char * +sbrk(nbytes) + int nbytes; +{ + static char * heap_ptr = NULL; + char * base; + + if (heap_ptr == NULL) { + heap_ptr = (char *)&_end; + } + + if ((RAMSIZE - heap_ptr) >= 0) { + base = heap_ptr; + heap_ptr += nbytes; + return (heap_ptr); + } else { + errno = ENOMEM; + return ((char *)-1); + } +} + +/* + * isatty -- returns 1 if connected to a terminal device, + * returns 0 if not. Since we're hooked up to a + * serial port, we'll say yes return a 1. + */ +int +isatty(fd) + int fd; +{ + return (1); +} + +/* + * lseek -- move read/write pointer. Since a serial port + * is non-seekable, we return an error. + */ +off_t +lseek(fd, offset, whence) + int fd; + off_t offset; + int whence; +{ + errno = ESPIPE; + return ((off_t)-1); +} + +/* + * fstat -- get status of a file. Since we have no file + * system, we just return an error. + */ +int +fstat(fd, buf) + int fd; + struct stat *buf; +{ + errno = EIO; + return (-1); +} + +/* + * getpid -- only one process, so just return 1. + */ +#define __MYPID 1 +int +getpid() +{ + return __MYPID; +} + +/* + * kill -- assume mvme.S, and go out via exit... + */ +int +kill(pid, sig) + int pid; + int sig; +{ + if(pid == __MYPID) + _exit(sig); + return 0; +} diff --git a/libgloss/hp74x/iva_table.h b/libgloss/hp74x/iva_table.h new file mode 100644 index 0000000..68d6ba9 --- /dev/null +++ b/libgloss/hp74x/iva_table.h @@ -0,0 +1,164 @@ +/**************************************************************************** + + THIS SOFTWARE IS NOT COPYRIGHTED + + HP offers the following for use in the public domain. HP makes no + warranty with regard to the software or it's performance and the + user accepts the software "AS IS" with all faults. + + HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD + TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + +****************************************************************************/ + + /* Interrupt Vector Table entry macros */ + +#define cstring(Len,String) .byte Len !\ + .string String + +#define cstringz(Len,String) .byte Len !\ + .stringz String + +AdvancePCOQ .macro + mtctl %r0,%pcoq ; throw away iiaoq head pointer, tail->head + mfctl %pcoq,%r1 ; get tail pointer + mtctl %r1,%pcoq ; insert tail pointer + ldo 4(%r1),%r1 ; advance tail pointer + mtctl %r1,%pcoq ; insert new tail pointer, former tail->head + .endm + +#ifdef PRINTSTRING_LED +PrintString .macro NString,Num + bl put_led,%mrp + ldi Num+0xa0,%arg2 + addil L%NString-$global$,%dp + bl puts,%rp + ldo R%NString-$global$(%r1),%arg0 + b,n . + nop + .endm +#endif + +#ifdef HALT + +PrintString .macro NString,Num + bl,n save_state,%r25 + nop + bl print_intr,%rp + ldi NString-Str01,%arg0 + bl print_state,%rp + nop + b,n halt + nop + .endm + +#endif + +#ifdef RECOVER + +PrintString .macro NString,Num + bl,n save_state,%r25 + nop + bl print_intr,%rp + ldi NString-Str01,%arg0 + bl print_state,%rp + nop + b,n recover + nop + .endm + +#endif + +PrintString .macro NString,Num + bl,n save_state,%r25 + nop + bl print_intr,%rp + ldi NString-Str01,%arg0 +#ifdef FULL_REPORT + bl print_state,%rp +#else + nop +#endif + nop + b restore_to_STUB + ldi Num,%r1 + .endm + + + /* IVA register array offets */ + +#define R_sr0 0 +#define R_sr1 4 +#define R_sr2 8 +#define R_sr3 12 +#define R_sr4 16 +#define R_sr5 20 +#define R_sr6 24 +#define R_sr7 28 + +#define R_gr0 32 +#define R_gr1 36 +#define R_gr2 40 +#define R_gr3 44 +#define R_gr4 48 +#define R_gr5 52 +#define R_gr6 56 +#define R_gr7 60 +#define R_gr8 64 +#define R_gr9 68 +#define R_gr10 72 +#define R_gr11 76 +#define R_gr12 80 +#define R_gr13 84 +#define R_gr14 88 +#define R_gr15 92 +#define R_gr16 96 +#define R_gr17 100 +#define R_gr18 104 +#define R_gr19 108 +#define R_gr20 112 +#define R_gr21 116 +#define R_gr22 120 +#define R_gr23 124 +#define R_gr24 128 +#define R_gr25 132 +#define R_gr26 136 +#define R_gr27 140 +#define R_gr28 144 +#define R_gr29 148 +#define R_gr30 152 +#define R_gr31 156 + +#define R_rctr 160 +#define R_cpu0 164 +#define R_pidr1 168 +#define R_pidr2 172 +#define R_ccr 176 +#define R_sar 180 +#define R_pidr3 184 +#define R_pidr4 188 +#define R_iva 192 +#define R_eiem 196 + +#define R_itmr 200 +#define R_pcsqH 204 +#define R_pcoqH 208 +#define R_iir 212 +#define R_pcsqT 216 +#define R_pcoqT 220 +#define R_isr 224 +#define R_ior 228 +#define R_ipsw 232 +#define R_eirr 236 + +#define R_tr0 240 +#define R_tr1 244 +#define R_tr2 248 +#define R_tr3 252 +#define R_tr4 256 +#define R_tr5 260 +#define R_tr6 264 +#define R_tr7 268 + +#define R_SIZE 272 diff --git a/libgloss/hp74x/iva_table.s b/libgloss/hp74x/iva_table.s new file mode 100644 index 0000000..289ea3c --- /dev/null +++ b/libgloss/hp74x/iva_table.s @@ -0,0 +1,996 @@ +/**************************************************************************** + + THIS SOFTWARE IS NOT COPYRIGHTED + + HP offers the following for use in the public domain. HP makes no + warranty with regard to the software or it's performance and the + user accepts the software "AS IS" with all faults. + + HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD + TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + +****************************************************************************/ + + .space $TEXT$ + .subspa $CODE$,access=0x2c + +#include "diagnose.h" +#if 0 +#include "iva_table.h" +#endif + +R_gr0 .equ 0 +R_gr1 .equ 4 +R_gr2 .equ 8 +R_gr3 .equ 12 +R_gr4 .equ 16 +R_gr5 .equ 20 +R_gr6 .equ 24 +R_gr7 .equ 28 +R_gr8 .equ 32 +R_gr9 .equ 36 +R_gr10 .equ 40 +R_gr11 .equ 44 +R_gr12 .equ 48 +R_gr13 .equ 52 +R_gr14 .equ 56 +R_gr15 .equ 60 +R_gr16 .equ 64 +R_gr17 .equ 68 +R_gr18 .equ 72 +R_gr19 .equ 76 +R_gr20 .equ 80 +R_gr21 .equ 84 +R_gr22 .equ 88 +R_gr23 .equ 92 +R_gr24 .equ 96 +R_gr25 .equ 100 +R_gr26 .equ 104 +R_gr27 .equ 108 +R_gr28 .equ 112 +R_gr29 .equ 116 +R_gr30 .equ 120 +R_gr31 .equ 124 +R_rctr .equ 160 +R_cpu0 .equ 164 +R_pidr1 .equ 168 +R_pidr2 .equ 172 +R_ccr .equ 176 +R_sar .equ 180 +R_pidr3 .equ 184 +R_pidr4 .equ 188 +R_iva .equ 192 +R_eiem .equ 196 + +R_itmr .equ 200 +R_pcsqH .equ 204 +R_pcoqH .equ 208 +R_iir .equ 212 +R_pcsqT .equ 216 +R_pcoqT .equ 220 +R_isr .equ 224 +R_ior .equ 228 +R_ipsw .equ 232 +R_eirr .equ 236 +R_tr0 .equ 240 +R_tr1 .equ 244 +R_tr2 .equ 248 +R_tr3 .equ 252 +R_tr4 .equ 256 +R_tr5 .equ 260 +R_tr6 .equ 264 +R_tr7 .equ 268 + +R_SIZE .equ 300 + + .import putc,code + .import puts,code + .import putnum,code + .import put_led,code + .import save_regs,code + .import STUB_RESTORE,code + .import RegBlk,data + .export iva_table,data + .IMPORT led_putnum,code + .IMPORT delay,code + .IMPORT putnum,code + .IMPORT outbyte,code + .IMPORT print,code + + .align 2048 +iva_table + .blockz 32 ; entry 0 is reserved + + .align 32 +hpmc + nop + b,n hpmc_handler + nop + .word 0 + .word 0 + .word 0 + .word hpmc_handler + .word 0 + + .align 32 +power_fail +; PrintString Str02,0x2 + ldi 1,%r26 + bl,n putnum,%r2 + nop + + .align 32 +recovery +;; PrintString Str03,0x3 + ldi 2,%r26 + bl,n putnum,%r2 + nop + ldi 3,%r1 + b,n handle_rcc + nop + + .align 32 +external +; PrintString Str04,0x4 + ldi 3,%r26 + bl,n putnum,%r2 + nop + + .align 32 +lpmc +; PrintString Str05,0x5 + ldi 4,%r26 + bl,n putnum,%r2 + nop + + .align 32 +itlb_miss +; PrintString Str06,0x6 + ldi 5,%r26 + bl,n putnum,%r2 + nop + + .align 32 +imem_protection +; PrintString Str07,0x7 + ldi 6,%r26 + bl,n putnum,%r2 + nop + + .align 32 +illegal_inst +; PrintString Str08,0x8 + ldi 7,%r26 + bl,n putnum,%r2 + nop + + .align 32 +break + b,n break_handler + nop + + .align 32 +privileged_op +; PrintString Str0a,0xa + ldi 8,%r26 + bl,n putnum,%r2 + nop + + .align 32 +privileged_reg +; PrintString Str0b,0xb + ldi 9,%r26 + bl,n putnum,%r2 + nop + + .align 32 +overflow +; PrintString Str0c,0xc + ldi 32,%r26 + bl,n putnum,%r2 + nop + + .align 32 +conditional +; PrintString Str0d,0xd + ldi 32,%r26 + bl,n putnum,%r2 + nop + + .align 32 +assist_excep +; PrintString Str0e,0xe + ldi 32,%r26 + bl,n putnum,%r2 + nop + + .align 32 +dtlb_miss +; PrintString Str0f,0xf + ldi 32,%r26 + bl,n putnum,%r2 + nop + + .align 32 +na_itlb +; PrintString Str10,0x10 + ldi 32,%r26 + bl,n putnum,%r2 + nop + + .align 32 +na_dtlb +; PrintString Str11,0x11 + ldi 32,%r26 + bl,n putnum,%r2 + nop + + .align 32 +dmem_protection +; PrintString Str12,0x12 + ldi 32,%r26 + bl,n putnum,%r2 + nop + + .align 32 +dmem_break +; PrintString Str13,0x13 + ldi 32,%r26 + bl,n putnum,%r2 + nop + + .align 32 +tlb_dirty +; PrintString Str14,0x14 + ldi 32,%r26 + bl,n putnum,%r2 + nop + + .align 32 +page_ref +; PrintString Str15,0x15 + ldi 32,%r26 + bl,n putnum,%r2 + nop + + .align 32 +assist_emul +; PrintString Str16,0x16 + ldi 32,%r26 + bl,n putnum,%r2 + nop + + .align 32 +high_priv +; PrintString Str17,0x17 + ldi 32,%r26 + bl,n putnum,%r2 + nop + + .align 32 +low_priv +; PrintString Str18,0x18 + ldi 32,%r26 + bl,n putnum,%r2 + nop + + .align 32 +branch_taken +; PrintString Str19,0x19 + ldi 32,%r26 + bl,n putnum,%r2 + nop + +/* + * foobar -- debug procedure calling between C and assembler + */ + .EXPORT foobar,ENTRY,ARGW0=GR,RTNVAL=GR +foobar + .PROC + .CALLINFO CALLER,FRAME=128,SAVE_RP + .ENTRY + + stw %r2,-20(0,%r30) ; stash the return pointer + ldo 128(%r30),%r30 ; push up the stack pointer + + ldi 8, %r26 + bl,n led_putnum,%r2 + nop + ldil L'900000,%r26 + ldo R'900000(%r26),%r26 + bl,n delay,%r2 + nop + ldi 8, %r26 + bl,n led_putnum,%r2 + nop + ldil L'900000,%r26 + ldo R'900000(%r26),%r26 + bl,n delay,%r2 + nop +;; copy %r26,%r26 +;; bl,n putnum,%r2 + nop + + ldw -148(0,%r30),%r2 ; retrieve the return pointer + ldo -128(%r30),%r30 ; reset the stack pointer + bv,n 0(%r2) + nop + + .EXIT + .PROCEND + +/* + * setup_vectors -- add vectors for GDB to the vector table. + * %r3 - current vector table + * %r4 - new vector table + */ + .EXPORT setup_vectors,ENTRY,ARGW0=GR,RTNVAL=GR +setup_vectors + .PROC + .CALLINFO CALLER,FRAME=128,SAVE_RP + .ENTRY + stw %r2,-20(0,%r30) ; stash the return pointer + ldo 128(%r30),%r30 ; push up the stack pointer + + mfctl %iva,%r3 + + ldil L%iva_table,%r4 ; Get the new vector table + ldo R%iva_table(%r4),%r4 ; address + + ldil L%break_handler,%r5 ; Get the breakpoint + ldo R%break_handler(%r5),%r5 ; handler vector + + ldil L%break_default,%r6 ; Get the default handler + ldo R%break_default(%r6),%r6 ; vector + + stw %r6,4(%r4) ; ad the default vector + stw %r5,36(%r4) ; add the break vector + + mtctl %r4,%iva + + ldw -148(0,%r30),%r2 ; retrieve the return pointer + ldo -128(%r30),%r30 ; reset the stack pointer + bv,n 0(%r2) + nop + + .EXIT + .PROCEND + +;------------------------------------------------------------------------------- +hpmc_handler + bl,n save_state,%r25 + nop + bl print_intr,%rp + ldi Str01-Str01,%arg0 + bl print_state,%rp + nop + ldil L%0xf0000000,%r1 + ldw (%r1),%r1 ; read from ROM to reset HPMC + + mfcpu_c 0,%r1 + mfcpu_c 0,%r1 + depi 0,CPU_DIAG_0_PREV_HPMC_PREP_BIT,1,%r1 ; clear Prev HPMC bit + +#ifdef PCXL + depi 0,CPU_DIAG_0_L2DHPMC_BIT,1,%r1 + depi 0,CPU_DIAG_0_L2IHPMC_BIT,1,%r1 + depi 0,CPU_DIAG_0_L1IHPMC_BIT,1,%r1 + depi 0,CPU_DIAG_0_L2PARERR_BIT,4,%r1 +#else /* PCXT */ + depi 0,CPU_DIAG_0_DHPMC_BIT,1,%r1 ; don't clear DHPMC + depi 0,CPU_DIAG_0_ILPMC_BIT,1,%r1 ; don't clear ILPMC + depi 0,CPU_DIAG_0_HTOC_BIT,1,%r1 ; don't clear HTOC +#endif + + mtcpu %r1,0 + mtcpu %r1,0 + + b,n restore_to_STUB + ldi 0x1,%r1 + +/* + * break_handler -- this is the main entry point for an exception + */ + .ALIGN 2048 +break_handler + + mfctl %iir,%r1 ; r1 = break instruction + extru %r1,18,13,%r8 + ldo -i13BREAK(%r8),%r8 ; if im13 field doesn't match + comb,<>,n %r8,%r0,break_default ; go to default operation + extru %r1,31,5,%r8 + ldi 0x9,%r1 ; set exception index + comib,=,n i5BP,%r8,break_breakpoint + comib,=,n i5PSW,%r8,break_psw + comib,=,n i5REG,%r8,break_reg_init + comib,=,n i5INLINE,%r8,break_breakpoint + ; fall through to break_default + +break_default +; PrintString Str09,0x9 + ldi 32,%r26 + bl,n putnum,%r2 + nop + +break_reg_init + bl setup_vectors,%r25 + nop + bl save_regs,%r25 + nop + ; fall through to advance past break instruction + +break_psw + b,n recover + +break_breakpoint + b,n STUB_RESTORE + +;------------------------------------------------------------------------------- + +handle_rcc + mfctl %ipsw,%r1 + bb,>=,n %r1,10,do_restore ; check nullify bit + dep %r0,10,1,%r1 + mtctl %r1,%ipsw ; clear nullify bit + + ;; was the AdvancePCOQ .macro + mtctl %r0,%pcoq ; throw away iiaoq head pointer, tail->head + mfctl %pcoq,%r1 ; get tail pointer + mtctl %r1,%pcoq ; insert tail pointer + ldo 4(%r1),%r1 ; advance tail pointer + mtctl %r1,%pcoq ; insert new tail pointer, former tail->head + +do_restore + b,n STUB_RESTORE + nop +;------------------------------------------------------------------------------- + +print_intr +; %dp may be messed up, so do self-relocating to reach Save_area + blr %r0,%r1 + addil L%Str01-pr_intr_0,%r1 + +pr_intr_0 + ldo R%Str01-pr_intr_0(%r1),%r1 ; r1 points to Save_area + b puts ; print string--return through rp + add %r1,%arg0,%arg0 + +;------------------------------------------------------------------------------- + +halt +; %dp may be messed up, so do self-relocating to reach Save_area + blr %r0,%r1 + addil L%HaltStr-halt_0,%r1 + +halt_0 + bl puts,%rp ; print halt message + ldo R%HaltStr-halt_0(%r1),%arg0 + + nop + b,n . ; loop forever + nop + +;------------------------------------------------------------------------------- + +recover + ;; was the AdvancePCOQ .macro + mtctl %r0,%pcoq ; throw away iiaoq head pointer, tail->head + mfctl %pcoq,%r1 ; get tail pointer + mtctl %r1,%pcoq ; insert tail pointer + ldo 4(%r1),%r1 ; advance tail pointer + mtctl %r1,%pcoq ; insert new tail pointer, former tail->head + + rfir + +;------------------------------------------------------------------------------- + +save_state ; %r25 is return pointer +; %dp may be messed up, so do self-relocating to reach Save_area + blr %r0,%r1 + addil L%Save_area-sa_st_0,%r1 + +sa_st_0 + ldo R%Save_area-sa_st_0(%r1),%r1 ; r1 points to Save_area + +; save general registers + stw %r0,R_gr0(%r1) + ; don't save %r1 until restored + stw %r2,R_gr2(%r1) + stw %r3,R_gr3(%r1) + stw %r4,R_gr4(%r1) + stw %r5,R_gr5(%r1) + stw %r6,R_gr6(%r1) + stw %r7,R_gr7(%r1) + ; don't save %r8, %r9 until restored + stw %r10,R_gr10(%r1) + stw %r11,R_gr11(%r1) + stw %r12,R_gr12(%r1) + stw %r13,R_gr13(%r1) + stw %r14,R_gr14(%r1) + stw %r15,R_gr15(%r1) + ; don't save %r16, %r17 until restored + stw %r18,R_gr18(%r1) + stw %r19,R_gr19(%r1) + stw %r20,R_gr20(%r1) + stw %r21,R_gr21(%r1) + stw %r22,R_gr22(%r1) + stw %r23,R_gr23(%r1) + ; don't save %r24, %r25 until restored + stw %r26,R_gr26(%r1) + stw %r27,R_gr27(%r1) + stw %r28,R_gr28(%r1) + stw %r29,R_gr29(%r1) + copy %r25,%rp ; copy return pointer to %rp + stw %r30,R_gr30(%r1) + copy %r1,%r19 ; save Save_area pointer in %r19 + stw %r31,R_gr31(%r1) + shdw_gr ; restore %r1 and %r25 (et al.) from shadow regs + shdw_gr + stw %r1,R_gr1(%r19) ; save %r1 + stw %r8,R_gr8(%r19) + stw %r9,R_gr9(%r19) + stw %r16,R_gr16(%r19) + stw %r17,R_gr17(%r19) + stw %r24,R_gr24(%r19) + +; save control registers + mfctl %rctr,%r1 + stw %r1,R_rctr(%r19) + mfctl %pidr1,%r1 + stw %r1,R_pidr1(%r19) + mfctl %pidr2,%r1 + stw %r1,R_pidr2(%r19) + mfctl %ccr,%r1 + stw %r1,R_ccr(%r19) + mfctl %sar,%r1 + stw %r1,R_sar(%r19) + mfctl %pidr3,%r1 + stw %r1,R_pidr3(%r19) + mfctl %pidr4,%r1 + stw %r1,R_pidr4(%r19) + mfctl %iva,%r1 + stw %r1,R_iva(%r19) + mfctl %eiem,%r1 + stw %r1,R_eiem(%r19) + mfctl %itmr,%r1 + stw %r1,R_itmr(%r19) + mfctl %pcsq,%r1 + mtctl %r1,%pcsq + stw %r1,R_pcsqH(%r19) + mfctl %pcsq,%r1 + mtctl %r1,%pcsq + stw %r1,R_pcsqT(%r19) + mfctl %pcoq,%r1 + mtctl %r1,%pcoq + stw %r1,R_pcoqH(%r19) + mfctl %pcoq,%r1 + mtctl %r1,%pcoq + stw %r1,R_pcoqT(%r19) + mfctl %iir,%r1 + stw %r1,R_iir(%r19) + mfctl %isr,%r1 + stw %r1,R_isr(%r19) + mfctl %ior,%r1 + stw %r1,R_ior(%r19) + mfctl %ipsw,%r1 + stw %r1,R_ipsw(%r19) + mfctl %eirr,%r1 + stw %r1,R_eirr(%r19) + mfctl %tr0,%r1 + stw %r1,R_tr0(%r19) + mfctl %tr1,%r1 + stw %r1,R_tr1(%r19) + mfctl %tr2,%r1 + stw %r1,R_tr2(%r19) + mfctl %tr3,%r1 + stw %r1,R_tr3(%r19) + mfctl %tr4,%r1 + stw %r1,R_tr4(%r19) + mfctl %tr5,%r1 + stw %r1,R_tr5(%r19) + mfctl %tr6,%r1 + stw %r1,R_tr6(%r19) + mfctl %tr7,%r1 + stw %r1,R_tr7(%r19) + +; save diagnose registers + mfcpu_c 0,%r1 + mfcpu_c 0,%r1 + stw %r1,R_cpu0(%r19) + +#ifdef PRINT_SPACE + stw %r25,R_gr25(%r19) + +; save space registers + mfsp %sr0,%r1 + stw %r1,R_sr0(%r19) + mfsp %sr1,%r1 + stw %r1,R_sr1(%r19) + mfsp %sr2,%r1 + stw %r1,R_sr2(%r19) + mfsp %sr3,%r1 + stw %r1,R_sr3(%r19) + mfsp %sr4,%r1 + stw %r1,R_sr4(%r19) + mfsp %sr5,%r1 + stw %r1,R_sr5(%r19) + mfsp %sr6,%r1 + stw %r1,R_sr6(%r19) + mfsp %sr7,%r1 + bv (%rp) + stw %r1,R_sr7(%r19) +#else + bv (%rp) + stw %r25,R_gr25(%r19) +#endif + + +;------------------------------------------------------------------------------- + +restore_to_STUB ; doesn't return--goes to STUB_RESTORE + ; Note--STUB_RESTORE executes rfir, + ; so we don't need to + copy %r1,%r8 ; save exception index +; %dp may be messed up, so do self-relocating to reach Save_area + bl re_st_0,%r1 + addil L%Save_area-re_st_0,%r1 + +re_st_0 + ldo R%Save_area-re_st_0(%r1),%r1 ; r1 points to Save_area + +; restore general registers + ldw R_gr2(%r1),%r2 + ldw R_gr3(%r1),%r3 + ldw R_gr4(%r1),%r4 + ldw R_gr5(%r1),%r5 + ldw R_gr6(%r1),%r6 + ldw R_gr7(%r1),%r7 +; ldw R_gr8(%r1),%r8 don't smash the exception index + ldw R_gr9(%r1),%r9 + ldw R_gr10(%r1),%r10 + ldw R_gr11(%r1),%r11 + ldw R_gr12(%r1),%r12 + ldw R_gr13(%r1),%r13 + ldw R_gr14(%r1),%r14 + ldw R_gr15(%r1),%r15 + ldw R_gr16(%r1),%r16 + ldw R_gr17(%r1),%r17 + ldw R_gr18(%r1),%r18 + ldw R_gr19(%r1),%r19 + ldw R_gr20(%r1),%r20 + ldw R_gr21(%r1),%r21 + ldw R_gr22(%r1),%r22 + ldw R_gr23(%r1),%r23 + ldw R_gr24(%r1),%r24 + ldw R_gr25(%r1),%r25 + ldw R_gr26(%r1),%r26 + ldw R_gr27(%r1),%r27 + ldw R_gr28(%r1),%r28 + ldw R_gr29(%r1),%r29 + ldw R_gr30(%r1),%r30 + ldw R_gr31(%r1),%r31 + ldw R_gr1(%r1),%r1 + b STUB_RESTORE + copy %r8,%r1 ; restore the exception index + +;------------------------------------------------------------------------------- + +#define HoldPtr %r10 +#define SavePtr %r11 +#define StrPtr %r12 +#define Count %r13 + +#define Hold_Hold 0*4 /* First word of hold area */ +#define Hold_Save 1*4 /* Second word of hold area */ +#define Hold_Str 2*4 /* Third word of hold area */ +#define Hold_Count 3*4 /* Fourth word of hold area */ +#define Hold_rp 4*4 /* Fifth word of hold area */ + +print_state +; %dp may be messed up, so do self-relocating to reach Save_area + blr %r0,%mrp + addil L%Hold_area-pr_st_0,%mrp + +pr_st_0 + ldo R%Hold_area-pr_st_0(%r1),%r1 ; r1 points to Hold_area + +; save working registers + + stw HoldPtr,Hold_Hold(%r1) + copy %r1,HoldPtr ; HoldPtr = &Hold_area + stw SavePtr,Hold_Save(HoldPtr) + ldo Save_area-Hold_area(HoldPtr),SavePtr ; SavePtr = &Save_area + stw StrPtr,Hold_Str(HoldPtr) + addil L%PrintLabels-pr_st_0,%mrp + stw Count,Hold_Count(HoldPtr) + ldo R%PrintLabels-pr_st_0(%r1),StrPtr + stw %rp,Hold_rp(HoldPtr) + + +#ifdef PRINT_SPACE + ldi 68,Count +#else + ldo R_gr0(SavePtr),SavePtr + ldi 60,Count +#endif + +; print register values + +print_loop + bl puts,%rp ; print label + ldo 1(StrPtr),%arg0 ; advance past length byte + bl putnum,%rp ; print register value + ldwm 4(SavePtr),%arg0 + ldbs,ma 1(StrPtr),%r1 + addib,> -1,Count,print_loop + add %r1,StrPtr,StrPtr + +; skip to next line + bl puts,%rp ; print label + ldo 1(StrPtr),%arg0 ; advance past length byte + +; restore working registers + + ldw Hold_rp(HoldPtr),%rp + ldw Hold_Count(HoldPtr),Count + ldw Hold_Str(HoldPtr),StrPtr + ldw Hold_Save(HoldPtr),SavePtr + bv (%rp) + ldw Hold_Hold(HoldPtr),HoldPtr + +#undef SavePtr +#undef HoldPtr +#undef StrPtr +#undef Count + +#undef Hold_Save +#undef Hold_Scr +#undef Hold_Str +#undef Hold_Count +#undef Hold_rp + +;------------------------------------------------------------------------------- + + .space $PRIVATE$ + .subspa $DATA$,align=4,access=0x1f + +/* Used to save machine registers before printing */ +Save_area + .block R_SIZE ; Used to store registers + +/* Used to hold callee-save registers */ +Hold_area + .block 8*4 ; 8 words to store temp. registers + +HaltStr + .stringz "\r\nHalted\r\n" + +RebootStr + .stringz "\r\nRebooting . . .\r\n" + +Str01 + .stringz "\r\nHPMC\r\n" + +Str02 + .stringz "\r\nPower Fail\r\n" + +Str03 + .stringz "\r\nRecovery Counter Trap\r\n" + +Str04 + .stringz "\r\nExternal Interrupt\r\n" + +Str05 + .stringz "\r\nLPMC\r\n" + +Str06 + .stringz "\r\nITLB Miss\r\n" + +Str07 + .stringz "\r\nInstruction Memory Protection Trap\r\n" + +Str08 + .stringz "\r\nIllegal Instruction\r\n" + +Str09 + .stringz "\r\nBreak Trap\r\n" + +Str0a + .stringz "\r\nPrivileged Operation\r\n" + +Str0b + .stringz "\r\nPrivileged Register\r\n" + +Str0c + .stringz "\r\nOverflow Trap\r\n" + +Str0d + .stringz "\r\nConditional Trap\r\n" + +Str0e + .stringz "\r\nAssist Exception\r\n" + +Str0f + .stringz "\r\nData TLB Miss\r\n" + +Str10 + .stringz "\r\nNon-access ITLB Miss\r\n" + +Str11 + .stringz "\r\nNon-access DTLB Miss\r\n" + +Str12 + .stringz "\r\nData Memory Protection Trap\r\n" + +Str13 + .stringz "\r\nData Memory Break\r\n" + +Str14 + .stringz "\r\nTLB Dirty Bit Trap\r\n" + +Str15 + .stringz "\r\nPage Reference Trap\r\n" + +Str16 + .stringz "\r\nAssist Emulation Trap\r\n" + +Str17 + .stringz "\r\nHigher-privilege Trap\r\n" + +Str18 + .stringz "\r\nLower-privilege Trap\r\n" + +Str19 + .stringz "\r\nTaken Branch Trap\r\n" + +Str20 + .stringz "\r\nHere I am!\r\n" + +PrintLabels +#ifdef PRINT_SPACE + .byte 10 + .stringz "sr 0 = 0x" + .byte 13 + .stringz "sr 1 = 0x" + .byte 13 + .stringz "sr 2 = 0x" + .byte 13 + .stringz " sr 3 = 0x" + .byte 12 + .stringz "\r\nsr 4 = 0x" + .byte 13 + .stringz " sr 5 = 0x" + .byte 13 + .stringz " sr 6 = 0x" + .byte 13 + .stringz " sr 7 = 0x" + .byte 13 + .stringz "\r\n\ngr 0 = 0x" +#else + .byte 10 + .stringz "gr 0 = 0x" +#endif + + .byte 13 + .stringz " gr 1 = 0x" + .byte 13 + .stringz " gr 2 = 0x" + .byte 13 + .stringz " gr 3 = 0x" + .byte 12 + .stringz "\r\ngr 4 = 0x" + .byte 13 + .stringz " gr 5 = 0x" + .byte 13 + .stringz " gr 6 = 0x" + .byte 13 + .stringz " gr 7 = 0x" + .byte 12 + .stringz "\r\ngr 8 = 0x" + .byte 13 + .stringz " gr 9 = 0x" + .byte 13 + .stringz " gr10 = 0x" + .byte 13 + .stringz " gr11 = 0x" + .byte 12 + .stringz "\r\ngr12 = 0x" + .byte 13 + .stringz " gr13 = 0x" + .byte 13 + .stringz " gr14 = 0x" + .byte 13 + .stringz " gr15 = 0x" + .byte 12 + .stringz "\r\ngr16 = 0x" + .byte 13 + .stringz " gr17 = 0x" + .byte 13 + .stringz " gr18 = 0x" + .byte 13 + .stringz " gr19 = 0x" + .byte 12 + .stringz "\r\ngr20 = 0x" + .byte 13 + .stringz " gr21 = 0x" + .byte 13 + .stringz " gr22 = 0x" + .byte 13 + .stringz " gr23 = 0x" + .byte 12 + .stringz "\r\ngr24 = 0x" + .byte 13 + .stringz " gr25 = 0x" + .byte 13 + .stringz " gr26 = 0x" + .byte 13 + .stringz " gr27 = 0x" + .byte 12 + .stringz "\r\ngr28 = 0x" + .byte 13 + .stringz " gr29 = 0x" + .byte 13 + .stringz " gr30 = 0x" + .byte 13 + .stringz " gr31 = 0x" + .byte 13 + .stringz "\r\n\nrctr = 0x" + .byte 53 + .stringz " cpu0 = 0x" + .byte 12 + .stringz "\r\npid1 = 0x" + .byte 13 + .stringz " pid2 = 0x" + .byte 13 + .stringz " ccr = 0x" + .byte 13 + .stringz " sar = 0x" + .byte 12 + .stringz "\r\npid3 = 0x" + .byte 13 + .stringz " pid4 = 0x" + .byte 13 + .stringz " iva = 0x" + .byte 13 + .stringz " eiem = 0x" + .byte 12 + .stringz "\r\nitmr = 0x" + .byte 13 + .stringz " iasq = 0x" + .byte 13 + .stringz " iaoq = 0x" + .byte 13 + .stringz " iir = 0x" + .byte 32 + .stringz "\r\n iasq = 0x" + .byte 13 + .stringz " iaoq = 0x" + .byte 12 + .stringz "\r\n isr = 0x" + .byte 13 + .stringz " ior = 0x" + .byte 13 + .stringz " ipsw = 0x" + .byte 13 + .stringz " eirr = 0x" + .byte 12 + .stringz "\r\ncr24 = 0x" + .byte 13 + .stringz " cr25 = 0x" + .byte 13 + .stringz " cr26 = 0x" + .byte 13 + .stringz " cr27 = 0x" + .byte 12 + .stringz "\r\ncr28 = 0x" + .byte 13 + .stringz " cr29 = 0x" + .byte 13 + .stringz " cr30 = 0x" + .byte 13 + .stringz " cr31 = 0x" + .byte 4 + .stringz "\r\n\n" + + .end diff --git a/libgloss/hp74x/pa_stub.c b/libgloss/hp74x/pa_stub.c new file mode 100644 index 0000000..2964921 --- /dev/null +++ b/libgloss/hp74x/pa_stub.c @@ -0,0 +1,698 @@ +/* -*-C-*- +******************************************************************************* +* +* File: pa_stub.c +* RCS: $Header$ +* Description: main routines for PA RISC monitor stub +* Author: Robert Quist +* Created: Mon Nov 1 10:00:36 1993 +* Modified: Fri Nov 12 15:14:23 1993 (Robert Quist) quist@hpfcrdq +* Language: C +* Package: N/A +* Status: Experimental (Do Not Distribute) +* +******************************************************************************* +*/ + +/**************************************************************************** + + THIS SOFTWARE IS NOT COPYRIGHTED + + HP offers the following for use in the public domain. HP makes no + warranty with regard to the software or it's performance and the + user accepts the software "AS IS" with all faults. + + HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD + TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + +****************************************************************************/ + +/**************************************************************************** + * + * Description: low level support for gdb debugger. $ + * + * Considerations: only works on target hardware $ + * + * NOTES: See Below $ + * + * To enable debugger support, two things need to happen. + * + * One, a call to set_debug_traps() is necessary in order to allow + * any breakpoints or error conditions to be properly intercepted and + * reported to gdb. + * + * Two, a breakpoint needs to be generated to begin communication. + * This is most easily accomplished by a call to breakpoint(). + * breakpoint() simulates a breakpoint + + + ************* + * + * The following gdb commands are supported: + * + * command function Return value + * + * g return the value of the CPU registers hex data or ENN + * G set the value of the CPU registers OK or ENN + * + * mAA..AA,LLLL Read LLLL bytes at address AA..AA hex data or ENN + * MAA..AA,LLLL: Write LLLL bytes at address AA.AA OK or ENN + * + * c Resume at current address SNN ( signal NN) + * cAA..AA Continue at address AA..AA SNN + * + * s Step one instruction SNN + * sAA..AA Step one instruction from AA..AA SNN + * + * k kill + * + * ? What was the last sigval ? SNN (signal NN) + * + * bBB..BB Set baud rate to BB..BB OK or BNN, then sets + * baud rate + * + + ************ + * All commands and responses are sent with a packet which includes a + * checksum. A packet consists of : + * + * $<packet info>#<checksum>. + * + * where + * <packet info> :: <characters representing the command or response> + * <checksum> :: < two hex digits computed as modulo 256 sum of <packetinfo>> + * + * When a packet is received, it is first acknowledged with either '+' or '-'. + * '+' indicates a successful transfer. '-' indicates a failed transfer. + * + * Example: + * + * Host: Reply: + * $m0,10#2a +$00010203040506070809101112131415#42 + * + ****************************************************************************/ +#include <signal.h> +#include "hppa-defs.h" + +/************************************************************************ + * + * external low-level support + */ +#define OPT_PDC_CACHE 5 +#define OPT_PDC_ADD_VALID 12 +#define PGZ_MEM_PDC 0x0388 /* location of PDC_ENTRY in memory */ +#define CALL_PDC (*(int (*)())((int *)(*((int *)PGZ_MEM_PDC)))) + +extern putDebugChar(); /* write a single character */ +extern getDebugChar(); /* read and return a single char */ +extern FICE(); /* flush i cache entry */ +extern INLINE_BREAK(); /* break for user call */ + +#define RADDR_ALIGN(s,r) (s = ((unsigned int *) ((((int) r ) + 7 ) & 0xFFFFFFF8))) + +/************************************************************************/ +/* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/ +/* at least NUMREGBYTES*2 are needed for register packets */ + +#define BUFMAX 2048 + +#define NUMGPRS 32 +#define NUMSRS 8 +#define NUMCRS 32 +#define NUMSPCLS 3 +#define NUMFPRS 32 + +#define NUMGPRBYTES 4 +#define NUMSRBYTES 4 +#define NUMCRBYTES 4 +#define NUMSPCLBYTES 4 +#define NUMFPRBYTES 8 + +/* Number of bytes of registers. */ +#define NUMREGBYTES \ + ( (NUMGPRS * NUMGPRBYTES) \ + + (NUMSRS * NUMSRBYTES) \ + + (NUMCRS * NUMCRBYTES) \ + + (NUMSPCLS * NUMSPCLBYTES) \ + + (NUMFPRS * NUMFPRBYTES) \ + ) + + +enum regnames {GR0, GR1, GR2, GR3, GR4, GR5, GR6, GR7, + GR8, GR9, GR10, GR11, GR12, GR13, GR14, GR15, + GR16, GR17, GR18, GR19, GR20, GR21, GR22, GR23, + GR24, GR25, GR26, GR27, GR28, GR29, GR30, GR31, + + SR0, SR1, SR2, SR3, SR4, SR5, SR6, SR7, + + CR0, CR1, CR2, CR3, CR4, CR5, CR6, CR7, + CR8, CR9, CR10, CR11, CR12, CR13, CR14, CR15, + CR16, CR17H,CR18H,CR19, CR20, CR21, CR22, CR23, + CR24, CR25, CR26, CR27, CR28, CR29, CR30, CR31, + + CR17T,CR18T,CPUD0 }; + +enum fregnames {FPR0, FPR1, FPR2, FPR3, FPR4, FPR5, FPR6, FPR7, + FPR8, FPR9, FPR10, FPR11, FPR12, FPR13, FPR14, FPR15, + FPR16, FPR17, FPR18, FPR19, FPR20, FPR21, FPR22, FPR23, + FPR24, FPR25, FPR26, FPR27, FPR28, FPR29, FPR30, FPR31 }; + +#define PC CR18H +#define NPC CR18T +#define SP GR30 + +struct registers { + int intregs[NUMGPRS + NUMSRS + NUMCRS + NUMSPCLS]; + int fpregs [NUMFPRS * 2]; + }; +/* Global Variables */ + +static int initialized = 0; /* !0 means we've been initialized */ +static unsigned char hexchars[]="0123456789abcdef"; +static unsigned char remcomInBuffer[BUFMAX]; +static unsigned char remcomOutBuffer[BUFMAX]; +static unsigned int i_cache_params[6]; + +/* This table contains the mapping between PA hardware exception + types, and signals, which are primarily what GDB understands. It also + indicates which hardware traps we need to commandeer when initializing + the stub. + + The only two currently used are Recovery counter (single stepping) + and Break trap ( break points ). +*/ + +static struct hard_trap_info +{ + unsigned char tt; /* Trap number for PA-RISC */ + unsigned char signo; /* Signal that we map this trap into */ +} hard_trap_info[] = { +/* 1 High priority machine check */ +/* 2 Power failure interrupt*/ +/* 3 Recovery counter -- init */ +/* 4 External interrupt */ +/* 5 Low priority machine check */ + {6, SIGSEGV}, /* Instruction TLB miss/page fault */ + {7, SIGSEGV}, /* Memory protection */ + {8, SIGILL}, /* Illegal instruction */ + {9, SIGTRAP}, /* Break instruction -- init */ + {10,SIGILL}, /* Privileged instruction */ + {11,SIGILL}, /* Privileged register */ + {12,SIGUSR1}, /* Overflow */ + {13,SIGUSR2}, /* Conditional */ + {14,SIGEMT}, /* Assist Exception */ + {15,SIGSEGV}, /* Data TLB miss/page fault */ + {16,SIGSEGV}, /* Non-access Instruction TLB miss */ + {17,SIGSEGV}, /* Non-access Data TLB miss/page fault */ + {18,SIGSEGV}, /* Data memory protection/ unaligned data reference */ + {19,SIGTRAP}, /* Data memory break */ + {20,SIGSEGV}, /* TLB dirty bit */ + {21,SIGSEGV}, /* Page reference */ + {22,SIGEMT}, /* Assist emulation */ + {23,SIGILL}, /* Higher-privilege */ + {24,SIGILL}, /* Lower-privilege */ + {25,SIGTRAP}, /* Taken branch */ + {0, 0} /* Must be last */ +}; + +/* Functions */ +/*========================================================================== */ + +/* Convert ch from a hex digit to an int */ + +static int +hex(ch) + unsigned char ch; +{ + if (ch >= 'a' && ch <= 'f') + return ch-'a'+10; + if (ch >= '0' && ch <= '9') + return ch-'0'; + if (ch >= 'A' && ch <= 'F') + return ch-'A'+10; + return -1; +} + +/* scan for the sequence $<data>#<checksum> */ + +static void +getpacket(buffer) + char *buffer; +{ + unsigned char checksum; + unsigned char xmitcsum; + int i; + int count; + unsigned char ch; + + do + { + /* wait around for the start character, ignore all other characters */ + strobe(); + while ((ch = getDebugChar()) != '$') ; + + checksum = 0; + xmitcsum = -1; + + count = 0; + + /* now, read until a # or end of buffer is found */ + while (count < BUFMAX) + { + ch = getDebugChar(); + if (ch == '#') + break; + checksum = checksum + ch; + buffer[count] = ch; + count = count + 1; + } + + if (count >= BUFMAX) + continue; + + buffer[count] = 0; + + if (ch == '#') + { + xmitcsum = hex(getDebugChar()) << 4; + xmitcsum |= hex(getDebugChar()); + +#if TESTING + /* Humans shouldn't have to figure out checksums to type to it. */ + putDebugChar ('+'); + return; +#endif + if (checksum != xmitcsum) + putDebugChar('-'); /* failed checksum */ + else + { + putDebugChar('+'); /* successful transfer */ + /* if a sequence char is present, reply the sequence ID */ + if (buffer[2] == ':') + { + putDebugChar(buffer[0]); + putDebugChar(buffer[1]); + /* remove sequence chars from buffer */ + count = strlen(buffer); + for (i=3; i <= count; i++) + buffer[i-3] = buffer[i]; + } + } + } + } + while (checksum != xmitcsum); +} + +/* send the packet in buffer. */ + +static void +putpacket(buffer) + unsigned char *buffer; +{ + unsigned char checksum; + int count; + unsigned char ch; + + /* $<packet info>#<checksum>. */ + + do + { + putDebugChar('$'); + checksum = 0; + count = 0; + + while (ch = buffer[count]) + { + if (! putDebugChar(ch)) + return; + checksum += ch; + count += 1; + } + + putDebugChar('#'); + putDebugChar(hexchars[checksum >> 4]); + putDebugChar(hexchars[checksum & 0xf]); + } while (getDebugChar() != '+'); +} + +/* Convert the memory pointed to by mem into hex, placing result in buf. + * Return a pointer to the last char put in buf (null), in case of mem fault, + * return 0. + * If MAY_FAULT is non-zero, then we will handle memory faults by returning + * a 0, else treat a fault like any other fault in the stub. + */ + +static unsigned char * +mem2hex(mem, buf, count, may_fault) + unsigned char *mem; + unsigned char *buf; + int count; + int may_fault; +{ + unsigned char ch; + int check_addr, + new_addr; + + check_addr = 0; + + while (count-- > 0) + { + if (may_fault) + { new_addr = ((int) (mem+3)) & 0xFFFFFFF8; + if (new_addr != check_addr) + { check_addr = new_addr; + if (pdc_call(OPT_PDC_ADD_VALID,0,check_addr)) return 0; + } + } + ch = *mem++; + *buf++ = hexchars[ch >> 4]; + *buf++ = hexchars[ch & 0xf]; + } + + *buf = 0; + + return buf; +} + +/* convert the hex array pointed to by buf into binary to be placed in mem + * return a pointer to the character AFTER the last byte written */ + +static unsigned char * +hex2mem(buf, mem, count, may_fault) + unsigned char *buf; + unsigned char *mem; + int count; + int may_fault; +{ + int i; + unsigned int ch; + int check_addr, + new_addr; + + check_addr = 0; + + for (i=0; i<count; i++) + { + ch = hex(*buf++) << 4; + ch |= hex(*buf++); + if (may_fault) + { new_addr = ((int)(mem+3)) & 0xFFFFFFF8; + if (new_addr != check_addr) + { check_addr = new_addr; + if (pdc_call(OPT_PDC_ADD_VALID,0,check_addr)) return 0; + } + } + *mem++ = ch; + } + + return mem; +} + +/* Set up exception handlers for traceing and breakpoints */ + +void +set_debug_traps() +{ + unsigned int R_addr[33]; + unsigned int *Raddr_ptr; + + setup_vectors(); + + /* get cache params for use by flush_i_cache */ + RADDR_ALIGN(Raddr_ptr,R_addr); + + if (pdc_call(OPT_PDC_CACHE,0,Raddr_ptr,0)) + i_cache_params[0] = -1; + else + i_cache_params[0] = R_addr[0]; + + i_cache_params[1] = Raddr_ptr[1]; + i_cache_params[2] = Raddr_ptr[2]; + i_cache_params[3] = Raddr_ptr[3]; + i_cache_params[4] = Raddr_ptr[4]; + i_cache_params[5] = Raddr_ptr[5]; + + /* In case GDB is started before us, ack any packets (presumably + "$?#xx") sitting there. */ + + putDebugChar ('+'); + + initialized = 1; +} + + +/* Convert the PA-RISC hardware trap number to a unix signal number. */ + +static int +computeSignal(tt) + int tt; +{ + struct hard_trap_info *ht; + + for (ht = hard_trap_info; ht->tt && ht->signo; ht++) + if (ht->tt == tt) + return ht->signo; + + return SIGHUP; /* default for things we don't know about */ +} + +/* + * While we find nice hex chars, build an int. + * Return number of chars processed. + */ + +static int +hexToInt(ptr, intValue) + unsigned char **ptr; + int *intValue; +{ + int numChars = 0; + int hexValue; + + *intValue = 0; + + while (**ptr) + { + hexValue = hex(**ptr); + if (hexValue < 0) + break; + + *intValue = (*intValue << 4) | hexValue; + numChars ++; + + (*ptr)++; + } + + return (numChars); +} + +void +flush_i_cache() + +{ + unsigned int addr,count,loop; + + if (i_cache_params[0] <= 0) return; + + addr = i_cache_params[2]; + for (count = 0; count < i_cache_params[4]; count++) + { for ( loop = 0; loop < i_cache_params[5]; loop++) FICE(addr); + addr = addr + i_cache_params[3]; + } +} + +/* + * This function does all command procesing for interfacing to gdb. + return of 0 will execute DEBUG_GO (continue) + return of 1 will execute DEBUG_SS (single step) + */ + +int +handle_exception (registers,tt) + unsigned long *registers; + int tt; /* Trap type */ +{ + int sigval; + int addr; + int length; + unsigned char *ptr; + + /* reply to host that an exception has occurred */ + sigval = computeSignal(tt); + ptr = remcomOutBuffer; + + *ptr++ = 'T'; + *ptr++ = hexchars[sigval >> 4]; + *ptr++ = hexchars[sigval & 0xf]; + +/* could be lots of stuff here like PC and SP registers */ + + *ptr++ = 0; + + putpacket(remcomOutBuffer); + + while (1) + { + remcomOutBuffer[0] = 0; + + getpacket(remcomInBuffer); + switch (remcomInBuffer[0]) + { + case '?': + remcomOutBuffer[0] = 'S'; + remcomOutBuffer[1] = hexchars[sigval >> 4]; + remcomOutBuffer[2] = hexchars[sigval & 0xf]; + remcomOutBuffer[3] = 0; + break; + + case 'd': + /* toggle debug flag */ + led_putnum (16); + break; + + case 'g': /* return the value of the CPU registers */ + { + ptr = remcomOutBuffer; + /* GR0..GR31 SR0..SR7 CR0..CR31 specials */ + ptr = mem2hex((char *)registers, ptr, NUMREGBYTES, 0); + /* need to add floating point registers */ + } + break; + + case 'G': /* set the value of the CPU registers - return OK */ + { + ptr = &remcomInBuffer[1]; + /* GR0..GR31 SR0..SR7 CR0..CR31 specials */ + hex2mem(ptr, (char *)registers, NUMREGBYTES, 0); + strcpy(remcomOutBuffer,"OK 1"); + } + break; + + case 'm': /* mAA..AA,LLLL Read LLLL bytes at address AA..AA */ + /* Try to read %x,%x. */ + + ptr = &remcomInBuffer[1]; + + if (hexToInt(&ptr, &addr) + && *ptr++ == ',' + && hexToInt(&ptr, &length)) + { + if (mem2hex((char *)addr, remcomOutBuffer, length, 1)) + break; + + strcpy (remcomOutBuffer, "E03"); + } + else + strcpy(remcomOutBuffer,"E01"); + break; + + case 'M': /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */ + /* Try to read '%x,%x:'. */ + + ptr = &remcomInBuffer[1]; + + if (hexToInt(&ptr, &addr) + && *ptr++ == ',' + && hexToInt(&ptr, &length) + && *ptr++ == ':') + { + if (hex2mem(ptr, (char *)addr, length, 1)) + strcpy(remcomOutBuffer, "OK"); + else + strcpy(remcomOutBuffer, "E03"); + } + else + strcpy(remcomOutBuffer, "E02"); + break; + + case 'c': /* cAA..AA Continue at address AA..AA(optional) */ + /* try to read optional parameter, pc unchanged if no parm */ + + ptr = &remcomInBuffer[1]; + if (hexToInt(&ptr, &addr)) + { + registers[PC] = addr; + registers[NPC] = addr + 4; + } + +/* Need to flush the instruction cache here, as we may have deposited a + breakpoint, and the icache probably has no way of knowing that a data ref to + some location may have changed something that is in the instruction cache. + */ + + flush_i_cache(); + return 0; /* execute GO */ + + /* kill the program */ + case 'k' : /* do nothing */ + break; + + case 's' : /* single step */ + /* try to read optional parameter, pc unchanged if no parm */ + + ptr = &remcomInBuffer[1]; + if (hexToInt(&ptr, &addr)) + { + registers[PC] = addr; + registers[NPC] = addr + 4; + } +/* Need to flush the instruction cache here, as we may have deposited a + breakpoint, and the icache probably has no way of knowing that a data ref to + some location may have changed something that is in the instruction cache. + */ + flush_i_cache(); + return 1; /* execute Single Step */ + break; + +#if TESTING1 + case 't': /* Test feature */ + break; +#endif + case 'r': /* Reset */ + break; + +#if TESTING2 +Disabled until we can unscrew this properly + + case 'b': /* bBB... Set baud rate to BB... */ + { + int baudrate; + extern void set_timer_3(); + + ptr = &remcomInBuffer[1]; + if (!hexToInt(&ptr, &baudrate)) + { + strcpy(remcomOutBuffer,"B01"); + break; + } + + /* Convert baud rate to uart clock divider */ + switch (baudrate) + { + case 38400: + baudrate = 16; + break; + case 19200: + baudrate = 33; + break; + case 9600: + baudrate = 65; + break; + default: + strcpy(remcomOutBuffer,"B02"); + goto x1; + } + + putpacket("OK 2"); /* Ack before changing speed */ + set_timer_3(baudrate); /* Set it */ + } +x1: break; +#endif + } /* switch */ + + /* reply to the request */ + putpacket(remcomOutBuffer); + } + print ("\r\nEscaped handle_exception\r\n"); +} diff --git a/libgloss/hp74x/test.c b/libgloss/hp74x/test.c new file mode 100644 index 0000000..2fd84ac --- /dev/null +++ b/libgloss/hp74x/test.c @@ -0,0 +1,47 @@ +extern int led_putnum(); +#define DELAY 900000 +extern char strobe(),putDebugChar(),print(),putnum(); +extern char foobar(); +extern char breakpoint(); + +#define TESTSTUB 1 + +main() +{ + unsigned char x; + char buf[20]; + +#if TESTIO + strobe(); + outbyte ('\n'); + outbyte ('$'); + write (2, "Enter 5 characters... ", 24); + read (0, buf, 5); + print (buf); + print ("\r\n"); + strobe (); +#endif + +#if TESTSTUB + print ("\r\nInit vectors...\r\n"); +/*** set_debug_traps(); ***/ + print ("\r\nSet a breakpoint...\r\n"); + handle_exception(); +/*** breakpoint(); ***/ +#endif + + print ("\r\nTest foobar\r\n"); + foobar(); + /* whew, we made it */ + print ("\r\nDone..."); +} + +/* + * FIXME: this is only hear so things will link. + */ +int +puts(s) + char *s; +{ + s++; +} diff --git a/libgloss/i386/Makefile.in b/libgloss/i386/Makefile.in new file mode 100644 index 0000000..d68657a --- /dev/null +++ b/libgloss/i386/Makefile.in @@ -0,0 +1,126 @@ +# Copyright (c) 1997 Cygnus Support +# +# The authors hereby grant permission to use, copy, modify, distribute, +# and license this software and its documentation for any purpose, provided +# that existing copyright notices are retained in all copies and that this +# notice is included verbatim in any distributions. No written agreement, +# license, or royalty fee is required for any of the authorized uses. +# Modifications to this software may be copyrighted by their authors +# and need not follow the licensing terms described here, provided that +# the new terms are clearly indicated on the first page of each file where +# they apply. + +VPATH = @srcdir@ +srcdir = @srcdir@ +objdir = . +srcroot = $(srcdir)/../.. +objroot = $(objdir)/../.. + +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +host_alias = @host_alias@ +target_alias = @target_alias@ +program_transform_name = @program_transform_name@ + +bindir = @bindir@ +libdir = @libdir@ +tooldir = $(exec_prefix)/$(target_alias) + +# Multilib support variables. +# TOP is used instead of MULTI{BUILD,SRC}TOP. +MULTIDIRS = +MULTISUBDIR = +MULTIDO = true +MULTICLEAN = true + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ + +SHELL = /bin/sh + +CC = @CC@ + +#AS = @AS@ +AS = `if [ -f ${objroot}/../gas/as.new ] ; \ + then echo ${objroot}/../gas/as.new ; \ + else echo as ; fi` + +AR = @AR@ + +#LD = @LD@ +LD = `if [ -f ${objroot}/../ld/ld.new ] ; \ + then echo ${objroot}/../ld/ld.new ; \ + else echo ld ; fi` + +RANLIB = @RANLIB@ + +OBJDUMP = `if [ -f ${objroot}/../binutils/objdump ] ; \ + then echo ${objroot}/../binutils/objdump ; \ + else t='$(program_transform_name)'; echo objdump | sed -e $$t ; fi` +OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \ + then echo ${objroot}/../binutils/objcopy ; \ + else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi` + +CRT0 = cygmon-crt0.o +CYGMON_OBJS = cygmon-salib.o cygmon-gmon.o + +CFLAGS = -g + +GCC_LDFLAGS = `if [ -d ${objroot}/../gcc ] ; \ + then echo -L${objroot}/../gcc ; fi` + +SCRIPTS = cygmon +BSP = libcygmon.a + +# Host specific makefile fragment comes in here. +@host_makefile_frag@ + +all: ${CRT0} ${BSP} + +# +# here's where we build the board support packages for each target +# +libcygmon.a: $(CYGMON_OBJS) + ${AR} ${ARFLAGS} $@ $(CYGMON_OBJS) + ${RANLIB} $@ + +cygmon-salib.o: ${srcdir}/cygmon-salib.c + $(CC) -c $(CFLAGS) @NEED_UNDERSCORE@ @IS_COFF@ $(<) -o $@ + +cygmon-crt0.o: ${srcdir}/cygmon-crt0.S + $(CC) -c $(CFLAGS) @NEED_UNDERSCORE@ @IS_COFF@ $(<) -o $@ + +doc: + +clean mostlyclean: + rm -f a.out core *.i *~ *.o *-test *.srec *.dis *.map *.x + +distclean maintainer-clean realclean: clean + rm -f Makefile config.status a.out + +.PHONY: install info install-info clean-info +install: + $(INSTALL_PROGRAM) $(CRT0) $(tooldir)/lib${MULTISUBDIR}/$(CRT0) + @for bsp in ${BSP}; do\ + $(INSTALL_PROGRAM) $${bsp} $(tooldir)/lib${MULTISUBDIR}; \ + done + @for script in ${SCRIPTS}; do\ + $(INSTALL_DATA) ${srcdir}/$${script}.ld $(tooldir)/lib${MULTISUBDIR}/$${script}.ld; \ + done + +info: +install-info: +clean-info: + +test.o: ${srcdir}/test.c + +# these are for the BSPs +${CRT0}: cygmon-crt0.S + +Makefile: Makefile.in config.status @host_makefile_frag_path@ + $(SHELL) config.status + +config.status: configure + $(SHELL) config.status --recheck diff --git a/libgloss/i386/configure b/libgloss/i386/configure new file mode 100755 index 0000000..d0e35b2 --- /dev/null +++ b/libgloss/i386/configure @@ -0,0 +1,1203 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.12.1 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.12.1" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=cygmon-salib.c + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + +if test "${enable_shared}" = "yes" ; then + echo "Shared libraries not supported for cross compiling, ignored" +fi + +if test "$srcdir" = "." ; then + if test "${with_target_subdir}" != "." ; then + libgloss_topdir="${srcdir}/${with_multisrctop}../../.." + else + libgloss_topdir="${srcdir}/${with_multisrctop}../.." + fi +else + libgloss_topdir="${srcdir}/../.." +fi +ac_aux_dir= +for ac_dir in $libgloss_topdir $srcdir/$libgloss_topdir; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $libgloss_topdir $srcdir/$libgloss_topdir" 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + + + +# Do some error checking and defaulting for the host and target type. +# The inputs are: +# configure --host=HOST --target=TARGET --build=BUILD NONOPT +# +# The rules are: +# 1. You are not allowed to specify --host, --target, and nonopt at the +# same time. +# 2. Host defaults to nonopt. +# 3. If nonopt is not specified, then host defaults to the current host, +# as determined by config.guess. +# 4. Target and build default to nonopt. +# 5. If nonopt is not specified, then target and build default to host. + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +case $host---$target---$nonopt in +NONE---*---* | *---NONE---* | *---*---NONE) ;; +*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;; +esac + + +# Make sure we can run config.sub. +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi + +echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:585: checking host system type" >&5 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + +echo $ac_n "checking target system type""... $ac_c" 1>&6 +echo "configure:606: checking target system type" >&5 + +target_alias=$target +case "$target_alias" in +NONE) + case $nonopt in + NONE) target_alias=$host_alias ;; + *) target_alias=$nonopt ;; + esac ;; +esac + +target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias` +target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$target" 1>&6 + +echo $ac_n "checking build system type""... $ac_c" 1>&6 +echo "configure:624: checking build system type" >&5 + +build_alias=$build +case "$build_alias" in +NONE) + case $nonopt in + NONE) build_alias=$host_alias ;; + *) build_alias=$nonopt ;; + esac ;; +esac + +build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` +build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$build" 1>&6 + +test "$host_alias" != "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + +if test "$program_transform_name" = s,x,x,; then + program_transform_name= +else + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed +s,\\,\\\\,g; s,\$,$$,g +EOF_SED + program_transform_name="`echo $program_transform_name|sed -f conftestsed`" + rm -f conftestsed +fi +test "$program_prefix" != NONE && + program_transform_name="s,^,${program_prefix},; $program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" + +# sed with no file args requires a program. +test "$program_transform_name" = "" && program_transform_name="s,x,x," + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:678: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +# FIXME: We temporarily define our own version of AC_PROG_CC. This is +# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We +# are building a library that must be included in all links, so we +# can't link an executable until this lib is built. +# autoconf should provide a way to do this. + + +case "$target" in + *coff) + IS_COFF="-DCOFF" + ;; +esac + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:746: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:775: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + ac_prog_rejected=no + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +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 $# -gt 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 + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:823: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <<EOF +#ifdef __GNUC__ + yes; +#endif +EOF +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:832: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:847: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi + +AS=${AS-as} + +AR=${AR-ar} + +LD=${LD-ld} + + + +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:885: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +host_makefile_frag=${srcdir}/../config/default.mh + +host_makefile_frag_path=$host_makefile_frag + + + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs + + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS <<EOF +#! /bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.12.1" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS <<EOF + +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; + s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@host@%$host%g +s%@host_alias@%$host_alias%g +s%@host_cpu@%$host_cpu%g +s%@host_vendor@%$host_vendor%g +s%@host_os@%$host_os%g +s%@target@%$target%g +s%@target_alias@%$target_alias%g +s%@target_cpu@%$target_cpu%g +s%@target_vendor@%$target_vendor%g +s%@target_os@%$target_os%g +s%@build@%$build%g +s%@build_alias@%$build_alias%g +s%@build_cpu@%$build_cpu%g +s%@build_vendor@%$build_vendor%g +s%@build_os@%$build_os%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@CC@%$CC%g +s%@AS@%$AS%g +s%@AR@%$AR%g +s%@LD@%$LD%g +s%@IS_COFF@%$IS_COFF%g +s%@NEED_UNDERSCORE@%$NEED_UNDERSCORE%g +s%@RANLIB@%$RANLIB%g +s%@host_makefile_frag_path@%$host_makefile_frag_path%g +/@host_makefile_frag@/r $host_makefile_frag +s%@host_makefile_frag@%%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <<EOF + +CONFIG_FILES=\${CONFIG_FILES-"Makefile"} +EOF +cat >> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +EOF +cat >> $CONFIG_STATUS <<EOF +srcdir=${srcdir} +target=${target} +ac_configure_args="${ac_configure_args} --enable-multilib" +CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} +libgloss_topdir=${libgloss_topdir} + +EOF +cat >> $CONFIG_STATUS <<\EOF +. ${libgloss_topdir}/config-ml.in +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + diff --git a/libgloss/i386/configure.in b/libgloss/i386/configure.in new file mode 100644 index 0000000..fe9224c --- /dev/null +++ b/libgloss/i386/configure.in @@ -0,0 +1,110 @@ +# Copyright (c) 1995, 1996 Cygnus Support +# +# The authors hereby grant permission to use, copy, modify, distribute, +# and license this software and its documentation for any purpose, provided +# that existing copyright notices are retained in all copies and that this +# notice is included verbatim in any distributions. No written agreement, +# license, or royalty fee is required for any of the authorized uses. +# Modifications to this software may be copyrighted by their authors +# and need not follow the licensing terms described here, provided that +# the new terms are clearly indicated on the first page of each file where +# they apply. +# +# Process this file with autoconf to produce a configure script. +# +AC_PREREQ(2.5)dnl +AC_INIT(cygmon-salib.c) + +if test "${enable_shared}" = "yes" ; then + echo "Shared libraries not supported for cross compiling, ignored" +fi + +if test "$srcdir" = "." ; then + if test "${with_target_subdir}" != "." ; then + libgloss_topdir="${srcdir}/${with_multisrctop}../../.." + else + libgloss_topdir="${srcdir}/${with_multisrctop}../.." + fi +else + libgloss_topdir="${srcdir}/../.." +fi +AC_CONFIG_AUX_DIR($libgloss_topdir) + +AC_CANONICAL_SYSTEM +AC_ARG_PROGRAM + +AC_PROG_INSTALL + +# FIXME: We temporarily define our own version of AC_PROG_CC. This is +# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We +# are building a library that must be included in all links, so we +# can't link an executable until this lib is built. +# autoconf should provide a way to do this. + +AC_DEFUN(LIB_AC_PROG_CC, +[AC_BEFORE([$0], [AC_PROG_CPP])dnl +AC_CHECK_PROG(CC, gcc, gcc) +if test -z "$CC"; then + AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) + test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) +fi + +AC_PROG_CC_GNU + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +dnl Check whether -g works, even if CFLAGS is set, in case the package +dnl plays around with CFLAGS (such as to build both debugging and +dnl normal versions of a library), tasteless as that idea is. + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + AC_PROG_CC_G + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi +]) + +case "$target" in + *coff) + IS_COFF="-DCOFF" + ;; +esac + +LIB_AC_PROG_CC +AS=${AS-as} +AC_SUBST(AS) +AR=${AR-ar} +AC_SUBST(AR) +LD=${LD-ld} +AC_SUBST(LD) +AC_SUBST(IS_COFF) +AC_SUBST(NEED_UNDERSCORE) +AC_PROG_RANLIB + +host_makefile_frag=${srcdir}/../config/default.mh + +dnl We have to assign the same value to other variables because autoconf +dnl doesn't provide a mechanism to substitute a replacement keyword with +dnl arbitrary data or pathnames. +dnl +host_makefile_frag_path=$host_makefile_frag +AC_SUBST(host_makefile_frag_path) +AC_SUBST_FILE(host_makefile_frag) + +AC_OUTPUT(Makefile, +. ${libgloss_topdir}/config-ml.in, +srcdir=${srcdir} +target=${target} +ac_configure_args="${ac_configure_args} --enable-multilib" +CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} +libgloss_topdir=${libgloss_topdir} +) diff --git a/libgloss/i386/cygmon-crt0.S b/libgloss/i386/cygmon-crt0.S new file mode 100644 index 0000000..9be0209 --- /dev/null +++ b/libgloss/i386/cygmon-crt0.S @@ -0,0 +1,82 @@ +/* + * crt0 startup code for user programs running under Cygmon + * + * Copyright (c) 1998 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#ifndef NEED_UNDERSCORE +#define SYM(X) X +#else +#define SYM(X) _ ## X +#endif + +.data + .align 8 +SYM(environ): + .long 0 + +SYM(argc): + .long 0 + + .text + .align 4 + + .globl SYM(_start) +SYM(_start): + /* see if the stack is already setup. if not, then default + * to using the value of %sp as set by the ROM monitor + */ + lea __stack,%eax + cmpl $0,%eax + jz 1f + mov %eax, %esp +1: + mov $0, %ebp + + lea __bss_start, %eax +2: + movb $0,(%eax) + inc %eax + cmp $__bss_end,%eax + jl 2b + +2: + pushl $SYM(__sigtramp) + pushl $0 + call SYM(__install_signal_handler) + add $4, %esp + + pushl $SYM(__do_global_dtors) + call SYM(atexit) + add $4, %esp + + call SYM(__do_global_ctors) + + pushl $SYM(argc) + call SYM(__get_program_arguments) + add $4, %esp + + pushl %eax + lea SYM(argc), %ebx + pushl (%ebx) + call SYM(main) + add $8, %esp + + /* call exit from the C library so atexit gets called, and the + * C++ destructors get run. This calls our exit routine below + * when it's done. + */ + pushl %eax + call SYM(exit) +3: + jmp 3b diff --git a/libgloss/i386/cygmon-gmon.c b/libgloss/i386/cygmon-gmon.c new file mode 100644 index 0000000..30b1147 --- /dev/null +++ b/libgloss/i386/cygmon-gmon.c @@ -0,0 +1,362 @@ +/*- + * Copyright (c) 1991 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * This is a modified gmon.c by J.W.Hawtin <oolon@ankh.org>, + * 14/8/96 based on the original gmon.c in GCC and the hacked version + * solaris 2 sparc version (config/sparc/gmon-sol.c) by Mark Eichin. To do + * process profiling on solaris 2.X X86 + * + * It must be used in conjunction with sol2-gc1.asm, which is used to start + * and stop process monitoring. + * + * Differences. + * + * On Solaris 2 _mcount is called by library functions not mcount, so support + * has been added for both. + * + * Also the prototype for profil() is different + * + * Solaris 2 does not seem to have char *minbrk which allows the setting of + * the minimum SBRK region so this code has been removed and lets pray malloc + * does not mess it up. + * + * Notes + * + * This code could easily be integrated with the original gmon.c and perhaps + * should be. + */ + +#ifndef lint +static char sccsid[] = "@(#)gmon.c 5.3 (Berkeley) 5/22/91"; +#endif /* not lint */ + +#define DEBUG +#ifdef DEBUG +#include <stdio.h> +#endif + +#include "cygmon-gmon.h" + +/* + * froms is actually a bunch of unsigned shorts indexing tos + */ +static int profiling = 3; +static unsigned short *froms; +static struct tostruct *tos = 0; +static long tolimit = 0; +static char *s_lowpc = 0; +static char *s_highpc = 0; +static unsigned long s_textsize = 0; + +static int ssiz; +static char *sbuf; +static int s_scale; + /* see profil(2) where this is describe (incorrectly) */ +#define SCALE_1_TO_1 0x10000L + +#define MSG "No space for profiling buffer(s)\n" + +extern int errno; + +int +monstartup(lowpc, highpc) + char *lowpc; + char *highpc; +{ + int monsize; + char *buffer; + register int o; + + /* + * round lowpc and highpc to multiples of the density we're using + * so the rest of the scaling (here and in gprof) stays in ints. + */ + lowpc = (char *) + ROUNDDOWN((unsigned)lowpc, HISTFRACTION*sizeof(HISTCOUNTER)); + s_lowpc = lowpc; + highpc = (char *) + ROUNDUP((unsigned)highpc, HISTFRACTION*sizeof(HISTCOUNTER)); + s_highpc = highpc; + s_textsize = highpc - lowpc; + monsize = (s_textsize / HISTFRACTION) + sizeof(struct phdr); + buffer = (char *) sbrk (monsize); + if (buffer == (char *) -1) + { + write (2, MSG , sizeof(MSG)); + return; + } + bzero (buffer, monsize); + froms = (unsigned short *) sbrk (s_textsize / HASHFRACTION); + if (froms == (unsigned short *) -1) + { + write(2, MSG, sizeof(MSG)); + froms = 0; + return; + } + bzero (froms, s_textsize / HASHFRACTION); + tolimit = s_textsize * ARCDENSITY / 100; + if (tolimit < MINARCS) + { + tolimit = MINARCS; + } + else + { + if (tolimit > 65534) + { + tolimit = 65534; + } + } + tos = (struct tostruct *) sbrk( tolimit * sizeof( struct tostruct ) ); + if (tos == (struct tostruct *) -1) + { + write (2, MSG, sizeof(MSG)); + froms = 0; + tos = 0; + return; + } + bzero (tos, tolimit * sizeof( struct tostruct ) ); + tos[0].link = 0; + sbuf = buffer; + ssiz = monsize; + ( (struct phdr *) buffer ) -> lpc = lowpc; + ( (struct phdr *) buffer ) -> hpc = highpc; + ( (struct phdr *) buffer ) -> ncnt = ssiz; + monsize -= sizeof(struct phdr); + if ( monsize <= 0 ) + return; + o = highpc - lowpc; + if (monsize < o) + { + s_scale = ( (float) monsize / o ) * SCALE_1_TO_1; + } + else + s_scale = SCALE_1_TO_1; + moncontrol (1); +} + +void +_mcleanup() +{ + int fd; + int fromindex; + int endfrom; + char *frompc; + int toindex; + struct rawarc rawarc; + + moncontrol (0); + profil_write (1, sbuf, ssiz); + + endfrom = s_textsize / (HASHFRACTION * sizeof(*froms)); + for ( fromindex = 0 ; fromindex < endfrom ; fromindex++ ) + { + if ( froms[fromindex] == 0 ) + { + continue; + } + frompc = s_lowpc + (fromindex * HASHFRACTION * sizeof(*froms)); + for (toindex=froms[fromindex]; toindex!=0; toindex=tos[toindex].link) + { + rawarc.raw_frompc = (unsigned long) frompc; + rawarc.raw_selfpc = (unsigned long) tos[toindex].selfpc; + rawarc.raw_count = tos[toindex].count; + profil_write (2, &rawarc, sizeof (rawarc)); + } + } + profil_write (3, 0, 0); +} + +static char already_setup = 0; + +_mcount() +{ + register char *selfpc; + register unsigned short *frompcindex; + register struct tostruct *top; + register struct tostruct *prevtop; + register long toindex; + + /* + * find the return address for mcount, + * and the return address for mcount's caller. + */ + + /* selfpc = pc pushed by mcount call. + This identifies the function that was just entered. */ + selfpc = (void *) __builtin_return_address (0); + /* frompcindex = pc in preceding frame. + This identifies the caller of the function just entered. */ + frompcindex = (void *) __builtin_return_address (1); + + if (! already_setup) + { + extern etext(); + extern _ftext(); + already_setup = 1; + monstartup(_ftext, etext); + atexit(_mcleanup); + } + /* + * check that we are profiling + * and that we aren't recursively invoked. + */ + if (profiling) + { + goto out; + } + profiling++; + /* + * check that frompcindex is a reasonable pc value. + * for example: signal catchers get called from the stack, + * not from text space. too bad. + */ + frompcindex = (unsigned short *)((long)frompcindex - (long)s_lowpc); + if ((unsigned long)frompcindex > s_textsize) + { + goto done; + } + frompcindex = + &froms[((long)frompcindex) / (HASHFRACTION * sizeof(*froms))]; + toindex = *frompcindex; + if (toindex == 0) + { + /* + * first time traversing this arc + */ + toindex = ++tos[0].link; + if (toindex >= tolimit) + { + goto overflow; + } + *frompcindex = toindex; + top = &tos[toindex]; + top->selfpc = selfpc; + top->count = 1; + top->link = 0; + goto done; + } + top = &tos[toindex]; + if (top->selfpc == selfpc) + { + /* + * arc at front of chain; usual case. + */ + top->count++; + goto done; + } + /* + * have to go looking down chain for it. + * top points to what we are looking at, + * prevtop points to previous top. + * we know it is not at the head of the chain. + */ + for (; /* goto done */; ) + { + if (top->link == 0) + { + /* + * top is end of the chain and none of the chain + * had top->selfpc == selfpc. + * so we allocate a new tostruct + * and link it to the head of the chain. + */ + toindex = ++tos[0].link; + if (toindex >= tolimit) + { + goto overflow; + } + top = &tos[toindex]; + top->selfpc = selfpc; + top->count = 1; + top->link = *frompcindex; + *frompcindex = toindex; + goto done; + } + /* + * otherwise, check the next arc on the chain. + */ + prevtop = top; + top = &tos[top->link]; + if (top->selfpc == selfpc) + { + /* + * there it is. + * increment its count + * move it to the head of the chain. + */ + top->count++; + toindex = prevtop->link; + prevtop->link = top->link; + top->link = *frompcindex; + *frompcindex = toindex; + goto done; + } + } +done: + profiling--; + /* and fall through */ +out: + return; /* normal return restores saved registers */ + +overflow: + profiling++; /* halt further profiling */ +# define TOLIMIT "mcount: tos overflow\n" + write (2, TOLIMIT, sizeof(TOLIMIT)); + goto out; +} + +/* + * Control profiling + * profiling is what mcount checks to see if + * all the data structures are ready. + */ +moncontrol(mode) + int mode; +{ + if (mode) + { + /* start */ + profil((unsigned short *)(sbuf + sizeof(struct phdr)), + ssiz - sizeof(struct phdr), + (int)s_lowpc, s_scale); + + profiling = 0; + } + else + { + /* stop */ + profil((unsigned short *)0, 0, 0, 0); + profiling = 3; + } +} diff --git a/libgloss/i386/cygmon-gmon.h b/libgloss/i386/cygmon-gmon.h new file mode 100644 index 0000000..f35ae33 --- /dev/null +++ b/libgloss/i386/cygmon-gmon.h @@ -0,0 +1,35 @@ +#ifndef GMON_CYGMON_H +#define GMON_CYGMON_H + +struct phdr +{ + char *lpc; + char *hpc; + int ncnt; +}; + + +#define HISTFRACTION 2 +#define HISTCOUNTER unsigned short +#define HASHFRACTION 1 +#define ARCDENSITY 2 +#define MINARCS 50 + +struct tostruct +{ + char *selfpc; + long count; + unsigned short link; +}; + +struct rawarc +{ + unsigned long raw_frompc; + unsigned long raw_selfpc; + long raw_count; +}; + +#define ROUNDDOWN(x,y) (((x)/(y))*(y)) +#define ROUNDUP(x,y) ((((x)+(y)-1)/(y))*(y)) + +#endif diff --git a/libgloss/i386/cygmon-salib.c b/libgloss/i386/cygmon-salib.c new file mode 100644 index 0000000..e0d5e72 --- /dev/null +++ b/libgloss/i386/cygmon-salib.c @@ -0,0 +1,165 @@ +/* + * Standard x86 syscalls for user programs running under Cygmon + * + * Copyright (c) 1998 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#include <fcntl.h> +#include <stdlib.h> +#include "cygmon-syscall.h" +#include <sys/time.h> + +extern int errno; + +_syscall3(int,write,int,i,char *,c,int,len); + +_syscall3(int,read,int,i,char *,c,int,len); + +_syscall2(int,kill,int,pid,int,signal); + +_syscall2(void,__install_signal_handler,int,arg,void *,handler); +_syscall1(char **,__get_program_arguments,int *,argc); + +_syscall1(void,__sys_exit,int,exitcode); +_syscall1(void,putTtyChar,int,character); +_syscall1(time_t,time,time_t *,ptr); +_syscall2(int, gettimeofday, struct timeval *,time, struct timezone *,z); +_syscall3(int, __open, const char *, filename, int, mode, int, filemode); +_syscall4(void, profil, unsigned short *, buff, unsigned int, bufsiz, + unsigned int, offset, unsigned int, scale); +_syscall1(int, close, int, fd); + +/* Bleah. */ +int +open (const char *filename, int mode, ...) +{ + return __open (filename, mode, 0644); +} + +/* Ultra-super cheezy. */ +int +isatty (int i) +{ + return i<3; +} + +char * +sbrk (int amt) +{ + extern char _end; + static char *ptr = 0; + char *res; + if (ptr == 0) + ptr = &_end; + if (amt == 0) + return (char *)ptr; + + if (((long)ptr) % 8) + ptr = ptr + (8 - (((long)(ptr)) % 8)); + res = ptr; + ptr += amt; + return (char *)res; +} + +void +_exit(int i) +{ + while(1) { + __sys_exit (i); + asm(" int $3"); + } +} + +int +fstat(int des, struct stat *buf) +{ + return -1; +} + +int +lseek(int des,unsigned long offset, int whence) +{ + return -1; +} + +int +getpid () +{ + return -1; +} + +/* Simple replacement for the clock() syscall. */ +clock_t +clock () +{ + struct timeval t; + + gettimeofday (&t, 0); + return t.tv_sec * 1000 + (t.tv_usec / 1000); +} + +#ifndef COFF +typedef void (*ctp)(); +void +__do_global_ctors () +{ + extern int __CTOR_LIST__; + int *c = &__CTOR_LIST__; + c++; + while (*c) + { + ctp d = (ctp)*c; + (d)(); + c++; + } +} + +void +__do_global_dtors () +{ + extern int __DTOR_LIST__; + int *c = &__DTOR_LIST__; + int *cp = c; + c++; + while (*c) + { + c++; + } + c--; + while (c > cp) + { + ctp d = (ctp)*c; + (*d)(); + c--; + } +} +#endif + +void +profil_write (int type, char *buffer, int len) +{ + static int des = -1; + + if (des < 0) + { + des = open ("gmon.out", O_WRONLY | O_CREAT | O_TRUNC, 0644); + } + if (len == 0) + { + close (des); + } + else + { + write (des, buffer, len); + } +} diff --git a/libgloss/i386/cygmon-syscall.h b/libgloss/i386/cygmon-syscall.h new file mode 100644 index 0000000..3b058d9 --- /dev/null +++ b/libgloss/i386/cygmon-syscall.h @@ -0,0 +1,96 @@ +/* + * Standard x86 syscalls for user programs running under Cygmon + * + * Copyright (c) 1998 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#ifndef CYGMON_SYSCALL_H +#define CYGMON_SYSCALL_H + +#define __MAX_ERRNO 4096 + +#define _syscall0(type,name) \ +type name(void) \ +{ \ +long __res; \ +__asm__ __volatile__ ("int $0x80" \ + : "=a" (__res) \ + : "0" (SYS_##name)); \ + return (type) __res; \ +} + +#define _syscall1(type,name,atype,a) \ +type name(atype a) \ +{ \ +long __res, dummy; \ +__asm__ __volatile__ ("int $0x80" \ + : "=a" (__res), "=&b" (dummy) \ + : "0" (SYS_##name),"1" ((long)(a))); \ + return (type) __res; \ +} + +#define _syscall2(type,name,atype,a,btype,b) \ +type name(atype a,btype b) \ +{ \ +long __res, dummy; \ +__asm__ __volatile__ ("int $0x80" \ + : "=a" (__res), "=&b" (dummy) \ + : "0" (SYS_##name),"1" ((long)(a)),"c" ((long)(b))); \ + return (type) __res; \ +} + +#define _syscall3(type,name,atype,a,btype,b,ctype,c) \ +type name(atype a,btype b,ctype c) \ +{ \ +long __res, dummy; \ +__asm__ __volatile__ ("int $0x80" \ + : "=a" (__res), "=&b" (dummy) \ + : "0" (SYS_##name),"1" ((long)(a)),"c" ((long)(b)),"d" ((long)(c))); \ + return (type) __res; \ +} + +#define _syscall4(type,name,atype,a,btype,b,ctype,c,dtype,d) \ +type name (atype a, btype b, ctype c, dtype d) \ +{ \ +long __res; \ +__asm__ __volatile__ ("int $0x80" \ + : "=a" (__res) \ + : "0" (SYS_##name),"b" ((long)(a)),"c" ((long)(b)), \ + "d" ((long)(c)),"S" ((long)(d))); \ + return (type) __res; \ +} + +#define _syscall5(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e) \ +type name (atype a,btype b,ctype c,dtype d,etype e) \ +{ \ +long __res; \ +__asm__ __volatile__ ("int $0x80" \ + : "=a" (__res) \ + : "0" (SYS_##name),"b" ((long)(a)),"c" ((long)(b)), \ + "d" ((long)(c)),"S" ((long)(d)),"D" ((long)(e))); \ + return (type) __res; \ +} + +#define SYS_putTtyChar 2 +#define SYS___sys_exit 1 +#define SYS_read 3 +#define SYS_write 4 +#define SYS___open 5 +#define SYS_close 6 +#define SYS_kill 37 +#define SYS_time 13 +#define SYS_gettimeofday 156 +#define SYS___install_signal_handler 48 +#define SYS_profil 98 +#define SYS___get_program_arguments 184 +#endif /* SYSCALL_H */ diff --git a/libgloss/i386/cygmon.ld b/libgloss/i386/cygmon.ld new file mode 100644 index 0000000..03bbb60 --- /dev/null +++ b/libgloss/i386/cygmon.ld @@ -0,0 +1,88 @@ +STARTUP(cygmon-crt0.o) +ENTRY(_start) +GROUP(-lcygmon -lc -lcygmon -lgcc) +SEARCH_DIR(.) +__DYNAMIC = 0; + +/* + * Allocate the stack to be at the top of memory, since the stack + * grows down + */ +PROVIDE (__stack = 0x500000); + +/* + * Initalize some symbols to be zero so we can reference them in the + * crt0 without core dumping. These functions are all optional, but + * we do this so we can have our crt0 always use them if they exist. + * This is so BSPs work better when using the crt0 installed with gcc. + * We have to initalize them twice, so we multiple object file + * formats, as some prepend an underscore. + */ +PROVIDE (hardware_init_hook = 0); +PROVIDE (software_init_hook = 0); +PROVIDE (__mem_start = 0x100000); +PROVIDE (___mem_start = 0x100000); +SECTIONS +{ + . = 0x100000; + .text : { + _ftext = . ; + *(.init) + eprol = .; + *(.text) + PROVIDE (__runtime_reloc_start = .); + *(.rel.sdata) + PROVIDE (__runtime_reloc_stop = .); + *(.fini) + __CTOR_LIST__ = .; + CONSTRUCTORS + LONG(-1) + *(.ctors) + LONG(0) + __CTOR_END__ = .; + __DTOR_LIST__ = .; + LONG(-1) + *(.dtors) + LONG(0) + __DTOR_END__ = .; + etext = .; + _etext = .; + } + . = .; + .rdata : { + *(.rdata) + } + _fdata = ALIGN(16); + .data : { + *(.data) + } + . = ALIGN(8); + _gp = . + 0x8000; + __global = . + 0x8000; + .lit8 : { + *(.lit8) + } + .lit4 : { + *(.lit4) + } + .sdata : { + *(.sdata) + } + . = ALIGN(4); + edata = .; + _edata = .; + fbss = .; + _fbss = .; + .sbss : { + *(.sbss) + *(.scommon) + } + .bss : { + __bss_start = . ; + *(.bss) + *(COMMON) + __bss_end = . ; + } + end = .; + _end = .; +} diff --git a/libgloss/i960/Makefile.in b/libgloss/i960/Makefile.in new file mode 100644 index 0000000..5b483dc --- /dev/null +++ b/libgloss/i960/Makefile.in @@ -0,0 +1,142 @@ +# +# + +VPATH = @srcdir@ @srcdir@/.. +srcdir = @srcdir@ +objdir = . +srcroot = $(srcdir)/../.. +objroot = $(objdir)/../.. + +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +host_alias = @host_alias@ +target_alias = @target_alias@ + +bindir = @bindir@ +libdir = @libdir@ +tooldir = $(exec_prefix)/$(target_alias) + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ + +# Multilib support variables. +# TOP is used instead of MULTI{BUILD,SRC}TOP. +MULTIDIRS = +MULTISUBDIR = + +SHELL = /bin/sh + +CC = @CC@ + +AS = @AS@ +AR = @AR@ +LD = @LD@ +RANLIB = @RANLIB@ + +OBJDUMP = `if [ -f ${objroot}/../binutils/objdump ] ; \ + then echo ${objroot}/../binutils/objdump ; \ + else t='$(program_transform_name)'; echo objdump | sed -e $$t ; fi` +OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \ + then echo ${objroot}/../binutils/objcopy ; \ + else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi` + +OBJS = putnum.o unlink.o +CFLAGS = -g +SCRIPTS = + +# Here is all of the simulator stuff +SIM_SCRIPTS = +SIM_LDFLAGS = +SIM_BSP = libsim.a +SIM_CRT0 = sim-crt0.o +SIM_OBJS = sim-print.o sim-inbyte.o sim-sbrk.o sim-abort.o sim-errno.o simulator.o +SIM_TEST = sim-test +SIM_INSTALL = install-sim + +# Here is all of the mon960 stuff +MON_LDFLAGS = +MON_BSP = libmon960.a +MON_CRT0 = crt0.o +MON_OBJS = mon-read.o mon-write.o mon-syscalls.o mon960.o +MON_SCRIPTS = mon960.ld +MON_TEST = +MON_INSTALL = install-mon + +# Host specific makefile fragment comes in here. +@host_makefile_frag@ + +# +# 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. +# +all: ${MON_CRT0} ${MON_BSP} + +# +# here's where we build the board support packages for each target +# +${SIM_BSP}: ${OBJS} ${SIM_OBJS} + ${AR} ${ARFLAGS} ${SIM_BSP} ${SIM_OBJS} ${OBJS} + ${RANLIB} ${SIM_BSP} + +${MON_BSP}: ${OBJS} ${MON_OBJS} + ${AR} ${ARFLAGS} ${MON_BSP} ${MON_OBJS} ${OBJS} + ${RANLIB} ${MON_BSP} + +# +# here's where we build the test programs for each target +# +.PHONY: test +test: ${SIM_TEST} ${MVME_TEST} ${EVM_TEST} + +sim-test: sim-test.x sim-test.dis + +sim-test.x: test.o ${SIM_CRT0} ${SIM_BSP} + ${CC} ${LDFLAGS_FOR_TARGET} -L${objdir} \ + ${SIM_CRT0} test.o \ + -o sim-test.x ${LIBS_FOR_TARGET} -lc ${SIM_BSP} + +sim-test.dis: sim-test.x + ${OBJDUMP} -d sim-test.x > sim-test.dis + + +# +# +# +.c.S: + ${CC} ${CFLAGS_FOR_TARGET} -c $< + +simulator.o: simulator.S +sim-crt0.o: sim-crt0.S +mvme-crt0.o: mvme-crt0.S +mvme-exit.o: mvme-exit.S +mvme-inbyte.o: mvme-inbyte.S +mvme-outbyte.o: mvme-outbyte.S + +clean mostlyclean: + rm -f a.out core *.i *.o *-test *.srec *.dis *.x + +distclean maintainer-clean realclean: clean + rm -f Makefile config.status *~ + +.PHONY: install info install-info clean-info +install: ${MON_INSTALL} + +install-mon: + set -e; for x in ${MON_CRT0} ${MON_BSP}; do ${INSTALL_DATA} $$x ${tooldir}/lib${MULTISUBDIR}/$$x; done + set -e; for x in ${MON_SCRIPTS}; do ${INSTALL_DATA} ${srcdir}/$$x ${tooldir}/lib${MULTISUBDIR}/$$x; done + +install-sim: + set -e; for x in ${SIM_CRT0} ${SIM_BSP} ${SIM_SCRIPTS}; do ${INSTALL_DATA} $$x ${tooldir}/lib/$$x; done + +doc: +info: +install-info: +clean-info: + +Makefile: Makefile.in config.status @host_makefile_frag_path@ + $(SHELL) config.status + +config.status: configure + $(SHELL) config.status --recheck diff --git a/libgloss/i960/asm.h b/libgloss/i960/asm.h new file mode 100644 index 0000000..9595697 --- /dev/null +++ b/libgloss/i960/asm.h @@ -0,0 +1,17 @@ +#ifndef ASM_H +#define ASM_H + +#ifdef __STDC__ +# define _C_LABEL(x) _ ## x +#else +# define _C_LABEL(x) _/**/x +#endif +#define _ASM_LABEL(x) x + +#define _ENTRY(name) \ + .text; .align 4; .globl name; name: + +#define ENTRY(name) \ + _ENTRY(_C_LABEL(name)) + +#endif diff --git a/libgloss/i960/configure b/libgloss/i960/configure new file mode 100755 index 0000000..16d1d85 --- /dev/null +++ b/libgloss/i960/configure @@ -0,0 +1,1219 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.12.1 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.12.1" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=crt0.c + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + + +# Do some error checking and defaulting for the host and target type. +# The inputs are: +# configure --host=HOST --target=TARGET --build=BUILD NONOPT +# +# The rules are: +# 1. You are not allowed to specify --host, --target, and nonopt at the +# same time. +# 2. Host defaults to nonopt. +# 3. If nonopt is not specified, then host defaults to the current host, +# as determined by config.guess. +# 4. Target and build default to nonopt. +# 5. If nonopt is not specified, then target and build default to host. + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +case $host---$target---$nonopt in +NONE---*---* | *---NONE---* | *---*---NONE) ;; +*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;; +esac + + +# Make sure we can run config.sub. +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi + +echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:571: checking host system type" >&5 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + +echo $ac_n "checking target system type""... $ac_c" 1>&6 +echo "configure:592: checking target system type" >&5 + +target_alias=$target +case "$target_alias" in +NONE) + case $nonopt in + NONE) target_alias=$host_alias ;; + *) target_alias=$nonopt ;; + esac ;; +esac + +target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias` +target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$target" 1>&6 + +echo $ac_n "checking build system type""... $ac_c" 1>&6 +echo "configure:610: checking build system type" >&5 + +build_alias=$build +case "$build_alias" in +NONE) + case $nonopt in + NONE) build_alias=$host_alias ;; + *) build_alias=$nonopt ;; + esac ;; +esac + +build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` +build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$build" 1>&6 + +test "$host_alias" != "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + +if test "$program_transform_name" = s,x,x,; then + program_transform_name= +else + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed +s,\\,\\\\,g; s,\$,$$,g +EOF_SED + program_transform_name="`echo $program_transform_name|sed -f conftestsed`" + rm -f conftestsed +fi +test "$program_prefix" != NONE && + program_transform_name="s,^,${program_prefix},; $program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" + +# sed with no file args requires a program. +test "$program_transform_name" = "" && program_transform_name="s,x,x," + + +if test "$srcdir" = "." ; then + mdir=`echo "${with_multisubdir}/" \ + | sed -e 's,\([^/][^/]*\),..,g' -e 's,^/$,,'` + ac_aux_dir= +for ac_dir in ${mdir}../../.. $srcdir/${mdir}../../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in ${mdir}../../.. $srcdir/${mdir}../../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + +else + ac_aux_dir= +for ac_dir in ${srcdir}/../.. $srcdir/${srcdir}/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in ${srcdir}/../.. $srcdir/${srcdir}/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + +fi + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:708: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +# FIXME: We temporarily define our own version of AC_PROG_CC. This is +# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We +# are probably using a cross compiler, which will not be able to fully +# link an executable. This should really be fixed in autoconf +# itself. + + + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:770: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:799: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + ac_prog_rejected=no + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +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 $# -gt 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 + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:847: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <<EOF +#ifdef __GNUC__ + yes; +#endif +EOF +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:856: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:871: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi + +AS=${AS-as} + +AR=${AR-ar} + +LD=${LD-ld} + +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:907: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +host_makefile_frag=${srcdir}/../config/default.mh + +host_makefile_frag_path=$host_makefile_frag + + + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs + + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS <<EOF +#! /bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.12.1" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS <<EOF + +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; + s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@host@%$host%g +s%@host_alias@%$host_alias%g +s%@host_cpu@%$host_cpu%g +s%@host_vendor@%$host_vendor%g +s%@host_os@%$host_os%g +s%@target@%$target%g +s%@target_alias@%$target_alias%g +s%@target_cpu@%$target_cpu%g +s%@target_vendor@%$target_vendor%g +s%@target_os@%$target_os%g +s%@build@%$build%g +s%@build_alias@%$build_alias%g +s%@build_cpu@%$build_cpu%g +s%@build_vendor@%$build_vendor%g +s%@build_os@%$build_os%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@CC@%$CC%g +s%@AS@%$AS%g +s%@AR@%$AR%g +s%@LD@%$LD%g +s%@RANLIB@%$RANLIB%g +s%@host_makefile_frag_path@%$host_makefile_frag_path%g +/@host_makefile_frag@/r $host_makefile_frag +s%@host_makefile_frag@%%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <<EOF + +CONFIG_FILES=\${CONFIG_FILES-"Makefile"} +EOF +cat >> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +EOF +cat >> $CONFIG_STATUS <<EOF + +EOF +cat >> $CONFIG_STATUS <<\EOF + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + diff --git a/libgloss/i960/configure.in b/libgloss/i960/configure.in new file mode 100644 index 0000000..2f0fa00 --- /dev/null +++ b/libgloss/i960/configure.in @@ -0,0 +1,75 @@ +dnl Process this file with autoconf to produce a configure script. +AC_PREREQ(2.5)dnl +AC_INIT(crt0.c) + +AC_CANONICAL_SYSTEM +AC_ARG_PROGRAM + +if test "$srcdir" = "." ; then + mdir=`echo "${with_multisubdir}/" \ + | sed -e 's,\([[^/]][[^/]]*\),..,g' -e 's,^/$,,'` + AC_CONFIG_AUX_DIR(${mdir}../../..) +else + AC_CONFIG_AUX_DIR(${srcdir}/../..) +fi + +AC_PROG_INSTALL + +# FIXME: We temporarily define our own version of AC_PROG_CC. This is +# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We +# are probably using a cross compiler, which will not be able to fully +# link an executable. This should really be fixed in autoconf +# itself. + +AC_DEFUN(LIB_AC_PROG_CC, +[AC_BEFORE([$0], [AC_PROG_CPP])dnl +AC_CHECK_PROG(CC, gcc, gcc) +if test -z "$CC"; then + AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) + test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) +fi + +AC_PROG_CC_GNU + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +dnl Check whether -g works, even if CFLAGS is set, in case the package +dnl plays around with CFLAGS (such as to build both debugging and +dnl normal versions of a library), tasteless as that idea is. + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + AC_PROG_CC_G + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi +]) + +LIB_AC_PROG_CC +AS=${AS-as} +AC_SUBST(AS) +AR=${AR-ar} +AC_SUBST(AR) +LD=${LD-ld} +AC_SUBST(LD) +AC_PROG_RANLIB + +host_makefile_frag=${srcdir}/../config/default.mh + +dnl We have to assign the same value to other variables because autoconf +dnl doesn't provide a mechanism to substitute a replacement keyword with +dnl arbitrary data or pathnames. +dnl +host_makefile_frag_path=$host_makefile_frag +AC_SUBST(host_makefile_frag_path) +AC_SUBST_FILE(host_makefile_frag) + +AC_OUTPUT(Makefile) diff --git a/libgloss/i960/crt0.c b/libgloss/i960/crt0.c new file mode 100644 index 0000000..45d7891 --- /dev/null +++ b/libgloss/i960/crt0.c @@ -0,0 +1,66 @@ +extern int main(int argc, char **argv, char **envp); +extern int brk (void *value); + +extern char bss_start; +extern char end; + +char *__env[1] = {0}; +char **environ = __env; + +#define ENABLE_TRACE_MASK 1 + +__inline static void +enable_tracing (void) +{ + register int mask = ENABLE_TRACE_MASK; + __asm__ volatile ("modpc %0,%0,%0" + : + : "d" (mask)); +} + +#define STACK_ALIGN 64 + +__inline static void +set_stack (void* ptr) +{ + ptr = (void *)(((int)ptr + STACK_ALIGN - 1) & ~(STACK_ALIGN - 1)); + /* SP must be 64 bytes larger than FP at start. */ + __asm__ volatile ("mov %0,sp" + : + : "d" (ptr+STACK_ALIGN)); + __asm__ volatile ("mov %0,fp" + : + : "d" (ptr)); +} + +__inline static void +init_Cregs (void) +{ + /* set register values gcc like */ + register unsigned int mask0=0x3b001000; + register unsigned int mask1=0x00009107; + __asm__ volatile ("mov %0,g14" + : /* no output */ + : "I" (0)); /* gnu structure pointer */ + __asm__ volatile ("modac %1,%0,%0" + : /* no output */ + : "d" (mask0), + "d" (mask1)); /* fpu control kb */ +} + +void +_start(void) +{ + char *p; + + enable_tracing (); + set_stack (&end); + init_Cregs (); + /* The stack grows upwards, so this makes the heap start after a 256K + stack area. PlumHall known to fail with less than 73K of stack. */ + brk (&end+0x40000); + /* clear bss */ + memset (&bss_start, 0, &end - &bss_start); + main(0, 0, 0); + exit(0); +} diff --git a/libgloss/i960/mon-read.c b/libgloss/i960/mon-read.c new file mode 100644 index 0000000..92e15d2 --- /dev/null +++ b/libgloss/i960/mon-read.c @@ -0,0 +1,18 @@ +#include <errno.h> + +read (fd, buf, sz) + int fd; + char *buf; + int sz; +{ + int nread; + int r; + + r = _sys_read (fd, buf, sz, &nread); + if (r != 0) + { + errno = r; + return -1; + } + return nread; +} diff --git a/libgloss/i960/mon-syscalls.S b/libgloss/i960/mon-syscalls.S new file mode 100644 index 0000000..489d7fb --- /dev/null +++ b/libgloss/i960/mon-syscalls.S @@ -0,0 +1,30 @@ +#include "asm.h" + +ENTRY(_exit) + lda 257,g13 + calls g13 + +ENTRY(_sys_open) + lda 230,g13 + calls g13 + ret + +ENTRY(_sys_read) + lda 231,g13 + calls g13 + ret + +ENTRY(_sys_write) + lda 232,g13 + calls g13 + ret + +ENTRY(_sys_lseek) + lda 233,g13 + calls g13 + ret + +ENTRY(_sys_close) + lda 234,g13 + calls g13 + ret diff --git a/libgloss/i960/mon-write.c b/libgloss/i960/mon-write.c new file mode 100644 index 0000000..527037f --- /dev/null +++ b/libgloss/i960/mon-write.c @@ -0,0 +1,14 @@ +#include <errno.h> + +int +write (int fd, const char *buf, int sz) +{ + int nwritten; + int r = _sys_write (fd, buf, sz, &nwritten); + if (r != 0) + { + errno = r; + return -1; + } + return nwritten; +} diff --git a/libgloss/i960/mon960.c b/libgloss/i960/mon960.c new file mode 100644 index 0000000..f81b6ac --- /dev/null +++ b/libgloss/i960/mon960.c @@ -0,0 +1,83 @@ +#include <sys/types.h> +#include <sys/stat.h> + +static char *heap_end = 0; + +int +brk (void *ptr) +{ + heap_end = ptr; + return 0; +} + +caddr_t +sbrk (int amt) +{ + extern char end; + char *prev_heap_end; + + if (heap_end == 0) + heap_end = &end; + prev_heap_end = heap_end; + heap_end += amt; + return ((caddr_t) prev_heap_end); +} + +int +isatty (int file) +{ + return file<3; +} + +int +fstat (int file, struct stat *st) +{ + st->st_mode = S_IFCHR; + return 0; +} + +int +stat (const char *filename, struct stat *st) +{ + st->st_mode = S_IFCHR; + return 0; +} + +int +lseek (int fd, off_t offset, int type) +{ + return _sys_lseek (fd, offset, type); +} + +int +open (char *file, int mode, int perms) +{ + return _sys_open (file, mode, perms); +} + +int +close (int fd) +{ + return _sys_close (fd); +} + +int +getpid () +{ + return -1; +} + +int +kill (int pid, int signal) +{ + exit (signal); +} + +#if 0 +/* This conflicts with the abort defined in newlib. */ +void +abort () +{ + exit (6); +} +#endif diff --git a/libgloss/i960/mon960.ld b/libgloss/i960/mon960.ld new file mode 100644 index 0000000..342a03b --- /dev/null +++ b/libgloss/i960/mon960.ld @@ -0,0 +1,36 @@ +GROUP(-lc -lgcc -lmon960) + +SECTIONS +{ + . = 0xa0008000; + .text : + { + CREATE_OBJECT_SYMBOLS + *(.text) + _etext = .; + + ___CTOR_LIST__ = .; + LONG((___CTOR_END__ - ___CTOR_LIST__) / 4 - 2) + *(.ctors) + LONG(0) + ___CTOR_END__ = .; + ___DTOR_LIST__ = .; + LONG((___DTOR_END__ - ___DTOR_LIST__) / 4 - 2) + *(.dtors) + LONG(0) + ___DTOR_END__ = .; + } + .data SIZEOF(.text) + ADDR(.text): + { + *(.data) + CONSTRUCTORS + _edata = .; + } + .bss SIZEOF(.data) + ADDR(.data): + { + _bss_start = .; + *(.bss) + *(COMMON) + _end = .; + } +} diff --git a/libgloss/i960/syscall.h b/libgloss/i960/syscall.h new file mode 100644 index 0000000..b12a8fe --- /dev/null +++ b/libgloss/i960/syscall.h @@ -0,0 +1,51 @@ +/* mon960 syscall.h file. This is used only by the simulator. This matches + the syscall numbers used by mon-syscalls.S, but is otherwise a copy of + the libgloss/syscall.h file. */ +/* ??? This file should be used by mon-syscalls.S to avoid maintenance + problems. */ + +#ifndef LIBGLOSS_SYSCALL_H +#define LIBGLOSS_SYSCALL_H + +/* Note: This file may be included by assembler source. */ + +/* These should be as small as possible to allow a port to use a trap type + instruction, which the system call # as the trap (the d10v for instance + supports traps 0..31). An alternative would be to define one trap for doing + system calls, and put the system call number in a register that is not used + for the normal calling sequence (so that you don't have to shift down the + arguments to add the system call number). Obviously, if these system call + numbers are ever changed, all of the simulators and potentially user code + will need to be updated. */ + +/* There is no current need for the following: SYS_execv, SYS_creat, SYS_wait, + etc. etc. Don't add them. */ + +/* These are required by the ANSI C part of newlib (excluding system() of + course). */ +#define SYS_exit 257 +#define SYS_open 230 +#define SYS_close 234 +#define SYS_read 231 +#define SYS_write 232 +#define SYS_lseek 233 + +/* ??? The following system calls apparently aren't support by mon960. */ +#define SYS_unlink 7 +#define SYS_getpid 8 +#define SYS_kill 9 +#define SYS_fstat 10 +/*#define SYS_sbrk 11 - not currently a system call, but reserved. */ + +/* ARGV support. */ +#define SYS_argvlen 12 +#define SYS_argv 13 + +/* These are extras added for one reason or another. */ +#define SYS_chdir 14 +#define SYS_stat 15 +#define SYS_chmod 16 +#define SYS_utime 17 +#define SYS_time 18 + +#endif diff --git a/libgloss/isatty.c b/libgloss/isatty.c new file mode 100644 index 0000000..2d66cd6 --- /dev/null +++ b/libgloss/isatty.c @@ -0,0 +1,27 @@ +/* isatty.c -- chek the terminal device. + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include "glue.h" + +/* + * isatty -- returns 1 if connected to a terminal device, + * returns 0 if not. Since we're hooked up to a + * serial port, we'll say yes _AND return a 1. + */ +int +_DEFUN (isatty, (fd), + int fd) +{ + return (1); +} diff --git a/libgloss/kill.c b/libgloss/kill.c new file mode 100644 index 0000000..afc1257 --- /dev/null +++ b/libgloss/kill.c @@ -0,0 +1,28 @@ +/* kill.c -- remove a process. + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include "glue.h" + +/* + * kill -- go out via exit... + */ +int +_DEFUN (kill, (pid, sig), + int pid _AND + int sig) +{ + if(pid == __MYPID) + _exit(sig); + return 0; +} diff --git a/libgloss/libnosys/Makefile.in b/libgloss/libnosys/Makefile.in new file mode 100644 index 0000000..4856154 --- /dev/null +++ b/libgloss/libnosys/Makefile.in @@ -0,0 +1,144 @@ +# Copyright (c) 1998 Cygnus Support +# +# The authors hereby grant permission to use, copy, modify, distribute, +# and license this software and its documentation for any purpose, provided +# that existing copyright notices are retained in all copies and that this +# notice is included verbatim in any distributions. No written agreement, +# license, or royalty fee is required for any of the authorized uses. +# Modifications to this software may be copyrighted by their authors +# and need not follow the licensing terms described here, provided that +# the new terms are clearly indicated on the first page of each file where +# they apply. + +VPATH = @srcdir@ +srcdir = @srcdir@ +objdir = . +srcroot = $(srcdir)/../.. +objroot = $(objdir)/../.. + +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +host_alias = @host_alias@ +target_alias = @target_alias@ +program_transform_name = @program_transform_name@ + +bindir = @bindir@ +libdir = @libdir@ +tooldir = $(exec_prefix)/$(target_alias) + +# Multilib support variables. +# TOP is used instead of MULTI{BUILD,SRC}TOP. +MULTIDIRS = +MULTISUBDIR = +MULTIDO = true +MULTICLEAN = true + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ + +SHELL = /bin/sh + +CC = @CC@ + +#AS = @AS@ +AS = `if [ -f ${objroot}/../gas/as.new ] ; \ + then echo ${objroot}/../gas/as.new ; \ + else echo as ; fi` + +AR = @AR@ + +#LD = @LD@ +LD = `if [ -f ${objroot}/../ld/ld.new ] ; \ + then echo ${objroot}/../ld/ld.new ; \ + else echo ld ; fi` + +RANLIB = @RANLIB@ + +OBJDUMP = `if [ -f ${objroot}/../binutils/objdump ] ; \ + then echo ${objroot}/../binutils/objdump ; \ + else t='$(program_transform_name)'; echo objdump | sed -e $$t ; fi` +OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \ + then echo ${objroot}/../binutils/objcopy ; \ + else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi` + +# object files needed +OBJS = close.o environ.o execve.o fork.o fstat.o getpid.o gettod.o isatty.o \ + kill.o link.o lseek.o open.o read.o sbrk.o stat.o \ + times.o unlink.o wait.o write.o + +# Object files specific to particular targets. +EVALOBJS = ${OBJS} + +GCC_LDFLAGS = `if [ -d ${objroot}/../gcc ] ; \ + then echo -L${objroot}/../gcc ; fi` + +OUTPUTS = libnosys.a + +NEWLIB_CFLAGS = `if [ -d ${objroot}/newlib ]; then echo -I${objroot}/newlib/targ-include -I${srcroot}/newlib/libc/include; fi` +NEWLIB_LDFLAGS = `if [ -d ${objroot}/newlib ]; then echo -B${objroot}/newlib/ -L${objroot}/newlib/; fi` + +INCLUDES = -I. -I$(srcdir)/.. +# Note that when building the library, ${MULTILIB} is not the way multilib +# options are passed; they're passed in $(CFLAGS). +CFLAGS_FOR_TARGET = ${MULTILIB} ${INCLUDES} ${NEWLIB_CFLAGS} +LDFLAGS_FOR_TARGET = ${MULTILIB} ${NEWLIB_LDFLAGS} +AR_FLAGS = qc + +.c.o: + $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $< + +.C.o: + $(CC) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $(CFLAGS) $< +.s.o: + $(AS) $(ASFLAGS_FOR_TARGET) $(INCLUDES) $(ASFLAGS) -o $*.o $< + +# +# GCC knows to run the preprocessor on .S files before it assembles them. +# +.S.o: + $(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) $(CFLAGS) -c $< + +# +# this is a bogus target that'll produce an assembler from the +# C source with the right compiler options. this is so we can +# track down code generation or debug symbol bugs. +# +.c.s: + $(CC) $(CFLAGS_FOR_TARGET) -S $(INCLUDES) $(CFLAGS) $< + +all: ${OUTPUTS} + +# +# here's where we build the library for each target +# + +libnosys.a: $(EVALOBJS) + ${AR} ${ARFLAGS} $@ $(EVALOBJS) + ${RANLIB} $@ + +doc: + +clean mostlyclean: + rm -f $(OUTPUTS) *.i *~ *.o *-test *.srec *.dis *.map *.x + +distclean maintainer-clean realclean: clean + rm -f Makefile config.status $(OUTPUTS) + +.PHONY: install info install-info clean-info +install: + @for outputs in ${OUTPUTS}; do\ + mkdir -p $(tooldir)/lib${MULTISUBDIR}; \ + $(INSTALL_PROGRAM) $${outputs} $(tooldir)/lib${MULTISUBDIR}; \ + done + +info: +install-info: +clean-info: + +Makefile: Makefile.in config.status @host_makefile_frag_path@ + $(SHELL) config.status + +config.status: configure + $(SHELL) config.status --recheck diff --git a/libgloss/libnosys/acconfig.h b/libgloss/libnosys/acconfig.h new file mode 100644 index 0000000..a9508c7 --- /dev/null +++ b/libgloss/libnosys/acconfig.h @@ -0,0 +1,23 @@ +/* Name of package. */ +#undef PACKAGE + +/* Version of package. */ +#undef VERSION + +/* Missing syscall names */ +#undef MISSING_SYSCALL_NAMES + +/* Using ELF format */ +#undef HAVE_ELF + +/* Using GNU LD */ +#undef HAVE_GNU_LD + +/* .previous directive allowed */ +#undef HAVE_ASM_PREVIOUS_DIRECTIVE + +/* .pushsection/.popsection directives allowed */ +#undef HAVE_ASM_POPSECTION_DIRECTIVE + +/* symbol prefix */ +#undef __SYMBOL_PREFIX diff --git a/libgloss/libnosys/close.c b/libgloss/libnosys/close.c new file mode 100644 index 0000000..b759b86 --- /dev/null +++ b/libgloss/libnosys/close.c @@ -0,0 +1,21 @@ +/* + * Stub version of close. + */ + +#include "config.h" +#include <_ansi.h> +#include <_syslist.h> +#include <errno.h> +#undef errno +extern int errno; +#include "warning.h" + +int +_DEFUN (_close, (fildes), + int fildes) +{ + errno = ENOSYS; + return -1; +} + +stub_warning (_close) diff --git a/libgloss/libnosys/config.h.in b/libgloss/libnosys/config.h.in new file mode 100644 index 0000000..fa5d9d9 --- /dev/null +++ b/libgloss/libnosys/config.h.in @@ -0,0 +1,19 @@ +/* config.h.in. Generated automatically from configure.in by autoheader. */ + +/* Missing syscall names */ +#undef MISSING_SYSCALL_NAMES + +/* Using ELF format */ +#undef HAVE_ELF + +/* Using GNU LD */ +#undef HAVE_GNU_LD + +/* .previous directive allowed */ +#undef HAVE_ASM_PREVIOUS_DIRECTIVE + +/* .pushsection/.popsection directives allowed */ +#undef HAVE_ASM_POPSECTION_DIRECTIVE + +/* symbol prefix */ +#undef __SYMBOL_PREFIX diff --git a/libgloss/libnosys/configure b/libgloss/libnosys/configure new file mode 100755 index 0000000..944d970 --- /dev/null +++ b/libgloss/libnosys/configure @@ -0,0 +1,1439 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.13 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.13" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=close.c + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +ac_exeext= +ac_objext=o +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + + +if test "${enable_shared}" = "yes" ; then + echo "Shared libraries not supported for cross compiling, ignored" +fi + +if test "$srcdir" = "." ; then + if test "${with_target_subdir}" != "." ; then + libgloss_topdir="${srcdir}/${with_multisrctop}../../.." + else + libgloss_topdir="${srcdir}/${with_multisrctop}../.." + fi +else + libgloss_topdir="${srcdir}/../.." +fi +ac_aux_dir= +for ac_dir in $libgloss_topdir $srcdir/$libgloss_topdir; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $libgloss_topdir $srcdir/$libgloss_topdir" 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + + + +# Do some error checking and defaulting for the host and target type. +# The inputs are: +# configure --host=HOST --target=TARGET --build=BUILD NONOPT +# +# The rules are: +# 1. You are not allowed to specify --host, --target, and nonopt at the +# same time. +# 2. Host defaults to nonopt. +# 3. If nonopt is not specified, then host defaults to the current host, +# as determined by config.guess. +# 4. Target and build default to nonopt. +# 5. If nonopt is not specified, then target and build default to host. + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +case $host---$target---$nonopt in +NONE---*---* | *---NONE---* | *---*---NONE) ;; +*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;; +esac + + +# Make sure we can run config.sub. +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi + +echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:588: checking host system type" >&5 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + +echo $ac_n "checking target system type""... $ac_c" 1>&6 +echo "configure:609: checking target system type" >&5 + +target_alias=$target +case "$target_alias" in +NONE) + case $nonopt in + NONE) target_alias=$host_alias ;; + *) target_alias=$nonopt ;; + esac ;; +esac + +target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias` +target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$target" 1>&6 + +echo $ac_n "checking build system type""... $ac_c" 1>&6 +echo "configure:627: checking build system type" >&5 + +build_alias=$build +case "$build_alias" in +NONE) + case $nonopt in + NONE) build_alias=$host_alias ;; + *) build_alias=$nonopt ;; + esac ;; +esac + +build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` +build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$build" 1>&6 + +test "$host_alias" != "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + +if test "$program_transform_name" = s,x,x,; then + program_transform_name= +else + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed +s,\\,\\\\,g; s,\$,$$,g +EOF_SED + program_transform_name="`echo $program_transform_name|sed -f conftestsed`" + rm -f conftestsed +fi +test "$program_prefix" != NONE && + program_transform_name="s,^,${program_prefix},; $program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" + +# sed with no file args requires a program. +test "$program_transform_name" = "" && program_transform_name="s,x,x," + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:681: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +# FIXME: We temporarily define our own version of AC_PROG_CC. This is +# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We +# are building a library that must be included in all links, so we +# can't link an executable until this lib is built. +# autoconf should provide a way to do this. + + + +cat >> confdefs.h <<\EOF +#define HAVE_GNU_LD 1 +EOF + +case "${target}" in + *-*-cygwin*) + ;; + a29k-amd-udi) + ;; + arc-*-*) + ;; + arm-*-pe) + ;; + arm-*-*) + ;; + strongarm-*-*) + ;; + d10v*) + ;; + h8300*-*-*) + ;; + h8500-*-*) + ;; + i345686-*-sco*) + ;; + m32r-*-*) + ;; + mn10?00-*-*) + ;; + powerpcle-*-pe) + ;; + sh*-*-*) + ;; + sparc-sun-sunos*) + ;; + sparc64-*-*) + ;; + thumb-*-pe) + ;; + thumb-*-*) + ;; + v850-*-*) + ;; + v850e-*-*) + ;; + v850ea-*-*) + ;; + w65-*-*) + ;; + z8k-*-*) + ;; + *) + cat >> confdefs.h <<\EOF +#define MISSING_SYSCALL_NAMES 1 +EOF + + ;; +esac + +case "${target}" in + *-*-elf) + cat >> confdefs.h <<\EOF +#define HAVE_ELF 1 +EOF + + + echo $ac_n "checking for .previous assembler directive""... $ac_c" 1>&6 +echo "configure:813: checking for .previous assembler directive" >&5 +if eval "test \"`echo '$''{'libc_cv_asm_previous_directive'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.s <<EOF +.section foo_section +.previous +EOF + if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:821: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + cat >> confdefs.h <<\EOF +#define HAVE_ASM_PREVIOUS_DIRECTIVE 1 +EOF + + else + rm -f conftest* +fi + +echo "$ac_t""$libc_cv_asm_previous_directive" 1>&6 + echo $ac_n "checking for .popsection assembler directive""... $ac_c" 1>&6 +echo "configure:832: checking for .popsection assembler directive" >&5 +if eval "test \"`echo '$''{'libc_cv_asm_popsection_directive'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.s <<EOF +.pushsection foo_section +.popsection +EOF + if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:840: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + cat >> confdefs.h <<\EOF +#define HAVE_ASM_POPSECTION_DIRECTIVE 1 +EOF + + fi + fi + rm -f conftest* +fi + +echo "$ac_t""$libc_cv_asm_popsection_directive" 1>&6 + ;; +esac + +echo $ac_n "checking for function prefix""... $ac_c" 1>&6 +echo "configure:855: checking for function prefix" >&5 +if eval "test \"`echo '$''{'libc_dollar_prefix'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <<\EOF +foo () { } +EOF +if { ac_try='${CC-cc} -S conftest.c -o - | fgrep "\$foo" > /dev/null'; { (eval echo configure:862: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; +then + libc_dollar_prefix=yes +else + libc_dollar_prefix=no +fi +rm -f conftest* +fi + +echo "$ac_t""$libc_dollar_prefix" 1>&6 +if test $libc_dollar_prefix = yes ; then + cat >> confdefs.h <<\EOF +#define __SYMBOL_PREFIX "$" +EOF + +else + cat >> confdefs.h <<\EOF +#define __SYMBOL_PREFIX "" +EOF + +fi + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:887: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:917: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +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 $# -gt 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 + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:966: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <<EOF +#ifdef __GNUC__ + yes; +#endif +EOF +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:975: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:990: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi + +AS=${AS-as} + +AR=${AR-ar} + +LD=${LD-ld} + +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1026: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +host_makefile_frag=${srcdir}/../config/default.mh + +host_makefile_frag_path=$host_makefile_frag + + + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +DEFS=-DHAVE_CONFIG_H + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS <<EOF +#! /bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.13" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS <<EOF + +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; + s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@FFLAGS@%$FFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@host@%$host%g +s%@host_alias@%$host_alias%g +s%@host_cpu@%$host_cpu%g +s%@host_vendor@%$host_vendor%g +s%@host_os@%$host_os%g +s%@target@%$target%g +s%@target_alias@%$target_alias%g +s%@target_cpu@%$target_cpu%g +s%@target_vendor@%$target_vendor%g +s%@target_os@%$target_os%g +s%@build@%$build%g +s%@build_alias@%$build_alias%g +s%@build_cpu@%$build_cpu%g +s%@build_vendor@%$build_vendor%g +s%@build_os@%$build_os%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@CC@%$CC%g +s%@AS@%$AS%g +s%@AR@%$AR%g +s%@LD@%$LD%g +s%@RANLIB@%$RANLIB%g +s%@host_makefile_frag_path@%$host_makefile_frag_path%g +/@host_makefile_frag@/r $host_makefile_frag +s%@host_makefile_frag@%%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <<EOF + +CONFIG_FILES=\${CONFIG_FILES-"Makefile"} +EOF +cat >> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' +ac_dC='\3' +ac_dD='%g' +# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='\([ ]\)%\1#\2define\3' +ac_uC=' ' +ac_uD='\4%g' +# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_eB='$%\1#\2define\3' +ac_eC=' ' +ac_eD='%g' + +if test "${CONFIG_HEADERS+set}" != set; then +EOF +cat >> $CONFIG_STATUS <<EOF + CONFIG_HEADERS="config.h" +EOF +cat >> $CONFIG_STATUS <<\EOF +fi +for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + echo creating $ac_file + + rm -f conftest.frag conftest.in conftest.out + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + cat $ac_file_inputs > conftest.in + +EOF + +# Transform confdefs.h into a sed script conftest.vals that substitutes +# the proper values into config.h.in to produce config.h. And first: +# Protect against being on the right side of a sed subst in config.status. +# Protect against being in an unquoted here document in config.status. +rm -f conftest.vals +cat > conftest.hdr <<\EOF +s/[\\&%]/\\&/g +s%[\\$`]%\\&%g +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp +s%ac_d%ac_u%gp +s%ac_u%ac_e%gp +EOF +sed -n -f conftest.hdr confdefs.h > conftest.vals +rm -f conftest.hdr + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >> conftest.vals <<\EOF +s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% +EOF + +# Break up conftest.vals because some shells have a limit on +# the size of here documents, and old seds have small limits too. + +rm -f conftest.tail +while : +do + ac_lines=`grep -c . conftest.vals` + # grep -c gives empty output for an empty file on some AIX systems. + if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi + # Write a limited-size here document to conftest.frag. + echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS + echo 'CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in +' >> $CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail + rm -f conftest.vals + mv conftest.tail conftest.vals +done +rm -f conftest.vals + +cat >> $CONFIG_STATUS <<\EOF + rm -f conftest.frag conftest.h + echo "/* $ac_file. Generated automatically by configure. */" > conftest.h + cat conftest.in >> conftest.h + rm -f conftest.in + if cmp -s $ac_file conftest.h 2>/dev/null; then + echo "$ac_file is unchanged" + rm -f conftest.h + else + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + fi + rm -f $ac_file + mv conftest.h $ac_file + fi +fi; done + +EOF +cat >> $CONFIG_STATUS <<EOF +srcdir=${srcdir} +target=${target} +ac_configure_args="${ac_configure_args} --enable-multilib" +CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} +libgloss_topdir=${libgloss_topdir} + +EOF +cat >> $CONFIG_STATUS <<\EOF +ac_file=Makefile . ${libgloss_topdir}/config-ml.in +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + + + diff --git a/libgloss/libnosys/configure.in b/libgloss/libnosys/configure.in new file mode 100644 index 0000000..45cbfdd --- /dev/null +++ b/libgloss/libnosys/configure.in @@ -0,0 +1,206 @@ +# Copyright (c) 1995, 1996 Cygnus Support +# +# The authors hereby grant permission to use, copy, modify, distribute, +# and license this software and its documentation for any purpose, provided +# that existing copyright notices are retained in all copies and that this +# notice is included verbatim in any distributions. No written agreement, +# license, or royalty fee is required for any of the authorized uses. +# Modifications to this software may be copyrighted by their authors +# and need not follow the licensing terms described here, provided that +# the new terms are clearly indicated on the first page of each file where +# they apply. +# +# Process this file with autoconf to produce a configure script. +# +AC_PREREQ(2.5)dnl +AC_INIT(close.c) +AC_CONFIG_HEADER(config.h) + +if test "${enable_shared}" = "yes" ; then + echo "Shared libraries not supported for cross compiling, ignored" +fi + +if test "$srcdir" = "." ; then + if test "${with_target_subdir}" != "." ; then + libgloss_topdir="${srcdir}/${with_multisrctop}../../.." + else + libgloss_topdir="${srcdir}/${with_multisrctop}../.." + fi +else + libgloss_topdir="${srcdir}/../.." +fi +AC_CONFIG_AUX_DIR($libgloss_topdir) + +AC_CANONICAL_SYSTEM +AC_ARG_PROGRAM + +AC_PROG_INSTALL + +# FIXME: We temporarily define our own version of AC_PROG_CC. This is +# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We +# are building a library that must be included in all links, so we +# can't link an executable until this lib is built. +# autoconf should provide a way to do this. + +AC_DEFUN(LIB_AC_PROG_CC, +[AC_BEFORE([$0], [AC_PROG_CPP])dnl +AC_CHECK_PROG(CC, gcc, gcc) +if test -z "$CC"; then + AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) + test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) +fi + +AC_PROG_CC_GNU + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +dnl Check whether -g works, even if CFLAGS is set, in case the package +dnl plays around with CFLAGS (such as to build both debugging and +dnl normal versions of a library), tasteless as that idea is. + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + AC_PROG_CC_G + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi +]) + +AC_DEFINE(HAVE_GNU_LD) +dnl Make sure syscall names match those being used by newlib +case "${target}" in + *-*-cygwin*) + ;; + a29k-amd-udi) + ;; + arc-*-*) + ;; + arm-*-pe) + ;; + arm-*-*) + ;; + strongarm-*-*) + ;; + d10v*) + ;; + h8300*-*-*) + ;; + h8500-*-*) + ;; + i[3456]86-*-sco*) + ;; + m32r-*-*) + ;; + mn10?00-*-*) + ;; + powerpcle-*-pe) + ;; + sh*-*-*) + ;; + sparc-sun-sunos*) + ;; + sparc64-*-*) + ;; + thumb-*-pe) + ;; + thumb-*-*) + ;; + v850-*-*) + ;; + v850e-*-*) + ;; + v850ea-*-*) + ;; + w65-*-*) + ;; + z8k-*-*) + ;; + *) + AC_DEFINE(MISSING_SYSCALL_NAMES) + ;; +esac + +dnl Make sure we know if elf format used +case "${target}" in + *-*-elf) + AC_DEFINE(HAVE_ELF) + + AC_CACHE_CHECK(for .previous assembler directive, + libc_cv_asm_previous_directive, [dnl + cat > conftest.s <<EOF +.section foo_section +.previous +EOF + if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.s 1>&AC_FD_CC); then + AC_DEFINE(HAVE_ASM_PREVIOUS_DIRECTIVE) + else + rm -f conftest*]) + AC_CACHE_CHECK(for .popsection assembler directive, + libc_cv_asm_popsection_directive, [dnl + cat > conftest.s <<EOF +.pushsection foo_section +.popsection +EOF + if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.s 1>&AC_FD_CC); then + AC_DEFINE(HAVE_ASM_POPSECTION_DIRECTIVE) + fi + fi + rm -f conftest*]) + ;; +esac + +AC_CACHE_CHECK(for function prefix, libc_dollar_prefix, [dnl +cat > conftest.c <<\EOF +foo () { } +EOF +dnl +if AC_TRY_COMMAND([${CC-cc} -S conftest.c -o - | fgrep "\$foo" > /dev/null]); +then + libc_dollar_prefix=yes +else + libc_dollar_prefix=no +fi +rm -f conftest* ]) +if test $libc_dollar_prefix = yes ; then + AC_DEFINE(__SYMBOL_PREFIX, "$") +else + AC_DEFINE(__SYMBOL_PREFIX, "") +fi + +LIB_AC_PROG_CC +AS=${AS-as} +AC_SUBST(AS) +AR=${AR-ar} +AC_SUBST(AR) +LD=${LD-ld} +AC_SUBST(LD) +AC_PROG_RANLIB + +host_makefile_frag=${srcdir}/../config/default.mh + +dnl We have to assign the same value to other variables because autoconf +dnl doesn't provide a mechanism to substitute a replacement keyword with +dnl arbitrary data or pathnames. +dnl +host_makefile_frag_path=$host_makefile_frag +AC_SUBST(host_makefile_frag_path) +AC_SUBST_FILE(host_makefile_frag) + +AC_OUTPUT(Makefile, +ac_file=Makefile . ${libgloss_topdir}/config-ml.in, +srcdir=${srcdir} +target=${target} +ac_configure_args="${ac_configure_args} --enable-multilib" +CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} +libgloss_topdir=${libgloss_topdir} +) + + diff --git a/libgloss/libnosys/environ.c b/libgloss/libnosys/environ.c new file mode 100644 index 0000000..b582506 --- /dev/null +++ b/libgloss/libnosys/environ.c @@ -0,0 +1,6 @@ +/* + * Version of environ for no OS. + */ + +char *__env[1] = { 0 }; +char **environ = __env; diff --git a/libgloss/libnosys/execve.c b/libgloss/libnosys/execve.c new file mode 100644 index 0000000..01743ff --- /dev/null +++ b/libgloss/libnosys/execve.c @@ -0,0 +1,23 @@ +/* + * Stub version of execve. + */ + +#include "config.h" +#include <_ansi.h> +#include <_syslist.h> +#include <errno.h> +#undef errno +extern int errno; +#include "warning.h" + +int +_DEFUN (_execve, (name, argv, env), + char *name _AND + char **argv _AND + char **env) +{ + errno = ENOSYS; + return -1; +} + +stub_warning(_execve) diff --git a/libgloss/libnosys/fork.c b/libgloss/libnosys/fork.c new file mode 100644 index 0000000..f5795cb --- /dev/null +++ b/libgloss/libnosys/fork.c @@ -0,0 +1,21 @@ +/* + * Stub version of fork. + */ + +#include "config.h" +#include <_ansi.h> +#include <_syslist.h> +#include <errno.h> +#undef errno +extern int errno; +#include "warning.h" + +int +_DEFUN (_fork, (), + _NOARGS) +{ + errno = ENOSYS; + return -1; +} + +stub_warning(_fork) diff --git a/libgloss/libnosys/fstat.c b/libgloss/libnosys/fstat.c new file mode 100644 index 0000000..4e18d42 --- /dev/null +++ b/libgloss/libnosys/fstat.c @@ -0,0 +1,24 @@ +/* + * Stub version of fstat. + */ + +#include "config.h" +#include <_ansi.h> +#include <_syslist.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <errno.h> +#undef errno +extern int errno; +#include "warning.h" + +int +_DEFUN (_fstat, (fildes, st), + int fildes _AND + struct stat *st) +{ + errno = ENOSYS; + return -1; +} + +stub_warning(_fstat) diff --git a/libgloss/libnosys/getpid.c b/libgloss/libnosys/getpid.c new file mode 100644 index 0000000..0ea1923 --- /dev/null +++ b/libgloss/libnosys/getpid.c @@ -0,0 +1,21 @@ +/* + * Stub version of getpid. + */ + +#include "config.h" +#include <_ansi.h> +#include <_syslist.h> +#include <errno.h> +#undef errno +extern int errno; +#include "warning.h" + +int +_DEFUN (_getpid, (), + _NOARGS) +{ + errno = ENOSYS; + return -1; +} + +stub_warning(_getpid) diff --git a/libgloss/libnosys/gettod.c b/libgloss/libnosys/gettod.c new file mode 100644 index 0000000..7003459 --- /dev/null +++ b/libgloss/libnosys/gettod.c @@ -0,0 +1,27 @@ +/* + * Stub version of gettimeofday. + */ + +#include "config.h" +#include <_ansi.h> +#include <_syslist.h> +#include <sys/time.h> +#include <sys/times.h> +#include <errno.h> +#undef errno +extern int errno; +#include "warning.h" + +struct timeval; +struct timezone; + +int +_DEFUN (_gettimeofday, (ptimeval, ptimezone), + struct timeval *ptimeval _AND + struct timezone *ptimezone) +{ + errno = ENOSYS; + return -1; +} + +stub_warning(_gettimeofday) diff --git a/libgloss/libnosys/isatty.c b/libgloss/libnosys/isatty.c new file mode 100644 index 0000000..db12431 --- /dev/null +++ b/libgloss/libnosys/isatty.c @@ -0,0 +1,21 @@ +/* + * Stub version of isatty. + */ + +#include "config.h" +#include <_ansi.h> +#include <_syslist.h> +#include <errno.h> +#undef errno +extern int errno; +#include "warning.h" + +int +_DEFUN (isatty, (file), + int file) +{ + errno = ENOSYS; + return 0; +} + +stub_warning(isatty) diff --git a/libgloss/libnosys/kill.c b/libgloss/libnosys/kill.c new file mode 100644 index 0000000..f1d12c6 --- /dev/null +++ b/libgloss/libnosys/kill.c @@ -0,0 +1,22 @@ +/* + * Stub version of kill. + */ + +#include "config.h" +#include <_ansi.h> +#include <_syslist.h> +#include <errno.h> +#undef errno +extern int errno; +#include "warning.h" + +int +_DEFUN (_kill, (pid, sig), + int pid _AND + int sig) +{ + errno = ENOSYS; + return -1; +} + +stub_warning(_kill) diff --git a/libgloss/libnosys/link.c b/libgloss/libnosys/link.c new file mode 100644 index 0000000..35881cf --- /dev/null +++ b/libgloss/libnosys/link.c @@ -0,0 +1,22 @@ +/* + * Stub version of link. + */ + +#include "config.h" +#include <_ansi.h> +#include <_syslist.h> +#include <errno.h> +#undef errno +extern int errno; +#include "warning.h" + +int +_DEFUN (_link, (existing, new), + char *existing _AND + char *new) +{ + errno = ENOSYS; + return -1; +} + +stub_warning(_link) diff --git a/libgloss/libnosys/lseek.c b/libgloss/libnosys/lseek.c new file mode 100644 index 0000000..0aa89e2 --- /dev/null +++ b/libgloss/libnosys/lseek.c @@ -0,0 +1,23 @@ +/* + * Stub version of lseek. + */ + +#include "config.h" +#include <_ansi.h> +#include <_syslist.h> +#include <errno.h> +#undef errno +extern int errno; +#include "warning.h" + +int +_DEFUN (_lseek, (file, ptr, dir), + int file _AND + int ptr _AND + int dir) +{ + errno = ENOSYS; + return -1; +} + +stub_warning(_lseek) diff --git a/libgloss/libnosys/open.c b/libgloss/libnosys/open.c new file mode 100644 index 0000000..2c8a6ce --- /dev/null +++ b/libgloss/libnosys/open.c @@ -0,0 +1,23 @@ +/* + * Stub version of open. + */ + +#include "config.h" +#include <_ansi.h> +#include <_syslist.h> +#include <errno.h> +#undef errno +extern int errno; +#include "warning.h" + +int +_DEFUN (_open, (file, flags, mode), + char *file _AND + int flags _AND + int mode) +{ + errno = ENOSYS; + return -1; +} + +stub_warning(_open) diff --git a/libgloss/libnosys/read.c b/libgloss/libnosys/read.c new file mode 100644 index 0000000..1a2819c --- /dev/null +++ b/libgloss/libnosys/read.c @@ -0,0 +1,23 @@ +/* + * Stub version of read. + */ + +#include "config.h" +#include <_ansi.h> +#include <_syslist.h> +#include <errno.h> +#undef errno +extern int errno; +#include "warning.h" + +int +_DEFUN (_read, (file, ptr, len), + int file _AND + char *ptr _AND + int len) +{ + errno = ENOSYS; + return -1; +} + +stub_warning(_read) diff --git a/libgloss/libnosys/sbrk.c b/libgloss/libnosys/sbrk.c new file mode 100644 index 0000000..8091d70 --- /dev/null +++ b/libgloss/libnosys/sbrk.c @@ -0,0 +1,27 @@ +/* + * Version of sbrk for no operating system. + */ + +#include "config.h" +#include <_ansi.h> +#include <_syslist.h> +#include <sys/types.h> +#include <errno.h> +#undef errno +extern int errno; + +caddr_t +_DEFUN (_sbrk, (incr), + int incr) +{ + extern char end; /* set by linker */ + static char *heap_end; + char *prev_heap_end; + + if (heap_end == 0) { + heap_end = &end; + } + prev_heap_end = heap_end; + heap_end += incr; + return (caddr_t) prev_heap_end; +} diff --git a/libgloss/libnosys/stat.c b/libgloss/libnosys/stat.c new file mode 100644 index 0000000..7c34637 --- /dev/null +++ b/libgloss/libnosys/stat.c @@ -0,0 +1,24 @@ +/* + * Stub version of stat. + */ + +#include "config.h" +#include <_ansi.h> +#include <_syslist.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <errno.h> +#undef errno +extern int errno; +#include "warning.h" + +int +_DEFUN (_stat, (file, st), + const char *file _AND + struct stat *st) +{ + errno = ENOSYS; + return -1; +} + +stub_warning(_stat) diff --git a/libgloss/libnosys/times.c b/libgloss/libnosys/times.c new file mode 100644 index 0000000..f205e50 --- /dev/null +++ b/libgloss/libnosys/times.c @@ -0,0 +1,22 @@ +/* + * Stub version of times. + */ + +#include "config.h" +#include <_ansi.h> +#include <_syslist.h> +#include <sys/times.h> +#include <errno.h> +#undef errno +extern int errno; +#include "warning.h" + +clock_t +_DEFUN (_times, (buf), + struct tms *buf) +{ + errno = ENOSYS; + return -1; +} + +stub_warning(_times) diff --git a/libgloss/libnosys/unlink.c b/libgloss/libnosys/unlink.c new file mode 100644 index 0000000..c543709 --- /dev/null +++ b/libgloss/libnosys/unlink.c @@ -0,0 +1,21 @@ +/* + * Stub version of unlink. + */ + +#include "config.h" +#include <_ansi.h> +#include <_syslist.h> +#include <errno.h> +#undef errno +extern int errno; +#include "warning.h" + +int +_DEFUN (_unlink, (name), + char *name) +{ + errno = ENOSYS; + return -1; +} + +stub_warning(_unlink) diff --git a/libgloss/libnosys/wait.c b/libgloss/libnosys/wait.c new file mode 100644 index 0000000..2a785be --- /dev/null +++ b/libgloss/libnosys/wait.c @@ -0,0 +1,21 @@ +/* + * Stub version of wait. + */ + +#include "config.h" +#include <_ansi.h> +#include <_syslist.h> +#include <errno.h> +#undef errno +extern int errno; +#include "warning.h" + +int +_DEFUN (_wait, (status), + int *status) +{ + errno = ENOSYS; + return -1; +} + +stub_warning(_wait) diff --git a/libgloss/libnosys/warning.h b/libgloss/libnosys/warning.h new file mode 100644 index 0000000..99f3e0d --- /dev/null +++ b/libgloss/libnosys/warning.h @@ -0,0 +1,39 @@ +#ifndef __WARNING_H__ +#define __WARNING_H__ + +#ifdef HAVE_GNU_LD +# ifdef HAVE_ELF + +/* We want the .gnu.warning.SYMBOL section to be unallocated. */ +# ifdef HAVE_ASM_PREVIOUS_DIRECTIVE +# define __make_section_unallocated(section_string) \ + asm(".section " section_string "; .previous"); +# elif defined (HAVE_ASM_POPSECTION_DIRECTIVE) +# define __make_section_unallocated(section_string) \ + asm(".pushsection " section_string "; .popsection"); +# else +# define __make_section_unallocated(section_string) +# endif + +# define link_warning(symbol, msg) \ + __make_section_unallocated (".gnu.warning." #symbol) \ + static const char __evoke_link_warning_##symbol[] \ + __attribute__ ((section (".gnu.warning." #symbol))) = msg; + +#else /* !ELF */ + +# define link_warning(symbol, msg) \ + asm(".stabs \"" msg "\",30,0,0,0\n" \ + ".stabs \"" __SYMBOL_PREFIX #symbol "\",1,0,0,0\n"); +# endif +#else /* !GNULD */ +/* We will never be heard; they will all die horribly. */ +# define link_warning(symbol, msg) +#endif + +/* A canned warning for sysdeps/stub functions. */ +#define stub_warning(name) \ + link_warning (name, \ + "warning: " #name " is not implemented and will always fail") + +#endif /* __WARNING_H__ */ diff --git a/libgloss/libnosys/write.c b/libgloss/libnosys/write.c new file mode 100644 index 0000000..0136d74 --- /dev/null +++ b/libgloss/libnosys/write.c @@ -0,0 +1,24 @@ +/* + * Stub version of write. + */ + +#include "config.h" +#include <_ansi.h> +#include <_syslist.h> +#include <errno.h> +#undef errno +extern int errno; +#include "warning.h" + +int +_DEFUN (_write, (file, ptr, len), + int file _AND + char *ptr _AND + int len) +{ + errno = ENOSYS; + return -1; +} + +stub_warning(_write) + diff --git a/libgloss/lseek.c b/libgloss/lseek.c new file mode 100644 index 0000000..1df36f5 --- /dev/null +++ b/libgloss/lseek.c @@ -0,0 +1,31 @@ +/* lseek.c -- move read/write pointer. + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include <sys/types.h> +#include <errno.h> +#include "glue.h" + +/* + * lseek -- Since a serial port is non-seekable, we return an error. + */ +off_t +_DEFUN (lseek, (fd, offset, whence), + int fd _AND + off_t offset _AND + int whence) +{ + errno = ESPIPE; + return ((off_t)-1); +} + diff --git a/libgloss/m32r/Makefile.in b/libgloss/m32r/Makefile.in new file mode 100644 index 0000000..909a837 --- /dev/null +++ b/libgloss/m32r/Makefile.in @@ -0,0 +1,144 @@ +# Makefile for libgloss/m32r +# Copyright (c) 1996, 1998 Cygnus Support. +# All rights reserved. +# +# Redistribution and use in source and binary forms are permitted +# provided that the above copyright notice and this paragraph are +# duplicated in all such forms and that any documentation, +# advertising materials, and other materials related to such +# distribution and use acknowledge that the software was developed +# at Cygnus Support, Inc. Cygnus Support, Inc. may not be used to +# endorse or promote products derived from this software without +# specific prior written permission. +# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + +VPATH = @srcdir@ +srcdir = @srcdir@ +objdir = . +srcroot = $(srcdir)/../.. +objroot = $(objdir)/../.. + +host_alias = @host_alias@ +target_alias = @target_alias@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ +bindir = @bindir@ +libdir = @libdir@ +tooldir = $(exec_prefix)/$(target_alias) + +TOP = ../.. +SRCTOP = ../.. + +# Multilib support variables. +# TOP is used instead of MULTI{BUILD,SRC}TOP. +MULTISRCTOP = +MULTIBUILDTOP = +MULTIDIRS = +MULTISUBDIR = +MULTIDO = true +MULTICLEAN = true + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ + +SHELL = /bin/sh + +CC = @CC@ + +AS = @AS@ +AR = @AR@ +LD = @LD@ +RANLIB = @RANLIB@ + +AR_FLAGS = qv +BISON = bison +MAKEINFO = makeinfo + +.NOEXPORT: +MAKEOVERRIDES= + +TARGETDOC = ../../targetdep.tex + +CRT0 = crt0.o +GDBLIB = m32r-lib.o +GDBSTUB = m32r-stub.o +EVASCRIPT = eva.ld +STUBSCRIPT = eva-stub.ld + +GENERIC_LIBOBJS = \ + chmod.o close.o exit.o fstat.o getpid.o isatty.o kill.o lseek.o \ + open.o raise.o read.o sbrk.o stat.o unlink.o utime.o write.o + +LIBOBJS = trap0.o $(GENERIC_LIBOBJS) +LIBGLOSS = libgloss.a + +MONLIBOBJS = trapmon0.o $(GENERIC_LIBOBJS) +MONLIBGLOSS = libmon.a +MONSPECS = mon.specs + +# Host specific makefile fragment comes in here. +@host_makefile_frag@ + +all: $(CRT0) $(LIBGLOSS) $(MONLIBGLOSS) $(GDBLIB) $(GDBSTUB) + +m32r-stub.o: $(srcdir)/$(MULTISRCTOP)../../gdb/m32r-stub.c + $(CC) -c $(CFLAGS) -o $@ $(srcdir)/$(MULTISRCTOP)../../gdb/m32r-stub.c + +libgloss.a: $(LIBOBJS) + $(AR) $(ARFLAGS) $@ $(LIBOBJS) + $(RANLIB) $@ + +libmon.a: $(MONLIBOBJS) + $(AR) $(ARFLAGS) $@ $(MONLIBOBJS) + $(RANLIB) $@ + +install: + $(INSTALL_DATA) $(CRT0) $(tooldir)/lib${MULTISUBDIR}/$(CRT0) + $(INSTALL_DATA) $(LIBGLOSS) $(tooldir)/lib${MULTISUBDIR}/$(LIBGLOSS) + $(INSTALL_DATA) $(MONLIBGLOSS) $(tooldir)/lib${MULTISUBDIR}/$(MONLIBGLOSS) + $(INSTALL_DATA) $(GDBLIB) $(tooldir)/lib${MULTISUBDIR}/$(GDBLIB) + $(INSTALL_DATA) $(GDBSTUB) $(tooldir)/lib${MULTISUBDIR}/$(GDBSTUB) + $(INSTALL_DATA) $(srcdir)/$(EVASCRIPT) $(tooldir)/lib/$(EVASCRIPT) + $(INSTALL_DATA) $(srcdir)/$(STUBSCRIPT) $(tooldir)/lib/$(STUBSCRIPT) + $(INSTALL_DATA) $(srcdir)/$(MONSPECS) $(tooldir)/lib/$(MONSPECS) + +clean mostlyclean: + rm -f *~ *.[oa] + +distclean maintainer-clean realclean: clean + rm -f Makefile config.status + +info doc: +install-info: +clean-info: + +Makefile: Makefile.in config.status @host_makefile_frag_path@ + $(SHELL) config.status + +config.status: configure + $(SHELL) config.status --recheck + +# to support SunOS VPATH +crt0.o: crt0.S +m32r-lib.o: m32r-lib.c +chmod.o: chmod.c +close.o: close.c +exit.o: exit.c +fstat.o: fstat.c +getpid.o: getpid.c +isatty.o: isatty.c +kill.o: kill.c +lseek.o: lseek.c +open.o: open.c +raise.o: raise.c +read.o: read.c +sbrk.o: sbrk.c +stat.o: stat.c +unlink.o: unlink.c +utime.o: utime.c +write.o: write.c +trap0.o: trap0.S +trapmon0.o: trapmon0.c diff --git a/libgloss/m32r/chmod.c b/libgloss/m32r/chmod.c new file mode 100644 index 0000000..14990d9 --- /dev/null +++ b/libgloss/m32r/chmod.c @@ -0,0 +1,10 @@ +#include <sys/types.h> +#include <sys/stat.h> +#include "syscall.h" +#include "eit.h" + +int +_chmod (const char *path, short mode) +{ + return TRAP0 (SYS_chmod, path, mode, 0); +} diff --git a/libgloss/m32r/close.c b/libgloss/m32r/close.c new file mode 100644 index 0000000..1e32da4 --- /dev/null +++ b/libgloss/m32r/close.c @@ -0,0 +1,10 @@ +#include <sys/types.h> +#include <sys/stat.h> +#include "syscall.h" +#include "eit.h" + +int +_close (int file) +{ + return TRAP0 (SYS_close, file, 0, 0); +} diff --git a/libgloss/m32r/configure b/libgloss/m32r/configure new file mode 100755 index 0000000..8424baa --- /dev/null +++ b/libgloss/m32r/configure @@ -0,0 +1,1110 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.10 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.10" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set LANG and LC_ALL to C if already set. +# These must not be set unconditionally because not all systems understand +# e.g. LANG=C (notably SCO). +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LANG+set}" = set; then LANG=C; export LANG; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=crt0.S + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' + +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + +if test "${enable_shared}" = "yes" ; then + echo "Shared libraries not supported for cross compiling, ignored" +fi + +if test "$srcdir" = "." ; then + if test "${with_target_subdir}" != "." ; then + libgloss_topdir="${srcdir}/${with_multisrctop}../../.." + else + libgloss_topdir="${srcdir}/${with_multisrctop}../.." + fi +else + libgloss_topdir="${srcdir}/../.." +fi +ac_aux_dir= +for ac_dir in $libgloss_topdir $srcdir/$libgloss_topdir; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $libgloss_topdir $srcdir/$libgloss_topdir" 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + + + +# Do some error checking and defaulting for the host and target type. +# The inputs are: +# configure --host=HOST --target=TARGET --build=BUILD NONOPT +# +# The rules are: +# 1. You are not allowed to specify --host, --target, and nonopt at the +# same time. +# 2. Host defaults to nonopt. +# 3. If nonopt is not specified, then host defaults to the current host, +# as determined by config.guess. +# 4. Target and build default to nonopt. +# 5. If nonopt is not specified, then target and build default to host. + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +case $host---$target---$nonopt in +NONE---*---* | *---NONE---* | *---*---NONE) ;; +*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;; +esac + + +# Make sure we can run config.sub. +if $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi + +echo $ac_n "checking host system type""... $ac_c" 1>&6 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`$ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`$ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + +echo $ac_n "checking target system type""... $ac_c" 1>&6 + +target_alias=$target +case "$target_alias" in +NONE) + case $nonopt in + NONE) target_alias=$host_alias ;; + *) target_alias=$nonopt ;; + esac ;; +esac + +target=`$ac_config_sub $target_alias` +target_cpu=`echo $target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` +target_vendor=`echo $target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` +target_os=`echo $target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` +echo "$ac_t""$target" 1>&6 + +echo $ac_n "checking build system type""... $ac_c" 1>&6 + +build_alias=$build +case "$build_alias" in +NONE) + case $nonopt in + NONE) build_alias=$host_alias ;; + *) build_alias=$nonopt ;; + esac ;; +esac + +build=`$ac_config_sub $build_alias` +build_cpu=`echo $build | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` +build_vendor=`echo $build | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` +build_os=`echo $build | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` +echo "$ac_t""$build" 1>&6 + +test "$host_alias" != "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + +if test "$program_transform_name" = s,x,x,; then + program_transform_name= +else + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed +s,\\,\\\\,g; s,\$,$$,g +EOF_SED + program_transform_name="`echo $program_transform_name|sed -f conftestsed`" + rm -f conftestsed +fi +test "$program_prefix" != NONE && + program_transform_name="s,^,${program_prefix},; $program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" + +# sed with no file args requires a program. +test "$program_transform_name" = "" && program_transform_name="s,x,x," + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + for ac_prog in ginstall installbsd scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + # OSF/1 installbsd also uses dspmsg, but is usable. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_ifs" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + ac_prog_rejected=no + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +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 $# -gt 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 + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <<EOF +#ifdef __GNUC__ + yes; +#endif +EOF +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:802: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 +if test $ac_cv_prog_gcc = yes; then + GCC=yes + if test "${CFLAGS+set}" != set; then + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_gcc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_gcc_g=yes +else + ac_cv_prog_gcc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_gcc_g" 1>&6 + if test $ac_cv_prog_gcc_g = yes; then + CFLAGS="-g -O" + else + CFLAGS="-O" + fi + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi + +AS=${AS-as} + +AR=${AR-ar} + +LD=${LD-ld} + +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +host_makefile_frag=${srcdir}/../config/default.mh + +host_makefile_frag_path=$host_makefile_frag + + + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1='\2'}/p" \ + >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs + + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS <<EOF +#! /bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.10" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS <<EOF + +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; + s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@host@%$host%g +s%@host_alias@%$host_alias%g +s%@host_cpu@%$host_cpu%g +s%@host_vendor@%$host_vendor%g +s%@host_os@%$host_os%g +s%@target@%$target%g +s%@target_alias@%$target_alias%g +s%@target_cpu@%$target_cpu%g +s%@target_vendor@%$target_vendor%g +s%@target_os@%$target_os%g +s%@build@%$build%g +s%@build_alias@%$build_alias%g +s%@build_cpu@%$build_cpu%g +s%@build_vendor@%$build_vendor%g +s%@build_os@%$build_os%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@CC@%$CC%g +s%@AS@%$AS%g +s%@AR@%$AR%g +s%@LD@%$LD%g +s%@RANLIB@%$RANLIB%g +s%@host_makefile_frag_path@%$host_makefile_frag_path%g +/@host_makefile_frag@/r $host_makefile_frag +s%@host_makefile_frag@%%g + +CEOF +EOF +cat >> $CONFIG_STATUS <<EOF + +CONFIG_FILES=\${CONFIG_FILES-"Makefile"} +EOF +cat >> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust relative srcdir, etc. for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" -f conftest.subs $ac_given_srcdir/$ac_file_in > $ac_file +fi; done +rm -f conftest.subs + +EOF +cat >> $CONFIG_STATUS <<EOF +srcdir=${srcdir} +target=${target} +ac_configure_args="${ac_configure_args} --enable-multilib" +CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} +libgloss_topdir=${libgloss_topdir} + +EOF +cat >> $CONFIG_STATUS <<\EOF +. ${libgloss_topdir}/config-ml.in +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + diff --git a/libgloss/m32r/configure.in b/libgloss/m32r/configure.in new file mode 100644 index 0000000..1e98698 --- /dev/null +++ b/libgloss/m32r/configure.in @@ -0,0 +1,51 @@ +dnl Process this file with autoconf to produce a configure script. +AC_PREREQ(2.5)dnl +AC_INIT(crt0.S) + +if test "${enable_shared}" = "yes" ; then + echo "Shared libraries not supported for cross compiling, ignored" +fi + +if test "$srcdir" = "." ; then + if test "${with_target_subdir}" != "." ; then + libgloss_topdir="${srcdir}/${with_multisrctop}../../.." + else + libgloss_topdir="${srcdir}/${with_multisrctop}../.." + fi +else + libgloss_topdir="${srcdir}/../.." +fi +AC_CONFIG_AUX_DIR($libgloss_topdir) + +AC_CANONICAL_SYSTEM +AC_ARG_PROGRAM + +AC_PROG_INSTALL + +AC_PROG_CC +AS=${AS-as} +AC_SUBST(AS) +AR=${AR-ar} +AC_SUBST(AR) +LD=${LD-ld} +AC_SUBST(LD) +AC_PROG_RANLIB + +host_makefile_frag=${srcdir}/../config/default.mh + +dnl We have to assign the same value to other variables because autoconf +dnl doesn't provide a mechanism to substitute a replacement keyword with +dnl arbitrary data or pathnames. +dnl +host_makefile_frag_path=$host_makefile_frag +AC_SUBST(host_makefile_frag_path) +AC_SUBST_FILE(host_makefile_frag) + +AC_OUTPUT(Makefile, +. ${libgloss_topdir}/config-ml.in, +srcdir=${srcdir} +target=${target} +ac_configure_args="${ac_configure_args} --enable-multilib" +CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} +libgloss_topdir=${libgloss_topdir} +) diff --git a/libgloss/m32r/crt0.S b/libgloss/m32r/crt0.S new file mode 100644 index 0000000..f60a1a6 --- /dev/null +++ b/libgloss/m32r/crt0.S @@ -0,0 +1,51 @@ + .text + .balign 4 + .global _start +_start: + + ld24 sp, _stack + ldi fp, #0 + +# Clear the BSS. Do it in two parts for efficiency: longwords first +# for most of it, then the remaining 0 to 3 bytes. + + seth r2, #shigh(__bss_start) + add3 r2, r2, #low(__bss_start); R2 = start of BSS + seth r3, #shigh(_end) + add3 r3, r3, #low(_end) ; R3 = end of BSS + 1 + + sub r3, r2 ; R3 = BSS size in bytes + mv r4, r3 + srli r4, #2 ; R4 = BSS size in longwords (rounded down) + ldi r1, #0 ; clear R1 for longword store + addi r2, #-4 ; account for pre-inc store + beqz r4, .Lendloop1 ; any more to go? +.Lloop1: + st r1, @+r2 ; yep, zero out another longword + addi r4, #-1 ; decrement count + bnez r4, .Lloop1 ; go do some more +.Lendloop1: + and3 r4, r3, #3 ; get no. of remaining BSS bytes to clear + addi r2, #4 ; account for pre-inc store + beqz r4, .Lendloop2 ; any more to go? +.Lloop2: + stb r1, @r2 ; yep, zero out another byte + addi r2, #1 ; bump address + addi r4, #-1 ; decrement count + bnez r4, .Lloop2 ; go do some more +.Lendloop2: + +# Run code in the .init section. +# This will queue the .fini section to be run with atexit. + + bl __init + +# Call main, then exit. + + bl main + bl exit + +# If that fails just loop. + +.Lexit: + bra .Lexit diff --git a/libgloss/m32r/eit.h b/libgloss/m32r/eit.h new file mode 100644 index 0000000..ef51c08 --- /dev/null +++ b/libgloss/m32r/eit.h @@ -0,0 +1,13 @@ +/* M32R libgloss EIT interface. + Copyright (C) 1998, Cygnus Solutions. + + At present we only document trap 0, the syscall interface. + In the future this can hold further EIT related stuff. + [The m32r manuals use the acronym EIT: exception, interrupt, trap.] */ + +#include <reent.h> + +int __trap0 (int function, int p1, int p2, int p3, struct _reent *r); + +#define TRAP0(f, p1, p2, p3) \ +__trap0 (f, (int) (p1), (int) (p2), (int) (p3), _REENT) diff --git a/libgloss/m32r/eva-stub.ld b/libgloss/m32r/eva-stub.ld new file mode 100644 index 0000000..34c341c --- /dev/null +++ b/libgloss/m32r/eva-stub.ld @@ -0,0 +1,111 @@ +OUTPUT_FORMAT("elf32-m32r", "elf32-m32r", + "elf32-m32r") +OUTPUT_ARCH(m32r) +ENTRY(_start) +/* Do we need any of these for elf? + __DYNAMIC = 0; */ + +INPUT(m32r-stub.o) +INPUT(m32r-lib.o) +INPUT(-lgloss) + +SECTIONS +{ + /* Read-only sections, merged into text segment: */ + . = 0x200000; + .interp : { *(.interp) } + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .rel.text : { *(.rel.text) } + .rela.text : { *(.rela.text) } + .rel.data : { *(.rel.data) } + .rela.data : { *(.rela.data) } + .rel.rodata : { *(.rel.rodata) } + .rela.rodata : { *(.rela.rodata) } + .rel.got : { *(.rel.got) } + .rela.got : { *(.rela.got) } + .rel.ctors : { *(.rel.ctors) } + .rela.ctors : { *(.rela.ctors) } + .rel.dtors : { *(.rel.dtors) } + .rela.dtors : { *(.rela.dtors) } + .rel.init : { *(.rel.init) } + .rela.init : { *(.rela.init) } + .rel.fini : { *(.rel.fini) } + .rela.fini : { *(.rela.fini) } + .rel.bss : { *(.rel.bss) } + .rela.bss : { *(.rela.bss) } + .rel.plt : { *(.rel.plt) } + .rela.plt : { *(.rela.plt) } + .init : { *(.init) } = 0 + .plt : { *(.plt) } + .text : + { + *(.text) + /* .gnu.warning sections are handled specially by elf32.em. */ + *(.gnu.warning) + *(.gnu.linkonce.t*) + } = 0 + _etext = .; + PROVIDE (etext = .); + .fini : { *(.fini) } = 0 + .rodata : { *(.rodata) *(.gnu.linkonce.r*) } + .rodata1 : { *(.rodata1) } + /* Adjust the address for the data segment. We want to adjust up to + the same address within the page on the next page up. */ + . = ALIGN(32) + (ALIGN(8) & (32 - 1)); + .data : + { + *(.data) + *(.gnu.linkonce.d*) + CONSTRUCTORS + } + .data1 : { *(.data1) } + .ctors : + { + *(.ctors) + } + .dtors : + { + *(.dtors) + } + .got : { *(.got.plt) *(.got) } + .dynamic : { *(.dynamic) } + /* We want the small data sections together, so single-instruction offsets + can access them all, and initialized data all before uninitialized, so + we can shorten the on-disk segment size. */ + .sdata : { *(.sdata) } + _edata = .; + PROVIDE (edata = .); + __bss_start = .; + .sbss : { *(.sbss) *(.scommon) } + .bss : + { + *(.dynbss) + *(.bss) + *(COMMON) + } + _end = . ; + PROVIDE (end = .); + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + /* DWARF debug sections. + Symbols in the .debug DWARF section are relative to the beginning of the + section so we begin .debug at 0. It's not clear yet what needs to happen + for the others. */ + .debug 0 : { *(.debug) } + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + .debug_sfnames 0 : { *(.debug_sfnames) } + .line 0 : { *(.line) } + .stack 0x207ffc : { _stack = .; *(.stack) } + /* These must appear regardless of . */ +} + diff --git a/libgloss/m32r/eva.ld b/libgloss/m32r/eva.ld new file mode 100644 index 0000000..ee66464 --- /dev/null +++ b/libgloss/m32r/eva.ld @@ -0,0 +1,97 @@ +OUTPUT_FORMAT("elf32-m32r", "elf32-m32r", + "elf32-m32r") +OUTPUT_ARCH(m32r) +ENTRY(_start) +/* Do we need any of these for elf? + __DYNAMIC = 0; */ + +INPUT(-lgloss) + +SECTIONS +{ + /* Read-only sections, merged into text segment: */ + . = 0x208000; + .interp : { *(.interp) } + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .rel.text : { *(.rel.text) } + .rela.text : { *(.rela.text) } + .rel.data : { *(.rel.data) } + .rela.data : { *(.rela.data) } + .rel.rodata : { *(.rel.rodata) } + .rela.rodata : { *(.rela.rodata) } + .rel.got : { *(.rel.got) } + .rela.got : { *(.rela.got) } + .rel.ctors : { *(.rel.ctors) } + .rela.ctors : { *(.rela.ctors) } + .rel.dtors : { *(.rel.dtors) } + .rela.dtors : { *(.rela.dtors) } + .rel.init : { *(.rel.init) } + .rela.init : { *(.rela.init) } + .rel.fini : { *(.rel.fini) } + .rela.fini : { *(.rela.fini) } + .rel.bss : { *(.rel.bss) } + .rela.bss : { *(.rela.bss) } + .rel.plt : { *(.rel.plt) } + .rela.plt : { *(.rela.plt) } + .init : { *(.init) } =0 + .plt : { *(.plt) } + .text : + { + *(.text) + /* .gnu.warning sections are handled specially by elf32.em. */ + *(.gnu.warning) + *(.gnu.linkonce.t*) + } =0 + _etext = .; + PROVIDE (etext = .); + .fini : { *(.fini) } =0 + .rodata : { *(.rodata) *(.gnu.linkonce.r*) } + .rodata1 : { *(.rodata1) } + /* Adjust the address for the data segment. We want to adjust up to + the same address within the page on the next page up. */ + . = ALIGN(32) + (ALIGN(8) & (32 - 1)); + .data : + { + *(.data) + *(.gnu.linkonce.d*) + CONSTRUCTORS + } + .data1 : { *(.data1) } + .ctors : { *(.ctors) } + .dtors : { *(.dtors) } + .got : { *(.got.plt) *(.got)} + .dynamic : { *(.dynamic) } + /* We want the small data sections together, so single-instruction offsets + can access them all, and initialized data all before uninitialized, so + we can shorten the on-disk segment size. */ + .sdata : { *(.sdata) } + _edata = .; + PROVIDE (edata = .); + __bss_start = .; + .sbss : { *(.sbss) *(.scommon) } + .bss : { *(.dynbss) *(.bss) *(COMMON) } + _end = . ; + PROVIDE (end = .); + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + /* DWARF debug sections. + Symbols in the .debug DWARF section are relative to the beginning of the + section so we begin .debug at 0. It's not clear yet what needs to happen + for the others. */ + .debug 0 : { *(.debug) } + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + .debug_sfnames 0 : { *(.debug_sfnames) } + .line 0 : { *(.line) } + .stack 0x5ffffc : { _stack = .; *(.stack) } + /* These must appear regardless of . */ +} diff --git a/libgloss/m32r/exit.c b/libgloss/m32r/exit.c new file mode 100644 index 0000000..5251f0d --- /dev/null +++ b/libgloss/m32r/exit.c @@ -0,0 +1,10 @@ +#include <sys/types.h> +#include <sys/stat.h> +#include "syscall.h" +#include "eit.h" + +void +_exit (n) +{ + TRAP0 (SYS_exit, n, 0, 0); +} diff --git a/libgloss/m32r/fstat.c b/libgloss/m32r/fstat.c new file mode 100644 index 0000000..1f91828 --- /dev/null +++ b/libgloss/m32r/fstat.c @@ -0,0 +1,11 @@ +#include <sys/types.h> +#include <sys/stat.h> +#include "syscall.h" +#include "eit.h" + +int +_fstat (int file, struct stat *st) +{ + st->st_mode = S_IFCHR; + return 0; +} diff --git a/libgloss/m32r/getpid.c b/libgloss/m32r/getpid.c new file mode 100644 index 0000000..ff6e902 --- /dev/null +++ b/libgloss/m32r/getpid.c @@ -0,0 +1,6 @@ + +int +_getpid (int n) +{ + return 1; +} diff --git a/libgloss/m32r/isatty.c b/libgloss/m32r/isatty.c new file mode 100644 index 0000000..bb5f2ac --- /dev/null +++ b/libgloss/m32r/isatty.c @@ -0,0 +1,8 @@ + +/* FIXME: can we not nuke the 10,000 copies of this function + and fudge things (which is all this function does) in _fstat? */ +int +isatty (int fd) +{ + return 1; +} diff --git a/libgloss/m32r/kill.c b/libgloss/m32r/kill.c new file mode 100644 index 0000000..d7aaee9 --- /dev/null +++ b/libgloss/m32r/kill.c @@ -0,0 +1,9 @@ +#include <sys/types.h> +#include <sys/stat.h> +#include "syscall.h" +#include "eit.h" + +_kill (n, m) +{ + return TRAP0 (SYS_exit, 0xdead, 0, 0); +} diff --git a/libgloss/m32r/lseek.c b/libgloss/m32r/lseek.c new file mode 100644 index 0000000..1fbb5d0 --- /dev/null +++ b/libgloss/m32r/lseek.c @@ -0,0 +1,10 @@ +#include <sys/types.h> +#include <sys/stat.h> +#include "syscall.h" +#include "eit.h" + +int +_lseek (int file, int ptr, int dir) +{ + return TRAP0 (SYS_lseek, file, ptr, dir); +} diff --git a/libgloss/m32r/m32r-lib.c b/libgloss/m32r/m32r-lib.c new file mode 100644 index 0000000..cad55f5 --- /dev/null +++ b/libgloss/m32r/m32r-lib.c @@ -0,0 +1,142 @@ +/* Stand-alone library for M32R-EVA board. + * + * Copyright (c) 1996, 1998 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +/* #define REVC to enable handling of the original RevC board, + which is no longer the default, nor is it supported. */ + +#ifndef REVC + +/* Serial I/O routines for MSA2000G01 board */ +#define UART_INCHAR_ADDR 0xff004009 +#define UART_OUTCHR_ADDR 0xff004007 +#define UART_STATUS_ADDR 0xff004002 + +#else + +/* Serial I/O routines for M32R-EVA board */ +#define UART_INCHAR_ADDR 0xff102013 +#define UART_OUTCHR_ADDR 0xff10200f +#define UART_STATUS_ADDR 0xff102006 + +#endif + +#define UART_INPUT_EMPTY 0x4 +#define UART_OUTPUT_EMPTY 0x1 + +static volatile char *rx_port = (unsigned char *) UART_INCHAR_ADDR; +static volatile char *tx_port = (char *) UART_OUTCHR_ADDR; +static volatile short *rx_status = (short *) UART_STATUS_ADDR; +static volatile short *tx_status = (short *) UART_STATUS_ADDR; + +static int +rx_rdy() +{ +#ifndef REVC + return (*rx_status & UART_INPUT_EMPTY); +#else + return !(*rx_status & UART_INPUT_EMPTY); +#endif +} + +static int +tx_rdy() +{ + return (*tx_status & UART_OUTPUT_EMPTY); +} + +static unsigned char +rx_uchar() +{ + return *rx_port; +} + +void +tx_char(char c) +{ + *tx_port = c; +} + +int +getDebugChar() +{ + while (!rx_rdy()) + ; + return rx_uchar(); +} + +void +putDebugChar(int c) +{ + while (!tx_rdy()) + ; + tx_char(c); +} + +void mesg(char *p) +{ + while (*p) + { + if (*p == '\n') + putDebugChar('\r'); + putDebugChar(*p++); + } +} + +void phex(long x) +{ + char buf[9]; + int i; + + buf[8] = '\0'; + for (i = 7; i >= 0; i--) + { + char c = x & 0x0f; + buf[i] = c < 10 ? c + '0' : c - 10 + 'A'; + x >>= 4; + } + mesg(buf); +} + +/* Setup trap TT to go to ROUTINE. */ + +void +exceptionHandler (int tt, unsigned long routine) +{ +#ifndef REVC + unsigned long *tb = (unsigned long *) 0x40; /* Trap vector base address */ + + tb[tt] = ((routine >> 2) | 0xff000000) - tt - (0x40 >> 2); +#else + unsigned long *tb = 0; /* Trap vector base address */ + + tb[tt] = ((routine >> 2) | 0xff000000) - tt; +#endif +} + +/* Return the address of trap TT handler */ + +unsigned long +getExceptionHandler (int tt) +{ +#ifndef REVC + unsigned long *tb = (unsigned long *) 0x40; /* Trap vector base address */ + + return ((tb[tt] + tt + (0x40 >> 2)) | 0xff000000) << 2; +#else + unsigned long *tb = 0; /* Trap vector base address */ + + return ((tb[tt] + tt) | 0xff000000) << 2; +#endif +} diff --git a/libgloss/m32r/mon.specs b/libgloss/m32r/mon.specs new file mode 100644 index 0000000..5db789a --- /dev/null +++ b/libgloss/m32r/mon.specs @@ -0,0 +1,3 @@ +*endfile_cpu: +-lmon %{m32rx:m32rx/crtfini.o%s} %{!m32rx:crtfini.o%s} + diff --git a/libgloss/m32r/open.c b/libgloss/m32r/open.c new file mode 100644 index 0000000..6671c29 --- /dev/null +++ b/libgloss/m32r/open.c @@ -0,0 +1,10 @@ +#include <sys/types.h> +#include <sys/stat.h> +#include "syscall.h" +#include "eit.h" + +int +_open (const char *path, int flags) +{ + return TRAP0 (SYS_open, path, flags, 0); +} diff --git a/libgloss/m32r/raise.c b/libgloss/m32r/raise.c new file mode 100644 index 0000000..b2dc2f6 --- /dev/null +++ b/libgloss/m32r/raise.c @@ -0,0 +1,5 @@ +/* ??? Needed? */ + +_raise () +{ +} diff --git a/libgloss/m32r/read.c b/libgloss/m32r/read.c new file mode 100644 index 0000000..0e32b74 --- /dev/null +++ b/libgloss/m32r/read.c @@ -0,0 +1,10 @@ +#include <sys/types.h> +#include <sys/stat.h> +#include "syscall.h" +#include "eit.h" + +int +_read (int file, char *ptr, int len) +{ + return TRAP0 (SYS_read, file, ptr, len); +} diff --git a/libgloss/m32r/sbrk.c b/libgloss/m32r/sbrk.c new file mode 100644 index 0000000..bc82091 --- /dev/null +++ b/libgloss/m32r/sbrk.c @@ -0,0 +1,34 @@ +#include <sys/types.h> +#include <sys/stat.h> +#include "syscall.h" +#include "eit.h" + +caddr_t +_sbrk (int incr) +{ + /* `_end' is defined in the linker script. + We must handle it carefully as we don't want the compiler to think + it lives in the small data area. Use medium model to ensure 32 bit + addressability. */ + extern char _end __attribute__ ((__model__(__medium__))); + static char *heap_end; + char *prev_heap_end; + char *sp = (char *)&sp; + + if (heap_end == 0) + { + heap_end = &_end; + } + prev_heap_end = heap_end; + if (heap_end > sp) + { + _write (1, "Heap and stack collision\n", 25); +#if 0 /* Calling abort brings in the signal handling code. */ + abort (); +#else + exit (1); +#endif + } + heap_end += incr; + return (caddr_t) prev_heap_end; +} diff --git a/libgloss/m32r/stat.c b/libgloss/m32r/stat.c new file mode 100644 index 0000000..eb4c8e3 --- /dev/null +++ b/libgloss/m32r/stat.c @@ -0,0 +1,11 @@ +#include <sys/types.h> +#include <sys/stat.h> +#include "syscall.h" +#include "eit.h" + +int +_stat (const char *path, struct stat *st) + +{ + return TRAP0 (SYS_stat, path, st, 0); +} diff --git a/libgloss/m32r/trap0.S b/libgloss/m32r/trap0.S new file mode 100644 index 0000000..04efa13 --- /dev/null +++ b/libgloss/m32r/trap0.S @@ -0,0 +1,16 @@ +; Trap 0 handler (syscall interface). +; +; The trap handler returns the result in r0 and the error code (errno value) +; in r2. r1 is reserved in case an 8 byte quantity ever needs to be +; returned in registers. + + .text + .global __trap0 +__trap0: + trap #0 ; trap 0 returns result in r0, error code in r2 + cmpui r2,#1 ; is error code zero? + bc .Lret ; yes, skip setting errno + ld r4,@(sp) ; no, set errno + st r2,@r4 +.Lret: + jmp lr ; return to caller diff --git a/libgloss/m32r/trapmon0.c b/libgloss/m32r/trapmon0.c new file mode 100644 index 0000000..44bf6a5 --- /dev/null +++ b/libgloss/m32r/trapmon0.c @@ -0,0 +1,53 @@ +/* + * Mon2000 Trap handler (syscall interface). + * + * This trap handler is linked into the mon2000 libgloss (libmon). + */ +#include <reent.h> +#include "syscall.h" + +int __trap0 (int function, int p1, int p2, int p3, struct _reent *r) +{ + int rc = 0; + + switch (function) { + case SYS_exit: + /* loop so GDB can't go past system exit call */ + while (1) { + asm volatile (" + ldi r0, #0 + trap #15 ; return control to Mon2000"); + } + break; + + case SYS_write: + { + int i; + + for( i=0; i<p3; i++ ) { + asm volatile (" + ldi r0, #2 + ldi r1, #15 ; load Ctrl-O (ASCII 15) + trap #15 ; write Ctrl-O for quoting purposes" ); + + asm volatile (" + ldi r0, #2 + ldb r1, %0 + trap #15 ; write character to console" + : /* no outputs */ + : "m" (((char*)p2)[i])); + } + + rc = p3; /* return number of chars written */ + break; + } + + default: + rc = 0; + break; + } + + return rc; +} + + diff --git a/libgloss/m32r/unlink.c b/libgloss/m32r/unlink.c new file mode 100644 index 0000000..14f741e --- /dev/null +++ b/libgloss/m32r/unlink.c @@ -0,0 +1,10 @@ +#include <sys/types.h> +#include <sys/stat.h> +#include "syscall.h" +#include "eit.h" + +int +_unlink () +{ + return -1; +} diff --git a/libgloss/m32r/utime.c b/libgloss/m32r/utime.c new file mode 100644 index 0000000..ea8da2f --- /dev/null +++ b/libgloss/m32r/utime.c @@ -0,0 +1,12 @@ +#include <sys/types.h> +#include <sys/stat.h> +#include "syscall.h" +#include "eit.h" + +int +_utime (path, times) + const char *path; + char *times; +{ + return TRAP0 (SYS_utime, path, times, 0); +} diff --git a/libgloss/m32r/write.c b/libgloss/m32r/write.c new file mode 100644 index 0000000..55be40c --- /dev/null +++ b/libgloss/m32r/write.c @@ -0,0 +1,10 @@ +#include <sys/types.h> +#include <sys/stat.h> +#include "syscall.h" +#include "eit.h" + +int +_write (int file, char *ptr, int len) +{ + return TRAP0 (SYS_write, file, ptr, len); +} diff --git a/libgloss/m68k/Makefile.in b/libgloss/m68k/Makefile.in new file mode 100644 index 0000000..528c265 --- /dev/null +++ b/libgloss/m68k/Makefile.in @@ -0,0 +1,255 @@ +# Copyright (c) 1995, 1996 Cygnus Support +# +# The authors hereby grant permission to use, copy, modify, distribute, +# and license this software and its documentation for any purpose, provided +# that existing copyright notices are retained in all copies and that this +# notice is included verbatim in any distributions. No written agreement, +# license, or royalty fee is required for any of the authorized uses. +# Modifications to this software may be copyrighted by their authors +# and need not follow the licensing terms described here, provided that +# the new terms are clearly indicated on the first page of each file where +# they apply. +# +# This currently works with Motorola's MVME135 and IDP m68k based +# target boards. +# + +VPATH = @srcdir@ +srcdir = @srcdir@ +objdir = . +srcroot = $(srcdir)/../.. +objroot = $(objdir)/../.. + +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +host_alias = @host_alias@ +target_alias = @target_alias@ +program_transform_name = @program_transform_name@ + +bindir = @bindir@ +libdir = @libdir@ +tooldir = $(exec_prefix)/$(target_alias) + +# Multilib support variables. +# TOP is used instead of MULTI{BUILD,SRC}TOP. +MULTIDIRS = +MULTISUBDIR = +MULTIDO = true +MULTICLEAN = true + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ + +SHELL = /bin/sh + +CC = @CC@ + +AS = @AS@ +AR = @AR@ +LD = @LD@ +RANLIB = @RANLIB@ +AR_FLAGS = qv + +OBJDUMP = `if [ -f ${objroot}/../binutils/objdump ] ; \ + then echo ${objroot}/../binutils/objdump ; \ + else t='$(program_transform_name)'; echo objdump | sed -e $$t ; fi` +OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \ + then echo ${objroot}/../binutils/objcopy ; \ + else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi` + +SCRIPTS = mvme162 mvme135 idp bcc + +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 + +CRT0 = crt0.o +# +# here's all the MVME135 target stuff +# +MVME_LDFLAGS= -L${srcdir} -Tmvme135.ld +MVME135_BSP= libmvme135.a +MVME162_BSP= libmvme162.a +#MVME135_OBJS= mvme.o +#MVME162_OBJS= mvme.o +# Uncomment the last two objects if you want to use the GDB stub. +# The stub is included "as is", and will likely take some hacking +# to work on your system. +MVME135_OBJS= cpu32bug.o # mvme-stub.o mvme135-asm.o +MVME162_OBJS= cpu32bug.o # mvme-stub.o mvme162lx-asm.o + + +# +# here's all the BCC target stuff +# +BCC_LDFLAGS= -L${srcdir} -Tbcc.ld +BCC_BSP= libbcc.a +BCC_OBJS= cpu32bug.o + +# +# here's all the IDP target stuff +# +IDP_LDFLAGS= -L${srcdir} -Tidp.ld +IDP_BSP= libidp.a +IDP_OBJS= leds.o idp-inbyte.o idp-outbyte.o mc68ec.o + +# +# here's all the DBUG target stuff +# +DBUG_BSP= libdbug.a +DBUG_OBJS= dbug-exit.o dbug-inbyte.o dbug-outbyte.o + +# Host specific makefile fragment comes in here. +@host_makefile_frag@ + +# +# 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. +# +all: ${CRT0} ${BCC_BSP} ${IDP_BSP} ${MVME135_BSP} ${MVME162_BSP} ${DBUG_BSP} + +# +# here's where we build the board support packages for each target +# +${BCC_BSP}: $(OBJS) ${BCC_OBJS} + ${AR} ${ARFLAGS} $@ $(OBJS) ${BCC_OBJS} + ${RANLIB} $@ + +${IDP_BSP}: $(OBJS) ${IDP_OBJS} + ${AR} ${ARFLAGS} $@ $(OBJS) ${IDP_OBJS} + ${RANLIB} $@ + +${DBUG_BSP}: $(OBJS) ${DBUG_OBJS} + ${AR} ${ARFLAGS} $@ $(OBJS) ${DBUG_OBJS} + ${RANLIB} $@ + +${MVME135_BSP}: $(OBJS) ${MVME135_OBJS} + ${AR} ${ARFLAGS} $@ $(OBJS) ${MVME135_OBJS} + ${RANLIB} $@ + +${MVME162_BSP}: $(OBJS) ${MVME162_OBJS} + ${AR} ${ARFLAGS} $@ $(OBJS) ${MVME162_OBJS} + ${RANLIB} $@ + +leds.o: ${srcdir}/leds.c + $(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $< + +idp-inbyte.o: ${srcdir}/idp-inbyte.c + $(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $< + +idp-outbyte.o: ${srcdir}/idp-outbyte.c + $(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $< + +mc68ec.o: ${srcdir}/mc68ec.c + $(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -c $< + +test.o: ${srcdir}/test.c + +# +# Make a simple test case to test the linker script, startup code, and +# I/O code +# +test: $(OBJS) idp-test.srec mvme135-test.srec bcc-test.srec \ + idp-test.dis mvme135-test.dis bcc-test.dis + @echo Done... + +# compile a fully linked binary. The -N option is for a.out, so the +# base address will be zero, rather than the default of 0x2020. The +# -Wl,-T*.ld is for the linker script. By using -Wl, the linker script +# is put on the proper place in the comand line for ld, and all the +# symbols will get fully resolved. + +idp-test.x: test.o ${CRT0} Makefile ${IDP_BSP} + ${CC} $(CFLAGS_FOR_TARGET) -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 $@ +idp-test.dis: idp-test.x + @rm -fr idp-test.dis + $(OBJDUMP) -d idp-test.x > $@ +idp-test: idp-test.srec idp-test.dis + +mvme135-test.x: test.o ${CRT0} ${srcdir}/mvme135.ld Makefile ${MVME135_BSP} + ${CC} -L${srcdir} -L${objdir} test.o -o $@ $(LDFLAGS_FOR_TARGET) \ + -N -Wl,-Tmvme135.ld -nostdlib +mvme135-test.srec: mvme135-test.x + $(OBJCOPY) -O srec mvme135-test.x $@ +mvme135-test.dis: mvme135-test.x + @rm -fr mvme135-test.dis + $(OBJDUMP) -d mvme135-test.x > $@ +mvme135-test: mvme135-test.srec mvme135-test.dis + +mvme162-test.x: test.o ${CRT0} ${srcdir}/mvme162.ld Makefile ${MVME162_BSP} + ${CC} -L${srcdir} -L${objdir} test.o -o $@ $(LDFLAGS_FOR_TARGET) \ + -N -Wl,-Tmvme162.ld -nostdlib +mvme162-test.srec: mvme162-test.x + $(OBJCOPY) -O srec mvme162-test.x $@ +mvme162-test.dis: mvme162-test.x + @rm -fr mvme162-test.dis + $(OBJDUMP) -d mvme162-test.x > $@ +mvme162-test: mvme162-test.srec mvme162-test.dis + +bcc-test.x: test.o ${CRT0} ${srcdir}/bcc.ld Makefile ${BCC_BSP} + ${CC} -L${srcdir} -L${objdir} test.o -o $@ $(LDFLAGS_FOR_TARGET) \ + -N -Wl,-Tbcc.ld -nostdlib +bcc-test.srec: bcc-test.x + $(OBJCOPY) -O srec bcc-test.x $@ +bcc-test.dis: bcc-test.x + @rm -fr bcc-test.dis + $(OBJDUMP) -d bcc-test.x > $@ +bcc-test: bcc-test.srec bcc-test.dis + +# a C++ test case +dtor.o: $(srcdir)/dtor.C + $(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -o $@ -c $< +dtor.dis: dtor.x + @rm -fr dtor.dis + $(OBJDUMP) -d dtor.x > $@ +dtor.x: dtor.o ${CRT0} ${srcdir}/mvme135.ld Makefile ${MVME135_BSP} + ${CC} -L${srcdir} -L${objdir} dtor.o -o $@ $(LIBS_FOR_TARGET) \ + -N -Wl,-Tmvme135.ld -nostdlib + + +.PHONY: install info dvi doc install-info clean-info +install: + $(INSTALL_PROGRAM) $(CRT0) $(tooldir)/lib${MULTISUBDIR}/$(CRT0) + # install BCC stuff + $(INSTALL_PROGRAM) $(BCC_BSP) $(tooldir)/lib${MULTISUBDIR}/$(BCC_BSP) + $(INSTALL_DATA) ${srcdir}/bcc.ld $(tooldir)/lib${MULTISUBDIR}/bcc.ld + # install IDP stuff + $(INSTALL_PROGRAM) $(IDP_BSP) $(tooldir)/lib${MULTISUBDIR}/$(IDP_BSP) + $(INSTALL_DATA) ${srcdir}/idp.ld $(tooldir)/lib${MULTISUBDIR}/idp.ld + # install MVME135 stuff + $(INSTALL_PROGRAM) $(MVME135_BSP) $(tooldir)/lib${MULTISUBDIR}/$(MVME135_BSP) + $(INSTALL_DATA) ${srcdir}/mvme135.ld $(tooldir)/lib${MULTISUBDIR}/mvme135.ld + # install MVME162lx stuff + $(INSTALL_PROGRAM) $(MVME162_BSP) $(tooldir)/lib${MULTISUBDIR}/$(MVME162_BSP) + $(INSTALL_DATA) ${srcdir}/mvme162.ld $(tooldir)/lib${MULTISUBDIR}/mvme162.ld + # install DBUG stuff + $(INSTALL_PROGRAM) $(DBUG_BSP) $(tooldir)/lib${MULTISUBDIR}/$(DBUG_BSP) + $(INSTALL_DATA) ${srcdir}/sbc5204.ld $(tooldir)/lib${MULTISUBDIR}/sbc5204.ld + $(INSTALL_DATA) ${srcdir}/sbc5206.ld $(tooldir)/lib${MULTISUBDIR}/sbc5206.ld + +# target specific makefile fragment comes in here. +@target_makefile_frag@ + +clean mostlyclean: + rm -f a.out core *.i *~ *.a *.o *-test *.srec *.dis *.x *.map + +distclean maintainer-clean realclean: clean + rm -f Makefile config.cache config.log config.status + +info dvi doc: +install-info: +clean-info: + +Makefile: Makefile.in config.status @host_makefile_frag_path@ @target_makefile_frag_path@ + $(SHELL) config.status + +config.status: configure + $(SHELL) config.status --recheck diff --git a/libgloss/m68k/README b/libgloss/m68k/README new file mode 100644 index 0000000..28b7c12 --- /dev/null +++ b/libgloss/m68k/README @@ -0,0 +1,8 @@ +Support for the mvme162 was written by: + + Technische Universitaet Berlin fax: +49.30.314 21 116 + Axel Nennker, FR 2-2 phone: +49.30.314 73 114 + Franklinstr. 28-29 e-mail: nennker@cs.tu-berlin.de + D-10587 Berlin World Wide Web: http://www.cs.tu-berlin.de/~nennker + Germany http://www.cs.tu-berlin.de/~gnat + diff --git a/libgloss/m68k/asm.h b/libgloss/m68k/asm.h new file mode 100644 index 0000000..035024a --- /dev/null +++ b/libgloss/m68k/asm.h @@ -0,0 +1,85 @@ +/* asm.h -- macros for m68k asm + * + * Copyright (c) 1995, 1996 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#if 0 +/* + * XXX __USER_LABEL_PREFIX__ and __REGISTER_PREFIX__ do not work on gcc 2.7.0-3 + * XXX The following ifdef magic fixes the problem but results in a warning + * XXX when compiling assembly code. + */ +#ifndef __USER_LABEL_PREFIX__ +/* #define __USER_LABEL_PREFIX__ "" /* no underscore for coff */ +#define __USER_LABEL_PREFIX__ _ /* leading underscore for aout */ +#endif + +#ifndef __REGISTER_PREFIX__ +#define __REGISTER_PREFIX__ /* never has anything prefixed */ +#endif +#endif + +/* + * some assemblers choke on '#' as an immediate value. As gcc can also + * use '&', use that in those cases. + */ +#ifndef __IMMEDIATE_PREFIX__ +#define __IMMEDIATE_PREFIX__ # +#endif + +/* ANSI concatenation macros. */ +#define CONCAT1(a, b) CONCAT2(a, b) +#define CONCAT2(a, b) a ## b + +/* use the right prefix for global labels. */ +#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__,x) + +/* use the right prefix for registers. */ +#define REG(x) CONCAT1 (__REGISTER_PREFIX__,x) + +/* use the right prefix for immediate values. */ +#define IMM(x) CONCAT1 (__IMMEDIATE_PREFIX__,x) + +/* use the right prefix for register names */ +#define d0 REG (d0) +#define d1 REG (d1) +#define d2 REG (d2) +#define d3 REG (d3) +#define d4 REG (d4) +#define d5 REG (d5) +#define d6 REG (d6) +#define d7 REG (d7) +#define a0 REG (a0) +#define a1 REG (a1) +#define a2 REG (a2) +#define a3 REG (a3) +#define a4 REG (a4) +#define a5 REG (a5) +#define a6 REG (a6) +#define a7 REG (a7) +#define fp REG (fp) +#define fp0 REG (fp0) +#define fp1 REG (fp1) +#define fp2 REG (fp2) +#define fp3 REG (fp3) +#define fp4 REG (fp4) +#define fp5 REG (fp5) +#define fp6 REG (fp6) +#define fp7 REG (fp7) +#define sp REG (sp) +#define usp REG (usp) +#define vbr REG (vbr) +#define sr REG (sr) +#define fpcr REG (fpcr) +#define fpsr REG (fpsr) +#define fpi REG (fpi) diff --git a/libgloss/m68k/bcc.ld b/libgloss/m68k/bcc.ld new file mode 100644 index 0000000..65f6441 --- /dev/null +++ b/libgloss/m68k/bcc.ld @@ -0,0 +1,127 @@ +STARTUP(crt0.o) +OUTPUT_ARCH(m68k) +/* Uncomment this if you want srecords. This is needed for a.out + * if you plan to use GDB. +OUTPUT_FORMAT(srec) + */ +SEARCH_DIR(.) +GROUP(-lbcc -lc -lgcc) +__DYNAMIC = 0; + +/* + * Setup the memory map of the M68332BCC Business Card Computer. + * stack grows down from high memory. + * + * The memory map look like this: + * +--------------------+ <- low memory + * | .text | + * | _etext | + * | ctor list | the ctor and dtor lists are for + * | dtor list | C++ support + * +--------------------+ + * | .data | initialized data goes here + * | _edata | + * +--------------------+ + * | .bss | + * | __bss_start | start of bss, cleared by crt0 + * | _end | start of heap, used by sbrk() + * +--------------------+ + * . . + * . . + * . . + * | __stack | top of stack + * +--------------------+ + */ +MEMORY +{ + ram (rwx) : ORIGIN = 0x3000, LENGTH = 0xd000 +} + +/* + * allocate the stack to be at the top of memory, since the stack + * grows down + */ + +PROVIDE (__stack = 0xd000); + +/* + * Initalize some symbols to be zero so we can reference them in the + * crt0 without core dumping. These functions are all optional, but + * we do this so we can have our crt0 always use them if they exist. + * This is so BSPs work better when using the crt0 installed with gcc. + * We have to initalize them twice, so we cover a.out (which prepends + * an underscore) and coff object file formats. + */ +PROVIDE (hardware_init_hook = 0); +PROVIDE (_hardware_init_hook = 0); +PROVIDE (software_init_hook = 0); +PROVIDE (_software_init_hook = 0); +/* + * stick everything in ram (of course) + */ +SECTIONS +{ + .text : + { + *(.text) + . = ALIGN(0x4); + __CTOR_LIST__ = .; + ___CTOR_LIST__ = .; + LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) + *(.ctors) + LONG(0) + __CTOR_END__ = .; + __DTOR_LIST__ = .; + ___DTOR_LIST__ = .; + LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) + *(.dtors) + LONG(0) + __DTOR_END__ = .; + *(.rodata) + *(.gcc_except_table) + + . = ALIGN(0x2); + __INIT_SECTION__ = . ; + LONG (0x4e560000) /* linkw %fp,#0 */ + *(.init) + SHORT (0x4e5e) /* unlk %fp */ + SHORT (0x4e75) /* rts */ + + __FINI_SECTION__ = . ; + LONG (0x4e560000) /* linkw %fp,#0 */ + *(.fini) + SHORT (0x4e5e) /* unlk %fp */ + SHORT (0x4e75) /* rts */ + + _etext = .; + *(.lit) + } > ram + + .data : + { + *(.shdata) + *(.data) + _edata = .; + } > ram + + .bss : + { + . = ALIGN(0x4); + __bss_start = . ; + *(.shbss) + *(.bss) + *(COMMON) + _end = ALIGN (0x8); + __end = _end; + } > ram + + .stab 0 (NOLOAD) : + { + *(.stab) + } + + .stabstr 0 (NOLOAD) : + { + *(.stabstr) + } +} diff --git a/libgloss/m68k/configure b/libgloss/m68k/configure new file mode 100755 index 0000000..3ebe855 --- /dev/null +++ b/libgloss/m68k/configure @@ -0,0 +1,1118 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.10 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.10" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set LANG and LC_ALL to C if already set. +# These must not be set unconditionally because not all systems understand +# e.g. LANG=C (notably SCO). +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LANG+set}" = set; then LANG=C; export LANG; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=crt0.S + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' + +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + +if test "${enable_shared}" = "yes" ; then + echo "Shared libraries not supported for cross compiling, ignored" +fi + +if test "$srcdir" = "." ; then + if test "${with_target_subdir}" != "." ; then + libgloss_topdir="${srcdir}/${with_multisrctop}../../.." + else + libgloss_topdir="${srcdir}/${with_multisrctop}../.." + fi +else + libgloss_topdir="${srcdir}/../.." +fi + +ac_aux_dir= +for ac_dir in $libgloss_topdir $srcdir/$libgloss_topdir; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $libgloss_topdir $srcdir/$libgloss_topdir" 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + + +# Do some error checking and defaulting for the host and target type. +# The inputs are: +# configure --host=HOST --target=TARGET --build=BUILD NONOPT +# +# The rules are: +# 1. You are not allowed to specify --host, --target, and nonopt at the +# same time. +# 2. Host defaults to nonopt. +# 3. If nonopt is not specified, then host defaults to the current host, +# as determined by config.guess. +# 4. Target and build default to nonopt. +# 5. If nonopt is not specified, then target and build default to host. + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +case $host---$target---$nonopt in +NONE---*---* | *---NONE---* | *---*---NONE) ;; +*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;; +esac + + +# Make sure we can run config.sub. +if $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi + +echo $ac_n "checking host system type""... $ac_c" 1>&6 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`$ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`$ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + +echo $ac_n "checking target system type""... $ac_c" 1>&6 + +target_alias=$target +case "$target_alias" in +NONE) + case $nonopt in + NONE) target_alias=$host_alias ;; + *) target_alias=$nonopt ;; + esac ;; +esac + +target=`$ac_config_sub $target_alias` +target_cpu=`echo $target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` +target_vendor=`echo $target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` +target_os=`echo $target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` +echo "$ac_t""$target" 1>&6 + +echo $ac_n "checking build system type""... $ac_c" 1>&6 + +build_alias=$build +case "$build_alias" in +NONE) + case $nonopt in + NONE) build_alias=$host_alias ;; + *) build_alias=$nonopt ;; + esac ;; +esac + +build=`$ac_config_sub $build_alias` +build_cpu=`echo $build | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` +build_vendor=`echo $build | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` +build_os=`echo $build | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` +echo "$ac_t""$build" 1>&6 + +test "$host_alias" != "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + +if test "$program_transform_name" = s,x,x,; then + program_transform_name= +else + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed +s,\\,\\\\,g; s,\$,$$,g +EOF_SED + program_transform_name="`echo $program_transform_name|sed -f conftestsed`" + rm -f conftestsed +fi +test "$program_prefix" != NONE && + program_transform_name="s,^,${program_prefix},; $program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" + +# sed with no file args requires a program. +test "$program_transform_name" = "" && program_transform_name="s,x,x," + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + for ac_prog in ginstall installbsd scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + # OSF/1 installbsd also uses dspmsg, but is usable. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_ifs" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + ac_prog_rejected=no + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +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 $# -gt 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 + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <<EOF +#ifdef __GNUC__ + yes; +#endif +EOF +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:802: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 +if test $ac_cv_prog_gcc = yes; then + GCC=yes + if test "${CFLAGS+set}" != set; then + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_gcc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_gcc_g=yes +else + ac_cv_prog_gcc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_gcc_g" 1>&6 + if test $ac_cv_prog_gcc_g = yes; then + CFLAGS="-g -O" + else + CFLAGS="-O" + fi + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi + +AS=${AS-as} + +AR=${AR-ar} + +LD=${LD-ld} + +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +host_makefile_frag=${srcdir}/../config/default.mh +target_makefile_frag=${srcdir}/../config/default.mt + +host_makefile_frag_path=$host_makefile_frag + + +target_makefile_frag_path=$target_makefile_frag + + + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1='\2'}/p" \ + >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs + + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS <<EOF +#! /bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.10" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS <<EOF + +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; + s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@host@%$host%g +s%@host_alias@%$host_alias%g +s%@host_cpu@%$host_cpu%g +s%@host_vendor@%$host_vendor%g +s%@host_os@%$host_os%g +s%@target@%$target%g +s%@target_alias@%$target_alias%g +s%@target_cpu@%$target_cpu%g +s%@target_vendor@%$target_vendor%g +s%@target_os@%$target_os%g +s%@build@%$build%g +s%@build_alias@%$build_alias%g +s%@build_cpu@%$build_cpu%g +s%@build_vendor@%$build_vendor%g +s%@build_os@%$build_os%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@CC@%$CC%g +s%@AS@%$AS%g +s%@AR@%$AR%g +s%@LD@%$LD%g +s%@RANLIB@%$RANLIB%g +s%@host_makefile_frag_path@%$host_makefile_frag_path%g +/@host_makefile_frag@/r $host_makefile_frag +s%@host_makefile_frag@%%g +s%@target_makefile_frag_path@%$target_makefile_frag_path%g +/@target_makefile_frag@/r $target_makefile_frag +s%@target_makefile_frag@%%g + +CEOF +EOF +cat >> $CONFIG_STATUS <<EOF + +CONFIG_FILES=\${CONFIG_FILES-"Makefile"} +EOF +cat >> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust relative srcdir, etc. for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" -f conftest.subs $ac_given_srcdir/$ac_file_in > $ac_file +fi; done +rm -f conftest.subs + +EOF +cat >> $CONFIG_STATUS <<EOF +srcdir=${srcdir} +target=${target} +ac_configure_args="${ac_configure_args} --enable-multilib" +CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} +libgloss_topdir=${libgloss_topdir} + +EOF +cat >> $CONFIG_STATUS <<\EOF +. ${libgloss_topdir}/config-ml.in +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + + diff --git a/libgloss/m68k/configure.in b/libgloss/m68k/configure.in new file mode 100644 index 0000000..1770226 --- /dev/null +++ b/libgloss/m68k/configure.in @@ -0,0 +1,68 @@ +# Copyright (c) 1995, 1996 Cygnus Support +# +# The authors hereby grant permission to use, copy, modify, distribute, +# and license this software and its documentation for any purpose, provided +# that existing copyright notices are retained in all copies and that this +# notice is included verbatim in any distributions. No written agreement, +# license, or royalty fee is required for any of the authorized uses. +# Modifications to this software may be copyrighted by their authors +# and need not follow the licensing terms described here, provided that +# the new terms are clearly indicated on the first page of each file where +# they apply. +# +# process this file with autoconf to produce a configure script. +AC_PREREQ(2.5)dnl +AC_INIT(crt0.S) + +if test "${enable_shared}" = "yes" ; then + echo "Shared libraries not supported for cross compiling, ignored" +fi + +if test "$srcdir" = "." ; then + if test "${with_target_subdir}" != "." ; then + libgloss_topdir="${with_multisrctop}../../.." + else + libgloss_topdir="${with_multisrctop}../.." + fi +else + libgloss_topdir="${srcdir}/../.." +fi + +AC_CONFIG_AUX_DIR($libgloss_topdir) +AC_CANONICAL_SYSTEM +AC_ARG_PROGRAM + +AC_PROG_INSTALL + +AC_PROG_CC +AS=${AS-as} +AC_SUBST(AS) +AR=${AR-ar} +AC_SUBST(AR) +LD=${LD-ld} +AC_SUBST(LD) +AC_PROG_RANLIB + +host_makefile_frag=${srcdir}/../config/default.mh +target_makefile_frag=${srcdir}/../config/default.mt + +dnl We have to assign the same value to other variables because autoconf +dnl doesn't provide a mechanism to substitute a replacement keyword with +dnl arbitrary data or pathnames. +dnl +host_makefile_frag_path=$host_makefile_frag +AC_SUBST(host_makefile_frag_path) +AC_SUBST_FILE(host_makefile_frag) +target_makefile_frag_path=$target_makefile_frag +AC_SUBST(target_makefile_frag_path) +AC_SUBST_FILE(target_makefile_frag) + +AC_OUTPUT(Makefile, +. ${libgloss_topdir}/config-ml.in, +srcdir=${srcdir} +target=${target} +ac_configure_args="${ac_configure_args} --enable-multilib" +CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} +libgloss_topdir=${libgloss_topdir} +) + diff --git a/libgloss/m68k/cpu32bug.S b/libgloss/m68k/cpu32bug.S new file mode 100644 index 0000000..39f31d4 --- /dev/null +++ b/libgloss/m68k/cpu32bug.S @@ -0,0 +1,118 @@ +/* + * cpu32bug.S -- board support for the CPU32BUG monitor. + * + * Copyright (c) 1995, 1996 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#include "asm.h" +#include "cpu32bug.h" + + .title "cpu32bug.S for m68k-coff" + + .text + .global SYM (_exit) + .global SYM (outln) + .global SYM (outbyte) + .global SYM (putDebugChar) + .global SYM (inbyte) + .global SYM (getDebugChar) + .global SYM (havebyte) + +/* + * _exit -- Exit from the application. Normally we cause a user trap + * to return to the ROM monitor for another run. + */ + .text + .align 2 +SYM (_exit): + link fp, IMM(0) + trap IMM(15) + .word RETURN + +/* + * inbyte -- get a byte from the serial port + * d0 - contains the byte read in + */ + .text + .align 2 +SYM (getDebugChar): /* symbol name used by m68k-stub */ +SYM (inbyte): + link fp, IMM(-8) + trap IMM(15) + .word INCHR + moveb sp@, d0 + extw d0 + extl d0 + unlk fp + rts + +/* + * outbyte -- sends a byte out the serial port + * d0 - contains the byte to be sent + */ + .text + .align 2 +SYM (putDebugChar): /* symbol name used by m68k-stub */ +SYM (outbyte): + link fp, IMM(-4) + moveb fp@(11), sp@ + trap IMM(15) + .word OUTCHR + unlk fp + rts + +/* + * outln -- sends a string of bytes out the serial port with a CR/LF + * a0 - contains the address of the string's first byte + * a1 - contains the address of the string's last byte + */ + .text + .align 2 +SYM (outln): + link fp, IMM(-8) + moveml a0/a1, sp@ + trap IMM(15) + .word OUTLN + unlk fp + rts + +/* + * outstr -- sends a string of bytes out the serial port without a CR/LF + * a0 - contains the address of the string's first byte + * a1 - contains the address of the string's last byte + */ + .text + .align 2 +SYM (outstr): + link fp, IMM(-8) + moveml a0/a1, sp@ + trap IMM(15) + .word OUTSTR + unlk fp + rts + +/* + * havebyte -- checks to see if there is a byte in the serial port, + * returns 1 if there is a byte, 0 otherwise. + */ + .text + .align 2 +SYM (havebyte): + trap IMM(15) + .word INSTAT + beqs empty + movel IMM(1), d0 + rts +empty: + movel IMM(0), d0 + rts diff --git a/libgloss/m68k/cpu32bug.h b/libgloss/m68k/cpu32bug.h new file mode 100644 index 0000000..583b1a9 --- /dev/null +++ b/libgloss/m68k/cpu32bug.h @@ -0,0 +1,35 @@ +/* + * These constants are for the M68332BCC's boot monitor. They + * are used with a TRAP 15 call to access the monitor's I/O routines. + * they must be in the word following the trap call. + */ + INCHR=0X0 + INSTAT=0X1 + INLN=0X2 + READSTR=0X3 + READLN=0X4 + CHKBRK=0X5 + + OUTCHR=0X20 + OUTSTR=0X21 + OUTLN=0X22 + WRITE=0X23 + WRITELN=0X24 + WRITDLN=0X25 + PCRLF=0X26 + ERASELN=0X27 + WRITD=0X28 + SNDBRK=0X29 + + TM_INI=0X40 + TM_STR0=0X41 + TM_RD=0X42 + DELAY=0X43 + + RETURN=0X63 + BINDEC=0X64 + + CHANGEV=0X67 + STRCMP=0X68 + MULU32=0X69 + DIVU32=0X6A diff --git a/libgloss/m68k/crt0.S b/libgloss/m68k/crt0.S new file mode 100644 index 0000000..cb78481 --- /dev/null +++ b/libgloss/m68k/crt0.S @@ -0,0 +1,143 @@ +/* + * crt0.S -- startup file for m68k-coff + * + * Copyright (c) 1995, 1996, 1998 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#include "asm.h" + + .title "crt0.S for m68k-coff" +#define STACKSIZE 0x4000 + +/* + * Define an empty environment. + */ + .data + .align 2 +SYM (environ): + .long 0 + + .align 2 + .text + +/* + * These symbols are defined in C code, so they need to always be + * named with SYM because of the difference between object file formats. + */ + +/* These are defined in C code. */ + .extern SYM (main) + .extern SYM (exit) + .extern SYM (hardware_init_hook) + .extern SYM (software_init_hook) + .extern SYM (atexit) + .extern SYM(__do_global_dtors) + +/* + * These values are set in the linker script, so they must be + * explicitly named here without SYM. + */ + .extern __stack + .extern __bss_start + .extern _end + +/* + * set things up so the application will run. This *must* be called start. + */ + .global SYM (start) + +SYM (start): + /* + * put any hardware init code here + */ + + /* See if user supplied their own stack (__stack != 0). If not, then + * default to using the value of %sp as set by the ROM monitor. + */ + movel IMM(__stack), a0 + cmpl IMM(0), a0 + jbeq 1f + movel a0, sp +1: + /* set up initial stack frame */ + link a6, IMM(-8) + +/* + * zero out the bss section. + */ + movel IMM(__bss_start), d1 + movel IMM(_end), d0 + cmpl d0, d1 + jbeq 3f + movl d1, a0 + subl d1, d0 + subql IMM(1), d0 +2: + clrb (a0)+ +#ifndef __mcf5200__ + dbra d0, 2b + clrw d0 + subql IMM(1), d0 + jbcc 2b +#else + subql IMM(1), d0 + jbpl 2b +#endif + +3: + +/* + * initialize target specific stuff. Only execute these + * functions it they exist. + */ + lea SYM (hardware_init_hook), a0 + cmpl IMM(0),a0 + jbeq 4f + jsr (a0) +4: + + lea SYM (software_init_hook), a0 + cmpl IMM(0),a0 + jbeq 5f + jsr (a0) +5: + +/* + * call the main routine from the application to get it going. + * main (argc, argv, environ) + * we pass argv as a pointer to NULL. + */ + +#ifdef ADD_DTORS + /* put __do_global_dtors in the atexit list so the destructors get run */ + movel IMM (SYM(__do_global_dtors)),(sp) + jsr SYM (atexit) +#endif + movel IMM (__FINI_SECTION__),(sp) + jsr SYM (atexit) + + jsr __INIT_SECTION__ + + pea 0 + pea SYM (environ) + pea sp@(4) + pea 0 + jsr SYM (main) + movel d0, sp@- + +/* + * drop down into exit incase the user doesn't. This should drop + * control back to the ROM monitor, if there is one. This calls the + * exit() from the C library so the C++ tables get cleaned up right. + */ + jsr SYM (exit) diff --git a/libgloss/m68k/dbug-exit.S b/libgloss/m68k/dbug-exit.S new file mode 100644 index 0000000..6baae8b --- /dev/null +++ b/libgloss/m68k/dbug-exit.S @@ -0,0 +1,29 @@ +/* + * dbug-exit.S -- + * + * Copyright (c) 1996 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#include "asm.h" + + .text + .global SYM (_exit) +/* + * _exit -- Exit from the application. Normally we cause a user trap + * to return to the ROM monitor for another run. + */ + .text + .align 2 +SYM (_exit): + moveql IMM(0),d0 + trap IMM(15) diff --git a/libgloss/m68k/dbug-inbyte.S b/libgloss/m68k/dbug-inbyte.S new file mode 100644 index 0000000..128c260 --- /dev/null +++ b/libgloss/m68k/dbug-inbyte.S @@ -0,0 +1,34 @@ +/* + * dbug-inbyte.S -- + * + * Copyright (c) 1996 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#include "asm.h" + + .text + .global SYM (inbyte) + .global SYM (getDebugChar) + +/* + * inbyte -- get a byte from the serial port + * d0 - contains the byte read in + */ + .text + .align 2 +SYM (getDebugChar): /* symbol name used by m68k-stub */ +SYM (inbyte): + movel IMM(0x10),d0 + trap IMM(15) + movel d1,d0 + rts diff --git a/libgloss/m68k/dbug-outbyte.S b/libgloss/m68k/dbug-outbyte.S new file mode 100644 index 0000000..9d0c864 --- /dev/null +++ b/libgloss/m68k/dbug-outbyte.S @@ -0,0 +1,34 @@ +/* + * dbug-outbyte.S -- + * + * Copyright (c) 1996 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#include "asm.h" + + .text + .global SYM (outbyte) + .global SYM (putDebugChar) + +/* + * outbyte -- sends a byte out the serial port + * d0 - contains the byte to be sent + */ + .text + .align 2 +SYM (putDebugChar): /* symbol name used by m68k-stub */ +SYM (outbyte): + movel sp@(4),d1 + movl IMM(0x13),d0 + trap IMM(15) + rts diff --git a/libgloss/m68k/dtor.C b/libgloss/m68k/dtor.C new file mode 100644 index 0000000..2cfcb46 --- /dev/null +++ b/libgloss/m68k/dtor.C @@ -0,0 +1,25 @@ +#include <stdio.h> + +extern "C" void print (char *, ...); + +class foo +{ +public: + foo () { print ("ctor\n"); } + ~foo () { print ("dtor\n"); } +}; + +foo x; + +main () +{ + outbyte ('&'); + outbyte ('@'); + outbyte ('$'); + outbyte ('%'); + print ("FooBar\r\n"); + + /* whew, we made it */ + print ("\r\nDone...\r\n"); + fflush(stdout); +} diff --git a/libgloss/m68k/idp-inbyte.c b/libgloss/m68k/idp-inbyte.c new file mode 100644 index 0000000..41db57f --- /dev/null +++ b/libgloss/m68k/idp-inbyte.c @@ -0,0 +1,41 @@ +/* idp-inbyte.c -- + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#include <_ansi.h> +#include "mc68681reg.h" + +/* + * The DUART is mapped into the IDP address space in an unusual + * manner. The mc68681 is an 8 bit device located on the least + * significant byte (byte0) of the data bus. Bytes 3, 2, and + * one have nothing in them and writes to these locations are + * not valid. + */ + +#define DUART_ADDR 0x00B00000 +#define READREG(x) (*((volatile char *) DUART_ADDR + (x * 4) + 3)) +#define WRITEREG(x, y) (*((char *) DUART_ADDR + (x * 4) + 3) = y) + +/* + * inbyte -- get a byte from the DUART RX buffer. This only reads + * from channel A + */ +char +_DEFUN_VOID (inbyte) +{ + while ((READREG (DUART_SRA) & 0x01) == 0x00) + ; + + return (READREG (DUART_RBA)); /* read the byte */ +} diff --git a/libgloss/m68k/idp-outbyte.c b/libgloss/m68k/idp-outbyte.c new file mode 100644 index 0000000..d09ae89 --- /dev/null +++ b/libgloss/m68k/idp-outbyte.c @@ -0,0 +1,42 @@ +/* idp-outbyte.c + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#include <_ansi.h> +#include "mc68681reg.h" + +/* + * The DUART is mapped into the IDP address space in an unusual + * manner. The mc68681 is an 8 bit device located on the least + * significant byte (byte0) of the data bus. Bytes 3, 2, and + * one have nothing in them and writes to these locations are + * not valid. + */ + +#define DUART_ADDR 0x00B00000 +#define READREG(x) (*((volatile char *) DUART_ADDR + (x * 4) + 3)) +#define WRITEREG(x, y) (*((char *) DUART_ADDR + (x * 4) + 3) = y) + +/* + * outbyte -- send a byte to the DUART buffer. This only sends + * to channel A. + */ +void +_DEFUN (outbyte, (byte), + char byte) +{ + while ((READREG (DUART_SRA) & 0x04) == 0x00) + ; + + WRITEREG (DUART_TBA, byte); /* write the byte */ +} diff --git a/libgloss/m68k/idp.ld b/libgloss/m68k/idp.ld new file mode 100644 index 0000000..db6d8c5 --- /dev/null +++ b/libgloss/m68k/idp.ld @@ -0,0 +1,146 @@ +STARTUP(crt0.o) +OUTPUT_ARCH(m68k) +/* Uncomment this if you want srecords. This is needed for a.out + * if you plan to use GDB. +OUTPUT_FORMAT(srec) + */ + +SEARCH_DIR(.) +GROUP(-lidp -lc -lgcc) +__DYNAMIC = 0; + +/* + * Setup the memory map of the MC68ec0x0 Board (IDP) + * stack grows down from high memory. This works for + * both the rom68k and the mon68k monitors. + * + * The memory map look like this: + * +--------------------+ <- low memory + * | .text | + * | _etext | + * | ctor list | the ctor and dtor lists are for + * | dtor list | C++ support + * +--------------------+ + * | .data | initialized data goes here + * | _edata | + * +--------------------+ + * | .bss | + * | __bss_start | start of bss, cleared by crt0 + * | _end | start of heap, used by sbrk() + * +--------------------+ + * . . + * . . + * . . + * | __stack | top of stack + * +--------------------+ + */ + +/* + * When the IDP is not remapped (see rom68k's MP command in the + * "M68EC0x0IDP Users Manual", the first 64K bytes are reserved; + * Otherwise the first 256K bytes are reserved. + * + * The following memory map describes a unmapped IDP w/2MB RAM. + */ + +MEMORY +{ + ram (rwx) : ORIGIN = 0x00010000, LENGTH = 2M-64K + rom0 : ORIGIN = 0x00800000, LENGTH = 1M + rom1 : ORIGIN = 0x00900000, LENGTH = 1M +} + +/* + * allocate the stack to be at the top of memory, since the stack + * grows down + */ + +PROVIDE (__stack = 2M - 8); + +/* + * Initalize some symbols to be zero so we can reference them in the + * crt0 without core dumping. These functions are all optional, but + * we do this so we can have our crt0 always use them if they exist. + * This is so BSPs work better when using the crt0 installed with gcc. + * We have to initalize them twice, so we cover a.out (which prepends + * an underscore) and coff object file formats. + */ +PROVIDE (hardware_init_hook = 0); +PROVIDE (_hardware_init_hook = 0); +PROVIDE (software_init_hook = 0); +PROVIDE (_software_init_hook = 0); +/* + * stick everything in ram (of course) + */ +SECTIONS +{ + .text : + { + CREATE_OBJECT_SYMBOLS + *(.text) + + . = ALIGN(0x4); + /* These are for running static constructors and destructors under ELF. */ + KEEP (*crtbegin.o(.ctors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + + *(.rodata) + + . = ALIGN(0x4); + *(.gcc_except_table) + + . = ALIGN(0x4); + *(.eh_frame) + + . = ALIGN(0x4); + __INIT_SECTION__ = . ; + LONG (0x4e560000) /* linkw %fp,#0 */ + *(.init) + SHORT (0x4e5e) /* unlk %fp */ + SHORT (0x4e75) /* rts */ + + . = ALIGN(0x4); + __FINI_SECTION__ = . ; + LONG (0x4e560000) /* linkw %fp,#0 */ + *(.fini) + SHORT (0x4e5e) /* unlk %fp */ + SHORT (0x4e75) /* rts */ + + _etext = .; + *(.lit) + } > ram + + .data : + { + *(.shdata) + *(.data) + _edata = .; + } > ram + + .bss : + { + . = ALIGN(0x4); + __bss_start = . ; + *(.shbss) + *(.bss) + *(COMMON) + _end = ALIGN (0x8); + __end = _end; + } > ram + + .stab 0 (NOLOAD) : + { + *(.stab) + } + + .stabstr 0 (NOLOAD) : + { + *(.stabstr) + } +} diff --git a/libgloss/m68k/leds.c b/libgloss/m68k/leds.c new file mode 100644 index 0000000..125ae8b --- /dev/null +++ b/libgloss/m68k/leds.c @@ -0,0 +1,81 @@ +/* + * leds.c -- control the led's on a Motorola mc68ec0x0 board. + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include "leds.h" + +void zylons(); +void led_putnum(); + +/* + * led_putnum -- print a hex number on the LED. the value of num must be a char with + * the ascii value. ie... number 0 is '0', a is 'a', ' ' (null) clears + * the led display. + * Setting the bit to 0 turns it on, 1 turns it off. + * the LED's are controlled by setting the right bit mask in the base + * address. + * The bits are: + * [d.p | g | f | e | d | c | b | a ] is the byte. + * + * The locations are: + * + * a + * ----- + * f | | b + * | g | + * ----- + * | | + * e | | c + * ----- + * d . d.p (decimal point) + */ +void +led_putnum ( num ) +char num; +{ + static unsigned char *leds = (unsigned char *)LED_ADDR; + static unsigned char num_bits [18] = { + 0xff, /* clear all */ + 0xc0, 0xf9, 0xa4, 0xb0, 0x99, 0x92, 0x82, 0xf8, 0x80, 0x98, /* numbers 0-9 */ + 0x98, 0x20, 0x3, 0x27, 0x21, 0x4, 0xe /* letters a-f */ + }; + + if (num >= '0' && num <= '9') + num = (num - '0') + 1; + + if (num >= 'a' && num <= 'f') + num = (num - 'a') + 12; + + if (num == ' ') + num = 0; + + *leds = num_bits[num]; +} + +/* + * zylons -- draw a rotating pattern. NOTE: this function never returns. + */ +void +zylons() +{ + unsigned char *leds = (unsigned char *)LED_ADDR; + unsigned char curled = 0xfe; + + while (1) + { + *leds = curled; + curled = (curled >> 1) | (curled << 7); + delay ( 200 ); + } +} diff --git a/libgloss/m68k/leds.h b/libgloss/m68k/leds.h new file mode 100644 index 0000000..919c381 --- /dev/null +++ b/libgloss/m68k/leds.h @@ -0,0 +1,36 @@ +/* leds.c -- control the led's on a Motorola mc68ec0x0 board. + * Written by rob@cygnus.com (Rob Savoye) + * + * Copyright (c) 1995, 1996 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#ifndef __LEDS_H__ +#define __LEDS_H__ + +#define LED_ADDR 0xd00003 +#define LED_0 ~0x1 +#define LED_1 ~0x2 +#define LED_2 ~0x4 +#define LED_3 ~0x8 +#define LED_4 ~0x10 +#define LED_5 ~0x20 +#define LED_6 ~0x40 +#define LED_7 ~0x80 +#define LEDS_OFF 0xff +#define LEDS_ON 0x0 + +#define FUDGE(x) ((x >= 0xa && x <= 0xf) ? (x + 'a') & 0x7f : (x + '0') & 0x7f) + +extern void led_putnum( char ); + +#endif /* __LEDS_H__ */ diff --git a/libgloss/m68k/mc68681reg.h b/libgloss/m68k/mc68681reg.h new file mode 100644 index 0000000..1d9d4ce --- /dev/null +++ b/libgloss/m68k/mc68681reg.h @@ -0,0 +1,43 @@ +/* mc68681reg.h -- Motorola mc68681 DUART register offsets. + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#define DUART_MR1A 0x00 /* Mode Register A */ +#define DUART_MR1A 0x00 /* Mode Register A */ +#define DUART_SRA 0x01 /* Status Register A */ +#define DUART_CSRA 0x01 /* Clock-Select Register A */ +#define DUART_CRA 0x02 /* Command Register A */ +#define DUART_RBA 0x03 /* Receive Buffer A */ +#define DUART_TBA 0x03 /* Transmit Buffer A */ +#define DUART_IPCR 0x04 /* Input Port Change Register */ +#define DUART_ACR 0x04 /* Auxiliary Control Register */ +#define DUART_ISR 0x05 /* Interrupt Status Register */ +#define DUART_IMR 0x05 /* Interrupt Mask Register */ +#define DUART_CUR 0x06 /* Counter Mode: current MSB */ +#define DUART_CTUR 0x06 /* Counter/Timer upper reg */ +#define DUART_CLR 0x07 /* Counter Mode: current LSB */ +#define DUART_CTLR 0x07 /* Counter/Timer lower reg */ +#define DUART_MR1B 0x08 /* Mode Register B */ +#define DUART_MR2B 0x08 /* Mode Register B */ +#define DUART_SRB 0x09 /* Status Register B */ +#define DUART_CSRB 0x09 /* Clock-Select Register B */ +#define DUART_CRB 0x0A /* Command Register B */ +#define DUART_RBB 0x0B /* Receive Buffer B */ +#define DUART_TBB 0x0B /* Transmit Buffer A */ +#define DUART_IVR 0x0C /* Interrupt Vector Register */ +#define DUART_IP 0x0D /* Input Port */ +#define DUART_OPCR 0x0D /* Output Port Configuration Reg. */ +#define DUART_STRTCC 0x0E /* Start-Counter command */ +#define DUART_OPRSET 0x0E /* Output Port Reg, SET bits */ +#define DUART_STOPCC 0x0F /* Stop-Counter command */ +#define DUART_OPRRST 0x0F /* Output Port Reg, ReSeT bits */ diff --git a/libgloss/m68k/mc68ec.c b/libgloss/m68k/mc68ec.c new file mode 100644 index 0000000..d5ee9b5 --- /dev/null +++ b/libgloss/m68k/mc68ec.c @@ -0,0 +1,48 @@ +/* mc68ec.c -- Low level support for the Motorola mc68ec0x0 board. + * Written by rob@cygnus.com (Rob Savoye) + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include <sys/types.h> +#include <sys/stat.h> +#include <_ansi.h> +#include <errno.h> +#include "leds.h" + +/* + * _exit -- exit the running program. We just cause an exception + * which makes the program return to the boot monitor + * prompt. It can be restarted from there. + */ +void +_DEFUN (_exit, (status), + int_status) +{ + /* Use `i' constraint to get proper immediate-operand syntax for + target assembler configuration. */ + asm ("trap %0" : : "i" (0)); /* seems to be a harmless vector number */ +} + +/* + * delay -- delay execution. This is an ugly hack. It should + * use the timer, but I'm waiting for docs. (sigh) + */ +void +_DEFUN (delay, (num), + int num) +{ + while (num--) + { + asm ("nop"); + } +} diff --git a/libgloss/m68k/mvme-stub.c b/libgloss/m68k/mvme-stub.c new file mode 100644 index 0000000..fbc4c61 --- /dev/null +++ b/libgloss/m68k/mvme-stub.c @@ -0,0 +1,734 @@ +unsigned long sp_ptr; +unsigned long pc_ptr; +int cnt; +#define UNWIND asm ("movel %/sp, %0" : "=g" (sp_ptr));\ + printf ("\n\t\t== Starting at 0x%x ==\n", sp_ptr);\ + for (cnt=4; cnt <=32; cnt+=4) {\ + printf ("+%d(0x%x): 0x%x\t\t-%d(0x%x): 0x%x\n",\ + cnt, (sp_ptr + cnt), *(unsigned long *)(sp_ptr + cnt),\ + cnt, (sp_ptr - cnt), *(unsigned long *)(sp_ptr - cnt)\ + ); }; fflush (stdout); + +/**************************************************************************** + + THIS SOFTWARE IS NOT COPYRIGHTED + + HP offers the following for use in the public domain. HP makes no + warranty with regard to the software or it's performance and the + user accepts the software "AS IS" with all faults. + + HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD + TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + +****************************************************************************/ + +/**************************************************************************** + * Header: remcom.c,v 1.34 91/03/09 12:29:49 glenne Exp $ + * + * Module name: remcom.c $ + * Revision: 1.34 $ + * Date: 91/03/09 12:29:49 $ + * Contributor: Lake Stevens Instrument Division$ + * + * Description: low level support for gdb debugger. $ + * + * Considerations: only works on target hardware $ + * + * Written by: Glenn Engel $ + * ModuleState: Experimental $ + * + * NOTES: See Below $ + * + * To enable debugger support, two things need to happen. One, a + * call to set_debug_traps() is necessary in order to allow any breakpoints + * or error conditions to be properly intercepted and reported to gdb. + * Two, a breakpoint needs to be generated to begin communication. This + * is most easily accomplished by a call to breakpoint(). Breakpoint() + * simulates a breakpoint by executing a trap #1. + * + * Some explanation is probably necessary to explain how exceptions are + * handled. When an exception is encountered the 68000 pushes the current + * program counter and status register onto the supervisor stack and then + * transfers execution to a location specified in it's vector table. + * The handlers for the exception vectors are hardwired to jmp to an address + * given by the relation: (exception - 256) * 6. These are decending + * addresses starting from -6, -12, -18, ... By allowing 6 bytes for + * each entry, a jsr, jmp, bsr, ... can be used to enter the exception + * handler. Using a jsr to handle an exception has an added benefit of + * allowing a single handler to service several exceptions and use the + * return address as the key differentiation. The vector number can be + * computed from the return address by [ exception = (addr + 1530) / 6 ]. + * The sole purpose of the routine _catchException is to compute the + * exception number and push it on the stack in place of the return address. + * The external function exceptionHandler() is + * used to attach a specific handler to a specific 68k exception. + * For 68020 machines, the ability to have a return address around just + * so the vector can be determined is not necessary because the '020 pushes an + * extra word onto the stack containing the vector offset + * + * Because gdb will sometimes write to the stack area to execute function + * calls, this program cannot rely on using the supervisor stack so it + * uses it's own stack area reserved in the int array remcomStack. + * + ************* + * + * The following gdb commands are supported: + * + * command function Return value + * + * g return the value of the CPU registers hex data or ENN + * G set the value of the CPU registers OK or ENN + * + * mAA..AA,LLLL Read LLLL bytes at address AA..AA hex data or ENN + * MAA..AA,LLLL: Write LLLL bytes at address AA.AA OK or ENN + * + * c Resume at current address SNN ( signal NN) + * cAA..AA Continue at address AA..AA SNN + * + * s Step one instruction SNN + * sAA..AA Step one instruction from AA..AA SNN + * + * k kill + * + * ? What was the last sigval ? SNN (signal NN) + * + * All commands and responses are sent with a packet which includes a + * checksum. A packet consists of + * + * $<packet info>#<checksum>. + * + * where + * <packet info> :: <characters representing the command or response> + * <checksum> :: < two hex digits computed as modulo 256 sum of <packetinfo>> + * + * When a packet is received, it is first acknowledged with either '+' or '-'. + * '+' indicates a successful transfer. '-' indicates a failed transfer. + * + * Example: + * + * Host: Reply: + * $m0,10#2a +$00010203040506070809101112131415#42 + * + ****************************************************************************/ + +#include <stdio.h> +#include <string.h> +#include <setjmp.h> +#include <_ansi.h> + +/************************************************************************ + * + * external low-level support routines + */ +typedef void (*ExceptionHook)(int); /* pointer to function with int parm */ +typedef void (*Function)(); /* pointer to a function */ + +extern int putDebugChar(); /* write a single character */ +extern char getDebugChar(); /* read and return a single char */ + +ExceptionHook exceptionHook; /* hook variable for errors/exceptions */ + +/************************/ +/* FORWARD DECLARATIONS */ +/************************/ +/** static void initializeRemcomErrorFrame PARAMS ((void)); **/ +static void _DEFUN_VOID (initializeRemcomErrorFrame); + +/************************************************************************/ +/* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/ +/* at least NUMREGBYTES*2 are needed for register packets */ +#define BUFMAX 400 + +static char initialized; /* boolean flag. != 0 means we've been initialized */ + +int remote_debug = 0; /*** Robs Thu Sep 24 22:18:51 PDT 1992 ***/ +/* debug > 0 prints ill-formed commands in valid packets & checksum errors */ + +static const char hexchars[]="0123456789abcdef"; + +/* there are 180 bytes of registers on a 68020 w/68881 */ +/* many of the fpa registers are 12 byte (96 bit) registers */ +#define NUMREGBYTES 180 +enum regnames {D0,D1,D2,D3,D4,D5,D6,D7, + A0,A1,A2,A3,A4,A5,A6,A7, + PS,PC, + FP0,FP1,FP2,FP3,FP4,FP5,FP6,FP7, + FPCONTROL,FPSTATUS,FPIADDR + }; + +typedef struct FrameStruct +{ + struct FrameStruct *previous; + int exceptionPC; /* pc value when this frame created */ + int exceptionVector; /* cpu vector causing exception */ + short frameSize; /* size of cpu frame in words */ + short sr; /* for 68000, this not always sr */ + int pc; + short format; + int fsaveHeader; + int morejunk[0]; /* exception frame, fp save... */ +} Frame; + +#define FRAMESIZE 500 +int gdbFrameStack[FRAMESIZE]; +Frame *lastFrame; + +/* + * these should not be static cuz they can be used outside this module + */ +int registers[NUMREGBYTES/4]; +int superStack; + +#define STACKSIZE 10000 +int remcomStack[STACKSIZE/sizeof(int)]; +int* stackPtr = &remcomStack[STACKSIZE/sizeof(int) - 1]; + +/* + * In many cases, the system will want to continue exception processing + * when a continue command is given. + * oldExceptionHook is a function to invoke in this case. + */ + +static ExceptionHook oldExceptionHook; + +/* the size of the exception stack on the 68020 varies with the type of + * exception. The following table is the number of WORDS used + * for each exception format. + */ +const short exceptionSize[] = { 4,4,6,4,4,4,4,4,29,10,16,46,12,4,4,4 }; + +/************* jump buffer used for setjmp/longjmp **************************/ +jmp_buf remcomEnv; + +#define BREAKPOINT() asm(" trap #1"); + +extern void _DEFUN_VOID (return_to_super); +extern void _DEFUN_VOID (return_to_user); +extern void _DEFUN_VOID (_catchException); + +void _returnFromException( Frame *frame ) +{ + /* if no passed in frame, use the last one */ + if (! frame) + { + frame = lastFrame; + frame->frameSize = 4; + frame->format = 0; + frame->fsaveHeader = -1; /* restore regs, but we dont have fsave info*/ + } + +#ifndef mc68020 + /* a 68000 cannot use the internal info pushed onto a bus error + * or address error frame when doing an RTE so don't put this info + * onto the stack or the stack will creep every time this happens. + */ + frame->frameSize=3; +#endif + + /* throw away any frames in the list after this frame */ + lastFrame = frame; + + frame->sr = registers[(int) PS]; + frame->pc = registers[(int) PC]; + + if (registers[(int) PS] & 0x2000) + { + /* return to supervisor mode... */ + return_to_super(); + } + else + { /* return to user mode */ + return_to_user(); + } +} + +int hex(ch) +char ch; +{ + if ((ch >= 'a') && (ch <= 'f')) return (ch-'a'+10); + if ((ch >= '0') && (ch <= '9')) return (ch-'0'); + if ((ch >= 'A') && (ch <= 'F')) return (ch-'A'+10); + return (-1); +} + + +/* scan for the sequence $<data>#<checksum> */ +void getpacket(buffer) +char * buffer; +{ + unsigned char checksum; + unsigned char xmitcsum; + int i; + int count; + char ch; + + if (remote_debug) { + printf("\nGETPACKET: sr=0x%x, pc=0x%x, sp=0x%x\n", + registers[ PS ], + registers[ PC ], + registers[ A7 ] + ); fflush (stdout); + UNWIND + } + + do { + /* wait around for the start character, ignore all other characters */ + while ((ch = getDebugChar()) != '$'); + checksum = 0; + xmitcsum = -1; + + count = 0; + + /* now, read until a # or end of buffer is found */ + while (count < BUFMAX) { + ch = getDebugChar(); + if (ch == '#') break; + checksum = checksum + ch; + buffer[count] = ch; + count = count + 1; + } + buffer[count] = 0; + + if (ch == '#') { + xmitcsum = hex(getDebugChar()) << 4; + xmitcsum += hex(getDebugChar()); + if ((remote_debug ) && (checksum != xmitcsum)) { + fprintf(stderr,"bad checksum. My count = 0x%x, sent=0x%x. buf=%s\n", + checksum,xmitcsum,buffer); + } + + if (checksum != xmitcsum) putDebugChar('-'); /* failed checksum */ + else { + putDebugChar('+'); /* successful transfer */ + /* if a sequence char is present, reply the sequence ID */ + if (buffer[2] == ':') { + putDebugChar( buffer[0] ); + putDebugChar( buffer[1] ); + /* remove sequence chars from buffer */ + count = strlen(buffer); + for (i=3; i <= count; i++) buffer[i-3] = buffer[i]; + } + } + } + } while (checksum != xmitcsum); + +} + +/* send the packet in buffer. The host get's one chance to read it. + This routine does not wait for a positive acknowledge. */ + +void putpacket(buffer) +char * buffer; +{ + unsigned char checksum; + int count; + char ch; + + /* $<packet info>#<checksum>. */ + /*** do {***/ + putDebugChar('$'); + checksum = 0; + count = 0; + + while (ch=buffer[count]) { + if (! putDebugChar(ch)) return; + checksum += ch; + count += 1; + } + + putDebugChar('#'); + putDebugChar(hexchars[checksum >> 4]); + putDebugChar(hexchars[checksum % 16]); + + if (remote_debug) { + printf("\nPUTPACKET: sr=0x%x, pc=0x%x, sp=0x%x\n", + registers[ PS ], + registers[ PC ], + registers[ A7 ] + ); fflush (stdout); + UNWIND + } + +/*** } while (getDebugChar() != '+'); ***/ +/** } while (1 == 0); (getDebugChar() != '+'); **/ + +} + +char remcomInBuffer[BUFMAX]; +char remcomOutBuffer[BUFMAX]; +static short error; + + +void debug_error(format, parm) +char * format; +char * parm; +{ + if (remote_debug) fprintf(stderr,format,parm); +} + +/* convert the memory pointed to by mem into hex, placing result in buf */ +/* return a pointer to the last char put in buf (null) */ +char* mem2hex(mem, buf, count) +char* mem; +char* buf; +int count; +{ + int i; + unsigned char ch; + for (i=0;i<count;i++) { + ch = *mem++; + *buf++ = hexchars[ch >> 4]; + *buf++ = hexchars[ch % 16]; + } + *buf = 0; + return(buf); +} + +/* convert the hex array pointed to by buf into binary to be placed in mem */ +/* return a pointer to the character AFTER the last byte written */ +char* hex2mem(buf, mem, count) +char* buf; +char* mem; +int count; +{ + int i; + unsigned char ch; + for (i=0;i<count;i++) { + ch = hex(*buf++) << 4; + ch = ch + hex(*buf++); + *mem++ = ch; + } + return(mem); +} + +/* a bus error has occurred, perform a longjmp + to return execution and allow handling of the error */ + +void handle_buserror() +{ + longjmp(remcomEnv,1); +} + +/* this function takes the 68000 exception number and attempts to + translate this number into a unix compatible signal value */ +int computeSignal( exceptionVector ) +int exceptionVector; +{ + int sigval; + switch (exceptionVector) { + case 2 : sigval = 10; break; /* bus error */ + case 3 : sigval = 10; break; /* address error */ + case 4 : sigval = 4; break; /* illegal instruction */ + case 5 : sigval = 8; break; /* zero divide */ + case 6 : sigval = 16; break; /* chk instruction */ + case 7 : sigval = 16; break; /* trapv instruction */ + case 8 : sigval = 11; break; /* privilege violation */ + case 9 : sigval = 5; break; /* trace trap */ + case 10: sigval = 4; break; /* line 1010 emulator */ + case 11: sigval = 4; break; /* line 1111 emulator */ + case 13: sigval = 8; break; /* floating point err */ + case 31: sigval = 2; break; /* interrupt */ + case 33: sigval = 5; break; /* breakpoint */ + case 40: sigval = 8; break; /* floating point err */ + case 48: sigval = 8; break; /* floating point err */ + case 49: sigval = 8; break; /* floating point err */ + case 50: sigval = 8; break; /* zero divide */ + case 51: sigval = 8; break; /* underflow */ + case 52: sigval = 8; break; /* operand error */ + case 53: sigval = 8; break; /* overflow */ + case 54: sigval = 8; break; /* NAN */ + default: + sigval = 7; /* "software generated"*/ + } + return (sigval); +} + +/**********************************************/ +/* WHILE WE FIND NICE HEX CHARS, BUILD AN INT */ +/* RETURN NUMBER OF CHARS PROCESSED */ +/**********************************************/ +int hexToInt(char **ptr, int *intValue) +{ + int numChars = 0; + int hexValue; + + *intValue = 0; + + while (**ptr) + { + hexValue = hex(**ptr); + if (hexValue >=0) + { + *intValue = (*intValue <<4) | hexValue; + numChars ++; + } + else + break; + + (*ptr)++; + } + + return (numChars); +} + +/* + * This function does all command procesing for interfacing to gdb. + */ +void handle_exception(int exceptionVector) +{ + int sigval; + int addr, length; + char * ptr; + int newPC; + Frame *frame; + + if (remote_debug) printf("\nHANDLE_EXCEPTION: vector=%d, sr=0x%x, pc=0x%x, sp=0x%x\n", + exceptionVector, + registers[ PS ], + registers[ PC ], + registers[ A7 ] + ); fflush (stdout); + + /* reply to host that an exception has occurred */ + sigval = computeSignal( exceptionVector ); + remcomOutBuffer[0] = 'S'; + remcomOutBuffer[1] = hexchars[sigval >> 4]; + remcomOutBuffer[2] = hexchars[sigval % 16]; + remcomOutBuffer[3] = 0; + + putpacket(remcomOutBuffer); + + while (1==1) { + error = 0; + remcomOutBuffer[0] = 0; + getpacket(remcomInBuffer); + switch (remcomInBuffer[0]) { + case '?' : remcomOutBuffer[0] = 'S'; + remcomOutBuffer[1] = hexchars[sigval >> 4]; + remcomOutBuffer[2] = hexchars[sigval % 16]; + remcomOutBuffer[3] = 0; + break; + case 'd' : remote_debug = !(remote_debug); /* toggle debug flag */ + break; + case 'g' : /* return the value of the CPU registers */ + mem2hex((char*) registers, remcomOutBuffer, NUMREGBYTES); + break; + case 'G' : /* set the value of the CPU registers - return OK */ + hex2mem(&remcomInBuffer[1], (char*) registers, NUMREGBYTES); + strcpy(remcomOutBuffer,"OK"); + break; + + /* mAA..AA,LLLL Read LLLL bytes at address AA..AA */ + case 'm' : + if (setjmp(remcomEnv) == 0) + { + exceptionHandler(2,handle_buserror); + + /* TRY TO READ %x,%x. IF SUCCEED, SET PTR = 0 */ + ptr = &remcomInBuffer[1]; + if (hexToInt(&ptr,&addr)) + if (*(ptr++) == ',') + if (hexToInt(&ptr,&length)) + { + ptr = 0; + mem2hex((char*) addr, remcomOutBuffer, length); + } + + if (ptr) + { + strcpy(remcomOutBuffer,"E01"); + debug_error("malformed read memory command: %s",remcomInBuffer); + } + } + else { + exceptionHandler(2,_catchException); + strcpy(remcomOutBuffer,"E03"); + debug_error("bus error"); + } + + /* restore handler for bus error */ + exceptionHandler(2,_catchException); + break; + + /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */ + case 'M' : + if (setjmp(remcomEnv) == 0) { + exceptionHandler(2,handle_buserror); + + /* TRY TO READ '%x,%x:'. IF SUCCEED, SET PTR = 0 */ + ptr = &remcomInBuffer[1]; + if (hexToInt(&ptr,&addr)) + if (*(ptr++) == ',') + if (hexToInt(&ptr,&length)) + if (*(ptr++) == ':') + { + hex2mem(ptr, (char*) addr, length); + ptr = 0; + strcpy(remcomOutBuffer,"OK"); + } + if (ptr) + { + strcpy(remcomOutBuffer,"E02"); + debug_error("malformed write memory command: %s",remcomInBuffer); + } + } + else { + exceptionHandler(2,_catchException); + strcpy(remcomOutBuffer,"E03"); + debug_error("bus error"); + } + + /* restore handler for bus error */ + exceptionHandler(2,_catchException); + break; + + /* cAA..AA Continue at address AA..AA(optional) */ + /* sAA..AA Step one instruction from AA..AA(optional) */ + case 'c' : + case 's' : + /* try to read optional parameter, pc unchanged if no parm */ + ptr = &remcomInBuffer[1]; + if (hexToInt(&ptr,&addr)) + registers[ PC ] = addr; + + newPC = registers[ PC]; + + /* clear the trace bit */ + registers[ PS ] &= 0x7fff; + + /* set the trace bit if we're stepping */ + if (remcomInBuffer[0] == 's') registers[ PS ] |= 0x8000; + + /* + * look for newPC in the linked list of exception frames. + * if it is found, use the old frame it. otherwise, + * fake up a dummy frame in returnFromException(). + */ + if (remote_debug) printf("new pc = 0x%x\n",newPC); + frame = lastFrame; + while (frame) + { + if (remote_debug) + printf("frame at 0x%x has pc=0x%x, except#=%d\n", + frame,frame->exceptionPC, + frame->exceptionVector); + if (frame->exceptionPC == newPC) break; /* bingo! a match */ + /* + * for a breakpoint instruction, the saved pc may + * be off by two due to re-executing the instruction + * replaced by the trap instruction. Check for this. + */ + if ((frame->exceptionVector == 33) && + (frame->exceptionPC == (newPC+2))) break; + if (frame == frame->previous) + { + frame = 0; /* no match found */ + break; + } + frame = frame->previous; + } + + /* + * If we found a match for the PC AND we are not returning + * as a result of a breakpoint (33), + * trace exception (9), nmi (31), jmp to + * the old exception handler as if this code never ran. + */ + if (frame) + { + if ((frame->exceptionVector != 9) && + (frame->exceptionVector != 31) && + (frame->exceptionVector != 33)) + { + /* + * invoke the previous handler. + */ + if (oldExceptionHook) + (*oldExceptionHook) (frame->exceptionVector); + newPC = registers[ PC ]; /* pc may have changed */ + if (newPC != frame->exceptionPC) + { + if (remote_debug) + printf("frame at 0x%x has pc=0x%x, except#=%d\n", + frame,frame->exceptionPC, + frame->exceptionVector); + /* re-use the last frame, we're skipping it (longjump?)*/ + frame = (Frame *) 0; + _returnFromException( frame ); /* this is a jump */ + } + } + } + + /* if we couldn't find a frame, create one */ + if (frame == 0) + { + frame = lastFrame -1 ; + + /* by using a bunch of print commands with breakpoints, + it's possible for the frame stack to creep down. If it creeps + too far, give up and reset it to the top. Normal use should + not see this happen. + */ + if ((unsigned int) (frame-2) < (unsigned int) &gdbFrameStack) + { + initializeRemcomErrorFrame(); + frame = lastFrame; + } + frame->previous = lastFrame; + lastFrame = frame; + frame = 0; /* null so _return... will properly initialize it */ + } + + _returnFromException( frame ); /* this is a jump */ + + break; + + /* kill the program */ + case 'k' : /* do nothing */ + break; + } /* switch */ + + /* reply to the request */ + putpacket(remcomOutBuffer); + } +} + + +void initializeRemcomErrorFrame() +{ + lastFrame = ((Frame *) &gdbFrameStack[FRAMESIZE-1]) - 1; + lastFrame->previous = lastFrame; +} + +/* this function is used to set up exception handlers for tracing and + breakpoints */ +void set_debug_traps() +{ +extern void _debug_level7(); +extern void remcomHandler(); +int exception; + + initializeRemcomErrorFrame(); + stackPtr = &remcomStack[STACKSIZE/sizeof(int) - 1]; + + setup_vectors(); + + if (oldExceptionHook != remcomHandler) + { + oldExceptionHook = exceptionHook; + exceptionHook = remcomHandler; + } + + initialized = 1; + +} +/* This function will generate a breakpoint exception. It is used at the + beginning of a program to sync up with a debugger and can be used + otherwise as a quick means to stop program execution and "break" into + the debugger. */ + +void breakpoint() +{ + if (initialized) BREAKPOINT(); +} diff --git a/libgloss/m68k/mvme.S b/libgloss/m68k/mvme.S new file mode 100644 index 0000000..d2ab37f --- /dev/null +++ b/libgloss/m68k/mvme.S @@ -0,0 +1,155 @@ +/* mvme.S -- board support for m68k + * + * Copyright (c) 1995, 1996 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#include "asm.h" + + .title "mvme.S for m68k-coff" + + .align 2 + .text + .global SYM (_exit) + .global SYM (outln) + .global SYM (outbyte) + .global SYM (putDebugChar) + .global SYM (inbyte) + .global SYM (getDebugChar) + .global SYM (havebyte) + .global SYM (exceptionHandler) + + .set vbr_size, 0x400 + .comm SYM (vbr_table), vbr_size + +/* + * _exit -- Exit from the application. Normally we cause a user trap + * to return to the ROM monitor for another run. + */ +SYM (_exit): + unlk a6 + trap IMM(15) + .word return + + .align 2 + +/* + * inbyte -- get a byte from the serial port + * d0 - contains the byte read in + */ + .align 2 +SYM (getDebugChar): /* symbol name used by m68k-stub */ +SYM (inbyte): + link a6, IMM(-8) + trap IMM(15) + .word inchr + moveb sp@, d0 + extw d0 + extl d0 + unlk a6 + rts + +/* + * outbyte -- sends a byte out the serial port + * d0 - contains the byte to be sent + */ + .align 2 +SYM (putDebugChar): /* symbol name used by m68k-stub */ +SYM (outbyte): + link fp, IMM(-4) + moveb fp@(11), sp@ + trap IMM(15) + .word outchr + unlk fp + rts + +/* + * outln -- sends a string of bytes out the serial port with a CR/LF + * a0 - contains the address of the string's first byte + * a1 - contains the address of the string's last byte + */ + .align 2 +SYM (outln): + link a6, IMM(-8) + moveml a0/a1, sp@ + trap IMM(15) + .word outln + unlk a6 + rts + +/* + * outstr -- sends a string of bytes out the serial port without a CR/LF + * a0 - contains the address of the string's first byte + * a1 - contains the address of the string's last byte + */ + .align 2 +SYM (outstr): + link a6, IMM(-8) + moveml a0/a1, sp@ + trap IMM(15) + .word outstr + unlk a6 + rts + +/* + * havebyte -- checks to see if there is a byte in the serial port, + * returns 1 if there is a byte, 0 otherwise. + */ +SYM (havebyte): + trap IMM(15) + .word instat + beqs empty + movel IMM(1), d0 + rts +empty: + movel IMM(0), d0 + rts + +/* + * These constants are for the MVME-135 board's boot monitor. They + * are used with a TRAP 15 call to access the monitor's I/O routines. + * they must be in the word following the trap call. + */ + .set inchr, 0x0 + .set instat, 0x1 + .set inln, 0x2 + .set readstr, 0x3 + .set readln, 0x4 + .set chkbrk, 0x5 + + .set outchr, 0x20 + .set outstr, 0x21 + .set outln, 0x22 + .set write, 0x23 + .set writeln, 0x24 + .set writdln, 0x25 + .set pcrlf, 0x26 + .set eraseln, 0x27 + .set writd, 0x28 + .set sndbrk, 0x29 + + .set tm_ini, 0x40 + .set dt_ini, 0x42 + .set tm_disp, 0x43 + .set tm_rd, 0x44 + + .set redir, 0x60 + .set redir_i, 0x61 + .set redir_o, 0x62 + .set return, 0x63 + .set bindec, 0x64 + + .set changev, 0x67 + .set strcmp, 0x68 + .set mulu32, 0x69 + .set divu32, 0x6A + .set chk_sum, 0x6B diff --git a/libgloss/m68k/mvme135-asm.S b/libgloss/m68k/mvme135-asm.S new file mode 100644 index 0000000..1722c18 --- /dev/null +++ b/libgloss/m68k/mvme135-asm.S @@ -0,0 +1,397 @@ +/* + * mvme135-asm.S -- assembler routines for the MVME stub. + * + * This code was pulled out of mvme135-stub.c by Ian Taylor so that I + * could handle different register and label prefixes in a sensible + * way. + */ + +/**************************************************************************** + + THIS SOFTWARE IS NOT COPYRIGHTED + + HP offers the following for use in the public domain. HP makes no + warranty with regard to the software or it's performance and the + user accepts the software "AS IS" with all faults. + + HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD + TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + +****************************************************************************/ + +#include "asm.h" + + .title "mvme135-asm.S for m68k" + + .globl SYM (registers) + .globl SYM (lastFrame) + .globl SYM (superStack) + .globl SYM (exceptionHook) + .globl SYM (_returnFromException) + .globl SYM (stackPtr) + .globl SYM (handle_exception) + .globl SYM (exceptionSize) + .globl SYM (exceptionHandler) + +.text + + +/* + * Create a new exception vector table and populates it. Vectors from the + * boot monitor are spliced in so I/O and the abort button will continue + * to work. We also use the monitor's generalized vector for anything the + * debugger doesn't want. + */ + .global SYM (setup_vectors) +SYM (setup_vectors): + link fp, IMM (-8) + /* copy monitor vector table */ + + movecl vbr, a0 + lea SYM (vbr_table), a1 + movel 0x8(a0), d0 /* get generalized vector */ + movew IMM (0x3fc), d1 /* load vector count */ + +loop: /* fill table to gen. vector */ + movel d0, (a1,d1) + subqw IMM (4), d1 + bne loop + + movel 0x10(a0), 0x10(a1) /* breakpoint */ + movel 0x24(a0), 0x24(a1) /* trace */ + movel 0xbc(a0), 0xbc(a1) /* system call */ + + /* add stub vectors to table */ + movel SYM (_catchException), 0x8(a1) /* vector = 2, Access Fault */ + movel SYM (_catchException), 0xc(a1) /* vector = 3, Address Error */ + movel SYM (_catchException), 0x10(a1) /* vector = 4, Illegal instruction */ + movel SYM (_catchException), 0x14(a1) /* vector = 5, divide by 0 */ + movel SYM (_catchException), 0x18(a1) /* vector = 6, chk, chk2 instruction */ + movel SYM (_catchException), 0x1c(a1) /* vector = 7, ftrap, trap, trapv ins */ + movel SYM (_catchException), 0x20(a1) /* vector = 8, priviledge violation */ + movel SYM (_catchException), 0x24(a1) /* vector = 9, trace */ + movel SYM (_catchException), 0x28(a1) /* vector = 10, Aline opcode */ + movel SYM (_catchException), 0x2c(a1) /* vector = 11, fline opcode */ + movel SYM (_catchException), 0x30(a1) /* vector = 12, reserved */ + movel SYM (_catchException), 0x34(a1) /* vector = 13, coprocessor protocol violation */ + movel SYM (_catchException), 0x38(a1) /* vector = 14, format error */ + movel SYM (_catchException), 0x3c(a1) /* vector = 15, unitialized interupt */ + + /* unassigned, reserved */ + movel SYM (_catchException), 0x40(a1) /* vector = 16 */ + movel SYM (_catchException), 0x44(a1) /* vector = 17 */ + movel SYM (_catchException), 0x48(a1) /* vector = 18 */ + movel SYM (_catchException), 0x4c(a1) /* vector = 19 */ + movel SYM (_catchException), 0x50(a1) /* vector = 20 */ + movel SYM (_catchException), 0x54(a1) /* vector = 21 */ + movel SYM (_catchException), 0x58(a1) /* vector = 22 */ + movel SYM (_catchException), 0x5c(a1) /* vector = 23 */ + + movel SYM (_catchException), 0x84(a1) /* vector = 33, breakpoint, trap #1 */ + movel SYM (_catchException), 0xa0(a1) /* vector = 40 , trap #8*/ + + /* floating point traps */ + movel SYM (_catchException), 0xc0(a1) /* vector = 48 */ + movel SYM (_catchException), 0xc4(a1) /* vector = 49 */ + movel SYM (_catchException), 0xc8(a1) /* vector = 50 */ + movel SYM (_catchException), 0xcc(a1) /* vector = 51 */ + movel SYM (_catchException), 0xd0(a1) /* vector = 52 */ + movel SYM (_catchException), 0xd4(a1) /* vector = 53 */ + movel SYM (_catchException), 0xd8(a1) /* vector = 54 */ + movel SYM (_catchException), 0xdc(a1) /* vector = 55 */ + movel SYM (_catchException), 0xe0(a1) /* vector = 56 */ + movel SYM (_catchException), 0xe4(a1) /* vector = 57 */ + movel SYM (_catchException), 0xe8(a1) /* vector = 58 */ + +/*** movel &__debug_level7, 0x7c(a1) /* level7 interupt vector */ + + movecl a1, vbr /* change VBR to new table */ + unlk fp + rts +/* + * exceptionHandler -- sets up exception vector table. + * First arg is an integer vector number + * Second arg is the function pointer for the vector + */ +SYM (exceptionHandler): +# link a6, IMM (-8) +#str1: .ascii "Exception Handler Called\n" +# moveal IMM (str1), a0 +# moveal IMM (str1+25), a1 +# jsr SYM (outln) + +# unlk a6 + rts + +/* this never gets called */ + movel fp@(8), d0 /* get vector number */ + movel fp@(12), a0 /* get function address */ + moveal &SYM (vbr_table), a1 /* FIXME */ + + addl d0, d0 + addl d0, d0 + + addal d0, a1 + movel a0, (a1) + + movecl a1, vbr + unlk a6 + rts + +.globl SYM (return_to_super) +SYM (return_to_super): + movel SYM (registers)+60,sp /* get new stack pointer */ + movel SYM (lastFrame),a0 /* get last frame info */ + bra return_to_any + +.globl SYM (return_to_user) +SYM (return_to_user): + movel SYM (registers)+60,a0 /* get usp */ + movel a0,usp /* set usp */ + movel SYM (superStack),sp /* get original stack pointer */ + +return_to_any: + movel SYM (lastFrame),a0 /* get last frame info */ + movel a0@+,SYM (lastFrame) /* link in previous frame */ + addql IMM (8),a0 /* skip over pc, vector#*/ + movew a0@+,d0 /* get # of words in cpu frame */ + addw d0,a0 /* point to end of data */ + addw d0,a0 /* point to end of data */ + movel a0,a1 +/* copy the stack frame */ + subql IMM (1),d0 +copyUserLoop: + movew a1@-,sp@- + dbf d0,copyUserLoop + +#ifdef __HAVE_68881__ + fmoveml SYM (registers)+168,fpcr/fpsr/fpi + fmovemx SYM (registers)+72,fp0-fp7 + cmpl IMM (-1),a0@ /* skip frestore flag set ? */ + beq skip_frestore + frestore a0@+ +skip_frestore: +#endif + + moveml SYM (registers),d0-d7/a0-a6 + rte /* pop and go! */ + + +/* this function is called immediately when a level 7 interrupt occurs */ +/* if the previous interrupt level was 7 then we're already servicing */ +/* this interrupt and an rte is in order to return to the debugger. */ +/* For the 68000, the offset for sr is 6 due to the jsr return address */ +.text +.globl SYM (_debug_level7) +SYM (_debug_level7): + movew d0,sp@- +#ifdef mc68020 + movew sp@(2),d0 +#else + movew sp@(6),d0 +#endif + andiw IMM (0x700),d0 + cmpiw IMM (0x700),d0 + beq _already7 + movew sp@+,d0 + bra SYM (_catchException) +_already7: + movew sp@+,d0 +#ifndef mc68020 + lea sp@(4),sp /* pull off 68000 return address */ +#endif + rte + +#ifdef mc68020 +/* This function is called when a 68020 exception occurs. It saves + * all the cpu and fpcp regs in the _registers array, creates a frame on a + * linked list of frames which has the cpu and fpcp stack frames needed + * to properly restore the context of these processors, and invokes + * an exception handler (remcom_handler). + * + * stack on entry: stack on exit: + * N bytes of junk exception # MSWord + * Exception Format Word exception # MSWord + * Program counter LSWord + * Program counter MSWord + * Status Register + * + * + */ + +.text +.globl SYM (_catchException) +SYM (_catchException): + + oriw IMM (0x0700),sr /* Disable interrupts */ + + moveml d0-d7/a0-a6,SYM (registers) /* save registers */ + movel SYM (lastFrame),a0 /* last frame pointer */ + +#ifdef __HAVE_68881__ + /* do an fsave, then remember the address to begin a restore from */ + fsave a0@- + fmovemx fp0-fp7, SYM (registers)+72 + fmoveml fpcr/fpsr/fpi, SYM (registers)+168 +#endif + + lea SYM (registers),a5 /* get address of registers */ + movew sp@,d1 /* get status register */ + movew d1,a5@(66) /* save sr */ + movel sp@(2),a4 /* save pc in a4 for later use */ + movel a4,a5@(68) /* save pc in _regisers[] */ + +/* figure out how many bytes in the stack frame */ + movew sp@(6),d0 /* get '020 exception format */ + movew d0,d2 /* make a copy of format word */ + andiw IMM (0xf000),d0 /* mask off format type */ + rolw IMM (5),d0 /* rotate into the low byte *2 */ + lea SYM (exceptionSize),a1 + addw d0,a1 /* index into the table */ + movew a1@,d0 /* get number of words in frame */ + movew d0,d3 /* save it */ + subw d0,a0 /* adjust save pointer */ + subw d0,a0 /* adjust save pointer(bytes) */ + movel a0,a1 /* copy save pointer */ + subql IMM (1),d0 /* predecrement loop counter */ + +/* copy the frame */ + +saveFrameLoop: + movew sp@+,a1@+ + dbf d0,saveFrameLoop + +/* now that the stack has been clenaed, + * save the a7 in use at time of exception + */ + movel sp,SYM (superStack) /* save supervisor sp */ + andiw IMM (0x2000),d1 /* were we in supervisor mode ? */ + beq userMode + movel a7,a5@(60) /* save a7 */ + bra a7saveDone +userMode: + movel usp,a1 + movel a1,a5@(60) /* save user stack pointer */ +a7saveDone: + + +/* save size of frame */ + movew d3,a0@- + +/* compute exception number */ + andl IMM (0xfff),d2 /* mask off vector offset */ + lsrw IMM (2),d2 /* divide by 4 to get vect num */ + movel d2,a0@- /* save it */ + +/* save pc causing exception */ + movel a4,a0@- + +/* save old frame link and set the new value*/ + movel SYM (lastFrame),a1 /* last frame pointer */ + movel a1,a0@- /* save pointer to prev frame */ + movel a0,SYM (lastFrame) + + movel d2,sp@- /* push exception num */ +#ifdef TMP_HACK + movel SYM (exceptionHook),a0 /* get address of handler */ + jbsr a0@ /* and call it */ +#else + jbsr SYM (remcomHandler) +#endif + clrl sp@ /* replace exception num parm with frame ptr */ + jbsr SYM (_returnFromException) /* jbsr, but never returns */ + +#else /* mc68000 */ + +/* This function is called when an exception occurs. It translates the + * return address found on the stack into an exception vector # which + * is then handled by either handle_exception or a system handler. + * _catchException provides a front end for both. + * + * stack on entry: stack on exit: + * Program counter MSWord exception # MSWord + * Program counter LSWord exception # MSWord + * Status Register + * Return Address MSWord + * Return Address LSWord + */ +.text +.globl SYM (_catchException) +SYM (_catchException): + + oriw IMM (0x0700),sr /* Disable interrupts */ + + moveml d0-d7/a0-a6,SYM (registers) /* save registers */ + movel SYM (lastFrame),a0 /* last frame pointer */ + +#ifdef __HAVE_68881__ + /* do an fsave, then remember the address to begin a restore from */ + fsave a0@- + fmovemx fp0-fp7, SYM (registers)+72 + fmoveml fpcr/fpsr/fpi, SYM (registers)+168 +#endif + + lea SYM (registers),a5 /* get address of registers */ + movel sp@+,d2 /* pop return address */ + addl IMM (1530),d2 /* convert return addr to */ + divs IMM (6),d2 /* exception number */ + extl d2 + + moveql IMM (3),d3 /* assume a three word frame */ + + cmpiw IMM (3),d2 /* bus error or address error ? */ + bgt normal /* if >3 then normal error */ + movel sp@+,a0@- /* copy error info to frame buff*/ + movel sp@+,a0@- /* these are never used */ + moveql IMM (7),d3 /* this is a 7 word frame */ + +normal: + movew sp@+,d1 /* pop status register */ + movel sp@+,a4 /* pop program counter */ + movew d1,a5@(66) /* save sr */ + movel a4,a5@(68) /* save pc in _regisers[] */ + movel a4,a0@- /* copy pc to frame buffer */ + movew d1,a0@- /* copy sr to frame buffer */ + + movel sp,SYM (superStack) /* save supervisor sp */ + + andiw IMM (0x2000),d1 /* were we in supervisor mode ? */ + beq userMode + movel a7,a5@(60) /* save a7 */ + bra saveDone +userMode: + movel usp,a1 /* save user stack pointer */ + movel a1,a5@(60) /* save user stack pointer */ +saveDone: + + movew d3,a0@- /* push frame size in words */ + movel d2,a0@- /* push vector number */ + movel a4,a0@- /* push exception pc */ + +/* save old frame link and set the new value */ + movel SYM (lastFrame),a1 /* last frame pointer */ + movel a1,a0@- /* save pointer to prev frame */ + movel a0,SYM (lastFrame) + + movel d2,sp@- /* push exception num */ + movel SYM (exceptionHook),a0 /* get address of handler */ + jbsr a0@ /* and call it */ + clrl sp@ /* replace exception num parm with frame ptr */ + jbsr SYM (_returnFromException) /* jbsr, but never returns */ + +#endif /* m68000 */ + +/* + * remcomHandler is a front end for handle_exception. It moves the + * stack pointer into an area reserved for debugger use in case the + * breakpoint happened in supervisor mode. + */ +.globl SYM (remcomHandler) +SYM (remcomHandler): + addl IMM (4),sp /* pop off return address */ + movel sp@+,d0 /* get the exception number */ + movel SYM (stackPtr),sp /* move to remcom stack area */ + movel d0,sp@- /* push exception onto stack */ + jbsr SYM (handle_exception) /* this never returns */ + rts /* return */ diff --git a/libgloss/m68k/mvme135.ld b/libgloss/m68k/mvme135.ld new file mode 100644 index 0000000..dba0dbe --- /dev/null +++ b/libgloss/m68k/mvme135.ld @@ -0,0 +1,128 @@ +STARTUP(crt0.o) +OUTPUT_ARCH(m68k) +/* Uncomment this if you want srecords. This is needed for a.out + * if you plan to use GDB. +OUTPUT_FORMAT(srec) + */ +SEARCH_DIR(.) +GROUP(-lmvme135 -lc -lgcc) +__DYNAMIC = 0; + +/* + * Setup the memory map of the Motorola MVME135 Board + * stack grows down from high memory. + * + * The memory map look like this: + * +--------------------+ <- low memory + * | .text | + * | _etext | + * | ctor list | the ctor and dtor lists are for + * | dtor list | C++ support + * +--------------------+ + * | .data | initialized data goes here + * | _edata | + * +--------------------+ + * | .bss | + * | __bss_start | start of bss, cleared by crt0 + * | _end | start of heap, used by sbrk() + * +--------------------+ + * . . + * . . + * . . + * | __stack | top of stack + * +--------------------+ + */ + +MEMORY +{ + ram (rwx) : ORIGIN = 0x5000, LENGTH = 1M +} + +/* + * Allocate the stack to be at the top of memory, since the stack + * grows down + */ + +PROVIDE (__stack = 1M - 8); + +/* + * Initalize some symbols to be zero so we can reference them in the + * crt0 without core dumping. These functions are all optional, but + * we do this so we can have our crt0 always use them if they exist. + * This is so BSPs work better when using the crt0 installed gcc. + * We have to initalize them twice, so we cover a.out (which prepends + * an underscore) and coff object file formats. + */ +PROVIDE (hardware_init_hook = 0); +PROVIDE (_hardware_init_hook = 0); +PROVIDE (software_init_hook = 0); +PROVIDE (_software_init_hook = 0); +/* + * stick everything in ram (of course) + */ +SECTIONS +{ + .text : + { + *(.text) + . = ALIGN(0x4); + __CTOR_LIST__ = .; + ___CTOR_LIST__ = .; + LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) + *(.ctors) + LONG(0) + __CTOR_END__ = .; + __DTOR_LIST__ = .; + ___DTOR_LIST__ = .; + LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) + *(.dtors) + LONG(0) + __DTOR_END__ = .; + *(.rodata) + *(.gcc_except_table) + + . = ALIGN(0x2); + __INIT_SECTION__ = . ; + LONG (0x4e560000) /* linkw %fp,#0 */ + *(.init) + SHORT (0x4e5e) /* unlk %fp */ + SHORT (0x4e75) /* rts */ + + __FINI_SECTION__ = . ; + LONG (0x4e560000) /* linkw %fp,#0 */ + *(.fini) + SHORT (0x4e5e) /* unlk %fp */ + SHORT (0x4e75) /* rts */ + + _etext = .; + *(.lit) + } > ram + + .data : + { + *(.shdata) + *(.data) + _edata = .; + } > ram + + .bss : + { + . = ALIGN(0x4); + __bss_start = . ; + *(.shbss) + *(.bss) + *(COMMON) + _end = ALIGN (0x8); + __end = _end; + } > ram + + .stab 0 (NOLOAD) : + { + *(.stab) + } + + .stabstr 0 (NOLOAD) : + { + *(.stabstr) + } +} diff --git a/libgloss/m68k/mvme162.ld b/libgloss/m68k/mvme162.ld new file mode 100644 index 0000000..fd3ae10 --- /dev/null +++ b/libgloss/m68k/mvme162.ld @@ -0,0 +1,129 @@ +STARTUP(crt0.o) +OUTPUT_ARCH(m68k) +/* Uncomment this if you want srecords. This is needed for a.out + * if you plan to use GDB. +OUTPUT_FORMAT(srec) + */ +SEARCH_DIR(.) +GROUP(-lmvme162 -lc -lgcc) +__DYNAMIC = 0; + +/* + * Setup the memory map of the Motorola MVME135 Board + * stack grows down from high memory. + * + * The memory map look like this: + * +--------------------+ <- low memory + * | .text | + * | _etext | + * | ctor list | the ctor and dtor lists are for + * | dtor list | C++ support + * +--------------------+ + * | .data | initialized data goes here + * | _edata | + * +--------------------+ + * | .bss | + * | __bss_start | start of bss, cleared by crt0 + * | _end | start of heap, used by sbrk() + * +--------------------+ + * . . + * . . + * . . + * | __stack | top of stack + * +--------------------+ + */ + +MEMORY +{ + monitor : ORIGIN = 0x0000, LENGTH = 64K + ram (rwx) : ORIGIN = 0x10000, LENGTH = 16M +} + +/* + * allocate the stack to be at the top of memory, since the stack + * grows down + */ + +PROVIDE (__stack = 16M - 8); + +/* + * Initalize some symbols to be zero so we can reference them in the + * crt0 without core dumping. These functions are all optional, but + * we do this so we can have our crt0 always use them if they exist. + * This is so BSPs work better when using the crt0 installed with gcc. + * We have to initalize them twice, so we cover a.out (which prepends + * an underscore) and coff object file formats. + */ +PROVIDE (hardware_init_hook = 0); +PROVIDE (_hardware_init_hook = 0); +PROVIDE (software_init_hook = 0); +PROVIDE (_software_init_hook = 0); +/* + * stick everything in ram (of course) + */ +SECTIONS +{ + .text : + { + *(.text) + . = ALIGN(0x4); + __CTOR_LIST__ = .; + ___CTOR_LIST__ = .; + LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) + *(.ctors) + LONG(0) + __CTOR_END__ = .; + __DTOR_LIST__ = .; + ___DTOR_LIST__ = .; + LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) + *(.dtors) + LONG(0) + __DTOR_END__ = .; + *(.rodata) + *(.gcc_except_table) + + . = ALIGN(0x2); + __INIT_SECTION__ = . ; + LONG (0x4e560000) /* linkw %fp,#0 */ + *(.init) + SHORT (0x4e5e) /* unlk %fp */ + SHORT (0x4e75) /* rts */ + + __FINI_SECTION__ = . ; + LONG (0x4e560000) /* linkw %fp,#0 */ + *(.fini) + SHORT (0x4e5e) /* unlk %fp */ + SHORT (0x4e75) /* rts */ + + _etext = .; + *(.lit) + } > ram + + .data : + { + *(.shdata) + *(.data) + _edata = .; + } > ram + + .bss : + { + . = ALIGN(0x4); + __bss_start = . ; + *(.shbss) + *(.bss) + *(COMMON) + _end = ALIGN (0x8); + __end = _end; + } > ram + + .stab 0 (NOLOAD) : + { + *(.stab) + } + + .stabstr 0 (NOLOAD) : + { + *(.stabstr) + } +} diff --git a/libgloss/m68k/mvme162lx-asm.S b/libgloss/m68k/mvme162lx-asm.S new file mode 100644 index 0000000..8b83621 --- /dev/null +++ b/libgloss/m68k/mvme162lx-asm.S @@ -0,0 +1,292 @@ +/* + * mvme162lx-asm.S -- assembler routines for the MVME stub. + * + * This code was pulled out of mvme162lx-stub.c by Ian Taylor so that I + * could handle different register and label prefixes in a sensible + * way. + */ + +/**************************************************************************** + + THIS SOFTWARE IS NOT COPYRIGHTED + + HP offers the following for use in the public domain. HP makes no + warranty with regard to the software or it's performance and the + user accepts the software "AS IS" with all faults. + + HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD + TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + +****************************************************************************/ + +#include "asm.h" + + .title "mvme162lx-asm.S for m68k" + + .globl SYM (registers) + .globl SYM (lastFrame) + .globl SYM (superStack) + .globl SYM (exceptionHook) + .globl SYM (_returnFromException) + .globl SYM (stackPtr) + .globl SYM (handle_exception) + .globl SYM (exceptionSize) + +.text +.globl SYM (return_to_super) +SYM (return_to_super): + movel SYM (registers)+60,sp /* get new stack pointer */ + movel SYM (lastFrame),a0 /* get last frame info */ + bra return_to_any + +.globl SYM (return_to_user) +SYM (return_to_user): + movel SYM (registers)+60,a0 /* get usp */ + movel a0,usp /* set usp */ + movel SYM (superStack),sp /* get original stack pointer */ + +return_to_any: + movel SYM (lastFrame),a0 /* get last frame info */ + movel a0@+,SYM (lastFrame) /* link in previous frame */ + addql IMM (8),a0 /* skip over pc, vector#*/ + movew a0@+,d0 /* get # of words in cpu frame */ + addw d0,a0 /* point to end of data */ + addw d0,a0 /* point to end of data */ + movel a0,a1 +/* copy the stack frame */ + subql IMM (1),d0 +copyUserLoop: + movew a1@-,sp@- + dbf d0,copyUserLoop + +#ifdef __HAVE_68881__ + fmoveml SYM (registers)+168,fpcr/fpsr/fpi + fmovemx SYM (registers)+72,fp0-fp7 + cmpl IMM (-1),a0@ /* skip frestore flag set ? */ + beq skip_frestore + frestore a0@+ +skip_frestore: +#endif + + moveml SYM (registers),d0-d7/a0-a6 + rte /* pop and go! */ + + +/* this function is called immediately when a level 7 interrupt occurs */ +/* if the previous interrupt level was 7 then we're already servicing */ +/* this interrupt and an rte is in order to return to the debugger. */ +/* For the 68000, the offset for sr is 6 due to the jsr return address */ +.text +.globl SYM (_debug_level7) +SYM (_debug_level7): + movew d0,sp@- +#ifdef mc68020 + movew sp@(2),d0 +#else + movew sp@(6),d0 +#endif + andiw IMM (0x700),d0 + cmpiw IMM (0x700),d0 + beq _already7 + movew sp@+,d0 + bra SYM (_catchException) +_already7: + movew sp@+,d0 +#ifndef mc68020 + lea sp@(4),sp /* pull off 68000 return address */ +#endif + rte + +#ifdef mc68020 +/* This function is called when a 68020 exception occurs. It saves + * all the cpu and fpcp regs in the _registers array, creates a frame on a + * linked list of frames which has the cpu and fpcp stack frames needed + * to properly restore the context of these processors, and invokes + * an exception handler (remcom_handler). + * + * stack on entry: stack on exit: + * N bytes of junk exception # MSWord + * Exception Format Word exception # MSWord + * Program counter LSWord + * Program counter MSWord + * Status Register + * + * + */ + +.text +.globl SYM (_catchException) +SYM (_catchException): + + oriw IMM (0x0700),sr /* Disable interrupts */ + + moveml d0-d7/a0-a6,SYM (registers) /* save registers */ + movel SYM (lastFrame),a0 /* last frame pointer */ + +#ifdef __HAVE_68881__ + /* do an fsave, then remember the address to begin a restore from */ + fsave a0@- + fmovemx fp0-fp7, SYM (registers)+72 + fmoveml fpcr/fpsr/fpi, SYM (registers)+168 +#endif + + lea SYM (registers),a5 /* get address of registers */ + movew sp@,d1 /* get status register */ + movew d1,a5@(66) /* save sr */ + movel sp@(2),a4 /* save pc in a4 for later use */ + movel a4,a5@(68) /* save pc in _regisers[] */ + +/* figure out how many bytes in the stack frame */ + movew sp@(6),d0 /* get '020 exception format */ + movew d0,d2 /* make a copy of format word */ + andiw IMM (0xf000),d0 /* mask off format type */ + rolw IMM (5),d0 /* rotate into the low byte *2 */ + lea SYM (exceptionSize),a1 + addw d0,a1 /* index into the table */ + movew a1@,d0 /* get number of words in frame */ + movew d0,d3 /* save it */ + subw d0,a0 /* adjust save pointer */ + subw d0,a0 /* adjust save pointer(bytes) */ + movel a0,a1 /* copy save pointer */ + subql IMM (1),d0 /* predecrement loop counter */ + +/* copy the frame */ + +saveFrameLoop: + movew sp@+,a1@+ + dbf d0,saveFrameLoop + +/* now that the stack has been clenaed, + * save the a7 in use at time of exception + */ + movel sp,SYM (superStack) /* save supervisor sp */ + andiw IMM (0x2000),d1 /* were we in supervisor mode ? */ + beq userMode + movel a7,a5@(60) /* save a7 */ + bra a7saveDone +userMode: + movel usp,a1 + movel a1,a5@(60) /* save user stack pointer */ +a7saveDone: + + +/* save size of frame */ + movew d3,a0@- + +/* compute exception number */ + andl IMM (0xfff),d2 /* mask off vector offset */ + lsrw IMM (2),d2 /* divide by 4 to get vect num */ + movel d2,a0@- /* save it */ + +/* save pc causing exception */ + movel a4,a0@- + +/* save old frame link and set the new value*/ + movel SYM (lastFrame),a1 /* last frame pointer */ + movel a1,a0@- /* save pointer to prev frame */ + movel a0,SYM (lastFrame) + + movel d2,sp@- /* push exception num */ +#ifdef TMP_HACK + movel SYM (exceptionHook),a0 /* get address of handler */ + jbsr a0@ /* and call it */ +#else + jbsr SYM (remcomHandler) +#endif + clrl sp@ /* replace exception num parm with frame ptr */ + jbsr SYM (_returnFromException) /* jbsr, but never returns */ + +#else /* mc68000 */ + +/* This function is called when an exception occurs. It translates the + * return address found on the stack into an exception vector # which + * is then handled by either handle_exception or a system handler. + * _catchException provides a front end for both. + * + * stack on entry: stack on exit: + * Program counter MSWord exception # MSWord + * Program counter LSWord exception # MSWord + * Status Register + * Return Address MSWord + * Return Address LSWord + */ +.text +.globl SYM (_catchException) +SYM (_catchException): + + oriw IMM (0x0700),sr /* Disable interrupts */ + + moveml d0-d7/a0-a6,SYM (registers) /* save registers */ + movel SYM (lastFrame),a0 /* last frame pointer */ + +#ifdef __HAVE_68881__ + /* do an fsave, then remember the address to begin a restore from */ + fsave a0@- + fmovemx fp0-fp7, SYM (registers)+72 + fmoveml fpcr/fpsr/fpi, SYM (registers)+168 +#endif + + lea SYM (registers),a5 /* get address of registers */ + movel sp@+,d2 /* pop return address */ + addl IMM (1530),d2 /* convert return addr to */ + divs IMM (6),d2 /* exception number */ + extl d2 + + moveql IMM (3),d3 /* assume a three word frame */ + + cmpiw IMM (3),d2 /* bus error or address error ? */ + bgt normal /* if >3 then normal error */ + movel sp@+,a0@- /* copy error info to frame buff*/ + movel sp@+,a0@- /* these are never used */ + moveql IMM (7),d3 /* this is a 7 word frame */ + +normal: + movew sp@+,d1 /* pop status register */ + movel sp@+,a4 /* pop program counter */ + movew d1,a5@(66) /* save sr */ + movel a4,a5@(68) /* save pc in _regisers[] */ + movel a4,a0@- /* copy pc to frame buffer */ + movew d1,a0@- /* copy sr to frame buffer */ + + movel sp,SYM (superStack) /* save supervisor sp */ + + andiw IMM (0x2000),d1 /* were we in supervisor mode ? */ + beq userMode + movel a7,a5@(60) /* save a7 */ + bra saveDone +userMode: + movel usp,a1 /* save user stack pointer */ + movel a1,a5@(60) /* save user stack pointer */ +saveDone: + + movew d3,a0@- /* push frame size in words */ + movel d2,a0@- /* push vector number */ + movel a4,a0@- /* push exception pc */ + +/* save old frame link and set the new value */ + movel SYM (lastFrame),a1 /* last frame pointer */ + movel a1,a0@- /* save pointer to prev frame */ + movel a0,SYM (lastFrame) + + movel d2,sp@- /* push exception num */ + movel SYM (exceptionHook),a0 /* get address of handler */ + jbsr a0@ /* and call it */ + clrl sp@ /* replace exception num parm with frame ptr */ + jbsr SYM (_returnFromException) /* jbsr, but never returns */ + +#endif /* m68000 */ + +/* + * remcomHandler is a front end for handle_exception. It moves the + * stack pointer into an area reserved for debugger use in case the + * breakpoint happened in supervisor mode. + */ +.globl SYM (remcomHandler) +SYM (remcomHandler): + addl IMM (4),sp /* pop off return address */ + movel sp@+,d0 /* get the exception number */ + movel SYM (stackPtr),sp /* move to remcom stack area */ + movel d0,sp@- /* push exception onto stack */ + jbsr SYM (handle_exception) /* this never returns */ + rts /* return */ diff --git a/libgloss/m68k/sbc5204.ld b/libgloss/m68k/sbc5204.ld new file mode 100644 index 0000000..4570b0e --- /dev/null +++ b/libgloss/m68k/sbc5204.ld @@ -0,0 +1,127 @@ +/* STARTUP(crt0.o) */ +OUTPUT_ARCH(m68k) +/* Uncomment this if you want srecords. This is needed for a.out + * if you plan to use GDB. +OUTPUT_FORMAT(srec) + */ +SEARCH_DIR(.) +GROUP(-ldbug -lc -lgcc) +__DYNAMIC = 0; + +/* + * Setup the memory map of the Arnewsh SBC5204 + * stack grows down from high memory. + * + * The memory map look like this: + * +--------------------+ <- low memory + * | .text | + * | _etext | + * | ctor list | the ctor and dtor lists are for + * | dtor list | C++ support + * +--------------------+ + * | .data | initialized data goes here + * | _edata | + * +--------------------+ + * | .bss | + * | __bss_start | start of bss, cleared by crt0 + * | _end | start of heap, used by sbrk() + * +--------------------+ + * . . + * . . + * . . + * | __stack | top of stack + * +--------------------+ + */ +MEMORY +{ + ram (rwx) : ORIGIN = 0x10000, LENGTH = 0x30000 +} + +/* + * allocate the stack to be at the top of memory, since the stack + * grows down + */ + +PROVIDE (__stack = 0x30000); + +/* + * Initalize some symbols to be zero so we can reference them in the + * crt0 without core dumping. These functions are all optional, but + * we do this so we can have our crt0 always use them if they exist. + * This is so BSPs work better when using the crt0 installed with gcc. + * We have to initalize them twice, so we cover a.out (which prepends + * an underscore) and coff object file formats. + */ +PROVIDE (hardware_init_hook = 0); +PROVIDE (_hardware_init_hook = 0); +PROVIDE (software_init_hook = 0); +PROVIDE (_software_init_hook = 0); +/* + * stick everything in ram (of course) + */ +SECTIONS +{ + .text : + { + *(.text) + . = ALIGN(0x4); + __CTOR_LIST__ = .; + ___CTOR_LIST__ = .; + LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) + *(.ctors) + LONG(0) + __CTOR_END__ = .; + __DTOR_LIST__ = .; + ___DTOR_LIST__ = .; + LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) + *(.dtors) + LONG(0) + __DTOR_END__ = .; + *(.rodata) + *(.gcc_except_table) + + . = ALIGN(0x2); + __INIT_SECTION__ = . ; + LONG (0x4e560000) /* linkw %fp,#0 */ + *(.init) + SHORT (0x4e5e) /* unlk %fp */ + SHORT (0x4e75) /* rts */ + + __FINI_SECTION__ = . ; + LONG (0x4e560000) /* linkw %fp,#0 */ + *(.fini) + SHORT (0x4e5e) /* unlk %fp */ + SHORT (0x4e75) /* rts */ + + _etext = .; + *(.lit) + } > ram + + .data : + { + *(.shdata) + *(.data) + _edata = .; + } > ram + + .bss : + { + . = ALIGN(0x4); + __bss_start = . ; + *(.shbss) + *(.bss) + *(COMMON) + _end = ALIGN (0x8); + __end = _end; + } > ram + + .stab 0 (NOLOAD) : + { + *(.stab) + } + + .stabstr 0 (NOLOAD) : + { + *(.stabstr) + } +} diff --git a/libgloss/m68k/sbc5206.ld b/libgloss/m68k/sbc5206.ld new file mode 100644 index 0000000..d082a08 --- /dev/null +++ b/libgloss/m68k/sbc5206.ld @@ -0,0 +1,127 @@ +/* STARTUP(crt0.o) */ +OUTPUT_ARCH(m68k) +/* Uncomment this if you want srecords. This is needed for a.out + * if you plan to use GDB. +OUTPUT_FORMAT(srec) + */ +SEARCH_DIR(.) +GROUP(-ldbug -lc -lgcc) +__DYNAMIC = 0; + +/* + * Setup the memory map of the Arnewsh SBC5206 + * stack grows down from high memory. + * + * The memory map look like this: + * +--------------------+ <- low memory + * | .text | + * | _etext | + * | ctor list | the ctor and dtor lists are for + * | dtor list | C++ support + * +--------------------+ + * | .data | initialized data goes here + * | _edata | + * +--------------------+ + * | .bss | + * | __bss_start | start of bss, cleared by crt0 + * | _end | start of heap, used by sbrk() + * +--------------------+ + * . . + * . . + * . . + * | __stack | top of stack + * +--------------------+ + */ +MEMORY +{ + ram (rwx) : ORIGIN = 0x10000, LENGTH = 0xd000 +} + +/* + * allocate the stack to be at the top of memory, since the stack + * grows down + */ + +PROVIDE (__stack = 0xd000); + +/* + * Initalize some symbols to be zero so we can reference them in the + * crt0 without core dumping. These functions are all optional, but + * we do this so we can have our crt0 always use them if they exist. + * This is so BSPs work better when using the crt0 installed with gcc. + * We have to initalize them twice, so we cover a.out (which prepends + * an underscore) and coff object file formats. + */ +PROVIDE (hardware_init_hook = 0); +PROVIDE (_hardware_init_hook = 0); +PROVIDE (software_init_hook = 0); +PROVIDE (_software_init_hook = 0); +/* + * stick everything in ram (of course) + */ +SECTIONS +{ + .text : + { + *(.text) + . = ALIGN(0x4); + __CTOR_LIST__ = .; + ___CTOR_LIST__ = .; + LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) + *(.ctors) + LONG(0) + __CTOR_END__ = .; + __DTOR_LIST__ = .; + ___DTOR_LIST__ = .; + LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) + *(.dtors) + LONG(0) + __DTOR_END__ = .; + *(.rodata) + *(.gcc_except_table) + + . = ALIGN(0x2); + __INIT_SECTION__ = . ; + LONG (0x4e560000) /* linkw %fp,#0 */ + *(.init) + SHORT (0x4e5e) /* unlk %fp */ + SHORT (0x4e75) /* rts */ + + __FINI_SECTION__ = . ; + LONG (0x4e560000) /* linkw %fp,#0 */ + *(.fini) + SHORT (0x4e5e) /* unlk %fp */ + SHORT (0x4e75) /* rts */ + + _etext = .; + *(.lit) + } > ram + + .data : + { + *(.shdata) + *(.data) + _edata = .; + } > ram + + .bss : + { + . = ALIGN(0x4); + __bss_start = . ; + *(.shbss) + *(.bss) + *(COMMON) + _end = ALIGN (0x8); + __end = _end; + } > ram + + .stab 0 (NOLOAD) : + { + *(.stab) + } + + .stabstr 0 (NOLOAD) : + { + *(.stabstr) + } +} diff --git a/libgloss/m68k/test.c b/libgloss/m68k/test.c new file mode 100644 index 0000000..d84045d --- /dev/null +++ b/libgloss/m68k/test.c @@ -0,0 +1,26 @@ +extern int led_putnum(); +extern char print(),putnum(); + +#include <stdio.h> + +main() +{ + char buf[20]; + + outbyte ('&'); + outbyte ('@'); + outbyte ('$'); + outbyte ('%'); + print ("FooBar\r\n"); + +#if 0 + write (2, "Enter 5 characters... ", 24); + read (0, buf, 5); + print (buf); + print ("\r\n"); +#endif + + /* whew, we made it */ + print ("\r\nDone...\r\n"); + fflush(stdout); +} diff --git a/libgloss/mcore/Makefile.in b/libgloss/mcore/Makefile.in new file mode 100644 index 0000000..236496c --- /dev/null +++ b/libgloss/mcore/Makefile.in @@ -0,0 +1,142 @@ +# +# + +VPATH = @srcdir@ @srcdir@/.. +srcdir = @srcdir@ +objdir = . +srcroot = $(srcdir)/../.. +objroot = $(objdir)/../.. + +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +host_alias = @host_alias@ +target_alias = @target_alias@ + +bindir = @bindir@ +libdir = @libdir@ +tooldir = $(exec_prefix)/$(target_alias) + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ + +# Multilib support variables. +# TOP is used instead of MULTI{BUILD,SRC}TOP. +MULTIDIRS = +MULTISUBDIR = + +SHELL = /bin/sh + +CC = @CC@ + +AS = @AS@ +AR = @AR@ +LD = @LD@ +RANLIB = @RANLIB@ + +OBJDUMP = `if [ -f ${objroot}/../binutils/objdump ] ; \ + then echo ${objroot}/../binutils/objdump ; \ + else t='$(program_transform_name)'; echo objdump | sed -e $$t ; fi` +OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \ + then echo ${objroot}/../binutils/objcopy ; \ + else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi` + +OBJS = fstat.o getpid.o isatty.o kill.o raise.o putnum.o stat.o unlink.o +CFLAGS = -g +SCRIPTS = + +# Here is all of the simulator stuff +SIM_SCRIPTS = +SIM_LDFLAGS = +SIM_BSP = libsim.a +SIM_CRT0 = crt0.o +SIM_OBJS = syscalls.o +SIM_TEST = sim-test +SIM_INSTALL = install-sim + +# Here is all of the picobug on cmb stuff +MON_PREFIX = @bsp_prefix@ +MON_LDFLAGS = +MON_BSP = libcmb.a +MON_CRT0 = crt0.o +MON_OBJS = open.o close.o lseek.o sbrk.o read.o write.o print.o cmb-exit.o cmb-inbyte.o cmb-outbyte.o +MON_SCRIPTS = cmb.ld cmb.specs +MON_TEST = +MON_INSTALL = install-mon + +# Host specific makefile fragment comes in here. +@host_makefile_frag@ + +# +# 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. +# +all: ${SIM_CRT0} ${SIM_BSP} ${MON_BSP} + +# +# here's where we build the board support packages for each target +# +${SIM_BSP}: ${OBJS} ${SIM_OBJS} + ${AR} ${ARFLAGS} ${SIM_BSP} ${SIM_OBJS} ${OBJS} + ${RANLIB} ${SIM_BSP} + +${MON_BSP}: ${OBJS} ${MON_OBJS} + ${AR} ${ARFLAGS} ${MON_BSP} ${MON_OBJS} ${OBJS} + ${RANLIB} ${MON_BSP} + +# +# here's where we build the test programs for each target +# +.PHONY: test +test: ${SIM_TEST} ${MON_TEST} + +sim-test: sim-test.x sim-test.dis + +sim-test.x: test.o ${SIM_CRT0} ${SIM_BSP} + ${CC} ${LDFLAGS_FOR_TARGET} -L${objdir} \ + ${SIM_CRT0} test.o \ + -o sim-test.x ${LIBS_FOR_TARGET} -lc ${SIM_BSP} + +sim-test.dis: sim-test.x + ${OBJDUMP} -d sim-test.x > sim-test.dis + + +# +# +# +.c.S: + ${CC} ${CFLAGS_FOR_TARGET} $(INCLUDES) $(CFLAGS) -c $< + +simulator.o: simulator.S +sim-crt0.o: sim-crt0.S +cmb-exit.o: cmb-exit.c +cmb-inbyte.o: cmb-inbyte.c +cmb-outbyte.o: cmb-outbyte.c + +clean mostlyclean: + rm -f a.out core *.i *.o *-test *.srec *.dis *.x $(SIM_BSP) $(MON_BSP) + +distclean maintainer-clean realclean: clean + rm -f Makefile config.status *~ + +.PHONY: install info install-info clean-info +install: ${SIM_INSTALL} ${MON_INSTALL} + +install-mon: + set -e; for x in ${MON_CRT0} ${MON_BSP}; do ${INSTALL_DATA} $$x ${tooldir}/lib${MULTISUBDIR}/$$x; done + set -e; for x in ${MON_SCRIPTS}; do ${INSTALL_DATA} ${srcdir}/${MON_PREFIX}$$x ${tooldir}/lib${MULTISUBDIR}/$$x; done + +install-sim: + set -e; for x in ${SIM_CRT0} ${SIM_BSP} ${SIM_SCRIPTS}; do ${INSTALL_DATA} $$x ${tooldir}/lib${MULTISUBDIR}/$$x; done + +doc: +info: +install-info: +clean-info: + +Makefile: Makefile.in config.status @host_makefile_frag_path@ + $(SHELL) config.status + +config.status: configure + $(SHELL) config.status --recheck diff --git a/libgloss/mcore/close.c b/libgloss/mcore/close.c new file mode 100644 index 0000000..b94cb60 --- /dev/null +++ b/libgloss/mcore/close.c @@ -0,0 +1,25 @@ +/* close.c -- close a file descriptor. + * + * Copyright (c) 1995, 1999 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include "glue.h" + +/* + * close -- We don't need to do anything, but pretend we did. + */ +int +_DEFUN (_close ,(fd), + int fd) +{ + return (0); +} diff --git a/libgloss/mcore/cmb-exit.c b/libgloss/mcore/cmb-exit.c new file mode 100644 index 0000000..0e1de85 --- /dev/null +++ b/libgloss/mcore/cmb-exit.c @@ -0,0 +1,27 @@ +/* cmb-exit.c -- exit trap binding. + * + * Copyright (c) 1999 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include <_ansi.h> + +/* + * _exit -- Just cause a breakpoint so user can see why we exited. + */ +void +_DEFUN (_exit, (val), + int val) +{ + while (1) { + asm("bkpt"); + } +} diff --git a/libgloss/mcore/cmb-inbyte.c b/libgloss/mcore/cmb-inbyte.c new file mode 100644 index 0000000..0b0b8f5 --- /dev/null +++ b/libgloss/mcore/cmb-inbyte.c @@ -0,0 +1,24 @@ +/* cmb-inbyte.c -- inbyte function for CMB1200 eval board. + * + * Copyright (c) 1999 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include <_ansi.h> + +int +_DEFUN (inbyte, (), + _NOARGS) + +{ + return -1; +} + diff --git a/libgloss/mcore/cmb-outbyte.c b/libgloss/mcore/cmb-outbyte.c new file mode 100644 index 0000000..ea2aaef --- /dev/null +++ b/libgloss/mcore/cmb-outbyte.c @@ -0,0 +1,46 @@ +/* cmb-outbyte.c -- outbyte function for CMB1200 eval board. + * + * Copyright (c) 1999 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include <_ansi.h> + +#define _TX 0x40 +#define _SR 0x86 + +#define UART0_BASE 0x10009000 +#define UART1_BASE 0x1000a000 + +#define UART_BASE UART0_BASE + +#define TXREG ((volatile unsigned short *)(UART_BASE + _TX)) +#define SRREG ((volatile unsigned short *)(UART_BASE + _SR)) + +#define TRDY 0x2000 + +#define GDB_QUOTE_CHAR 15 /* ^O */ + +/* + * outbyte -- send a byte to the UART. + */ +void +_DEFUN (outbyte, (ch), + char ch) +{ + while (!(*SRREG & TRDY)) + ; + *TXREG = GDB_QUOTE_CHAR; + + while (!(*SRREG & TRDY)) + ; + *TXREG = (unsigned short)ch; +} diff --git a/libgloss/mcore/configure b/libgloss/mcore/configure new file mode 100755 index 0000000..ff1f8c9 --- /dev/null +++ b/libgloss/mcore/configure @@ -0,0 +1,1206 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.12.1 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.12.1" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=crt0.S + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + +if test "${enable_shared}" = "yes" ; then + echo "Shared libraries not supported for cross compiling, ignored" +fi + +if test "$srcdir" = "." ; then + if test "${with_target_subdir}" != "." ; then + libgloss_topdir="${srcdir}/${with_multisrctop}../../.." + else + libgloss_topdir="${srcdir}/${with_multisrctop}../.." + fi +else + libgloss_topdir="${srcdir}/../.." +fi +ac_aux_dir= +for ac_dir in $libgloss_topdir $srcdir/$libgloss_topdir; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $libgloss_topdir $srcdir/$libgloss_topdir" 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + + + +# Do some error checking and defaulting for the host and target type. +# The inputs are: +# configure --host=HOST --target=TARGET --build=BUILD NONOPT +# +# The rules are: +# 1. You are not allowed to specify --host, --target, and nonopt at the +# same time. +# 2. Host defaults to nonopt. +# 3. If nonopt is not specified, then host defaults to the current host, +# as determined by config.guess. +# 4. Target and build default to nonopt. +# 5. If nonopt is not specified, then target and build default to host. + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +case $host---$target---$nonopt in +NONE---*---* | *---NONE---* | *---*---NONE) ;; +*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;; +esac + + +# Make sure we can run config.sub. +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi + +echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:585: checking host system type" >&5 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + +echo $ac_n "checking target system type""... $ac_c" 1>&6 +echo "configure:606: checking target system type" >&5 + +target_alias=$target +case "$target_alias" in +NONE) + case $nonopt in + NONE) target_alias=$host_alias ;; + *) target_alias=$nonopt ;; + esac ;; +esac + +target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias` +target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$target" 1>&6 + +echo $ac_n "checking build system type""... $ac_c" 1>&6 +echo "configure:624: checking build system type" >&5 + +build_alias=$build +case "$build_alias" in +NONE) + case $nonopt in + NONE) build_alias=$host_alias ;; + *) build_alias=$nonopt ;; + esac ;; +esac + +build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` +build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$build" 1>&6 + +test "$host_alias" != "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + +if test "$program_transform_name" = s,x,x,; then + program_transform_name= +else + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed +s,\\,\\\\,g; s,\$,$$,g +EOF_SED + program_transform_name="`echo $program_transform_name|sed -f conftestsed`" + rm -f conftestsed +fi +test "$program_prefix" != NONE && + program_transform_name="s,^,${program_prefix},; $program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" + +# sed with no file args requires a program. +test "$program_transform_name" = "" && program_transform_name="s,x,x," + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:678: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +# FIXME: We temporarily define our own version of AC_PROG_CC. This is +# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We +# are probably using a cross compiler, which will not be able to fully +# link an executable. This should really be fixed in autoconf +# itself. + + + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:740: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:769: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + ac_prog_rejected=no + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +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 $# -gt 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 + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:817: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <<EOF +#ifdef __GNUC__ + yes; +#endif +EOF +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:826: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:841: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi + +AS=${AS-as} + +AR=${AR-ar} + +LD=${LD-ld} + +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:877: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +case "${target}" in + mcore-*-elf) + bsp_prefix=elf- + ;; + mcore-*-pe) + bsp_prefix=pe- + ;; +esac + + + +host_makefile_frag=${srcdir}/../config/default.mh + +host_makefile_frag_path=$host_makefile_frag + + + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set) 2>&1 | grep ac_space` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs + + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS <<EOF +#! /bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.12.1" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS <<EOF + +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; + s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@host@%$host%g +s%@host_alias@%$host_alias%g +s%@host_cpu@%$host_cpu%g +s%@host_vendor@%$host_vendor%g +s%@host_os@%$host_os%g +s%@target@%$target%g +s%@target_alias@%$target_alias%g +s%@target_cpu@%$target_cpu%g +s%@target_vendor@%$target_vendor%g +s%@target_os@%$target_os%g +s%@build@%$build%g +s%@build_alias@%$build_alias%g +s%@build_cpu@%$build_cpu%g +s%@build_vendor@%$build_vendor%g +s%@build_os@%$build_os%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@CC@%$CC%g +s%@AS@%$AS%g +s%@AR@%$AR%g +s%@LD@%$LD%g +s%@RANLIB@%$RANLIB%g +s%@bsp_prefix@%$bsp_prefix%g +s%@host_makefile_frag_path@%$host_makefile_frag_path%g +/@host_makefile_frag@/r $host_makefile_frag +s%@host_makefile_frag@%%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <<EOF + +CONFIG_FILES=\${CONFIG_FILES-"Makefile"} +EOF +cat >> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +EOF +cat >> $CONFIG_STATUS <<EOF +srcdir=${srcdir} +target=${target} +ac_configure_args="${ac_configure_args} --enable-multilib" +CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} +libgloss_topdir=${libgloss_topdir} + +EOF +cat >> $CONFIG_STATUS <<\EOF +. ${libgloss_topdir}/config-ml.in +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + diff --git a/libgloss/mcore/configure.in b/libgloss/mcore/configure.in new file mode 100644 index 0000000..5ef9218 --- /dev/null +++ b/libgloss/mcore/configure.in @@ -0,0 +1,100 @@ +dnl Process this file with autoconf to produce a configure script. +AC_PREREQ(2.5)dnl +AC_INIT(crt0.S) + +if test "${enable_shared}" = "yes" ; then + echo "Shared libraries not supported for cross compiling, ignored" +fi + +if test "$srcdir" = "." ; then + if test "${with_target_subdir}" != "." ; then + libgloss_topdir="${srcdir}/${with_multisrctop}../../.." + else + libgloss_topdir="${srcdir}/${with_multisrctop}../.." + fi +else + libgloss_topdir="${srcdir}/../.." +fi +AC_CONFIG_AUX_DIR($libgloss_topdir) + +AC_CANONICAL_SYSTEM +AC_ARG_PROGRAM + +AC_PROG_INSTALL + +# FIXME: We temporarily define our own version of AC_PROG_CC. This is +# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We +# are probably using a cross compiler, which will not be able to fully +# link an executable. This should really be fixed in autoconf +# itself. + +AC_DEFUN(LIB_AC_PROG_CC, +[AC_BEFORE([$0], [AC_PROG_CPP])dnl +AC_CHECK_PROG(CC, gcc, gcc) +if test -z "$CC"; then + AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) + test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) +fi + +AC_PROG_CC_GNU + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +dnl Check whether -g works, even if CFLAGS is set, in case the package +dnl plays around with CFLAGS (such as to build both debugging and +dnl normal versions of a library), tasteless as that idea is. + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + AC_PROG_CC_G + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi +]) + +LIB_AC_PROG_CC +AS=${AS-as} +AC_SUBST(AS) +AR=${AR-ar} +AC_SUBST(AR) +LD=${LD-ld} +AC_SUBST(LD) +AC_PROG_RANLIB + +case "${target}" in + mcore-*-elf) + bsp_prefix=elf- + ;; + mcore-*-pe) + bsp_prefix=pe- + ;; +esac + +AC_SUBST(bsp_prefix) + +host_makefile_frag=${srcdir}/../config/default.mh + +dnl We have to assign the same value to other variables because autoconf +dnl doesn't provide a mechanism to substitute a replacement keyword with +dnl arbitrary data or pathnames. +dnl +host_makefile_frag_path=$host_makefile_frag +AC_SUBST(host_makefile_frag_path) +AC_SUBST_FILE(host_makefile_frag) + +AC_OUTPUT(Makefile, +. ${libgloss_topdir}/config-ml.in, +srcdir=${srcdir} +target=${target} +ac_configure_args="${ac_configure_args} --enable-multilib" +CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} +libgloss_topdir=${libgloss_topdir} +) diff --git a/libgloss/mcore/crt0.S b/libgloss/mcore/crt0.S new file mode 100644 index 0000000..cea4370 --- /dev/null +++ b/libgloss/mcore/crt0.S @@ -0,0 +1,49 @@ +// MCore StartUp Code. + + .import main + .import exit + + .text + .export _start +_start: + .export _mainCRTStartup +_mainCRTStartup: + // Initialise the stack pointer + lrw r1, _stack + mov r0, r1 + + // Zero the .bss data space + lrw r1, __bss_start__ + lrw r2, __bss_end__ + movi r3, 0 +.L0: + st r3, (r1, 0) + addi r1, 4 + cmphs r1, r2 + bf .L0 +#ifdef __ELF__ + // Call the global/static constructors + jbsr _init + + // Setup destructors to be called from exit, + // just in case main never returns... + lrw r2, _fini + jbsr atexit +#endif + + // Initialise the parameters to main() + movi r2, 0 // argc + movi r3, 0 // argv + movi r4, 0 // envp + + // Call main + jbsr main + + // Call exit + movi r2, 0 + jbsr exit + + // We should never reach here. + bkpt + + diff --git a/libgloss/mcore/elf-cmb.ld b/libgloss/mcore/elf-cmb.ld new file mode 100644 index 0000000..591aa9d --- /dev/null +++ b/libgloss/mcore/elf-cmb.ld @@ -0,0 +1,190 @@ +OUTPUT_FORMAT("elf32-mcore-big", "elf32-mcore-big", + "elf32-mcore-little") +OUTPUT_ARCH(mcore) +GROUP(-lc -lcmb -lgcc) +ENTRY(_start) +/* Do we need any of these for elf? + __DYNAMIC = 0; */ +SECTIONS +{ + /* Read-only sections, merged into text segment: */ + . = 0x2f000000; + .interp : { *(.interp) } + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .gnu.version : { *(.gnu.version) } + .gnu.version_d : { *(.gnu.version_d) } + .gnu.version_r : { *(.gnu.version_r) } + .rel.text : + { + *(.rel.text) + *(.rel.text.*) + *(.rel.gnu.linkonce.t*) + } + .rela.text : + { + *(.rela.text) + *(.rela.text.*) + *(.rela.gnu.linkonce.t*) + } + .rel.data : + { + *(.rel.data) + *(.rel.data.*) + *(.rel.gnu.linkonce.d*) + } + .rela.data : + { + *(.rela.data) + *(.rela.data.*) + *(.rela.gnu.linkonce.d*) + } + .rel.rodata : + { + *(.rel.rodata) + *(.rel.rodata.*) + *(.rel.gnu.linkonce.r*) + } + .rela.rodata : + { + *(.rela.rodata) + *(.rela.rodata.*) + *(.rela.gnu.linkonce.r*) + } + .rel.got : { *(.rel.got) } + .rela.got : { *(.rela.got) } + .rel.ctors : { *(.rel.ctors) } + .rela.ctors : { *(.rela.ctors) } + .rel.dtors : { *(.rel.dtors) } + .rela.dtors : { *(.rela.dtors) } + .rel.init : { *(.rel.init) } + .rela.init : { *(.rela.init) } + .rel.fini : { *(.rel.fini) } + .rela.fini : { *(.rela.fini) } + .rel.bss : { *(.rel.bss) } + .rela.bss : { *(.rela.bss) } + .rel.plt : { *(.rel.plt) } + .rela.plt : { *(.rela.plt) } + .init : { KEEP (*(.init)) } =0x0e0e + .plt : { *(.plt) } + .text : + { + *(.text) + *(.text.*) + *(.stub) + /* .gnu.warning sections are handled specially by elf32.em. */ + *(.gnu.warning) + *(.gnu.linkonce.t*) + } =0x0e0e + _etext = .; + PROVIDE (etext = .); + .fini : { KEEP (*(.fini)) } =0x0e0e + .rodata : + { + *(.rodata) + *(.rodata.*) + *(.gnu.linkonce.r*) + } + .rodata1 : { *(.rodata1) } + /* Adjust the address for the data segment. We want to adjust up to + the same address within the page on the next page up. */ + . = ALIGN(0x1000) + (. & (0x1000 - 1)); + .data : + { + *(.data) + *(.data.*) + *(.gnu.linkonce.d*) + SORT(CONSTRUCTORS) + } + .data1 : { *(.data1) } + .eh_frame : { *(.eh_frame) } + .gcc_except_table : { *(.gcc_except_table) } + .ctors : + { + /* gcc uses crtbegin.o to find the start of + the constructors, so we make sure it is + first. Because this is a wildcard, it + doesn't matter if the user does not + actually link against crtbegin.o; the + linker won't look for a file to match a + wildcard. The wildcard also means that it + doesn't matter which directory crtbegin.o + is in. */ + KEEP (*crtbegin.o(.ctors)) + /* We don't want to include the .ctor section from + from the crtend.o file until after the sorted ctors. + The .ctor section from the crtend file contains the + end of ctors marker and it must be last */ + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + } + .dtors : + { + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + } + .got : { *(.got.plt) *(.got) } + .dynamic : { *(.dynamic) } + /* We want the small data sections together, so single-instruction offsets + can access them all, and initialized data all before uninitialized, so + we can shorten the on-disk segment size. */ + .sdata : { *(.sdata) *(.sdata.*) } + _edata = .; + PROVIDE (edata = .); + __bss_start = .; + __bss_start__ = . ; + .sbss : { *(.sbss) *(.scommon) } + .bss : + { + *(.dynbss) + *(.bss) + *(COMMON) + /* Align here to ensure that the .bss section occupies space up to + _end. Align after .bss to ensure correct alignment even if the + .bss section disappears because there are no input sections. */ + . = ALIGN(32 / 8); + } + . = ALIGN(32 / 8); + _end = . ; + __bss_end__ = . ; + PROVIDE (end = .); + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + /* 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) } + .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) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + .stack 0x2f0ffffc : { _stack = .; *(.stack) } + /* These must appear regardless of . */ +} diff --git a/libgloss/mcore/elf-cmb.specs b/libgloss/mcore/elf-cmb.specs new file mode 100644 index 0000000..afb9894 --- /dev/null +++ b/libgloss/mcore/elf-cmb.specs @@ -0,0 +1,3 @@ +*endfile: +-Tcmb.ld crtend.o%s crtn.o%s + diff --git a/libgloss/mcore/fstat.c b/libgloss/mcore/fstat.c new file mode 100644 index 0000000..0205464 --- /dev/null +++ b/libgloss/mcore/fstat.c @@ -0,0 +1,30 @@ +/* fstat.c -- get status of a file. + * + * Copyright (c) 1995, 1999 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include <sys/stat.h> +#include "glue.h" + +/* + * fstat -- Since we have no file system, we just return an error. + */ +int +_DEFUN (_fstat, (fd, buf), + int fd _AND + struct stat *buf) +{ + buf->st_mode = S_IFCHR; /* Always pretend to be a tty */ + buf->st_blksize = 0; + + return (0); +} diff --git a/libgloss/mcore/getpid.c b/libgloss/mcore/getpid.c new file mode 100644 index 0000000..eee2ac0 --- /dev/null +++ b/libgloss/mcore/getpid.c @@ -0,0 +1,25 @@ +/* getpid.c -- get the current process id. + * + * Copyright (c) 1995, 1999 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include "glue.h" + +/* + * getpid -- only one process, so just return 1. + */ +int +_DEFUN (_getpid, (), + ) +{ + return __MYPID; +} diff --git a/libgloss/mcore/kill.c b/libgloss/mcore/kill.c new file mode 100644 index 0000000..43a3597 --- /dev/null +++ b/libgloss/mcore/kill.c @@ -0,0 +1,28 @@ +/* kill.c -- remove a process. + * + * Copyright (c) 1995, 1999 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include "glue.h" + +/* + * kill -- go out via exit... + */ +int +_DEFUN (_kill, (pid, sig), + int pid _AND + int sig) +{ + if(pid == __MYPID) + _exit(sig); + return 0; +} diff --git a/libgloss/mcore/lseek.c b/libgloss/mcore/lseek.c new file mode 100644 index 0000000..0f236fe --- /dev/null +++ b/libgloss/mcore/lseek.c @@ -0,0 +1,31 @@ +/* lseek.c -- move read/write pointer. + * + * Copyright (c) 1995, 1999 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include <sys/types.h> +#include <errno.h> +#include "glue.h" + +/* + * lseek -- Since a serial port is non-seekable, we return an error. + */ +off_t +_DEFUN (_lseek, (fd, offset, whence), + int fd _AND + off_t offset _AND + int whence) +{ + errno = ESPIPE; + return ((off_t)-1); +} + diff --git a/libgloss/mcore/open.c b/libgloss/mcore/open.c new file mode 100644 index 0000000..a9e9959 --- /dev/null +++ b/libgloss/mcore/open.c @@ -0,0 +1,30 @@ +/* open.c -- open a file. + * + * Copyright (c) 1995, 1999 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include <errno.h> +#include "glue.h" + +/* + * open -- open a file descriptor. We don't have a filesystem, so + * we return an error. + */ +int +_DEFUN (_open, (buf, flags, mode), + const char *buf _AND + int flags _AND + int mode) +{ + errno = EIO; + return (-1); +} diff --git a/libgloss/mcore/pe-cmb.ld b/libgloss/mcore/pe-cmb.ld new file mode 100644 index 0000000..2939a3f --- /dev/null +++ b/libgloss/mcore/pe-cmb.ld @@ -0,0 +1,108 @@ +OUTPUT_FORMAT("pei-mcore-big", "pei-mcore-big", + "pei-mcore-little") +GROUP(-lc -lcmb -lgcc) +ENTRY(_mainCRTStartup) +SECTIONS +{ + .text 0x2f000000 : + { + *(.init) + *(.text) + *(SORT(.text$*)) + *(.glue_7t) + *(.glue_7) + ___CTOR_LIST__ = .; __CTOR_LIST__ = . ; + LONG (-1); *(.ctors); *(.ctor); LONG (0); + ___DTOR_LIST__ = .; __DTOR_LIST__ = . ; + LONG (-1); *(.dtors); *(.dtor); LONG (0); + *(.fini) + /* ??? Why is .gcc_exc here? */ + *(.gcc_exc) + etext = .; + *(.gcc_except_table) + } + /* The Cygwin32 library uses a section to avoid copying certain data + on fork. This used to be named ".data". The linker used + to include this between __data_start__ and __data_end__, but that + breaks building the cygwin32 dll. Instead, we name the section + ".data_cygwin_nocopy" and explictly include it after __data_end__. */ + .data BLOCK(__section_alignment__) : + { + __data_start__ = . ; + *(.data) + *(.data2) + *(SORT(.data$*)) + __data_end__ = . ; + *(.data_cygwin_nocopy) + } + .bss BLOCK(__section_alignment__) : + { + __bss_start__ = . ; + *(.bss) + *(COMMON) + __bss_end__ = . ; + } + .rdata BLOCK(__section_alignment__) : + { + *(.rdata) + *(SORT(.rdata$*)) + *(.eh_frame) + } + .edata BLOCK(__section_alignment__) : + { + *(.edata) + } + /DISCARD/ : + { + *(.debug$S) + *(.debug$T) + *(.debug$F) + *(.drectve) + } + .idata BLOCK(__section_alignment__) : + { + /* This cannot currently be handled with grouped sections. + See pe.em:sort_sections. */ + SORT(*)(.idata$2) + SORT(*)(.idata$3) + /* These zeroes mark the end of the import list. */ + LONG (0); LONG (0); LONG (0); LONG (0); LONG (0); + SORT(*)(.idata$4) + SORT(*)(.idata$5) + SORT(*)(.idata$6) + SORT(*)(.idata$7) + } + .CRT BLOCK(__section_alignment__) : + { + *(SORT(.CRT$*)) + } + .endjunk BLOCK(__section_alignment__) : + { + /* end is deprecated, don't use it */ + end = .; + _end = .; + __end__ = .; + } + .reloc BLOCK(__section_alignment__) : + { + *(.reloc) + } + .rsrc BLOCK(__section_alignment__) : + { + *(.rsrc) + *(SORT(.rsrc$*)) + } + .stab BLOCK(__section_alignment__) (NOLOAD) : + { + [ .stab ] + } + .stabstr BLOCK(__section_alignment__) (NOLOAD) : + { + [ .stabstr ] + } + .stack 0x2f0ffffc : + { + _stack = .; + *(.stack) + } +} diff --git a/libgloss/mcore/pe-cmb.specs b/libgloss/mcore/pe-cmb.specs new file mode 100644 index 0000000..941b229 --- /dev/null +++ b/libgloss/mcore/pe-cmb.specs @@ -0,0 +1,3 @@ +*endfile: +-Tcmb.ld + diff --git a/libgloss/mcore/print.c b/libgloss/mcore/print.c new file mode 100644 index 0000000..d0d2bce --- /dev/null +++ b/libgloss/mcore/print.c @@ -0,0 +1,27 @@ +/* print.c -- print a string on the output device. + * + * Copyright (c) 1995, 1999 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include "glue.h" + +/* + * print -- do a raw print of a string + */ +void +_DEFUN (_print, (ptr), +char *ptr) +{ + while (*ptr) { + outbyte (*ptr++); + } +} diff --git a/libgloss/mcore/putnum.c b/libgloss/mcore/putnum.c new file mode 100644 index 0000000..2e37c09 --- /dev/null +++ b/libgloss/mcore/putnum.c @@ -0,0 +1,41 @@ +/* putnum.c -- put a hex number on the output device. + * + * Copyright (c) 1995, 1999 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include "glue.h" + +/* + * putnum -- print a 32 bit number in hex + */ +void +_DEFUN (_putnum, (num), + unsigned int num) +{ + char buf[9]; + int cnt; + char *ptr; + int digit; + + ptr = buf; + for (cnt = 7 ; cnt >= 0 ; cnt--) { + digit = (num >> (cnt * 4)) & 0xf; + + if (digit <= 9) + *ptr++ = (char) ('0' + digit); + else + *ptr++ = (char) ('a' - 10 + digit); + } + + *ptr = (char) 0; + print (buf); +} diff --git a/libgloss/mcore/raise.c b/libgloss/mcore/raise.c new file mode 100644 index 0000000..6657aa6 --- /dev/null +++ b/libgloss/mcore/raise.c @@ -0,0 +1,22 @@ +/* raise.c -- raise a signal for current process. + * + * Copyright (c) 1999 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include "glue.h" + +int +_DEFUN (_raise, (sig), + int sig) +{ + return _kill (_getpid (), sig); +} diff --git a/libgloss/mcore/read.c b/libgloss/mcore/read.c new file mode 100644 index 0000000..499426d --- /dev/null +++ b/libgloss/mcore/read.c @@ -0,0 +1,39 @@ +/* read.c -- read bytes from a input device. + * + * Copyright (c) 1995, 1999 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include "glue.h" + +extern char _DEFUN_VOID (inbyte); + +/* + * read -- read bytes from the serial port. Ignore fd, since + * we only have stdin. + */ +int +_DEFUN (_read, (fd, buf, nbytes), + int fd _AND + char *buf _AND + int nbytes) +{ + int i = 0; + + for (i = 0; i < nbytes; i++) { + *(buf + i) = inbyte(); + if ((*(buf + i) == '\n') || (*(buf + i) == '\r')) { + (*(buf + i + 1)) = 0; + break; + } + } + return (i); +} diff --git a/libgloss/mcore/sbrk.c b/libgloss/mcore/sbrk.c new file mode 100644 index 0000000..8449589 --- /dev/null +++ b/libgloss/mcore/sbrk.c @@ -0,0 +1,42 @@ +/* sbrk.c -- allocate memory dynamically. + * + * Copyright (c) 1995,1996,1999 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include <sys/types.h> +#include <sys/stat.h> +#include "glue.h" + +caddr_t +_sbrk (size_t incr) +{ + static char *heap_end; + char *prev_heap_end; + char *sp = (char *)&sp; + + if (heap_end == 0) + { + heap_end = _end; + } + prev_heap_end = heap_end; + if (heap_end > sp) + { + _write (1, "Heap and stack collision\n", 25); +#if 0 /* Calling abort brings in the signal handling code. */ + abort (); +#else + exit (1); +#endif + } + heap_end += incr; + return (caddr_t) prev_heap_end; +} diff --git a/libgloss/mcore/stat.c b/libgloss/mcore/stat.c new file mode 100644 index 0000000..401a6b5 --- /dev/null +++ b/libgloss/mcore/stat.c @@ -0,0 +1,30 @@ +/* stat.c -- Get the status of a file. + * + * Copyright (c) 1995, 1999 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include <sys/stat.h> +#include <errno.h> +#include "glue.h" + +/* + * stat -- Since we have no file system, we just return an error. + */ +int +_DEFUN (_stat, (path, buf), + const char *path _AND + struct stat *buf) +{ + errno = EIO; + return (-1); +} + diff --git a/libgloss/mcore/syscalls.S b/libgloss/mcore/syscalls.S new file mode 100644 index 0000000..61a2847 --- /dev/null +++ b/libgloss/mcore/syscalls.S @@ -0,0 +1,64 @@ +.macro FUNC_START name + .text + .globl \name + .globl _\name +\name: +_\name: +.endm + +FUNC_START _sbrk + mov r4, r2 // save increment + lrw r3, brkval + ldw r2, (r3) // get next spot + + movi r5, 7 + addi r2, 7 // round up to 8 bytes + andn r2, r5 + + addu r4, r2 // save updated pointer + stw r4, (r3) + jmp r15 + +// brk() could go in here too... + + .data + .import _end +brkval: .long _end + + +FUNC_START _exit + mov r1, r1 // accomodate simulator glitch... + .short 0x5000 + br _exit // hard loop here + +// 0x5001 - printf +// 0x5002 - scanf + +FUNC_START utime + .short 0x5003 + jmp r15 + + +.macro stub name value +FUNC_START \name + movi r1, \value + .short 0x50FF + jmp r15 +.endm + +stub _close 6 +stub _lseek 19 +stub _open 5 +stub _read 3 +stub _times 43 +stub _unlink 10 +stub _write 4 + +//stub access 33 +//stub creat 8 +//stub link 9 +//stub time 13 + +//stub profil 98 // movi r6, 2 +//stub lprofil 98 // movi r6, 4 + diff --git a/libgloss/mcore/unlink.c b/libgloss/mcore/unlink.c new file mode 100644 index 0000000..16dda14 --- /dev/null +++ b/libgloss/mcore/unlink.c @@ -0,0 +1,28 @@ +/* unlink.c -- remove a file. + * + * Copyright (c) 1995, 1999 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include <errno.h> +#include "glue.h" + +/* + * unlink -- since we have no file system, + * we just return an error. + */ +int +_DEFUN (_unlink, (path), + char * path) +{ + errno = EIO; + return (-1); +} diff --git a/libgloss/mcore/write.c b/libgloss/mcore/write.c new file mode 100644 index 0000000..7f39fd1 --- /dev/null +++ b/libgloss/mcore/write.c @@ -0,0 +1,39 @@ +/* write.c -- write bytes to an output device. + * + * Copyright (c) 1995, 1999 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include "glue.h" + +extern int _EXFUN (outbyte, (char x)); + +/* + * write -- write bytes to the serial port. Ignore fd, since + * stdout and stderr are the same. Since we have no filesystem, + * open will only return an error. + */ +int +_DEFUN (_write, (fd, buf, nbytes), + int fd _AND + char *buf _AND + int nbytes) +{ + int i; + + for (i = 0; i < nbytes; i++) { + if (*(buf + i) == '\n') { + outbyte ('\r'); + } + outbyte (*(buf + i)); + } + return (nbytes); +} diff --git a/libgloss/mips/Makefile.in b/libgloss/mips/Makefile.in new file mode 100644 index 0000000..ff88059 --- /dev/null +++ b/libgloss/mips/Makefile.in @@ -0,0 +1,233 @@ +# Copyright (c) 1995, 1996, 1997, 1998, 1999 Cygnus Support +# +# The authors hereby grant permission to use, copy, modify, distribute, +# and license this software and its documentation for any purpose, provided +# that existing copyright notices are retained in all copies and that this +# notice is included verbatim in any distributions. No written agreement, +# license, or royalty fee is required for any of the authorized uses. +# Modifications to this software may be copyrighted by their authors +# and need not follow the licensing terms described here, provided that +# the new terms are clearly indicated on the first page of each file where +# they apply. + +VPATH = @srcdir@ +srcdir = @srcdir@ +objdir = . +srcroot = $(srcdir)/../.. +objroot = $(objdir)/../.. + +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +host_alias = @host_alias@ +target_alias = @target_alias@ +program_transform_name = @program_transform_name@ + +bindir = @bindir@ +libdir = @libdir@ +tooldir = $(exec_prefix)/$(target_alias) + +# Multilib support variables. +# TOP is used instead of MULTI{BUILD,SRC}TOP. +MULTIDIRS = +MULTISUBDIR = +MULTIDO = true +MULTICLEAN = true + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ + +SHELL = /bin/sh + +CC = @CC@ + +#AS = @AS@ +AS = `if [ -f ${objroot}/../gas/as.new ] ; \ + then echo ${objroot}/../gas/as.new ; \ + else echo as ; fi` + +AR = @AR@ + +#LD = @LD@ +LD = `if [ -f ${objroot}/../ld/ld.new ] ; \ + then echo ${objroot}/../ld/ld.new ; \ + else echo ld ; fi` + +RANLIB = @RANLIB@ + +OBJDUMP = `if [ -f ${objroot}/../binutils/objdump ] ; \ + then echo ${objroot}/../binutils/objdump ; \ + else t='$(program_transform_name)'; echo objdump | sed -e $$t ; fi` +OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \ + then echo ${objroot}/../binutils/objcopy ; \ + else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi` + +CRT0 = @crt0@ +PCRT0 = @pcrt0@ +GENOBJS = syscalls.o fstat.o getpid.o isatty.o kill.o \ + lseek.o print.o putnum.o stat.o unlink.o +IDTOBJS = idtmon.o @part_specific_obj@ ${GENOBJS} +PMONOBJS = pmon.o @part_specific_obj@ ${GENOBJS} +LSIOBJS = lsipmon.o @part_specific_obj@ ${GENOBJS} +DVEOBJS = open.o close.o dvemon.o read.o write.o @part_specific_obj@ ${GENOBJS} +JMR3904OBJS = open.o close.o jmr3904-io.o read.o write.o \ + @part_specific_obj@ ${GENOBJS} + +# Nullmon cannot support read and write, but the test cases pull them in via libs +NULLMONOBJS = nullmon.o @part_specific_obj@ ${GENOBJS} + +CFLAGS = -g + +GCC_LDFLAGS = `if [ -d ${objroot}/../gcc ] ; \ + then echo -L${objroot}/../gcc ; fi` + +SCRIPTS = @script_list@ +BSP = @bsp_list@ + +PART_SPECIFIC_DEFINES = @part_specific_defines@ + +# Host specific makefile fragment comes in here. +@host_makefile_frag@ + +# +# 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. +# + +all: ${CRT0} ${PCRT0} test.o ${BSP} + +# +# here's where we build the board support packages for each target +# +mipsidt.o: $(IDTOBJS) + ${LD} -r $(IDTOBJS) -o $@ + +mipspmon.o: $(PMONOBJS) + ${LD} -r $(PMONOBJS) -o $@ + +mipslsi.o: $(PMONOBJS) + ${LD} -r $(LSIOBJS) -o $@ + +libidt.a: $(IDTOBJS) + ${AR} ${ARFLAGS} $@ $(IDTOBJS) + ${RANLIB} $@ + +libpmon.a: $(PMONOBJS) + ${AR} ${ARFLAGS} $@ $(PMONOBJS) + ${RANLIB} $@ + +liblsi.a: $(LSIOBJS) + ${AR} ${ARFLAGS} $@ $(LSIOBJS) + ${RANLIB} $@ + +libdve.a: $(DVEOBJS) + ${AR} ${ARFLAGS} $@ $(DVEOBJS) + ${RANLIB} $@ + +libjmr3904.a: $(JMR3904OBJS) + ${AR} ${ARFLAGS} $@ $(JMR3904OBJS) + ${RANLIB} $@ + +# nullmon.a , This is what you want if you want crt0 but NO mon services +# Supports GDB sim testing, board bringups, ICE operation. +libnullmon.a: $(NULLMONOBJS) + ${AR} ${ARFLAGS} $@ $(NULLMONOBJS) + ${RANLIB} $@ + + +# compile a fully linked binary. The -Wl,-T*.ld is for the linker +# script. By using -Wl, the linker script is put on the proper place +# in the comand line for ld, and all the symbols will get fully +# resolved. + +test: $(OBJS) ${BSP} pmon-test idt-test + @echo Done... + +dtor.o: $(srcdir)/dtor.C + $(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -o $@ -c $< +dtor.x: dtor.o ${CRT0} ${srcdir}/pmon.ld Makefile libpmon.a + ${CC} $(CFLAGS_FOR_TARGET) -L${srcdir} -L${objdir} \ + dtor.o -o $@ $(NEWLIB_LDFLAGS) -N -Wl,-Tpmon.ld + +pmon-test.x: test.o ${CRT0} Makefile libpmon.a + ${CC} $(CFLAGS_FOR_TARGET) -L${srcdir} -L${objdir} \ + test.o -o $@ $(NEWLIB_LDFLAGS) -Wl,-Tpmon.ld +pmon-test.srec: pmon-test.x + $(OBJCOPY) -O srec pmon-test.x $@ +pmon-test.dis: pmon-test.x + @rm -fr pmon-test.dis + $(OBJDUMP) -d pmon-test.x > $@ +pmon-test: pmon-test.srec pmon-test.dis + +idt-test.x: test.o ${CRT0} Makefile libidt.a + ${CC} $(CFLAGS_FOR_TARGET) -L${srcdir} -L${objdir} \ + test.o -o $@ $(NEWLIB_LDFLAGS) -Wl,-Tidt.ld +idt-test.srec: idt-test.x + $(OBJCOPY) -O srec idt-test.x $@ +idt-test.dis: idt-test.x + @rm -fr idt-test.dis + $(OBJDUMP) -d idt-test.x > $@ +idt-test: idt-test.srec idt-test.dis + +doc: + +clean mostlyclean: + rm -f a.out core *.i *~ *.o *-test *.srec *.dis *.map *.x + +distclean maintainer-clean realclean: clean + rm -f Makefile config.status a.out + +.PHONY: install info install-info clean-info +install: + if test "x$(CRT0)" != x ; then \ + $(INSTALL_PROGRAM) $(CRT0) $(tooldir)/lib${MULTISUBDIR}/$(CRT0) ; \ + fi + if test "x$(PCRT0)" != x ; then \ + $(INSTALL_PROGRAM) $(PCRT0) $(tooldir)/lib${MULTISUBDIR}/$(PCRT0) ; \ + fi + @for bsp in ${BSP}; do\ + $(INSTALL_PROGRAM) $${bsp} $(tooldir)/lib${MULTISUBDIR}; \ + done + @for script in ${SCRIPTS}; do\ + $(INSTALL_DATA) ${srcdir}/$${script}.ld $(tooldir)/lib${MULTISUBDIR}/$${script}.ld; \ + done + +info: +install-info: +clean-info: + +test.o: ${srcdir}/test.c + +# these are for the BSPs +crt0.o: ${srcdir}/crt0.S +pcrt0.o: ${srcdir}/crt0.S + $(CC) -c $(CFLAGS_FOR_TARGET) $(CFLAGS) -DGCRT0 ${srcdir}/crt0.S -o ${PCRT0} +idtmon.o: ${srcdir}/idtmon.S +pmon.o: ${srcdir}/pmon.S + $(CC) -c $(CFLAGS_FOR_TARGET) $(CFLAGS) $(PART_SPECIFIC_DEFINES) ${srcdir}/pmon.S -o pmon.o +vr4300.o: ${srcdir}/vr4300.S + $(CC) -c $(CFLAGS_FOR_TARGET) $(CFLAGS) ${srcdir}/vr4300.S +vr5xxx.o: ${srcdir}/vr5xxx.S + $(CC) -c $(CFLAGS_FOR_TARGET) $(CFLAGS) ${srcdir}/vr5xxx.S +lsipmon.o: $(srcdir)/lsipmon.S $(srcdir)/pmon.S +jmr3904-io.o: ${srcdir}/jmr3904-io.c + $(CC) -c $(CFLAGS_FOR_TARGET) $(CFLAGS) -mips3 ${srcdir}/jmr3904-io.c -o $@ + +# cma101 can not be compiled mips16, if a mips16 version is needed then +# it will have to be built, then this rule can be scrapped, allowing +# the implicit rule to run. +cma101.o: ${srcdir}/cma101.c + $(CC) -c $(CFLAGS_FOR_TARGET) $(CFLAGS) -mno-mips16 ${srcdir}/cma101.c + + +syscalls.o: ${srcdir}/syscalls.c + +# target specific makefile fragment comes in here. +@target_makefile_frag@ + +Makefile: Makefile.in config.status @host_makefile_frag_path@ @target_makefile_frag_path@ + $(SHELL) config.status + +config.status: configure + $(SHELL) config.status --recheck diff --git a/libgloss/mips/array-io.c b/libgloss/mips/array-io.c new file mode 100644 index 0000000..5c1d96f --- /dev/null +++ b/libgloss/mips/array-io.c @@ -0,0 +1,68 @@ +/* array-io.c -- I/O code for the Array Tech RAID disk controller. + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include "mips.h" + +/* + * outbyte -- shove a byte out the serial port. We wait till the byte + */ +int +outbyte(byte) + unsigned char byte; +{ + return (PUTCHAR(byte)); +} + +/* + * inbyte -- get a byte from the serial port + */ +unsigned char +inbyte() +{ + return ((unsigned char)GETCHAR); +} + +/* + * led_putnum -- print a hex number on the LED. the value of num must be a byte. + + * The max number 15, since the front panel only has 4 LEDs. + */ +void +led_putnum ( num ) +char num; +{ + print ("Sorry, unimplemented, using putnum instead\r\n"); + putnum (num); +} + +/* + * zylons -- draw a rotating pattern. NOTE: this function never returns. + */ +void +zylons() +{ + print ("Sorry, unimplemented\r\n"); +} + +/* + * delay -- a really gross, ugly hack for simple time delays + */ +void +delay (x) + int x; +{ + int y = 17; + while (x-- !=0) + y = y^2; +} diff --git a/libgloss/mips/array.ld b/libgloss/mips/array.ld new file mode 100644 index 0000000..4675105 --- /dev/null +++ b/libgloss/mips/array.ld @@ -0,0 +1,171 @@ +/* + * memory map assumed by prom and standalone system + * + * physical kseg1 use + * + * 0x1fc20000 0xbfc20000 + * to prom text and read-only data + * 0x1fc00000 0xbfc00000 (in cpu board "prom space") + * + * (Top of RAM - 8K) downward sash and standalone program stack + * | ( - 8K to preserve kernel message bufs) + * V (standalone programs grow their stack + * immediately below sash's stack) + * + * ^ + * | + * 0x00100000 0xa0100000 upward sash program text, data, and bss + * + * ^ + * | + * 0x00020000 0xa0020000 upward standalone program text, data, and bss + * (kernel is loaded here, also) + * + * 0x0001ffff 0xa001ffff downward dbgmon stack + * | + * V + * + * ^ + * | + * 0x00010000 0xa0010000 upward dbgmon text, data, and bss + * + * 0x0000ffff 0xa000ffff downward prom monitor stack + * | + * V + * + * ^ + * | + * 0x00000500 0xa0000500 upward prom monitor bss + * + * 0x000004ff 0xa00004ff + * to restart block + * 0x00000400 0xa0000400 + * + * 0x000003ff 0xa00003ff + * to general exception code + * 0x00000080 0xa0000080 (note cpu addresses as 0x80000080!) + * + * 0x0000007f 0xa000007f + * to utlbmiss exception code + * 0x00000000 0xa0000000 (note cpu addresses as 0x80000000!) + */ + +/* Uncomment this if you want srecords. +OUTPUT_FORMAT(srec) + */ +ENTRY(start) +STARTUP(crt0.o) +INPUT(array.o) +SEARCH_DIR(.) +__DYNAMIC = 0; + +/* + * Allocate the stack to be at the top of memory, since the stack + * grows down + * +PROVIDE (__stack = 1M - 8); + */ + +/* + * Initalize some symbols to be zero so we can reference them in the + * crt0 without core dumping. These functions are all optional, but + * we do this so we can have our crt0 always use them if they exist. + * This is so BSPs work better when using the crt0 installed with gcc. + * We have to initalize them twice, so we multiple object file + * formats, as some prepend an underscore. + */ +PROVIDE (hardware_init_hook = 0); +PROVIDE (software_init_hook = 0); + +SECTIONS +{ + . = 0x80020000; + .text : { + _ftext = . ; + *(.init) + eprol = .; + *(.text) + *(.text.*) + *(.gnu.linkonce.t*) + *(.mips16.fn.*) + *(.mips16.call.*) + PROVIDE (__runtime_reloc_start = .); + *(.rel.sdata) + PROVIDE (__runtime_reloc_stop = .); + *(.fini) + etext = .; + _etext = .; + } + + .ctors : + { + /* gcc uses crtbegin.o to find the start of + the constructors, so we make sure it is + first. Because this is a wildcard, it + doesn't matter if the user does not + actually link against crtbegin.o; the + linker won't look for a file to match a + wildcard. The wildcard also means that it + doesn't matter which directory crtbegin.o + is in. */ + + KEEP (*crtbegin.o(.ctors)) + + /* We don't want to include the .ctor section from + from the crtend.o file until after the sorted ctors. + The .ctor section from the crtend file contains the + end of ctors marker and it must be last */ + + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + } + + .dtors : + { + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + } + + . = .; + .rdata : { + *(.rdata) + *(.rodata) + *(.rodata.*) + *(.gnu.linkonce.r*) + } + _fdata = ALIGN(16); + .data : { + *(.data) + *(.data.*) + *(.gnu.linkonce.d*) + } + _gp = ALIGN(16) + 0x8000; + .lit8 : { + *(.lit8) + } + .lit4 : { + *(.lit4) + } + .sdata : { + *(.sdata) + *(.sdata.*) + *(.gnu.linkonce.s*) + } + edata = .; + _edata = .; + _fbss = .; + .sbss : { + *(.sbss) + *(.scommon) + } + .bss : { + _bss_start = . ; + *(.bss) + *(COMMON) + } + end = .; + _end = .; +} diff --git a/libgloss/mips/cma101.c b/libgloss/mips/cma101.c new file mode 100644 index 0000000..0a70440 --- /dev/null +++ b/libgloss/mips/cma101.c @@ -0,0 +1,300 @@ +/* + * cma101.c -- lo-level support for Cogent CMA101 development board. + * + * Copyright (c) 1996 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#ifdef __mips16 +/* The assembler portions of this file need to be re-written to + support mips16, if and when that seems useful. +*/ +#error cma101.c can not be compiled -mips16 +#endif + + +#include <time.h> /* standard ANSI time routines */ + +/* Normally these would appear in a header file for external + use. However, we are only building a simple example world at the + moment: */ + +#include "regs.S" + +#if defined(MIPSEB) +#define BYTEREG(b,o) ((volatile unsigned char *)(PHYS_TO_K1((b) + (o) + 7))) +#endif /* MIPSEB */ +#if defined(MIPSEL) +#define BYTEREG(b,o) ((volatile unsigned char *)(PHYS_TO_K1((b) + (o)))) +#endif /* MIPSEL */ + +/* I/O addresses: */ +#define RTCLOCK_BASE (0x0E800000) /* Mk48T02 NVRAM/RTC */ +#define UART_BASE (0x0E900000) /* NS16C552 DUART */ +#define LCD_BASE (0x0EB00000) /* Alphanumeric display */ + +/* LCD panel manifests: */ +#define LCD_DATA BYTEREG(LCD_BASE,0) +#define LCD_CMD BYTEREG(LCD_BASE,8) + +#define LCD_STAT_BUSY (0x80) +#define LCD_SET_DDADDR (0x80) + +/* RTC manifests */ +/* The lo-offsets are the NVRAM locations (0x7F8 bytes) */ +#define RTC_CONTROL BYTEREG(RTCLOCK_BASE,0x3FC0) +#define RTC_SECS BYTEREG(RTCLOCK_BASE,0x3FC8) +#define RTC_MINS BYTEREG(RTCLOCK_BASE,0x3FD0) +#define RTC_HOURS BYTEREG(RTCLOCK_BASE,0x3FD8) +#define RTC_DAY BYTEREG(RTCLOCK_BASE,0x3FE0) +#define RTC_DATE BYTEREG(RTCLOCK_BASE,0x3FE8) +#define RTC_MONTH BYTEREG(RTCLOCK_BASE,0x3FF0) +#define RTC_YEAR BYTEREG(RTCLOCK_BASE,0x3FF8) + +#define RTC_CTL_LOCK_READ (0x40) /* lock RTC whilst reading */ +#define RTC_CTL_LOCK_WRITE (0x80) /* lock RTC whilst writing */ + +/* Macro to force out-standing memory transfers to complete before + next sequence. For the moment we assume that the processor in the + CMA101 board supports at least ISA II. */ +#define DOSYNC() asm(" .set mips2 ; sync ; .set mips0") + +/* We disable interrupts by writing zero to all of the masks, and the + global interrupt enable bit: */ +#define INTDISABLE(sr,tmp) asm("\ + .set mips2 ; \ + mfc0 %0,$12 ; \ + lui %1,0xffff ; \ + ori %1,%1,0xfffe ; \ + and %1, %0, %1 ; \ + mtc0 %1,$12 ; \ + .set mips0" : "=d" (sr), "=d" (tmp)) +#define INTRESTORE(sr) asm("\ + .set mips2 ; \ + mtc0 %0,$12 ; \ + .set mips0" : : "d" (sr)) + +/* TODO:FIXME: The CPU card support should be in separate source file + from the standard CMA101 support provided in this file. */ + +/* The CMA101 board being used contains a CMA257 Vr4300 CPU: + MasterClock is at 33MHz. PClock is derived from MasterClock by + multiplying by the ratio defined by the DivMode pins: + DivMode(1:0) MasterClock PClock Ratio + 00 100MHz 100MHz 1:1 + 01 100MHz 150MHz 1.5:1 + 10 100MHz 200MHz 2:1 + 11 100Mhz 300MHz 3:1 + + Are these pins reflected in the EC bits in the CONFIG register? or + is that talking about a different clock multiplier? + 110 = 1 + 111 = 1.5 + 000 = 2 + 001 = 3 + (all other values are undefined) +*/ + +#define MASTERCLOCK (33) /* ticks per uS */ +unsigned int pclock; /* number of PClock ticks per uS */ +void +set_pclock (void) +{ + unsigned int config; + asm volatile ("mfc0 %0,$16 ; nop ; nop" : "=r" (config)); /* nasty CP0 register constant */ + switch ((config >> 28) & 0x7) { + case 0x7 : /* 1.5:1 */ + pclock = (MASTERCLOCK + (MASTERCLOCK / 2)); + break; + + case 0x0 : /* 2:1 */ + pclock = (2 * MASTERCLOCK); + break; + + case 0x1 : /* 3:1 */ + pclock = (3 * MASTERCLOCK); + break; + + case 0x6 : /* 1:1 */ + default : /* invalid configuration, so assume the lowest */ + pclock = MASTERCLOCK; + break; + } + + return; +} + +#define PCLOCK_WAIT(x) __cpu_timer_poll((x) * pclock) + +/* NOTE: On the Cogent CMA101 board the LCD controller will sometimes + return not-busy, even though it is. The work-around is to perform a + ~50uS delay before checking the busy signal. */ + +static int +lcd_busy (void) +{ + PCLOCK_WAIT(50); /* 50uS delay */ + return(*LCD_CMD & LCD_STAT_BUSY); +} + +/* Note: This code *ASSUMES* that the LCD has already been initialised + by the monitor. It only provides code to write to the LCD, and is + not a complete device driver. */ + +void +lcd_display (int line, const char *msg) +{ + int n; + + if (lcd_busy ()) + return; + + *LCD_CMD = (LCD_SET_DDADDR | (line == 1 ? 0x40 : 0x00)); + + for (n = 0; n < 16; n++) { + if (lcd_busy ()) + return; + if (*msg) + *LCD_DATA = *msg++; + else + *LCD_DATA = ' '; + } + + return; +} + +#define SM_PATTERN (0x55AA55AA) +#define SM_INCR ((256 << 10) / sizeof(unsigned int)) /* 64K words */ + +extern unsigned int __buserr_count(void); +extern void __default_buserr_handler(void); +extern void __restore_buserr_handler(void); + +unsigned int +__sizemem () +{ + volatile unsigned int *base; + volatile unsigned int *probe; + unsigned int baseorig; + unsigned int sr; + extern void *end; + int extra; + + INTDISABLE(sr,baseorig); /* disable all interrupt masks */ + + __default_buserr_handler(); + __cpu_flush(); + + DOSYNC(); + + /* _end is the end of the user program. _end may not be properly aligned + for an int pointer, so we adjust the address to make sure it is safe. + We use void * arithmetic to avoid accidentally truncating the pointer. */ + + extra = ((int) &end & (sizeof (int) - 1)); + base = ((void *) &end + sizeof (int) - extra); + baseorig = *base; + + *base = SM_PATTERN; + /* This assumes that the instructions fetched between the store, and + the following read will have changed the data bus contents: */ + if (*base == SM_PATTERN) { + probe = base; + for (;;) { + unsigned int probeorig; + probe += SM_INCR; + probeorig = *probe; + /* Check if a bus error occurred: */ + if (!__buserr_count()) { + *probe = SM_PATTERN; + DOSYNC(); + if (*probe == SM_PATTERN) { + *probe = ~SM_PATTERN; + DOSYNC(); + if (*probe == ~SM_PATTERN) { + if (*base == SM_PATTERN) { + *probe = probeorig; + continue; + } + } + } + *probe = probeorig; + } + break; + } + } + + *base = baseorig; + __restore_buserr_handler(); + __cpu_flush(); + + DOSYNC(); + + INTRESTORE(sr); /* restore interrupt mask to entry state */ + + return((probe - base) * sizeof(unsigned int)); +} + +/* Provided as a function, so as to avoid reading the I/O location + multiple times: */ +static int +convertbcd(byte) + unsigned char byte; +{ + return ((((byte >> 4) & 0xF) * 10) + (byte & 0xF)); +} + +time_t +time (_timer) + time_t *_timer; +{ + time_t result = 0; + struct tm tm; + *RTC_CONTROL |= RTC_CTL_LOCK_READ; + DOSYNC(); + + tm.tm_sec = convertbcd(*RTC_SECS); + tm.tm_min = convertbcd(*RTC_MINS); + tm.tm_hour = convertbcd(*RTC_HOURS); + tm.tm_mday = convertbcd(*RTC_DATE); + tm.tm_mon = convertbcd(*RTC_MONTH); + tm.tm_year = convertbcd(*RTC_YEAR); + + DOSYNC(); + *RTC_CONTROL &= ~(RTC_CTL_LOCK_READ | RTC_CTL_LOCK_WRITE); + + tm.tm_isdst = 0; + + /* Check for invalid time information */ + if ((tm.tm_sec < 60) && (tm.tm_min < 60) && (tm.tm_hour < 24) + && (tm.tm_mday < 32) && (tm.tm_mon < 13)) { + + /* Get the correct year number, but keep it in YEAR-1900 form: */ + if (tm.tm_year < 70) + tm.tm_year += 100; + +#if 0 /* NOTE: mon_printf() can only accept 4 arguments (format string + 3 fields) */ + mon_printf("[DBG: s=%d m=%d h=%d]", tm.tm_sec, tm.tm_min, tm.tm_hour); + mon_printf("[DBG: d=%d m=%d y=%d]", tm.tm_mday, tm.tm_mon, tm.tm_year); +#endif + + /* Convert the time-structure into a second count */ + result = mktime (&tm); + } + + if (_timer != NULL) + *_timer = result; + + return (result); +} + +/*> EOF cma101.c <*/ diff --git a/libgloss/mips/configure b/libgloss/mips/configure new file mode 100755 index 0000000..3ac1daa --- /dev/null +++ b/libgloss/mips/configure @@ -0,0 +1,1254 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.13 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.13" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=crt0.S + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +ac_exeext= +ac_objext=o +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + +if test "${enable_shared}" = "yes" ; then + echo "Shared libraries not supported for cross compiling, ignored" +fi + +if test "$srcdir" = "." ; then + if test "${with_target_subdir}" != "." ; then + libgloss_topdir="${srcdir}/${with_multisrctop}../../.." + else + libgloss_topdir="${srcdir}/${with_multisrctop}../.." + fi +else + libgloss_topdir="${srcdir}/../.." +fi +ac_aux_dir= +for ac_dir in $libgloss_topdir $srcdir/$libgloss_topdir; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $libgloss_topdir $srcdir/$libgloss_topdir" 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + + + +# Do some error checking and defaulting for the host and target type. +# The inputs are: +# configure --host=HOST --target=TARGET --build=BUILD NONOPT +# +# The rules are: +# 1. You are not allowed to specify --host, --target, and nonopt at the +# same time. +# 2. Host defaults to nonopt. +# 3. If nonopt is not specified, then host defaults to the current host, +# as determined by config.guess. +# 4. Target and build default to nonopt. +# 5. If nonopt is not specified, then target and build default to host. + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +case $host---$target---$nonopt in +NONE---*---* | *---NONE---* | *---*---NONE) ;; +*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;; +esac + + +# Make sure we can run config.sub. +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi + +echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:587: checking host system type" >&5 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + +echo $ac_n "checking target system type""... $ac_c" 1>&6 +echo "configure:608: checking target system type" >&5 + +target_alias=$target +case "$target_alias" in +NONE) + case $nonopt in + NONE) target_alias=$host_alias ;; + *) target_alias=$nonopt ;; + esac ;; +esac + +target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias` +target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$target" 1>&6 + +echo $ac_n "checking build system type""... $ac_c" 1>&6 +echo "configure:626: checking build system type" >&5 + +build_alias=$build +case "$build_alias" in +NONE) + case $nonopt in + NONE) build_alias=$host_alias ;; + *) build_alias=$nonopt ;; + esac ;; +esac + +build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` +build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$build" 1>&6 + +test "$host_alias" != "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + +if test "$program_transform_name" = s,x,x,; then + program_transform_name= +else + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed +s,\\,\\\\,g; s,\$,$$,g +EOF_SED + program_transform_name="`echo $program_transform_name|sed -f conftestsed`" + rm -f conftestsed +fi +test "$program_prefix" != NONE && + program_transform_name="s,^,${program_prefix},; $program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" + +# sed with no file args requires a program. +test "$program_transform_name" = "" && program_transform_name="s,x,x," + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:680: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +# FIXME: We temporarily define our own version of AC_PROG_CC. This is +# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We +# are building a library that must be included in all links, so we +# can't link an executable until this lib is built. +# autoconf should provide a way to do this. + + + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:744: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:774: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +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 $# -gt 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 + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:823: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <<EOF +#ifdef __GNUC__ + yes; +#endif +EOF +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:832: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:847: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi + +AS=${AS-as} + +AR=${AR-ar} + +LD=${LD-ld} + +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:883: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +crt0=crt0.o +pcrt0=pcrt0.o + +case "${target}" in + mips*-tx39*-*|mipstx39*-*-*) + part_specific_obj= + part_specific_defines= + script_list="dve idt jmr3904app jmr3904dram jmr3904dram-java jmr3904app-java" + bsp_list="libdve.a libidt.a libjmr3904.a" + ;; + mips*-lsi*-*) + part_specific_obj=entry.o + part_specific_defines= + script_list="lsi" + bsp_list=liblsi.a + ;; + mips64vr5*-*-*) + part_specific_obj="vr5xxx.o cma101.o" + part_specific_defines=-DR5000 + script_list="idt pmon ddb lsi idtecoff nullmon" + bsp_list="libidt.a libpmon.a liblsi.a libnullmon.a" + ;; + *) + part_specific_obj="vr4300.o cma101.o" + part_specific_defines= + script_list="idt pmon ddb lsi idtecoff nullmon" + bsp_list="libidt.a libpmon.a liblsi.a libnullmon.a" + ;; +esac + +host_makefile_frag=${srcdir}/../config/default.mh +target_makefile_frag=${srcdir}/../config/mips.mt + +host_makefile_frag_path=$host_makefile_frag + + +target_makefile_frag_path=$target_makefile_frag + + + + + + + + + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs + + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS <<EOF +#! /bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.13" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS <<EOF + +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; + s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@FFLAGS@%$FFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@host@%$host%g +s%@host_alias@%$host_alias%g +s%@host_cpu@%$host_cpu%g +s%@host_vendor@%$host_vendor%g +s%@host_os@%$host_os%g +s%@target@%$target%g +s%@target_alias@%$target_alias%g +s%@target_cpu@%$target_cpu%g +s%@target_vendor@%$target_vendor%g +s%@target_os@%$target_os%g +s%@build@%$build%g +s%@build_alias@%$build_alias%g +s%@build_cpu@%$build_cpu%g +s%@build_vendor@%$build_vendor%g +s%@build_os@%$build_os%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@CC@%$CC%g +s%@AS@%$AS%g +s%@AR@%$AR%g +s%@LD@%$LD%g +s%@RANLIB@%$RANLIB%g +s%@host_makefile_frag_path@%$host_makefile_frag_path%g +/@host_makefile_frag@/r $host_makefile_frag +s%@host_makefile_frag@%%g +s%@target_makefile_frag_path@%$target_makefile_frag_path%g +/@target_makefile_frag@/r $target_makefile_frag +s%@target_makefile_frag@%%g +s%@part_specific_obj@%$part_specific_obj%g +s%@part_specific_defines@%$part_specific_defines%g +s%@script_list@%$script_list%g +s%@bsp_list@%$bsp_list%g +s%@crt0@%$crt0%g +s%@pcrt0@%$pcrt0%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <<EOF + +CONFIG_FILES=\${CONFIG_FILES-"Makefile"} +EOF +cat >> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +EOF +cat >> $CONFIG_STATUS <<EOF +srcdir=${srcdir} +target=${target} +ac_configure_args="${ac_configure_args} --enable-multilib" +CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} +libgloss_topdir=${libgloss_topdir} + +EOF +cat >> $CONFIG_STATUS <<\EOF +. ${libgloss_topdir}/config-ml.in +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + + + diff --git a/libgloss/mips/configure.in b/libgloss/mips/configure.in new file mode 100644 index 0000000..8191529 --- /dev/null +++ b/libgloss/mips/configure.in @@ -0,0 +1,144 @@ +# Copyright (c) 1995, 1996, 1997, 1998, 1999 Cygnus Support +# +# The authors hereby grant permission to use, copy, modify, distribute, +# and license this software and its documentation for any purpose, provided +# that existing copyright notices are retained in all copies and that this +# notice is included verbatim in any distributions. No written agreement, +# license, or royalty fee is required for any of the authorized uses. +# Modifications to this software may be copyrighted by their authors +# and need not follow the licensing terms described here, provided that +# the new terms are clearly indicated on the first page of each file where +# they apply. +# +# Process this file with autoconf to produce a configure script. +# +AC_PREREQ(2.5)dnl +AC_INIT(crt0.S) + +if test "${enable_shared}" = "yes" ; then + echo "Shared libraries not supported for cross compiling, ignored" +fi + +if test "$srcdir" = "." ; then + if test "${with_target_subdir}" != "." ; then + libgloss_topdir="${srcdir}/${with_multisrctop}../../.." + else + libgloss_topdir="${srcdir}/${with_multisrctop}../.." + fi +else + libgloss_topdir="${srcdir}/../.." +fi +AC_CONFIG_AUX_DIR($libgloss_topdir) + +AC_CANONICAL_SYSTEM +AC_ARG_PROGRAM + +AC_PROG_INSTALL + +# FIXME: We temporarily define our own version of AC_PROG_CC. This is +# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We +# are building a library that must be included in all links, so we +# can't link an executable until this lib is built. +# autoconf should provide a way to do this. + +AC_DEFUN(LIB_AC_PROG_CC, +[AC_BEFORE([$0], [AC_PROG_CPP])dnl +AC_CHECK_PROG(CC, gcc, gcc) +if test -z "$CC"; then + AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) + test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) +fi + +AC_PROG_CC_GNU + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +dnl Check whether -g works, even if CFLAGS is set, in case the package +dnl plays around with CFLAGS (such as to build both debugging and +dnl normal versions of a library), tasteless as that idea is. + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + AC_PROG_CC_G + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi +]) + +LIB_AC_PROG_CC +AS=${AS-as} +AC_SUBST(AS) +AR=${AR-ar} +AC_SUBST(AR) +LD=${LD-ld} +AC_SUBST(LD) +AC_PROG_RANLIB + +crt0=crt0.o +pcrt0=pcrt0.o + +case "${target}" in + mips*-tx39*-*|mipstx39*-*-*) + part_specific_obj= + part_specific_defines= + script_list="dve idt jmr3904app jmr3904dram jmr3904dram-java jmr3904app-java" + bsp_list="libdve.a libidt.a libjmr3904.a" + ;; + mips*-lsi*-*) + part_specific_obj=entry.o + part_specific_defines= + script_list="lsi" + bsp_list=liblsi.a + ;; + mips64vr5*-*-*) + part_specific_obj="vr5xxx.o cma101.o" + part_specific_defines=-DR5000 + script_list="idt pmon ddb lsi idtecoff nullmon" + bsp_list="libidt.a libpmon.a liblsi.a libnullmon.a" + ;; + *) + part_specific_obj="vr4300.o cma101.o" + part_specific_defines= + script_list="idt pmon ddb lsi idtecoff nullmon" + bsp_list="libidt.a libpmon.a liblsi.a libnullmon.a" + ;; +esac + +host_makefile_frag=${srcdir}/../config/default.mh +target_makefile_frag=${srcdir}/../config/mips.mt + +dnl We have to assign the same value to other variables because autoconf +dnl doesn't provide a mechanism to substitute a replacement keyword with +dnl arbitrary data or pathnames. +dnl +host_makefile_frag_path=$host_makefile_frag +AC_SUBST(host_makefile_frag_path) +AC_SUBST_FILE(host_makefile_frag) +target_makefile_frag_path=$target_makefile_frag +AC_SUBST(target_makefile_frag_path) +AC_SUBST_FILE(target_makefile_frag) +AC_SUBST(part_specific_obj) +AC_SUBST(part_specific_defines) +AC_SUBST(script_list) +AC_SUBST(bsp_list) +AC_SUBST(crt0) +AC_SUBST(pcrt0) + +AC_OUTPUT(Makefile, +. ${libgloss_topdir}/config-ml.in, +srcdir=${srcdir} +target=${target} +ac_configure_args="${ac_configure_args} --enable-multilib" +CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} +libgloss_topdir=${libgloss_topdir} +) + + diff --git a/libgloss/mips/crt0.S b/libgloss/mips/crt0.S new file mode 100644 index 0000000..dbecc5e --- /dev/null +++ b/libgloss/mips/crt0.S @@ -0,0 +1,230 @@ +/* + * crt0.S -- startup file for MIPS. + * + * Copyright (c) 1995, 1996, 1997 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#ifdef __mips16 +/* This file contains 32 bit assembly code. */ + .set nomips16 +#endif + +#include "regs.S" + +/* + * Set up some room for a stack. We just grab a chunk of memory. + */ +#define STACK_SIZE 0x4000 +#define GLOBAL_SIZE 0x2000 + +#define STARTUP_STACK_SIZE 0x0100 + +/* This is for referencing addresses that are not in the .sdata or + .sbss section under embedded-pic, or before we've set up gp. */ +#ifdef __mips_embedded_pic +# ifdef __mips64 +# define LA(t,x) la t,x-PICBASE ; daddu t,s0,t +# else +# define LA(t,x) la t,x-PICBASE ; addu t,s0,t +# endif +#else /* __mips_embedded_pic */ +# define LA(t,x) la t,x +#endif /* __mips_embedded_pic */ + + .comm __memsize, 12 + .comm __lstack, STARTUP_STACK_SIZE + .comm __stackbase,4 + + .text + .align 2 + +/* Without the following nop, GDB thinks _start is a data variable. + * This is probably a bug in GDB in handling a symbol that is at the + * start of the .text section. + */ + nop + + .globl _start + .ent _start +_start: + .set noreorder +#ifdef __mips_embedded_pic + PICBASE = .+8 + bal PICBASE + nop + move s0,$31 +#endif +#if __mips < 3 +#define STATUS_MASK (SR_CU1|SR_PE) +#else +# For mips3 or mips4, turn on 64-bit addressing and additional float regs +#define STATUS_MASK (SR_CU1|SR_PE|SR_FR|SR_KX|SR_SX|SR_UX) +#endif + li v0, STATUS_MASK + mtc0 v0, C0_SR + mtc0 zero, C0_CAUSE + nop + +/* Check for FPU presence. Don't check if we know that soft_float is + being used. (This also avoids illegal instruction exceptions.) */ + +#ifndef __mips_soft_float + li t2,0xAAAA5555 + mtc1 t2,fp0 /* write to FPR 0 */ + mtc1 zero,fp1 /* write to FPR 1 */ + mfc1 t0,fp0 + mfc1 t1,fp1 + nop + bne t0,t2,1f /* check for match */ + nop + bne t1,zero,1f /* double check */ + nop + j 2f /* FPU is present. */ + nop +#endif +1: + /* FPU is not present. Set status register to say that. */ + li v0, (STATUS_MASK-(STATUS_MASK & SR_CU1)) + mtc0 v0, C0_SR + nop +2: + + +/* Fix high bits, if any, of the PC so that exception handling + doesn't get confused. */ + LA (v0, 3f) + jr v0 + nop +3: + LA (gp, _gp) # set the global data pointer + .end _start + +/* + * zero out the bss section. + */ + .globl __memsize + .globl get_mem_info .text + .globl __stack + .globl __global + .globl zerobss + .ent zerobss +zerobss: + LA (v0, _fbss) + LA (v1, _end) +3: + sw zero,0(v0) + bltu v0,v1,3b + addiu v0,v0,4 # executed in delay slot + + la t0, __lstack # make a small stack so we + addiu sp, t0, STARTUP_STACK_SIZE # can run some C code + la a0, __memsize # get the usable memory size + jal get_mem_info + nop + + /* setup the stack pointer */ + LA (t0, __stack) # is __stack set ? + bne t0,zero,4f + nop + + /* NOTE: a0[0] contains the amount of memory available, and + not the last memory address. */ + lw t0,0(a0) # last address of memory available + la t1,K0BASE # cached kernel memory + addu t0,t0,t1 # get the end of memory address + /* We must subtract 24 bytes for the 3 8 byte arguments to main, in + case main wants to write them back to the stack. The caller is + supposed to allocate stack space for parameters in registers in + the old MIPS ABIs. We must do this even though we aren't passing + arguments, because main might be declared to have them. + + Some ports need a larger alignment for the stack, so we subtract + 32, which satisifes the stack for the arguments and keeps the + stack pointer better aligned. */ + subu t0,t0,32 # and generate a starting stack-pointer +4: + move sp,t0 # set stack pointer + sw sp,__stackbase # keep this for future ref + .end zerobss + +/* + * initialize target specific stuff. Only execute these + * functions it they exist. + */ + .globl hardware_init_hook .text + .globl software_init_hook .text + .globl __do_global_dtors .text + .globl atexit .text + .globl exit .text + .globl init + .ent init +init: + LA (t9, hardware_init_hook) # init the hardware if needed + beq t9,zero,6f + nop + jal t9 + nop +6: + LA (t9, software_init_hook) # init the hardware if needed + beq t9,zero,7f + nop + jal t9 + nop +7: + LA (a0, __do_global_dtors) + jal atexit + nop + +#ifdef GCRT0 + .globl _ftext + .globl _extext + LA (a0, _ftext) + LA (a1, _etext) + jal monstartup + nop +#endif + + move a0,zero # set argc to 0 + jal main # call the program start function + nop + + # fall through to the "exit" routine + jal exit # call libc exit to run the G++ + # destructors + move a0,v0 # pass through the exit code + .end init + +/* + * _exit -- Exit from the application. Normally we cause a user trap + * to return to the ROM monitor for another run. NOTE: This is + * the only other routine we provide in the crt0.o object, since + * it may be tied to the "_start" routine. It also allows + * executables that contain a complete world to be linked with + * just the crt0.o object. + */ + .globl _exit + .ent _exit +_exit: +7: +#ifdef GCRT0 + jal _mcleanup + nop +#endif + # break instruction can cope with 0xfffff, but GAS limits the range: + break 1023 + nop + b 7b # but loop back just in-case + nop + .end _exit + +/* EOF crt0.S */ diff --git a/libgloss/mips/ddb.ld b/libgloss/mips/ddb.ld new file mode 100644 index 0000000..73dbad9 --- /dev/null +++ b/libgloss/mips/ddb.ld @@ -0,0 +1,154 @@ +/* The following TEXT start address leaves space for the monitor + workspace. */ + +ENTRY(_start) +OUTPUT_FORMAT("elf32-bigmips", "elf32-bigmips", "elf32-littlemips") +GROUP(-lc -lpmon -lgcc) +SEARCH_DIR(.) +__DYNAMIC = 0; + +/* + * Allocate the stack to be at the top of memory, since the stack + * grows down + */ +PROVIDE (__stack = 0); +/* PROVIDE (__global = 0); */ + +/* + * Initalize some symbols to be zero so we can reference them in the + * crt0 without core dumping. These functions are all optional, but + * we do this so we can have our crt0 always use them if they exist. + * This is so BSPs work better when using the crt0 installed with gcc. + * We have to initalize them twice, so we multiple object file + * formats, as some prepend an underscore. + */ +PROVIDE (hardware_init_hook = 0); +PROVIDE (software_init_hook = 0); + +SECTIONS +{ + . = 0xA0100000; + .text : { + _ftext = . ; + *(.init) + eprol = .; + *(.text) + *(.text.*) + *(.gnu.linkonce.t*) + *(.mips16.fn.*) + *(.mips16.call.*) + PROVIDE (__runtime_reloc_start = .); + *(.rel.sdata) + PROVIDE (__runtime_reloc_stop = .); + *(.fini) + etext = .; + _etext = .; + } + + .ctors : + { + /* gcc uses crtbegin.o to find the start of + the constructors, so we make sure it is + first. Because this is a wildcard, it + doesn't matter if the user does not + actually link against crtbegin.o; the + linker won't look for a file to match a + wildcard. The wildcard also means that it + doesn't matter which directory crtbegin.o + is in. */ + + KEEP (*crtbegin.o(.ctors)) + + /* We don't want to include the .ctor section from + from the crtend.o file until after the sorted ctors. + The .ctor section from the crtend file contains the + end of ctors marker and it must be last */ + + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + } + + .dtors : + { + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + } + + . = .; + .rdata : { + *(.rdata) + *(.rodata) + *(.rodata.*) + *(.gnu.linkonce.r*) + } + _fdata = ALIGN(16); + .data : { + *(.data) + *(.data.*) + *(.gnu.linkonce.d*) + } + . = ALIGN(8); + _gp = . + 0x8000; + __global = _gp; + .lit8 : { + *(.lit8) + } + .lit4 : { + *(.lit4) + } + .sdata : { + *(.sdata) + *(.sdata.*) + *(.gnu.linkonce.s*) + } + . = ALIGN(4); + edata = .; + _edata = .; + _fbss = .; + .sbss : { + *(.sbss) + *(.scommon) + } + .bss : { + _bss_start = . ; + *(.bss) + *(COMMON) + } + + end = .; + _end = .; + + /* 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) } + .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) } + + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } +} diff --git a/libgloss/mips/dtor.C b/libgloss/mips/dtor.C new file mode 100644 index 0000000..2cfcb46 --- /dev/null +++ b/libgloss/mips/dtor.C @@ -0,0 +1,25 @@ +#include <stdio.h> + +extern "C" void print (char *, ...); + +class foo +{ +public: + foo () { print ("ctor\n"); } + ~foo () { print ("dtor\n"); } +}; + +foo x; + +main () +{ + outbyte ('&'); + outbyte ('@'); + outbyte ('$'); + outbyte ('%'); + print ("FooBar\r\n"); + + /* whew, we made it */ + print ("\r\nDone...\r\n"); + fflush(stdout); +} diff --git a/libgloss/mips/dve.ld b/libgloss/mips/dve.ld new file mode 100644 index 0000000..a09eeee --- /dev/null +++ b/libgloss/mips/dve.ld @@ -0,0 +1,155 @@ +/* Linker script for Densan DVE-R3900/20A board */ + +ENTRY(_start) +OUTPUT_ARCH("mips:3000") +OUTPUT_FORMAT("elf32-bigmips", "elf32-bigmips", "elf32-littlemips") +GROUP(-lc -ldve -lgcc) +SEARCH_DIR(.) +__DYNAMIC = 0; + +/* + * Allocate the stack to be at the top of memory, since the stack + * grows down + */ +PROVIDE (__stack = 0); +/* PROVIDE (__global = 0); */ + +/* + * Initalize some symbols to be zero so we can reference them in the + * crt0 without core dumping. These functions are all optional, but + * we do this so we can have our crt0 always use them if they exist. + * This is so BSPs work better when using the crt0 installed with gcc. + * We have to initalize them twice, so we multiple object file + * formats, as some prepend an underscore. + */ +PROVIDE (hardware_init_hook = 0); +PROVIDE (software_init_hook = 0); + +SECTIONS +{ + . = 0xA0040000; + .text : { + _ftext = . ; + *(.init) + eprol = .; + *(.text) + *(.text.*) + *(.gnu.linkonce.t*) + *(.mips16.fn.*) + *(.mips16.call.*) + PROVIDE (__runtime_reloc_start = .); + *(.rel.sdata) + PROVIDE (__runtime_reloc_stop = .); + *(.fini) + etext = .; + _etext = .; + } + + .ctors : + { + /* gcc uses crtbegin.o to find the start of + the constructors, so we make sure it is + first. Because this is a wildcard, it + doesn't matter if the user does not + actually link against crtbegin.o; the + linker won't look for a file to match a + wildcard. The wildcard also means that it + doesn't matter which directory crtbegin.o + is in. */ + + KEEP (*crtbegin.o(.ctors)) + + /* We don't want to include the .ctor section from + from the crtend.o file until after the sorted ctors. + The .ctor section from the crtend file contains the + end of ctors marker and it must be last */ + + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + } + + .dtors : + { + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + } + + . = .; + .rodata : { + *(.rdata) + *(.rodata) + *(.rodata.*) + *(.gnu.linkonce.r*) + } + _fdata = ALIGN(16); + .data : { + *(.data) + *(.data.*) + *(.gnu.linkonce.d*) + CONSTRUCTORS + } + . = ALIGN(8); + _gp = . + 0x8000; + __global = _gp; + .lit8 : { + *(.lit8) + } + .lit4 : { + *(.lit4) + } + .sdata : { + *(.sdata) + *(.sdata.*) + *(.gnu.linkonce.s*) + } + . = ALIGN(4); + edata = .; + _edata = .; + _fbss = .; + .sbss : { + *(.sbss) + *(.scommon) + } + .bss : { + _bss_start = . ; + *(.bss) + *(COMMON) + } + + end = .; + _end = .; + + /* 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) } + .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) } + + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } +} diff --git a/libgloss/mips/dvemon.c b/libgloss/mips/dvemon.c new file mode 100644 index 0000000..16b49da --- /dev/null +++ b/libgloss/mips/dvemon.c @@ -0,0 +1,83 @@ +/* dve.c -- I/O code for the Densan DVE-R3900 board. + * + * Copyright (c) 1998, 1999 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +/* Flag indicating that we are being debugged by GDB. If set, + preceded each character output to the console with a ^O, + so that GDB will print it instead of discarding it. */ + +int output_debug = 1; + +/* Monitor "ci" function (console input) */ + +typedef int (*cifunc)(int waitflag); +#ifdef __mips64 +static cifunc ci = (cifunc) 0xffffffffbfc00010L; +#else +static cifunc ci = (cifunc) 0xbfc00010; +#endif + +#define WAIT 1 +#define NOWAIT 0 +#define NOCHAR (-1) + +/* Monitor "co" function (console output) */ + +typedef void (*cofunc)(int c); +#ifdef __mips64 +static cofunc co = (cofunc) 0xffffffffbfc00018L; +#else +static cofunc co = (cofunc) 0xbfc00018; +#endif + +/* outbyte -- shove a byte out the serial port; used by write.c. */ + +int +outbyte(byte) + unsigned char byte; +{ + /* Output a ^O prefix so that GDB won't discard the output. */ + if (output_debug) + co (0x0f); + + co (byte); + return byte; +} + +/* inbyte -- get a byte from the serial port; used by read.c. */ + +unsigned char +inbyte() +{ + return (unsigned char) ci (WAIT); +} + + +/* Structure filled in by get_mem_info. Only the size field is + actually used (by sbrk), so the others aren't even filled in. */ + +struct s_mem +{ + unsigned int size; + unsigned int icsize; + unsigned int dcsize; +}; + + +void +get_mem_info (mem) + struct s_mem *mem; +{ + mem->size = 0x1000000; /* DVE-R3900 board has 16 MB of RAM */ +} diff --git a/libgloss/mips/entry.S b/libgloss/mips/entry.S new file mode 100644 index 0000000..3630c55 --- /dev/null +++ b/libgloss/mips/entry.S @@ -0,0 +1,281 @@ +/* entry.S - exception handler for emulating MIPS16 'entry' and 'exit' + pseudo-instructions. These instructions are generated by the compiler + when the -mentry switch is used. The instructions are not implemented + in the MIPS16 CPU; hence the exception handler that emulates them. + + This module contains the following public functions: + + * void __install_entry_handler(void); + + This function installs the entry/exit exception handler. It should + be called before executing any MIPS16 functions that were compiled with + -mentry, typically before main() is called. + + * void __remove_entry_handler(void); + + This function removes the entry/exit exception handler. It should + be called when the program is exiting, or when it is known that no + more MIPS16 functions compiled with -mentry will be called. +*/ + +#ifdef __mips16 +/* This file contains 32 bit assembly code. */ + .set nomips16 +#endif + +#include "regs.S" + +#define CAUSE_EXCMASK 0x3c /* mask for ExcCode in Cause Register */ +#define EXC_RI 0x28 /* 101000 == 10 << 2 */ + +/* Set DEBUG to 1 to enable recording of the last 16 interrupt causes. */ + +#define DEBUG 0 + +#if DEBUG + + .sdata +int_count: + .space 4 /* interrupt count modulo 16 */ +int_cause: + .space 4*16 /* last 16 interrupt causes */ +#endif + + .text + + .set noreorder /* Do NOT reorder instructions */ + + +/* __entry_exit_handler - the reserved instruction exception handler + that emulates the entry and exit instruction. */ + +__entry_exit_handler: + .set noat /* Do NOT use at register */ +#if DEBUG +/* Must avoid using 'la' pseudo-op because it uses gp register, which + may not have a good value in an exception handler. */ + +# la k0, int_count /* intcount = (intcount + 1) & 0xf */ + lui k0 ,%hi(int_count) + addiu k0, k0 ,%lo(int_count) + lw k1, (k0) + addiu k1, k1, 1 + andi k1, k1, 0x0f + sw k1, (k0) +# la k0, int_cause /* k1 = &int_cause[intcount] */ + lui k0, %hi(int_cause) + addiu k0, k0, %lo(int_cause) + sll k1, k1, 2 + add k1, k1, k0 +#endif + mfc0 k0, C0_CAUSE /* Fetch cause */ +#if DEBUG + sw k0, -4(k1) /* Save exception cause in buffer */ +#endif + mfc0 k1, C0_EPC /* Check for Reserved Inst. without */ + and k0, CAUSE_EXCMASK /* destroying any register */ + subu k0, EXC_RI + bne k0, zero, check_others /* Sorry, go do something else */ + + and k0, k1, 1 /* Check for TR mode (pc.0 = 1) */ + beq k0, zero, ri_in_32 /* Sorry, RI in 32-bit mode */ + xor k1, 1 + +/* Since we now are going to emulate or die, we can use all the T-registers */ +/* that MIPS16 does not use (at, t0-t8), and we don't have to save them. */ + + .set at /* Now it's ok to use at again */ + +#if 0 + j leave + rfe +#endif + + lhu t0, 0(k1) /* Fetch the offending instruction */ + xor t8, k1, 1 /* Prepare t8 for exit */ + and t1, t0, 0xf81f /* Check for entry/exit opcode */ + bne t1, 0xe809, other_ri + +deareg: and t1, t0, 0x0700 /* Isolate the three a-bits */ + srl t1, 6 /* Adjust them so x4 is applied */ + slt t2, t1, 17 /* See if this is the exit instruction */ + beqz t2, doexit + la t2, savea + subu t2, t1 + jr t2 /* Jump into the instruction table */ + rfe /* We run the rest in user-mode */ + + /* This is the entry instruction! */ + sw a3, 12(sp) /* 4: a0-a3 saved */ + sw a2, 8(sp) /* 3: a0-a2 saved */ + sw a1, 4(sp) /* 2: a0-a1 saved */ + sw a0, 0(sp) /* 1: a0 saved */ +savea: /* 0: No arg regs saved */ + +dera: and t1, t0, 0x0020 /* Isolate the save-ra bit */ + move t7, sp /* Temporary SP */ + beq t1, zero, desreg + subu sp, 32 /* Default SP adjustment */ + sw ra, -4(t7) + subu t7, 4 + +desreg: and t1, t0, 0x00c0 /* Isolate the two s-bits */ + beq t1, zero, leave + subu t1, 0x0040 + beq t1, zero, leave /* Only one to save... */ + sw s0, -4(t7) /* Do the first one */ + sw s1, -8(t7) /* Do the last one */ + +leave: jr t8 /* Exit to unmodified EPC */ + nop /* Urgh - the only nop!! */ + +doexf0: mtc1 v0,$f0 /* Copy float value */ + b doex2 + +doexf1: mtc1 v1,$f0 /* Copy double value */ + mtc1 v0,$f1 + b doex2 + +doexit: slt t2, t1, 21 + beq t2, zero, doexf0 + slt t2, t1, 25 + beq t2, zero, doexf1 + +doex2: and t1, t0, 0x0020 /* Isolate ra bit */ + beq t1, zero, dxsreg /* t1 holds ra-bit */ + addu t7, sp, 32 /* Temporary SP */ + lw ra, -4(t7) + subu t7, 4 + +dxsreg: and t1, t0, 0x00c0 /* Isolate the two s-bits */ + beq t1, zero, leavex + subu t1, 0x0040 + beq t1, zero, leavex /* Only one to save... */ + lw s0, -4(t7) /* Do the first one */ + lw s1, -8(t7) /* Do the last one */ + +leavex: jr ra /* Exit to ra */ + addu sp, 32 /* Clean up stack pointer */ + +/* Come here for exceptions we can't handle. */ + +ri_in_32: +other_ri: +check_others: /* call the previous handler */ + la k0,__previous + jr k0 + nop + +__exception_code: + .set noreorder + la k0, __entry_exit_handler +# lui k0, %hi(exception) +# addiu k0, k0, %lo(exception) + jr k0 + nop + .set reorder +__exception_code_end: + + .data +__previous: + .space (__exception_code_end - __exception_code) + .text + + +/* void __install_entry_handler(void) + + Install our entry/exit reserved instruction exception handler. +*/ + .ent __install_entry_handler + .globl __install_entry_handler +__install_entry_handler: + .set noreorder + mfc0 a0,C0_SR + nop + li a1,SR_BEV + and a1,a1,a0 + beq a1,$0,baseaddr + lui a0,0x8000 /* delay slot */ + lui a0,0xbfc0 + addiu a0,a0,0x0100 +baseaddr: + addiu a0,a0,0x080 /* a0 = base vector table address */ + li a1,(__exception_code_end - __exception_code) + la a2,__exception_code + la a3,__previous +/* there must be a better way of doing this???? */ +copyloop: + lw v0,0(a0) + sw v0,0(a3) + lw v0,0(a2) + sw v0,0(a0) + addiu a0,a0,4 + addiu a2,a2,4 + addiu a3,a3,4 + subu a1,a1,4 + bne a1,$0,copyloop + nop + j ra + nop + .set reorder + .end __install_entry_handler + + +/* void __remove_entry_handler(void); + + Remove our entry/exit reserved instruction exception handler. +*/ + + .ent __remove_entry_handler + .globl __remove_entry_handler +__remove_entry_handler: + .set noreorder + + mfc0 a0,C0_SR + nop + li a1,SR_BEV + and a1,a1,a0 + beq a1,$0,res_baseaddr + lui a0,0x8000 /* delay slot */ + lui a0,0xbfc0 + addiu a0,a0,0x0200 +res_baseaddr: + addiu a0,a0,0x0180 /* a0 = base vector table address */ + li a1,(__exception_code_end - __exception_code) + la a3,__previous + +/* there must be a better way of doing this???? */ +res_copyloop: + lw v0,0(a3) + sw v0,0(a0) + addiu a0,a0,4 + addiu a3,a3,4 + subu a1,a1,4 + bne a1,$0,res_copyloop + nop + j ra + nop + .set reorder + .end __remove_entry_handler + + +/* software_init_hook - install entry/exit handler and arrange to have it + removed at exit. This function is called by crt0.S. */ + + .text + .globl software_init_hook + .ent software_init_hook +software_init_hook: + .set noreorder + subu sp, sp, 8 /* allocate stack space */ + sw ra, 4(sp) /* save return address */ + jal __install_entry_handler /* install entry/exit handler */ + nop + lui a0, %hi(__remove_entry_handler) /* arrange for exit to */ + jal atexit /* de-install handler */ + addiu a0, a0, %lo(__remove_entry_handler) /* delay slot */ + lw ra, 4(sp) /* get return address */ + j ra /* return */ + addu sp, sp, 8 /* deallocate stack */ + .set reorder + .end software_init_hook diff --git a/libgloss/mips/idt.ld b/libgloss/mips/idt.ld new file mode 100644 index 0000000..cba8b7b --- /dev/null +++ b/libgloss/mips/idt.ld @@ -0,0 +1,155 @@ +/* The following TEXT start address leaves space for the monitor + workspace. i.e. the NEC VR4300 (IDT) first free address is actually + 0xa001af20. */ + +ENTRY(_start) +OUTPUT_FORMAT("elf32-bigmips", "elf32-bigmips", "elf32-littlemips") +GROUP(-lc -lidt -lgcc) +SEARCH_DIR(.) +__DYNAMIC = 0; + +/* + * Allocate the stack to be at the top of memory, since the stack + * grows down + */ +PROVIDE (__stack = 0); +/* PROVIDE (__global = 0); */ + +/* + * Initalize some symbols to be zero so we can reference them in the + * crt0 without core dumping. These functions are all optional, but + * we do this so we can have our crt0 always use them if they exist. + * This is so BSPs work better when using the crt0 installed with gcc. + * We have to initalize them twice, so we multiple object file + * formats, as some prepend an underscore. + */ +PROVIDE (hardware_init_hook = 0); +PROVIDE (software_init_hook = 0); + +SECTIONS +{ + . = 0xA0020000; + .text : { + _ftext = . ; + *(.init) + eprol = .; + *(.text) + *(.text.*) + *(.gnu.linkonce.t*) + *(.mips16.fn.*) + *(.mips16.call.*) + PROVIDE (__runtime_reloc_start = .); + *(.rel.sdata) + PROVIDE (__runtime_reloc_stop = .); + *(.fini) + etext = .; + _etext = .; + } + + .ctors : + { + /* gcc uses crtbegin.o to find the start of + the constructors, so we make sure it is + first. Because this is a wildcard, it + doesn't matter if the user does not + actually link against crtbegin.o; the + linker won't look for a file to match a + wildcard. The wildcard also means that it + doesn't matter which directory crtbegin.o + is in. */ + + KEEP (*crtbegin.o(.ctors)) + + /* We don't want to include the .ctor section from + from the crtend.o file until after the sorted ctors. + The .ctor section from the crtend file contains the + end of ctors marker and it must be last */ + + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + } + + .dtors : + { + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + } + + . = .; + .rodata : { + *(.rdata) + *(.rodata) + *(.rodata.*) + *(.gnu.linkonce.r*) + } + _fdata = ALIGN(16); + .data : { + *(.data) + *(.data.*) + *(.gnu.linkonce.d*) + } + . = ALIGN(8); + _gp = . + 0x8000; + __global = _gp; + .lit8 : { + *(.lit8) + } + .lit4 : { + *(.lit4) + } + .sdata : { + *(.sdata) + *(.sdata.*) + *(.gnu.linkonce.s*) + } + . = ALIGN(4); + edata = .; + _edata = .; + _fbss = .; + .sbss : { + *(.sbss) + *(.scommon) + } + .bss : { + _bss_start = . ; + *(.bss) + *(COMMON) + } + + end = .; + _end = .; + + /* 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) } + .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) } + + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } +} diff --git a/libgloss/mips/idtecoff.ld b/libgloss/mips/idtecoff.ld new file mode 100644 index 0000000..08534d2 --- /dev/null +++ b/libgloss/mips/idtecoff.ld @@ -0,0 +1,93 @@ +/* The following TEXT start address leaves space for the monitor + workspace. i.e. the NEC VR4300 (IDT) first free address is actually + 0xa001af20. */ + +ENTRY(_start) +STARTUP(crt0.o) +OUTPUT_ARCH("mips:4000") +OUTPUT_FORMAT("ecoff-bigmips", "ecoff-bigmips", "ecoff-littlemips") +GROUP(-lc -lidt -lgcc) +SEARCH_DIR(.) +__DYNAMIC = 0; + +/* + * Allocate the stack to be at the top of memory, since the stack + * grows down + */ +PROVIDE (__stack = 0); +/* PROVIDE (__global = 0); */ + +/* + * Initalize some symbols to be zero so we can reference them in the + * crt0 without core dumping. These functions are all optional, but + * we do this so we can have our crt0 always use them if they exist. + * This is so BSPs work better when using the crt0 installed with gcc. + * We have to initalize them twice, so we multiple object file + * formats, as some prepend an underscore. + */ +PROVIDE (hardware_init_hook = 0); +PROVIDE (software_init_hook = 0); + +SECTIONS +{ + . = 0xA0020000; + .text : { + _ftext = . ; + *(.init) + eprol = .; + *(.text) + *(.text.*) + *(.gnu.linkonce.t*) + *(.mips16.fn.*) + *(.mips16.call.*) + PROVIDE (__runtime_reloc_start = .); + *(.rel.sdata) + PROVIDE (__runtime_reloc_stop = .); + *(.fini) + etext = .; + _etext = .; + } + . = .; + .rdata : { + *(.rdata) + *(.rodata) + *(.rodata.*) + *(.gnu.linkonce.r*) + } + _fdata = ALIGN(16); + .data : { + *(.data) + *(.data.*) + *(.gnu.linkonce.d*) + CONSTRUCTORS + } + . = ALIGN(8); + _gp = . + 0x8000; + __global = _gp; + .lit8 : { + *(.lit8) + } + .lit4 : { + *(.lit4) + } + .sdata : { + *(.sdata) + *(.sdata.*) + *(.gnu.linkonce.s*) + } + . = ALIGN(4); + edata = .; + _edata = .; + _fbss = .; + .sbss : { + *(.sbss) + *(.scommon) + } + .bss : { + _bss_start = . ; + *(.bss) + *(COMMON) + } + end = .; + _end = .; +} diff --git a/libgloss/mips/idtmon.S b/libgloss/mips/idtmon.S new file mode 100644 index 0000000..bb15388 --- /dev/null +++ b/libgloss/mips/idtmon.S @@ -0,0 +1,46 @@ +/* + * idtmon.S -- lo-level entry points into IDT monitor. + * + * Copyright (c) 1996 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#ifdef __mips16 +/* This file contains 32 bit assembly code. */ + .set nomips16 +#endif + +#include "regs.S" + + .text + .align 2 + +/* Provide named functions for entry into the IDT monitor: */ +#define INDIRECT(name,index) \ + .globl name; \ + .ent name; \ +name: la $2,+(0xbfc00000+((index)*8)); \ + j $2; \ + .end name + +/* The following magic numbers are for the slots into the IDT monitor: */ +INDIRECT(open,6) +INDIRECT(read,7) +INDIRECT(write,8) +INDIRECT(close,10) +INDIRECT(inbyte,11) +INDIRECT(outbyte,12) +INDIRECT(mon_printf,16) +INDIRECT(_flush_cache,28) +INDIRECT(get_mem_info,55) /* expects pointer to three word vector */ + +/* EOF idtmon.S */ diff --git a/libgloss/mips/jmr3904-io.c b/libgloss/mips/jmr3904-io.c new file mode 100644 index 0000000..8d43007 --- /dev/null +++ b/libgloss/mips/jmr3904-io.c @@ -0,0 +1,104 @@ + + +#define READ_UINT8( _register_, _value_ ) \ + ((_value_) = *((volatile unsigned char *)(_register_))) + +#define WRITE_UINT8( _register_, _value_ ) \ + (*((volatile unsigned char *)(_register_)) = (_value_)) + + /* - Board specific addresses for serial chip */ +#define DIAG_BASE 0xfffff300 +#define DIAG_SLCR (DIAG_BASE+0x00) +#define DIAG_SLSR (DIAG_BASE+0x04) +#define DIAG_SLDICR (DIAG_BASE+0x08) +#define DIAG_SLDISR (DIAG_BASE+0x0C) +#define DIAG_SFCR (DIAG_BASE+0x10) +#define DIAG_SBRG (DIAG_BASE+0x14) +#define DIAG_TFIFO (DIAG_BASE+0x20) +#define DIAG_RFIFO (DIAG_BASE+0x30) + +#define BRG_T0 0x0000 +#define BRG_T2 0x0100 +#define BRG_T4 0x0200 +#define BRG_T5 0x0300 + + +#define READ_UINT16( _register_, _value_ ) \ + ((_value_) = *((volatile unsigned short *)(_register_))) + +#define WRITE_UINT16( _register_, _value_ ) \ + (*((volatile unsigned short *)(_register_)) = (_value_)) + +unsigned char +inbyte (void) +{ + unsigned char c; + unsigned short disr; + + for (;;) + { + READ_UINT16 (DIAG_SLDISR, disr); + if (disr & 0x0001) + break; + } + disr = disr & ~0x0001; + READ_UINT8 (DIAG_RFIFO, c); + WRITE_UINT16 (DIAG_SLDISR, disr); + return c; +} + +void +outbyte (unsigned char c) +{ + unsigned short disr; + + for (;;) + { + READ_UINT16 (DIAG_SLDISR, disr); + if (disr & 0x0002) + break; + } + disr = disr & ~0x0002; + WRITE_UINT8 (DIAG_TFIFO, c); + WRITE_UINT16 (DIAG_SLDISR, disr); +} + +/* Stuff required to setup IO on this board */ +void board_serial_init (void) +{ + WRITE_UINT16 (DIAG_SLCR, 0x0020); + WRITE_UINT16 (DIAG_SLDICR, 0x0000); + WRITE_UINT16 (DIAG_SFCR, 0x0000); + WRITE_UINT16 (DIAG_SBRG, BRG_T2 | 5); +} + +/* If you want this to be initialized as part of the stuff which gets called + by crt0, it should be named 'hardware_init_hook'. + Local implementations may want to move or add to this function OR + do the initializations after main() is entered. +*/ +void hardware_init_hook(void) +{ + board_serial_init() ; +} + +/* Structure filled in by get_mem_info. Only the size field is + actually used (by sbrk), so the others aren't even filled in. */ + +struct s_mem +{ + unsigned int size; + unsigned int icsize; + unsigned int dcsize; +}; + +/* mem_size is provided in the linker script so that we don't have to + define it here. */ +extern char _mem_size[]; + +void +get_mem_info (mem) + struct s_mem *mem; +{ + mem->size = (unsigned int)_mem_size; +} diff --git a/libgloss/mips/jmr3904app-java.ld b/libgloss/mips/jmr3904app-java.ld new file mode 100644 index 0000000..b23d8e3 --- /dev/null +++ b/libgloss/mips/jmr3904app-java.ld @@ -0,0 +1,127 @@ +/* Linker script forJMR 3904 board using Java + qthreads */ + +ENTRY(_start) +OUTPUT_ARCH("mips:3000") +OUTPUT_FORMAT("elf32-bigmips", "elf32-bigmips", "elf32-littlemips") +GROUP(-lc -ljmr3904 -lgcc -lgcjcoop) +SEARCH_DIR(.) +__DYNAMIC = 0; + +PROVIDE (_mem_size = 0x100000); /* JMR3904 comes as standard with 512k of RAM */ + +/* Set the size of the stack for Java with qthreads. */ +PROVIDE (_Jv_QthreadsStackSize = 0x10000); + +/* PROVIDE (__global = 0); */ + +/* + * Initalize some symbols to be zero so we can reference them in the + * crt0 without core dumping. These functions are all optional, but + * we do this so we can have our crt0 always use them if they exist. + * This is so BSPs work better when using the crt0 installed with gcc. + * We have to initalize them twice, so we multiple object file + * formats, as some prepend an underscore. + */ +PROVIDE (hardware_init_hook = 0); +PROVIDE (software_init_hook = 0); + +SECTIONS +{ + . = 0x80008000; + /* This is NOT the address which fits with the monitor from jmr. */ + /* It fits the Cygmon ROMS */ + .text : { + _ftext = . ; + *(.init) + eprol = .; + *(.text) + *(.text.*) + *(.gnu.linkonce.t*) + *(.mips16.fn.*) + *(.mips16.call.*) + PROVIDE (__runtime_reloc_start = .); + *(.rel.sdata) + PROVIDE (__runtime_reloc_stop = .); + *(.fini) + etext = .; + _etext = .; + } + . = .; + .rodata : { + *(.rdata) + *(.rodata) + *(.rodata.*) + *(.gnu.linkonce.r*) + } + _fdata = ALIGN(16); + .data : { + *(.data) + *(.data.*) + *(.gnu.linkonce.d*) + CONSTRUCTORS + } + . = ALIGN(8); + _gp = . + 0x8000; + __global = _gp; + .lit8 : { + *(.lit8) + } + .lit4 : { + *(.lit4) + } + .sdata : { + *(.sdata) + *(.sdata.*) + *(.gnu.linkonce.s*) + } + . = ALIGN(4); + edata = .; + _edata = .; + _fbss = .; + .sbss : { + *(.sbss) + *(.scommon) + } + .bss : { + _bss_start = . ; + *(.bss) + *(COMMON) + . += 0x2000 ; /* 8k bytes of stack. */ + __stack = ALIGN(64) ; + . = __stack ; + } + + end = .; + _end = .; + + /* 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) } + .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) } + + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } +} diff --git a/libgloss/mips/jmr3904app.ld b/libgloss/mips/jmr3904app.ld new file mode 100644 index 0000000..f5808fd --- /dev/null +++ b/libgloss/mips/jmr3904app.ld @@ -0,0 +1,156 @@ +/* Linker script forJMR 3904 board */ + +ENTRY(_start) +OUTPUT_ARCH("mips:3000") +OUTPUT_FORMAT("elf32-bigmips", "elf32-bigmips", "elf32-littlemips") +GROUP(-lc -ljmr3904 -lgcc) +SEARCH_DIR(.) +__DYNAMIC = 0; + +PROVIDE (_mem_size = 0x100000); /* JMR3904 comes as standard with 512k of RAM */ + +/* PROVIDE (__global = 0); */ + +/* + * Initalize some symbols to be zero so we can reference them in the + * crt0 without core dumping. These functions are all optional, but + * we do this so we can have our crt0 always use them if they exist. + * This is so BSPs work better when using the crt0 installed with gcc. + * We have to initalize them twice, so we multiple object file + * formats, as some prepend an underscore. + */ +PROVIDE (hardware_init_hook = 0); +PROVIDE (software_init_hook = 0); + +SECTIONS +{ + . = 0x80008000; + /* This is NOT the address which fits with the monitor from jmr. */ + /* It fits the Cygmon ROMS */ + .text : { + _ftext = . ; + *(.init) + eprol = .; + *(.text) + *(.text.*) + *(.gnu.linkonce.t*) + *(.mips16.fn.*) + *(.mips16.call.*) + PROVIDE (__runtime_reloc_start = .); + *(.rel.sdata) + PROVIDE (__runtime_reloc_stop = .); + *(.fini) + etext = .; + _etext = .; + } + + .ctors : + { + /* gcc uses crtbegin.o to find the start of + the constructors, so we make sure it is + first. Because this is a wildcard, it + doesn't matter if the user does not + actually link against crtbegin.o; the + linker won't look for a file to match a + wildcard. The wildcard also means that it + doesn't matter which directory crtbegin.o + is in. */ + + KEEP (*crtbegin.o(.ctors)) + + /* We don't want to include the .ctor section from + from the crtend.o file until after the sorted ctors. + The .ctor section from the crtend file contains the + end of ctors marker and it must be last */ + + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + } + + .dtors : + { + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + } + + . = .; + .rodata : { + *(.rdata) + *(.rodata) + *(.rodata.*) + *(.gnu.linkonce.r*) + } + _fdata = ALIGN(16); + .data : { + *(.data) + *(.data.*) + *(.gnu.linkonce.d*) + } + . = ALIGN(8); + _gp = . + 0x8000; + __global = _gp; + .lit8 : { + *(.lit8) + } + .lit4 : { + *(.lit4) + } + .sdata : { + *(.sdata) + *(.sdata.*) + *(.gnu.linkonce.s*) + } + . = ALIGN(4); + edata = .; + _edata = .; + _fbss = .; + .sbss : { + *(.sbss) + *(.scommon) + } + .bss : { + _bss_start = . ; + *(.bss) + *(COMMON) + . += 0x2000 ; /* 8k bytes of stack. */ + __stack = ALIGN(64) ; + . = __stack ; + } + + end = .; + _end = .; + + /* 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) } + .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) } + + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } +} diff --git a/libgloss/mips/jmr3904dram-java.ld b/libgloss/mips/jmr3904dram-java.ld new file mode 100644 index 0000000..ce9595d --- /dev/null +++ b/libgloss/mips/jmr3904dram-java.ld @@ -0,0 +1,130 @@ +/* Linker script forJMR 3904 board using Java + qthreads */ + +ENTRY(_start) +OUTPUT_ARCH("mips:3000") +OUTPUT_FORMAT("elf32-bigmips", "elf32-bigmips", "elf32-littlemips") +GROUP(-lc -ljmr3904 -lgcc -lgcjcoop) +SEARCH_DIR(.) +__DYNAMIC = 0; + +PROVIDE (_mem_size = 0x100000); /* JMR3904 comes as standard with 512k of RAM */ + /* but this is 1 Mb */ + +/* Set the size of the stack for Java with qthreads. */ +PROVIDE (_Jv_QthreadsStackSize = 0x10000); + +/* PROVIDE (__global = 0); */ + +/* + * Initalize some symbols to be zero so we can reference them in the + * crt0 without core dumping. These functions are all optional, but + * we do this so we can have our crt0 always use them if they exist. + * This is so BSPs work better when using the crt0 installed with gcc. + * We have to initalize them twice, so we multiple object file + * formats, as some prepend an underscore. + */ +PROVIDE (hardware_init_hook = 0); +PROVIDE (software_init_hook = 0); + +SECTIONS +{ + /* Load everything into DRAM, except for the stack. Put stack in SRAM */ + . = 0x88000000; + /* This is NOT the address which fits with the monitor from jmr. */ + /* It fits the Cygmon ROMS */ + .text : { + _ftext = . ; + *(.init) + eprol = .; + *(.text) + *(.text.*) + *(.gnu.linkonce.t*) + *(.mips16.fn.*) + *(.mips16.call.*) + PROVIDE (__runtime_reloc_start = .); + *(.rel.sdata) + PROVIDE (__runtime_reloc_stop = .); + *(.fini) + etext = .; + _etext = .; + } + . = .; + .rdata : { + *(.rdata) + *(.rodata) + *(.rodata.*) + *(.gnu.linkonce.r*) + } + _fdata = ALIGN(16); + .data : { + *(.data) + *(.data.*) + *(.gnu.linkonce.d*) + CONSTRUCTORS + } + . = ALIGN(8); + _gp = . + 0x8000; + __global = _gp; + .lit8 : { + *(.lit8) + } + .lit4 : { + *(.lit4) + } + .sdata : { + *(.sdata) + *(.sdata.*) + *(.gnu.linkonce.s*) + } + . = ALIGN(4); + edata = .; + _edata = .; + _fbss = .; + .sbss : { + *(.sbss) + *(.scommon) + } + .bss : { + _bss_start = . ; + *(.bss) + *(COMMON) + } + + end = .; + _end = .; + + /* Put stack in SRAM (8 Kb); this size is the same as the stack from + the original script (when everything was in SRAM). */ + __stack = 0x8000A000; + + /* 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) } + .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) } + + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } +} diff --git a/libgloss/mips/jmr3904dram.ld b/libgloss/mips/jmr3904dram.ld new file mode 100644 index 0000000..cf28364 --- /dev/null +++ b/libgloss/mips/jmr3904dram.ld @@ -0,0 +1,127 @@ +/* Linker script forJMR 3904 board */ + +ENTRY(_start) +OUTPUT_ARCH("mips:3000") +OUTPUT_FORMAT("elf32-bigmips", "elf32-bigmips", "elf32-littlemips") +GROUP(-lc -ljmr3904 -lgcc) +SEARCH_DIR(.) +__DYNAMIC = 0; + +PROVIDE (_mem_size = 0x100000); /* JMR3904 comes as standard with 512k of RAM */ + /* but this is 1 Mb */ + +/* PROVIDE (__global = 0); */ + +/* + * Initalize some symbols to be zero so we can reference them in the + * crt0 without core dumping. These functions are all optional, but + * we do this so we can have our crt0 always use them if they exist. + * This is so BSPs work better when using the crt0 installed with gcc. + * We have to initalize them twice, so we multiple object file + * formats, as some prepend an underscore. + */ +PROVIDE (hardware_init_hook = 0); +PROVIDE (software_init_hook = 0); + +SECTIONS +{ + /* Load everything into DRAM, except for the stack. Put stack in SRAM */ + . = 0x88000000; + /* This is NOT the address which fits with the monitor from jmr. */ + /* It fits the Cygmon ROMS */ + .text : { + _ftext = . ; + *(.init) + eprol = .; + *(.text) + *(.text.*) + *(.gnu.linkonce.t*) + *(.mips16.fn.*) + *(.mips16.call.*) + PROVIDE (__runtime_reloc_start = .); + *(.rel.sdata) + PROVIDE (__runtime_reloc_stop = .); + *(.fini) + etext = .; + _etext = .; + } + . = .; + .rdata : { + *(.rdata) + *(.rodata) + *(.rodata.*) + *(.gnu.linkonce.r*) + } + _fdata = ALIGN(16); + .data : { + *(.data) + *(.data.*) + *(.gnu.linkonce.d*) + CONSTRUCTORS + } + . = ALIGN(8); + _gp = . + 0x8000; + __global = _gp; + .lit8 : { + *(.lit8) + } + .lit4 : { + *(.lit4) + } + .sdata : { + *(.sdata) + *(.sdata.*) + *(.gnu.linkonce.s*) + } + . = ALIGN(4); + edata = .; + _edata = .; + _fbss = .; + .sbss : { + *(.sbss) + *(.scommon) + } + .bss : { + _bss_start = . ; + *(.bss) + *(COMMON) + } + + end = .; + _end = .; + + /* Put stack in SRAM (8 Kb); this size is the same as the stack from + the original script (when everything was in SRAM). */ + __stack = 0x8000A000; + + /* 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) } + .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) } + + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } +} diff --git a/libgloss/mips/lsi.ld b/libgloss/mips/lsi.ld new file mode 100644 index 0000000..c567157 --- /dev/null +++ b/libgloss/mips/lsi.ld @@ -0,0 +1,121 @@ +/* The following TEXT start address leaves space for the monitor + workspace. */ + +ENTRY(_start) +OUTPUT_ARCH("mips:4000") +OUTPUT_FORMAT("elf32-bigmips", "elf32-bigmips", "elf32-littlemips") +GROUP(-lc -llsi -lgcc) +SEARCH_DIR(.) +__DYNAMIC = 0; + +/* + * Allocate the stack to be at the top of memory, since the stack + * grows down + */ +PROVIDE (__stack = 0); +/* PROVIDE (__global = 0); */ + +/* + * Initalize some symbols to be zero so we can reference them in the + * crt0 without core dumping. These functions are all optional, but + * we do this so we can have our crt0 always use them if they exist. + * This is so BSPs work better when using the crt0 installed with gcc. + * We have to initalize them twice, so we multiple object file + * formats, as some prepend an underscore. + */ +PROVIDE (hardware_init_hook = 0); +PROVIDE (software_init_hook = 0); + +SECTIONS +{ + . = 0xA0020000; + .text : { + _ftext = . ; + *(.init) + eprol = .; + *(.text) + *(.text.*) + *(.gnu.linkonce.t*) + PROVIDE (__runtime_reloc_start = .); + *(.rel.sdata) + PROVIDE (__runtime_reloc_stop = .); + *(.fini) + etext = .; + _etext = .; + } + + .ctors : + { + /* gcc uses crtbegin.o to find the start of + the constructors, so we make sure it is + first. Because this is a wildcard, it + doesn't matter if the user does not + actually link against crtbegin.o; the + linker won't look for a file to match a + wildcard. The wildcard also means that it + doesn't matter which directory crtbegin.o + is in. */ + + KEEP (*crtbegin.o(.ctors)) + + /* We don't want to include the .ctor section from + from the crtend.o file until after the sorted ctors. + The .ctor section from the crtend file contains the + end of ctors marker and it must be last */ + + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + } + + .dtors : + { + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + } + + . = .; + .rodata : { + *(.rdata) + *(.rodata) + *(.rodata.*) + *(.gnu.linkonce.r*) + } + _fdata = ALIGN(16); + .data : { + *(.data) + *(.data.*) + *(.gnu.linkonce.d*) + CONSTRUCTORS + } + . = ALIGN(8); + _gp = . + 0x8000; + __global = _gp; + .lit8 : { + *(.lit8) + } + .lit4 : { + *(.lit4) + } + .sdata : { + *(.sdata) + *(.sdata.*) + *(.gnu.linkonce.s*) + } + edata = .; + _edata = .; + _fbss = .; + .sbss : { + *(.sbss) + *(.scommon) + } + .bss : { + _bss_start = . ; + *(.bss) + *(COMMON) + } + end = .; + _end = .; +} diff --git a/libgloss/mips/lsi33k-stub.c b/libgloss/mips/lsi33k-stub.c new file mode 100644 index 0000000..dc0b86a --- /dev/null +++ b/libgloss/mips/lsi33k-stub.c @@ -0,0 +1,595 @@ +/**************************************************************************** + * + * Module name: remcom.c $ + * Revision: 1.34 $ + * Date: 91/03/09 12:29:49 $ + * Contributor: Lake Stevens Instrument Division$ + * + * Description: low level support for gdb debugger. $ + * + * Considerations: only works on target hardware $ + * + * Written by: Glenn Engel $ + * ModuleState: Experimental $ + * + * NOTES: See Below $ + * + * Modified for SPARC by Stu Grossman, Cygnus Support. + * + * This code has been extensively tested on the Fujitsu SPARClite demo board. + * + * To enable debugger support, two things need to happen. One, a + * call to set_debug_traps() is necessary in order to allow any breakpoints + * or error conditions to be properly intercepted and reported to gdb. + * Two, a breakpoint needs to be generated to begin communication. This + * is most easily accomplished by a call to breakpoint(). Breakpoint() + * simulates a breakpoint by executing a trap #1. + * + ************* + * + * The following gdb commands are supported: + * + * command function Return value + * + * g return the value of the CPU registers hex data or ENN + * G set the value of the CPU registers OK or ENN + * + * mAA..AA,LLLL Read LLLL bytes at address AA..AA hex data or ENN + * MAA..AA,LLLL: Write LLLL bytes at address AA.AA OK or ENN + * + * c Resume at current address SNN ( signal NN) + * cAA..AA Continue at address AA..AA SNN + * + * s Step one instruction SNN + * sAA..AA Step one instruction from AA..AA SNN + * + * k kill + * + * ? What was the last sigval ? SNN (signal NN) + * + * bBB..BB Set baud rate to BB..BB OK or BNN, then sets + * baud rate + * + * All commands and responses are sent with a packet which includes a + * checksum. A packet consists of + * + * $<packet info>#<checksum>. + * + * where + * <packet info> :: <characters representing the command or response> + * <checksum> :: < two hex digits computed as modulo 256 sum of <packetinfo>> + * + * When a packet is received, it is first acknowledged with either '+' or '-'. + * '+' indicates a successful transfer. '-' indicates a failed transfer. + * + * Example: + * + * Host: Reply: + * $m0,10#2a +$00010203040506070809101112131415#42 + * + ****************************************************************************/ + +#include <string.h> +#include <signal.h> +#include "dbgmon.h" +#include "parser.h" +#include "ctype.h" + +/************************************************************************ + * + * external low-level support routines + */ + +extern putchar(); /* write a single character */ +extern getchar(); /* read and return a single char */ + +/************************************************************************/ + +/* Stuff for stdio-like gets_debugger_check() */ + +#define CTRL(x) ('x'&0x1f) +#define DEL 0x7f +#define INTR CTRL(C) +#define BELL 0x7 +#define PROMPT "? " + +#define BUFSIZE 512 /* Big enough for register packets */ + +static int initialized = 0; /* !0 means we've been initialized */ + +static char hexchars[]="0123456789abcdef"; + +extern unsigned int _regs[]; /* Saved registers from client */ + +/* Convert ch from a hex digit to an int */ + +static int +hex(ch) + unsigned char ch; +{ + if (ch >= 'a' && ch <= 'f') + return ch-'a'+10; + if (ch >= '0' && ch <= '9') + return ch-'0'; + if (ch >= 'A' && ch <= 'F') + return ch-'A'+10; + return -1; +} + +/* scan for the sequence $<data>#<checksum> */ + +static void +getpacket(buffer) + char *buffer; +{ + unsigned char checksum; + unsigned char xmitcsum; + int i; + int count; + unsigned char ch; + + /* At this point, the start character ($) has been received through + * the debug monitor parser. Get the remaining characters and + * process them. + */ + + checksum = 0; + xmitcsum = -1; + count = 0; + + /* read until a # or end of buffer is found */ + + while (count < BUFSIZE) + { + ch = getchar(); + if (ch == '#') + break; + checksum = checksum + ch; + buffer[count] = ch; + count = count + 1; + } + + if (count >= BUFSIZE) + buffer[count] = 0; + + if (ch == '#') + { + xmitcsum = hex(getchar()) << 4; + xmitcsum |= hex(getchar()); +#if 0 + /* Humans shouldn't have to figure out checksums to type to it. */ + putchar ('+'); + return; +#endif + + if (checksum != xmitcsum) + { + putchar('-'); /* failed checksum */ + return; /* Back to monitor loop */ + } + else + { + putchar('+'); /* successful transfer */ + + /* if a sequence char is present, reply the sequence ID */ + + if (buffer[2] == ':') + { + putchar(buffer[0]); + putchar(buffer[1]); + + /* remove sequence chars from buffer */ + + count = strlen(buffer); + for (i=3; i <= count; i++) + buffer[i-3] = buffer[i]; + } + + /* Buffer command received- go and process it. */ + + + } + } +} + + +/* send the packet in buffer. */ + +static void +putpacket(buffer) + unsigned char *buffer; +{ + unsigned char checksum; + int count; + unsigned char ch; + + /* $<packet info>#<checksum>. */ + do + { + putchar('$'); + checksum = 0; + count = 0; + + while (ch = buffer[count]) + { + if (! putchar(ch)) + return; + checksum += ch; + count += 1; + } + + putchar('#'); + putchar(hexchars[checksum >> 4]); + putchar(hexchars[checksum & 0xf]); + + } + while (getchar() != '+'); +} + +static char remcomInBuffer[BUFSIZE]; +static char remcomOutBuffer[BUFSIZE]; + +/* Indicate to caller of mem2hex or hex2mem that there has been an error. */ + +static volatile int mem_err = 0; + +/* Convert the memory pointed to by mem into hex, placing result in buf. + * Return a pointer to the last char put in buf (null), in case of mem fault, + * return 0. + * If MAY_FAULT is non-zero, then we will handle memory faults by returning + * a 0, else treat a fault like any other fault in the stub. + */ + +static unsigned char * +mem2hex(mem, buf, count, may_fault) + unsigned char *mem; + unsigned char *buf; + int count; + int may_fault; +{ + unsigned char ch; + + while (count-- > 0) + { + ch = *mem++; + if (mem_err) + return 0; + *buf++ = hexchars[ch >> 4]; + *buf++ = hexchars[ch & 0xf]; + } + + *buf = 0; + + return buf; +} + +/* convert the hex array pointed to by buf into binary to be placed in mem + * return a pointer to the character AFTER the last byte written */ + +static char * +hex2mem(buf, mem, count, may_fault) + unsigned char *buf; + unsigned char *mem; + int count; + int may_fault; +{ + int i; + unsigned char ch; + + for (i=0; i<count; i++) + { + ch = hex(*buf++) << 4; + ch |= hex(*buf++); + *mem++ = ch; + if (mem_err) + return 0; + } + + return mem; +} + +/* This table contains the mapping between SPARC hardware trap types, and + signals, which are primarily what GDB understands. It also indicates + which hardware traps we need to commandeer when initializing the stub. */ + +static struct hard_trap_info +{ + unsigned char tt; /* Trap type code for SPARClite */ + unsigned char signo; /* Signal that we map this trap into */ +} hard_trap_info[] = { + {0x06, SIGSEGV}, /* instruction access error */ + {0x0a, SIGILL}, /* privileged instruction */ + {0x0a, SIGILL}, /* illegal instruction */ + {0x0b, SIGEMT}, /* cp disabled */ + {0x07, SIGSEGV}, /* data access exception */ + {0x09, SIGTRAP}, /* ta 1 - normal breakpoint instruction */ + {0, 0} /* Must be last */ +}; + +/* Convert the SPARC hardware trap type code to a unix signal number. */ + +static int +computeSignal(tt) + int tt; +{ + struct hard_trap_info *ht; + + for (ht = hard_trap_info; ht->tt && ht->signo; ht++) + if (ht->tt == tt) + return ht->signo; + + return SIGHUP; /* default for things we don't know about */ +} + +/* + * While we find nice hex chars, build an int. + * Return number of chars processed. + */ + +static int +hexToInt(char **ptr, int *intValue) +{ + int numChars = 0; + int hexValue; + + *intValue = 0; + + while (**ptr) + { + hexValue = hex(**ptr); + if (hexValue < 0) + break; + + *intValue = (*intValue << 4) | hexValue; + numChars ++; + + (*ptr)++; + } + + return (numChars); +} + +/* This function lets GDB know that an exception has occured. */ + +static void +debug_handle_exception () +{ + int tt; /* Trap type */ + int sigval; + char *ptr; + + tt = (_regs[R_CAUSE] >> 2) & 0x0f; + + /* reply to host that an exception has occurred */ + sigval = computeSignal(tt); + ptr = remcomOutBuffer; + + *ptr++ = 'T'; + *ptr++ = hexchars[sigval >> 4]; + *ptr++ = hexchars[sigval & 0xf]; + + *ptr++ = hexchars[R_EPC >> 4]; + *ptr++ = hexchars[R_EPC & 0xf]; + *ptr++ = ':'; + ptr = mem2hex((char *)&_regs[R_EPC], ptr, 4, 0); + *ptr++ = ';'; + + *ptr++ = hexchars[R_FP >> 4]; + *ptr++ = hexchars[R_FP & 0xf]; + *ptr++ = ':'; + ptr = mem2hex((char *)&_regs[R_FP], ptr, 4, 0); + *ptr++ = ';'; + + *ptr++ = hexchars[R_SP >> 4]; + *ptr++ = hexchars[R_SP & 0xf]; + *ptr++ = ':'; + ptr = mem2hex((char *)&_regs[R_SP], ptr, 4, 0); + *ptr++ = ';'; + + *ptr++ = 0; + + putpacket(remcomOutBuffer); + + return; +} + + +void process_packet() +{ + + char *ptr; + int length; + int addr; + int sigval; + int tt; /* Trap type */ + + remcomOutBuffer[0] = 0; + getpacket(remcomInBuffer); + switch (remcomInBuffer[0]) + { + +/* Return Last SIGVAL */ + +case '?': + tt = (_regs[R_CAUSE] >> 2) & 0x0f; + sigval = computeSignal(tt); + remcomOutBuffer[0] = 'S'; + remcomOutBuffer[1] = hexchars[sigval >> 4]; + remcomOutBuffer[2] = hexchars[sigval & 0xf]; + remcomOutBuffer[3] = 0; + break; + + /* toggle debug flag */ + + case 'd': + break; + + /* Return the values of the CPU registers */ + + case 'g': + ptr = remcomOutBuffer; + ptr = mem2hex((char *)_regs, ptr, 32 * 4, 0); /* General Purpose Registers */ + ptr = mem2hex((char *)&_regs[R_EPC], ptr, 9 * 4, 0); /* CP0 Registers */ + break; + + /* set the value of the CPU registers - return OK */ + + case 'G': + ptr = &remcomInBuffer[1]; + hex2mem(ptr, (char *)_regs, 32 * 4, 0); /* General Purpose Registers */ + hex2mem(ptr + 32 * 4 * 2, (char *)&_regs[R_EPC], 9 * 4, 0); /* CP0 Registers */ + strcpy(remcomOutBuffer,"OK"); + break; + + /* mAA..AA,LLLL Read LLLL bytes at address AA..AA */ + + case 'm': + ptr = &remcomInBuffer[1]; + if (hexToInt(&ptr, &addr) && *ptr++ == ',' && hexToInt(&ptr, &length)) + { + if (mem2hex((char *)addr, remcomOutBuffer, length, 1)) + break; + strcpy (remcomOutBuffer, "E03"); + } + else + strcpy(remcomOutBuffer,"E01"); + break; + + /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */ + + case 'M': + ptr = &remcomInBuffer[1]; + if (hexToInt(&ptr, &addr) && *ptr++ == ',' && hexToInt(&ptr, &length) && *ptr++ == ':') + { + if (hex2mem(ptr, (char *)addr, length, 1)) + strcpy(remcomOutBuffer, "OK"); + else + strcpy(remcomOutBuffer, "E03"); + } + else + strcpy(remcomOutBuffer, "E02"); + break; + + /* cAA..AA Continue at address AA..AA(optional) */ + + case 'c': + + /* try to read optional parameter, pc unchanged if no parm */ + + ptr = &remcomInBuffer[1]; + if (hexToInt(&ptr, &addr)) + { + gdb_go ( addr ); + } + else + { + dbg_cont(); + } + return; + + /* kill the program */ + + case 'k': + break; + + /* Reset */ + + case 'r': + break; + + /* switch */ + + } + + /* Reply to the request */ + + putpacket(remcomOutBuffer); +} + + +/* + * gets_debugger_check - This is the same as the stdio gets, but we also + * check for a leading $ in the buffer. This so we + * gracefully handle the GDB protocol packets. + */ + +char * +gets_debugger_check(buf) +char *buf; +{ + register char c; + char *bufp; + + bufp = buf; + for (;;) + { + c = getchar(); + switch (c) + { + + /* quote next char */ + + case '$': + if ( buf == bufp ) + process_packet(); + break; + + case CTRL(V): + c = getchar(); + if (bufp < &buf[LINESIZE-3]) + { + rmw_byte (bufp++,c); + showchar(c); + } + else + { + putchar(BELL); + } + break; + + case '\n': + case '\r': + putchar('\n'); + rmw_byte (bufp,0); + return(buf); + + case CTRL(H): + case DEL: + if (bufp > buf) + { + bufp--; + putchar(CTRL(H)); + putchar(' '); + putchar(CTRL(H)); + } + break; + + case CTRL(U): + if (bufp > buf) + { + printf("^U\n%s", PROMPT); + bufp = buf; + } + break; + + case '\t': + c = ' '; + + default: + /* + * Make sure there's room for this character + * plus a trailing \n and 0 byte + */ + if (isprint(c) && bufp < &buf[LINESIZE-3]) + { + rmw_byte ( bufp++, c ); + putchar(c); + } + else + { + putchar(BELL); + } + break; + } + } +} diff --git a/libgloss/mips/lsi33k-stub.h b/libgloss/mips/lsi33k-stub.h new file mode 100644 index 0000000..f885c27 --- /dev/null +++ b/libgloss/mips/lsi33k-stub.h @@ -0,0 +1,179 @@ +/*STARTINC + * + * COPYRIGHT (C) 1991, 1992 ARRAY TECHNOLOGY CORPORATION + * All Rights Reserved + * + * This software is confidential information which is proprietary to and + * a trade secret of ARRAY Technology Corporation. Use, duplication, or + * disclosure is subject to the terms of a separate license agreement. + * + * + * NAME: + * + * + * DESCRIPTION: + * + * + *ENDINC + */ + +/* %Q% %I% %M% */ + +/* + * Copyright 1985 by MIPS Computer Systems, Inc. + */ + +/* + * dbgmon.h -- debugging monitor definitions + */ + +/* + * catch bogus compiles + */ +#if defined(MIPSEB) && defined(MIPSEL) +# include "error -- both MIPSEB and MIPSEL defined" +#endif + +#if !defined(MIPSEB) && !defined(MIPSEL) +# include "error -- neither MIPSEB or MIPSEL defined" +#endif + +/* + * PROM_STACK is the address of the first word above the prom stack + * the prom stack grows downward from the first word less than PROM_STACK + */ +#define PROM_STACK 0xa0010000 + +/* + * register names + */ +#define R_R0 0 +#define R_R1 1 +#define R_R2 2 +#define R_R3 3 +#define R_R4 4 +#define R_R5 5 +#define R_R6 6 +#define R_R7 7 +#define R_R8 8 +#define R_R9 9 +#define R_R10 10 +#define R_R11 11 +#define R_R12 12 +#define R_R13 13 +#define R_R14 14 +#define R_R15 15 +#define R_R16 16 +#define R_R17 17 +#define R_R18 18 +#define R_R19 19 +#define R_R20 20 +#define R_R21 21 +#define R_R22 22 +#define R_R23 23 +#define R_R24 24 +#define R_R25 25 +#define R_R26 26 +#define R_R27 27 +#define R_R28 28 +#define R_R29 29 +#define R_R30 30 +#define R_R31 31 +#define R_F0 32 +#define R_F1 33 +#define R_F2 34 +#define R_F3 35 +#define R_F4 36 +#define R_F5 37 +#define R_F6 38 +#define R_F7 39 +#define R_F8 40 +#define R_F9 41 +#define R_F10 42 +#define R_F11 43 +#define R_F12 44 +#define R_F13 45 +#define R_F14 46 +#define R_F15 47 +#define R_F16 48 +#define R_F17 49 +#define R_F18 50 +#define R_F19 51 +#define R_F20 52 +#define R_F21 53 +#define R_F22 54 +#define R_F23 55 +#define R_F24 56 +#define R_F25 57 +#define R_F26 58 +#define R_F27 59 +#define R_F28 60 +#define R_F29 61 +#define R_F30 62 +#define R_F31 63 +#define R_EPC 64 +#define R_MDHI 65 +#define R_MDLO 66 +#define R_SR 67 +#define R_CAUSE 68 +#define R_BADVADDR 69 +#define R_DCIC 70 +#define R_BPC 71 +#define R_BDA 72 +#define R_EXCTYPE 73 +#define NREGS 74 + +/* + * compiler defined bindings + */ +#define R_ZERO R_R0 +#define R_AT R_R1 +#define R_V0 R_R2 +#define R_V1 R_R3 +#define R_A0 R_R4 +#define R_A1 R_R5 +#define R_A2 R_R6 +#define R_A3 R_R7 +#define R_T0 R_R8 +#define R_T1 R_R9 +#define R_T2 R_R10 +#define R_T3 R_R11 +#define R_T4 R_R12 +#define R_T5 R_R13 +#define R_T6 R_R14 +#define R_T7 R_R15 +#define R_S0 R_R16 +#define R_S1 R_R17 +#define R_S2 R_R18 +#define R_S3 R_R19 +#define R_S4 R_R20 +#define R_S5 R_R21 +#define R_S6 R_R22 +#define R_S7 R_R23 +#define R_T8 R_R24 +#define R_T9 R_R25 +#define R_K0 R_R26 +#define R_K1 R_R27 +#define R_GP R_R28 +#define R_SP R_R29 +#define R_FP R_R30 +#define R_RA R_R31 + +/* + * memory reference widths + */ +#define SW_BYTE 1 +#define SW_HALFWORD 2 +#define SW_WORD 4 + +/* + * Monitor modes + */ +#define MODE_DBGMON 0 /* debug monitor is executing */ +#define MODE_CLIENT 1 /* client is executing */ + +/* + * String constants + */ +#define DEFAULT_STRLEN 70 /* default max strlen for string cmd */ + diff --git a/libgloss/mips/lsipmon.S b/libgloss/mips/lsipmon.S new file mode 100644 index 0000000..f9083d6 --- /dev/null +++ b/libgloss/mips/lsipmon.S @@ -0,0 +1,2 @@ +#define LSI 1 +#include "pmon.S" diff --git a/libgloss/mips/nullmon.c b/libgloss/mips/nullmon.c new file mode 100644 index 0000000..12a157e --- /dev/null +++ b/libgloss/mips/nullmon.c @@ -0,0 +1,69 @@ +/* nullmon.c - Stub or monitor services. + * + * Copyright (c) 1998 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +/* This is a ROMSTUB + Various libraries in libgloss may reference board specific services. + These are often performed by system calls and by rom specific + interfaces such as dvemon.c This file defines the null interface in + which the rom monitor either does not exist or is not used. + Linking with this file supports applications which only exercise + the processor, specifically, the GDB test suite. + By linking this object in rather than a monitor specific support + we can insure that the testsuite will run without references or + linkages to nonexistent monitor services. + Similarly, every service provided by this file muse be provided by all + monitor speciifc interfaces. + PLEASE DO NOT MAKE THIS FILE SPECIFIC TO ANY MONITOR + */ + +/* This form is giving linker relocation errors */ +#if ! defined(BOARD_MEM_SIZE) +#define BOARD_MEM_SIZE 0x100000 /* About a megabyte */ +#endif +extern unsigned char _ftext ; /* Defined in nullmon.ld */ +extern unsigned char _end ; /* Defined in nullmon.ld */ + +#if defined(FIXME_WARNINGS) +#warning("FIXME: struct s_mem belongs in a header file") +#endif +struct s_mem +{ unsigned int size; + unsigned int icsize; + unsigned int dcsize; +}; + +void +get_mem_info (mem) + struct s_mem *mem; +{ char * t1, * t2 ; + unsigned long long tmp ; + t1 = & _ftext ; + t2 = & _end ; + tmp = (unsigned long long) (t2 - t1) ; + tmp = (unsigned long long) BOARD_MEM_SIZE - tmp ; + mem->size = tmp ; +} + +/* SYSTEM INTERFACE + Since we are defining a NULL operating environment here, I am + entering the stub definitions for the GNUpro libraries, System Calls. + I would rather not to even pretend to support these functions but, they + get pulled in by other libraries. +*/ + +int read(int file, char * ptr , int len) { return 0 ; } +int close (int file) { return -1 ; } +int write(int file , char * ptr, int len) { return 0 ; } +/*eof*/ diff --git a/libgloss/mips/nullmon.ld b/libgloss/mips/nullmon.ld new file mode 100644 index 0000000..82d8016 --- /dev/null +++ b/libgloss/mips/nullmon.ld @@ -0,0 +1,156 @@ +/* The following TEXT start address leaves space for the monitor + workspace. */ + +ENTRY(_start) +OUTPUT_ARCH("mips:4000") +OUTPUT_FORMAT("elf32-bigmips", "elf32-bigmips", "elf32-littlemips") +GROUP(-lc -lnullmon -lgcc) +SEARCH_DIR(.) +__DYNAMIC = 0; + +/* + * Allocate the stack to be at the top of memory, since the stack + * grows down + */ +PROVIDE (__stack = 0); +/* PROVIDE (__global = 0); */ + +/* + * Initalize some symbols to be zero so we can reference them in the + * crt0 without core dumping. These functions are all optional, but + * we do this so we can have our crt0 always use them if they exist. + * This is so BSPs work better when using the crt0 installed with gcc. + * We have to initalize them twice, so we multiple object file + * formats, as some prepend an underscore. + */ +PROVIDE (hardware_init_hook = 0); +PROVIDE (software_init_hook = 0); + +SECTIONS +{ + . = 0xA0020000; + .text : { + _ftext = . ; + *(.init) + eprol = .; + *(.text) + *(.text.*) + *(.gnu.linkonce.t*) + *(.mips16.fn.*) + *(.mips16.call.*) + PROVIDE (__runtime_reloc_start = .); + *(.rel.sdata) + PROVIDE (__runtime_reloc_stop = .); + *(.fini) + etext = .; + _etext = .; + } + + .ctors : + { + /* gcc uses crtbegin.o to find the start of + the constructors, so we make sure it is + first. Because this is a wildcard, it + doesn't matter if the user does not + actually link against crtbegin.o; the + linker won't look for a file to match a + wildcard. The wildcard also means that it + doesn't matter which directory crtbegin.o + is in. */ + + KEEP (*crtbegin.o(.ctors)) + + /* We don't want to include the .ctor section from + from the crtend.o file until after the sorted ctors. + The .ctor section from the crtend file contains the + end of ctors marker and it must be last */ + + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + } + + .dtors : + { + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + } + + . = .; + .rodata : { + *(.rdata) + *(.rodata) + *(.rodata.*) + *(.gnu.linkonce.r*) + } + _fdata = ALIGN(16); + .data : { + *(.data) + *(.data.*) + *(.gnu.linkonce.d*) + } + . = ALIGN(8); + _gp = . + 0x8000; + __global = _gp; + .lit8 : { + *(.lit8) + } + .lit4 : { + *(.lit4) + } + .sdata : { + *(.sdata) + *(.sdata.*) + *(.gnu.linkonce.s*) + } + . = ALIGN(4); + edata = .; + _edata = .; + _fbss = .; + .sbss : { + *(.sbss) + *(.scommon) + } + .bss : { + _bss_start = . ; + *(.bss) + *(COMMON) + } + . = ALIGN(64) ; + end = .; + _end = .; + + + /* 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) } + .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) } + + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } +} diff --git a/libgloss/mips/pmon.S b/libgloss/mips/pmon.S new file mode 100644 index 0000000..a4496c9 --- /dev/null +++ b/libgloss/mips/pmon.S @@ -0,0 +1,177 @@ +/* + * pmon.S -- low-level entry points into PMON monitor. + * + * Copyright (c) 1996, 1997 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#ifdef __mips16 +/* This file contains 32 bit assembly code. */ + .set nomips16 +#endif + +#if __mips < 3 + /* This machine does not support 64-bit operations. */ + #define ADDU addu + #define SUBU subu +#else + /* This machine supports 64-bit operations. */ + #define ADDU daddu + #define SUBU dsubu +#endif + +#include "regs.S" + + .text + .align 2 + +#ifdef LSI + #define PMON_VECTOR 0xffffffffbfc00200 +#else + #define PMON_VECTOR 0xffffffffbfc00500 +#endif + +#ifndef __mips_eabi +/* Provide named functions for entry into the monitor: */ +#define INDIRECT(name,index) \ + .globl name; \ + .ent name; \ + .set noreorder; \ +name: la $2,+(PMON_VECTOR+((index)*4)); \ + lw $2,0($2); \ + j $2; \ + nop; \ + .set reorder; \ + .end name + +#else +#define INDIRECT(name,index) \ + .globl name; \ + .ent name; \ + .set noreorder; \ +name: la $2,+(PMON_VECTOR+((index)*4)); \ + lw $2,0($2); \ + SUBU sp,sp,0x40; \ + sd ra,0x38(sp); \ + sd fp,0x30(sp); \ + jal $2; \ + move fp,sp; \ + ld ra,0x38(sp); \ + ld fp,0x30(sp); \ + j ra; \ + ADDU sp,sp,0x40; \ + .set reorder; \ + .end name +#endif + + +/* The following magic numbers are for the slots into the PMON monitor */ +/* The first are used as the lo-level library run-time: */ +INDIRECT(read,0) +INDIRECT(write,1) +INDIRECT(open,2) +INDIRECT(close,3) +/* The following are useful monitor routines: */ +INDIRECT(mon_ioctl,4) +INDIRECT(mon_printf,5) +INDIRECT(mon_vsprintf,6) +INDIRECT(mon_ttctl,7) +INDIRECT(mon_cliexit,8) +INDIRECT(mon_getenv,9) +INDIRECT(mon_onintr,10) +INDIRECT(mon_flush_cache,11) +INDIRECT(_flush_cache,11) +INDIRECT(mon_exception,12) + +/* The following routine is required by the "print()" function: */ + .globl outbyte + .ent outbyte + .set noreorder +outbyte: + subu sp,sp,0x20 /* allocate stack space for string */ + sd ra,0x18(sp) /* stack return address */ + sd fp,0x10(sp) /* stack frame-pointer */ + move fp,sp /* take a copy of the stack pointer */ + /* We leave so much space on the stack for the string (16 + characters), since the call to mon_printf seems to corrupt + the 8bytes at offset 8 into the string/stack. */ + sb a0,0x00(sp) /* character to print */ + sb z0,0x01(sp) /* NUL terminator */ + jal mon_printf /* and output the string */ + move a0,sp /* take a copy of the string pointer {DELAY SLOT} */ + + move sp,fp /* recover stack pointer */ + ld ra,0x18(sp) /* recover return address */ + ld fp,0x10(sp) /* recover frame-pointer */ + j ra /* return to the caller */ + addu sp,sp,0x20 /* dump the stack space {DELAY SLOT} */ + .set reorder + .end outbyte + +/* The following routine is required by the "sbrk()" function: */ + .globl get_mem_info + .ent get_mem_info + .set noreorder +get_mem_info: + # in: a0 = pointer to 3 word structure + # out: void + subu sp,sp,0x18 /* create some stack space */ + sd ra,0x00(sp) /* stack return address */ + sd fp,0x08(sp) /* stack frame-pointer */ + sd a0,0x10(sp) /* stack structure pointer */ + move fp,sp /* take a copy of the stack pointer */ + + # The monitor has already sized memory, but unfortunately we + # do not have access to the data location containing the + # memory size. + + jal __sizemem + nop + + ld a0,0x10(sp) # recover structure pointer + sw v0,0(a0) # amount of memory available + + # Deal with getting the cache size information: + mfc0 a1, C0_CONFIG + nop + nop + andi a2,a1,0x7 << 9 # bits 11..9 for instruction cache size + sll a2,a2,12 - 8 + sw a2,4(a0) + andi a2,a1,0x7 << 6 # bits 8..6 for data cache size + sll a2,a2,12 - 5 + sw a2,8(a0) # data cache size + # + move sp,fp /* recover stack pointer */ + ld ra,0x00(sp) /* recover return address */ + ld fp,0x08(sp) /* recover frame-pointer */ + j ra /* return to the caller */ + addu sp,sp,0x18 /* restore stack pointer {DELAY SLOT} */ + .set reorder + .end get_mem_info + +#ifdef LSI + +# For the LSI MiniRISC board, we can safely assume that we have +# at least one megabyte of RAM. + + .globl __sizemem + .ent __sizemem +__sizemem: + li v0,0x100000 + j ra + .end __sizemem +#else + + +#endif +/* EOF pmon.S */ diff --git a/libgloss/mips/pmon.ld b/libgloss/mips/pmon.ld new file mode 100644 index 0000000..f8dc54b --- /dev/null +++ b/libgloss/mips/pmon.ld @@ -0,0 +1,155 @@ +/* The following TEXT start address leaves space for the monitor + workspace. */ + +ENTRY(_start) +OUTPUT_ARCH("mips:4000") +OUTPUT_FORMAT("elf32-bigmips", "elf32-bigmips", "elf32-littlemips") +GROUP(-lc -lpmon -lgcc) +SEARCH_DIR(.) +__DYNAMIC = 0; + +/* + * Allocate the stack to be at the top of memory, since the stack + * grows down + */ +PROVIDE (__stack = 0); +/* PROVIDE (__global = 0); */ + +/* + * Initalize some symbols to be zero so we can reference them in the + * crt0 without core dumping. These functions are all optional, but + * we do this so we can have our crt0 always use them if they exist. + * This is so BSPs work better when using the crt0 installed with gcc. + * We have to initalize them twice, so we multiple object file + * formats, as some prepend an underscore. + */ +PROVIDE (hardware_init_hook = 0); +PROVIDE (software_init_hook = 0); + +SECTIONS +{ + . = 0xA0020000; + .text : { + _ftext = . ; + *(.init) + eprol = .; + *(.text) + *(.text.*) + *(.gnu.linkonce.t*) + *(.mips16.fn.*) + *(.mips16.call.*) + PROVIDE (__runtime_reloc_start = .); + *(.rel.sdata) + PROVIDE (__runtime_reloc_stop = .); + *(.fini) + etext = .; + _etext = .; + } + + .ctors : + { + /* gcc uses crtbegin.o to find the start of + the constructors, so we make sure it is + first. Because this is a wildcard, it + doesn't matter if the user does not + actually link against crtbegin.o; the + linker won't look for a file to match a + wildcard. The wildcard also means that it + doesn't matter which directory crtbegin.o + is in. */ + + KEEP (*crtbegin.o(.ctors)) + + /* We don't want to include the .ctor section from + from the crtend.o file until after the sorted ctors. + The .ctor section from the crtend file contains the + end of ctors marker and it must be last */ + + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + } + + .dtors : + { + KEEP (*crtbegin.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + } + + . = .; + .rodata : { + *(.rdata) + *(.rodata) + *(.rodata.*) + *(.gnu.linkonce.r*) + } + _fdata = ALIGN(16); + .data : { + *(.data) + *(.data.*) + *(.gnu.linkonce.d*) + } + . = ALIGN(8); + _gp = . + 0x8000; + __global = _gp; + .lit8 : { + *(.lit8) + } + .lit4 : { + *(.lit4) + } + .sdata : { + *(.sdata) + *(.sdata.*) + *(.gnu.linkonce.s*) + } + . = ALIGN(4); + edata = .; + _edata = .; + _fbss = .; + .sbss : { + *(.sbss) + *(.scommon) + } + .bss : { + _bss_start = . ; + *(.bss) + *(COMMON) + } + + end = .; + _end = .; + + /* 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) } + .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) } + + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } +} diff --git a/libgloss/mips/regs.S b/libgloss/mips/regs.S new file mode 100644 index 0000000..cf1f9d4 --- /dev/null +++ b/libgloss/mips/regs.S @@ -0,0 +1,151 @@ +/* + * regs.S -- standard MIPS register names. + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +/* Standard MIPS register names: */ +#define zero $0 +#define z0 $0 +#define v0 $2 +#define v1 $3 +#define a0 $4 +#define a1 $5 +#define a2 $6 +#define a3 $7 +#define t0 $8 +#define t1 $9 +#define t2 $10 +#define t3 $11 +#define t4 $12 +#define t5 $13 +#define t6 $14 +#define t7 $15 +#define s0 $16 +#define s1 $17 +#define s2 $18 +#define s3 $19 +#define s4 $20 +#define s5 $21 +#define s6 $22 +#define s7 $23 +#define t8 $24 +#define t9 $25 +#define k0 $26 /* kernel private register 0 */ +#define k1 $27 /* kernel private register 1 */ +#define gp $28 /* global data pointer */ +#define sp $29 /* stack-pointer */ +#define fp $30 /* frame-pointer */ +#define ra $31 /* return address */ +#define pc $pc /* pc, used on mips16 */ + +#define fp0 $f0 +#define fp1 $f1 + +/* Useful memory constants: */ +#define K0BASE 0x80000000 +#ifndef __mips64 +#define K1BASE 0xA0000000 +#else +#define K1BASE 0xFFFFFFFFA0000000LL +#endif + +#define PHYS_TO_K1(a) ((unsigned)(a) | K1BASE) + +/* Standard Co-Processor 0 register numbers: +#define C0_COUNT $9 /* Count Register */ +#define C0_SR $12 /* Status Register */ +#define C0_CAUSE $13 /* last exception description */ +#define C0_EPC $14 /* Exception error address */ +#define C0_PRID $15 /* Processor Revision ID */ +#define C0_CONFIG $16 /* CPU configuration */ + +/* Standard Processor Revision ID Register field offsets */ +#define PR_IMP 8 + +/* Standard Config Register field offsets */ +#define CR_DB 4 +#define CR_IB 5 +#define CR_DC 6 /* NOTE v4121 semantics != 43,5xxx semantics */ +#define CR_IC 9 /* NOTE v4121 semantics != 43,5xxx semantics */ +#define CR_SC 17 +#define CR_SS 20 +#define CR_SB 22 + + +/* Standard Status Register bitmasks: */ +#define SR_CU1 0x20000000 /* Mark CP1 as usable */ +#define SR_FR 0x04000000 /* Enable MIPS III FP registers */ +#define SR_BEV 0x00400000 /* Controls location of exception vectors */ +#define SR_PE 0x00100000 /* Mark soft reset (clear parity error) */ + +#define SR_KX 0x00000080 /* Kernel extended addressing enabled */ +#define SR_SX 0x00000040 /* Supervisor extended addressing enabled */ +#define SR_UX 0x00000020 /* User extended addressing enabled */ + +/* Standard (R4000) cache operations. Taken from "MIPS R4000 + Microprocessor User's Manual" 2nd edition: */ + +#define CACHE_I (0) /* primary instruction */ +#define CACHE_D (1) /* primary data */ +#define CACHE_SI (2) /* secondary instruction */ +#define CACHE_SD (3) /* secondary data (or combined instruction/data) */ + +#define INDEX_INVALIDATE (0) /* also encodes WRITEBACK if CACHE_D or CACHE_SD */ +#define INDEX_LOAD_TAG (1) +#define INDEX_STORE_TAG (2) +#define CREATE_DIRTY_EXCLUSIVE (3) /* CACHE_D and CACHE_SD only */ +#define HIT_INVALIDATE (4) +#define CACHE_FILL (5) /* CACHE_I only */ +#define HIT_WRITEBACK_INVALIDATE (5) /* CACHE_D and CACHE_SD only */ +#define HIT_WRITEBACK (6) /* CACHE_I, CACHE_D and CACHE_SD only */ +#define HIT_SET_VIRTUAL (7) /* CACHE_SI and CACHE_SD only */ + +#define BUILD_CACHE_OP(o,c) (((o) << 2) | (c)) + +/* Individual cache operations: */ +#define INDEX_INVALIDATE_I BUILD_CACHE_OP(INDEX_INVALIDATE,CACHE_I) +#define INDEX_WRITEBACK_INVALIDATE_D BUILD_CACHE_OP(INDEX_INVALIDATE,CACHE_D) +#define INDEX_INVALIDATE_SI BUILD_CACHE_OP(INDEX_INVALIDATE,CACHE_SI) +#define INDEX_WRITEBACK_INVALIDATE_SD BUILD_CACHE_OP(INDEX_INVALIDATE,CACHE_SD) + +#define INDEX_LOAD_TAG_I BUILD_CACHE_OP(INDEX_LOAD_TAG,CACHE_I) +#define INDEX_LOAD_TAG_D BUILD_CACHE_OP(INDEX_LOAD_TAG,CACHE_D) +#define INDEX_LOAD_TAG_SI BUILD_CACHE_OP(INDEX_LOAD_TAG,CACHE_SI) +#define INDEX_LOAD_TAG_SD BUILD_CACHE_OP(INDEX_LOAD_TAG,CACHE_SD) + +#define INDEX_STORE_TAG_I BUILD_CACHE_OP(INDEX_STORE_TAG,CACHE_I) +#define INDEX_STORE_TAG_D BUILD_CACHE_OP(INDEX_STORE_TAG,CACHE_D) +#define INDEX_STORE_TAG_SI BUILD_CACHE_OP(INDEX_STORE_TAG,CACHE_SI) +#define INDEX_STORE_TAG_SD BUILD_CACHE_OP(INDEX_STORE_TAG,CACHE_SD) + +#define CREATE_DIRTY_EXCLUSIVE_D BUILD_CACHE_OP(CREATE_DIRTY_EXCLUSIVE,CACHE_D) +#define CREATE_DIRTY_EXCLUSIVE_SD BUILD_CACHE_OP(CREATE_DIRTY_EXCLUSIVE,CACHE_SD) + +#define HIT_INVALIDATE_I BUILD_CACHE_OP(HIT_INVALIDATE,CACHE_I) +#define HIT_INVALIDATE_D BUILD_CACHE_OP(HIT_INVALIDATE,CACHE_D) +#define HIT_INVALIDATE_SI BUILD_CACHE_OP(HIT_INVALIDATE,CACHE_SI) +#define HIT_INVALIDATE_SD BUILD_CACHE_OP(HIT_INVALIDATE,CACHE_SD) + +#define CACHE_FILL_I BUILD_CACHE_OP(CACHE_FILL,CACHE_I) +#define HIT_WRITEBACK_INVALIDATE_D BUILD_CACHE_OP(HIT_WRITEBACK_INVALIDATE,CACHE_D) +#define HIT_WRITEBACK_INVALIDATE_SD BUILD_CACHE_OP(HIT_WRITEBACK_INVALIDATE,CACHE_SD) + +#define HIT_WRITEBACK_I BUILD_CACHE_OP(HIT_WRITEBACK,CACHE_I) +#define HIT_WRITEBACK_D BUILD_CACHE_OP(HIT_WRITEBACK,CACHE_D) +#define HIT_WRITEBACK_SD BUILD_CACHE_OP(HIT_WRITEBACK,CACHE_SD) + +#define HIT_SET_VIRTUAL_SI BUILD_CACHE_OP(HIT_SET_VIRTUAL,CACHE_SI) +#define HIT_SET_VIRTUAL_SD BUILD_CACHE_OP(HIT_SET_VIRTUAL,CACHE_SD) + +/*> EOF regs.S <*/ diff --git a/libgloss/mips/syscalls.c b/libgloss/mips/syscalls.c new file mode 100644 index 0000000..3ab5436 --- /dev/null +++ b/libgloss/mips/syscalls.c @@ -0,0 +1,45 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> + +#include "regs.S" + +extern char _end[]; + +/* FIXME: This is not ideal, since we do a get_mem_info() call for + every sbrk() call. */ +char * +sbrk (nbytes) + int nbytes; +{ + static char *heap_ptr = _end; + static char *heap_start = _end; + char *base; + struct s_mem { + unsigned int size; + unsigned int icsize; + unsigned int dcsize; + } mem; + unsigned int avail = 0; + + /* The sizeof (s_mem.size) must be 4 bytes. The compiler should be + able to eliminate this check */ + if (sizeof (unsigned int) != 4) + return (char *)-1; + + get_mem_info(&mem); + /* NOTE: The value returned from the get_mem_info call is the amount + of memory, and not the address of the (last byte + 1) */ + + if (((size_t)heap_ptr >= heap_start) && ((size_t)heap_ptr < (heap_start + mem.size))) { + avail = (heap_start + mem.size) - (size_t)heap_ptr; + base = heap_ptr; + } /* else will fail since "nbytes" will be greater than zeroed "avail" value */ + + if ((nbytes > avail) || (heap_ptr + nbytes < _end)) + base = (char *)-1; + else + heap_ptr += nbytes; + + return base; +} diff --git a/libgloss/mips/test.c b/libgloss/mips/test.c new file mode 100644 index 0000000..a993479 --- /dev/null +++ b/libgloss/mips/test.c @@ -0,0 +1,13 @@ +main() +{ + outbyte ('&'); + outbyte ('@'); + outbyte ('$'); + outbyte ('%'); + + /* whew, we made it */ + + print ("\r\nDone..."); + + return; +} diff --git a/libgloss/mips/vr4300.S b/libgloss/mips/vr4300.S new file mode 100644 index 0000000..2fc576e --- /dev/null +++ b/libgloss/mips/vr4300.S @@ -0,0 +1,341 @@ +/* + * vr4300.S -- CPU specific support routines + * + * Copyright (c) 1995,1996 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#ifndef __mips64 + .set mips3 +#endif +#ifdef __mips16 +/* This file contains 32 bit assembly code. */ + .set nomips16 +#endif + +#include "regs.S" + + .text + .align 2 + + # Taken from "R4300 Preliminary RISC Processor Specification + # Revision 2.0 January 1995" page 39: "The Count + # register... increments at a constant rate... at one-half the + # PClock speed." + # We can use this fact to provide small polled delays. + .globl __cpu_timer_poll + .ent __cpu_timer_poll +__cpu_timer_poll: + .set noreorder + # in: a0 = (unsigned int) number of PClock ticks to wait for + # out: void + + # The Vr4300 counter updates at half PClock, so divide by 2 to + # get counter delta: + bnezl a0, 1f # continue if delta non-zero + srl a0, a0, 1 # divide ticks by 2 {DELAY SLOT} + # perform a quick return to the caller: + j ra + nop # {DELAY SLOT} +1: + mfc0 v0, $9 # C0_COUNT: get current counter value + nop + nop + # We cannot just do the simple test, of adding our delta onto + # the current value (ignoring overflow) and then checking for + # equality. The counter is incrementing every two PClocks, + # which means the counter value can change between + # instructions, making it hard to sample at the exact value + # desired. + + # However, we do know that our entry delta value is less than + # half the number space (since we divide by 2 on entry). This + # means we can use a difference in signs to indicate timer + # overflow. + addu a0, v0, a0 # unsigned add (ignore overflow) + # We know have our end value (which will have been + # sign-extended to fill the 64bit register value). +2: + # get current counter value: + mfc0 v0, $9 # C0_COUNT + nop + nop + # This is an unsigned 32bit subtraction: + subu v0, a0, v0 # delta = (end - now) {DELAY SLOT} + bgtzl v0, 2b # looping back is most likely + nop + # We have now been delayed (in the foreground) for AT LEAST + # the required number of counter ticks. + j ra # return to caller + nop # {DELAY SLOT} + .set reorder + .end __cpu_timer_poll + + # Flush the processor caches to memory: + + .globl __cpu_flush + .ent __cpu_flush +__cpu_flush: + .set noreorder + # NOTE: The Vr4300 *CANNOT* have any secondary cache (bit 17 + # of the CONFIG registered is hard-wired to 1). We just + # provide code to flush the Data and Instruction caches. + + # Even though the Vr4300 has hard-wired cache and cache line + # sizes, we still interpret the relevant Config register + # bits. This allows this code to be used for other conforming + # MIPS architectures if desired. + + # Get the config register + mfc0 a0, C0_CONFIG + nop + nop + li a1, 1 # a useful constant + # + srl a2, a0, 9 # bits 11..9 for instruction cache size + andi a2, a2, 0x7 # 3bits of information + add a2, a2, 12 # get full power-of-2 value + sllv a2, a1, a2 # instruction cache size + # + srl a3, a0, 6 # bits 8..6 for data cache size + andi a3, a3, 0x7 # 3bits of information + add a3, a3, 12 # get full power-of-2 value + sllv a3, a1, a3 # data cache size + # + li a1, (1 << 5) # check IB (instruction cache line size) + and a1, a0, a1 # mask against the CONFIG register value + beqz a1, 1f # branch on result of delay slot operation + nop + li a1, 32 # non-zero, then 32bytes + j 2f # continue + nop +1: + li a1, 16 # 16bytes +2: + # + li t0, (1 << 4) # check DB (data cache line size) + and a0, a0, t0 # mask against the CONFIG register value + beqz a0, 3f # branch on result of delay slot operation + nop + li a0, 32 # non-zero, then 32bytes + j 4f # continue + nop +3: + li a0, 16 # 16bytes +4: + # + # a0 = data cache line size + # a1 = instruction cache line size + # a2 = instruction cache size + # a3 = data cache size + # + lui t0, ((K0BASE >> 16) & 0xFFFF) + ori t0, t0, (K0BASE & 0xFFFF) + addu t1, t0, a2 # end cache address + subu t2, a1, 1 # line size mask + not t2 # invert the mask + and t3, t0, t2 # get start address + addu t1, -1 + and t1, t2 # get end address +5: + cache INDEX_INVALIDATE_I,0(t3) + bne t3, t1, 5b + addu t3, a1 + # + addu t1, t0, a3 # end cache address + subu t2, a0, 1 # line size mask + not t2 # invert the mask + and t3, t0, t2 # get start address + addu t1, -1 + and t1, t2 # get end address +6: + cache INDEX_WRITEBACK_INVALIDATE_D,0(t3) + bne t3, t1, 6b + addu t3, a0 + # + j ra # return to the caller + nop + .set reorder + .end __cpu_flush + + # NOTE: This variable should *NOT* be addressed relative to + # the $gp register since this code is executed before $gp is + # initialised... hence we leave it in the text area. This will + # cause problems if this routine is ever ROMmed: + + .globl __buserr_cnt +__buserr_cnt: + .word 0 + .align 3 +__k1_save: + .word 0 + .word 0 + .align 2 + + .ent __buserr + .globl __buserr +__buserr: + .set noat + .set noreorder + # k0 and k1 available for use: + mfc0 k0,C0_CAUSE + nop + nop + andi k0,k0,0x7c + sub k0,k0,7 << 2 + beq k0,$0,__buserr_do + nop + # call the previous handler + la k0,__previous + jr k0 + nop + # +__buserr_do: + # TODO: check that the cause is indeed a bus error + # - if not then just jump to the previous handler + la k0,__k1_save + sd k1,0(k0) + # + la k1,__buserr_cnt + lw k0,0(k1) # increment counter + addu k0,1 + sw k0,0(k1) + # + la k0,__k1_save + ld k1,0(k0) + # + mfc0 k0,C0_EPC + nop + nop + addu k0,k0,4 # skip offending instruction + mtc0 k0,C0_EPC # update EPC + nop + nop + eret +# j k0 +# rfe + .set reorder + .set at + .end __buserr + +__exception_code: + .set noreorder + lui k0,%hi(__buserr) + daddiu k0,k0,%lo(__buserr) + jr k0 + nop + .set reorder +__exception_code_end: + + .data +__previous: + .space (__exception_code_end - __exception_code) + # This subtracting two addresses is working + # but is not garenteed to continue working. + # The assemble reserves the right to put these + # two labels into different frags, and then + # cant take their difference. + + .text + + .ent __default_buserr_handler + .globl __default_buserr_handler +__default_buserr_handler: + .set noreorder + # attach our simple bus error handler: + # in: void + # out: void + mfc0 a0,C0_SR + nop + li a1,SR_BEV + and a1,a1,a0 + beq a1,$0,baseaddr + lui a0,0x8000 # delay slot + lui a0,0xbfc0 + daddiu a0,a0,0x0200 +baseaddr: + daddiu a0,a0,0x0180 + # a0 = base vector table address + la a1,__exception_code_end + la a2,__exception_code + subu a1,a1,a2 + la a3,__previous + # there must be a better way of doing this???? +copyloop: + lw v0,0(a0) + sw v0,0(a3) + lw v0,0(a2) + sw v0,0(a0) + daddiu a0,a0,4 + daddiu a2,a2,4 + daddiu a3,a3,4 + subu a1,a1,4 + bne a1,$0,copyloop + nop + la a0,__buserr_cnt + sw $0,0(a0) + j ra + nop + .set reorder + .end __default_buserr_handler + + .ent __restore_buserr_handler + .globl __restore_buserr_handler +__restore_buserr_handler: + .set noreorder + # restore original (monitor) bus error handler + # in: void + # out: void + mfc0 a0,C0_SR + nop + li a1,SR_BEV + and a1,a1,a0 + beq a1,$0,res_baseaddr + lui a0,0x8000 # delay slot + lui a0,0xbfc0 + daddiu a0,a0,0x0200 +res_baseaddr: + daddiu a0,a0,0x0180 + # a0 = base vector table address + la a1,__exception_code_end + la a3,__exception_code + subu a1,a1,a3 + la a3,__previous + # there must be a better way of doing this???? +res_copyloop: + lw v0,0(a3) + sw v0,0(a0) + daddiu a0,a0,4 + daddiu a3,a3,4 + subu a1,a1,4 + bne a1,$0,res_copyloop + nop + j ra + nop + .set reorder + .end __restore_buserr_handler + + .ent __buserr_count + .globl __buserr_count +__buserr_count: + .set noreorder + # restore original (monitor) bus error handler + # in: void + # out: unsigned int __buserr_cnt + la v0,__buserr_cnt + lw v0,0(v0) + j ra + nop + .set reorder + .end __buserr_count + +/* EOF vr4300.S */ diff --git a/libgloss/mips/vr5xxx.S b/libgloss/mips/vr5xxx.S new file mode 100644 index 0000000..4d2b38b --- /dev/null +++ b/libgloss/mips/vr5xxx.S @@ -0,0 +1,457 @@ +/* + * vr5xxx.S -- CPU specific support routines + * + * Copyright (c) 1999 Cygnus Solutions + * + * 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. + */ + +/* This file cloned from vr4300.S by dlindsay@cygnus.com + * and recoded to suit Vr5432 and Vr5000. + * Should be no worse for Vr43{00,05,10}. + * Specifically, __cpu_flush() has been changed (a) to allow for the hardware + * difference (in set associativity) between the Vr5432 and Vr5000, + * and (b) to flush the optional secondary cache of the Vr5000. + */ + +/* Processor Revision Identifier (PRID) Register: Implementation Numbers */ +#define IMPL_VR5432 0x54 + +/* Cache Constants not determinable dynamically */ +#define VR5000_2NDLINE 32 /* secondary cache line size */ +#define VR5432_LINE 32 /* I,Dcache line sizes */ +#define VR5432_SIZE (16*1024) /* I,Dcache half-size */ + + +#ifndef __mips64 + .set mips3 +#endif +#ifdef __mips16 +/* This file contains 32 bit assembly code. */ + .set nomips16 +#endif + +#include "regs.S" + + .text + .align 2 + + # Taken from "R4300 Preliminary RISC Processor Specification + # Revision 2.0 January 1995" page 39: "The Count + # register... increments at a constant rate... at one-half the + # PClock speed." + # We can use this fact to provide small polled delays. + .globl __cpu_timer_poll + .ent __cpu_timer_poll +__cpu_timer_poll: + .set noreorder + # in: a0 = (unsigned int) number of PClock ticks to wait for + # out: void + + # The Vr4300 counter updates at half PClock, so divide by 2 to + # get counter delta: + bnezl a0, 1f # continue if delta non-zero + srl a0, a0, 1 # divide ticks by 2 {DELAY SLOT} + # perform a quick return to the caller: + j ra + nop # {DELAY SLOT} +1: + mfc0 v0, $9 # C0_COUNT: get current counter value + nop + nop + # We cannot just do the simple test, of adding our delta onto + # the current value (ignoring overflow) and then checking for + # equality. The counter is incrementing every two PClocks, + # which means the counter value can change between + # instructions, making it hard to sample at the exact value + # desired. + + # However, we do know that our entry delta value is less than + # half the number space (since we divide by 2 on entry). This + # means we can use a difference in signs to indicate timer + # overflow. + addu a0, v0, a0 # unsigned add (ignore overflow) + # We know have our end value (which will have been + # sign-extended to fill the 64bit register value). +2: + # get current counter value: + mfc0 v0, $9 # C0_COUNT + nop + nop + # This is an unsigned 32bit subtraction: + subu v0, a0, v0 # delta = (end - now) {DELAY SLOT} + bgtzl v0, 2b # looping back is most likely + nop + # We have now been delayed (in the foreground) for AT LEAST + # the required number of counter ticks. + j ra # return to caller + nop # {DELAY SLOT} + .set reorder + .end __cpu_timer_poll + + # Flush the processor caches to memory: + + .globl __cpu_flush + .ent __cpu_flush +__cpu_flush: + .set noreorder + # NOTE: The Vr4300 and Vr5432 *CANNOT* have any secondary cache. + # On those, SC (bit 17 of CONFIG register) is hard-wired to 1, + # except that email from Dennis_Han@el.nec.com says that old + # versions of the Vr5432 incorrectly hard-wired this bit to 0. + # The Vr5000 has an optional direct-mapped secondary cache, + # and the SC bit correctly indicates this. + + # So, for the 4300 and 5432 we want to just + # flush the primary Data and Instruction caches. + # For the 5000 it is desired to flush the secondary cache too. + # There is an operation difference worth noting. + # The 4300 and 5000 primary caches use VA bit 14 to choose cache set, + # whereas 5432 primary caches use VA bit 0. + + # This code interprets the relevant Config register bits as + # much as possible, except for the 5432. + # The code therefore has some portability. + # However, the associativity issues mean you should not just assume + # that this code works anywhere. Also, the secondary cache set + # size is hardwired, since the 5000 series does not define codes + # for variant sizes. + + # Note: this version of the code flushes D$ before I$. + # It is difficult to construct a case where that matters, + # but it cant hurt. + + mfc0 a0, C0_PRID # a0 = Processor Revision register + nop # dlindsay: unclear why the nops, but + nop # vr4300.S had such so I do too. + srl a2, a0, PR_IMP # want bits 8..15 + andi a2, a2, 0x255 # mask: now a2 = Implementation # field + li a1, IMPL_VR5432 + beq a1, a2, 8f # use Vr5432-specific flush algorithm + nop + + # Non-Vr5432 version of the code. + # (The distinctions being: CONFIG is truthful about secondary cache, + # and we act as if the primary Icache and Dcache are direct mapped.) + + mfc0 t0, C0_CONFIG # t0 = CONFIG register + nop + nop + li a1, 1 # a1=1, a useful constant + + srl a2, t0, CR_IC # want IC field of CONFIG + andi a2, a2, 0x7 # mask: now a2= code for Icache size + add a2, a2, 12 # +12 + sllv a2, a1, a2 # a2=primary instruction cache size in bytes + + srl a3, t0, CR_DC # DC field of CONFIG + andi a3, a3, 0x7 # mask: now a3= code for Dcache size + add a3, a3, 12 # +12 + sllv a3, a1, a3 # a3=primary data cache size in bytes + + li t2, (1 << CR_IB) # t2=mask over IB boolean + and t2, t2, t0 # test IB field of CONFIG register value + beqz t2, 1f # + li a1, 16 # 16 bytes (branch shadow: always loaded.) + li a1, 32 # non-zero, then 32bytes +1: + + li t2, (1 << CR_DB) # t2=mask over DB boolean + and t2, t2, t0 # test BD field of CONFIG register value + beqz t2, 2f # + li a0, 16 # 16bytes (branch shadow: always loaded.) + li a0, 32 # non-zero, then 32bytes +2: + lui t1, ((K0BASE >> 16) & 0xFFFF) + ori t1, t1, (K0BASE & 0xFFFF) + + # At this point, + # a0 = primary Dcache line size in bytes + # a1 = primary Icache line size in bytes + # a2 = primary Icache size in bytes + # a3 = primary Dcache size in bytes + # t0 = CONFIG value + # t1 = a round unmapped cached base address (we are in kernel mode) + # t2,t3 scratch + + addi t3, t1, 0 # t3=t1=start address for any cache + add t2, t3, a3 # t2=end adress+1 of Dcache + sub t2, t2, a0 # t2=address of last line in Dcache +3: + cache INDEX_WRITEBACK_INVALIDATE_D,0(t3) + bne t3, t2, 3b # + addu t3, a0 # (delay slot) increment by Dcache line size + + + # Now check CONFIG to see if there is a secondary cache + lui t2, (1 << (CR_SC-16)) # t2=mask over SC boolean + and t2, t2, t0 # test SC in CONFIG + bnez t2, 6f + + # There is a secondary cache. Find out its sizes. + + srl t3, t0, CR_SS # want SS field of CONFIG + andi t3, t3, 0x3 # mask: now t3= code for cache size. + beqz t3, 4f + lui a3, ((512*1024)>>16) # a3= 512K, code was 0 + addu t3, -1 # decrement code + beqz t3, 4f + lui a3, ((1024*1024)>>16) # a3= 1 M, code 1 + addu t3, -1 # decrement code + beqz t3, 4f + lui a3, ((2*1024*1024)>>16) # a3= 2 M, code 2 + j 6f # no secondary cache, code 3 + +4: # a3 = secondary cache size in bytes + li a0, VR5000_2NDLINE # no codes assigned for other than 32 + + # At this point, + # a0 = secondary cache line size in bytes + # a1 = primary Icache line size in bytes + # a2 = primary Icache size in bytes + # a3 = secondary cache size in bytes + # t1 = a round unmapped cached base address (we are in kernel mode) + # t2,t3 scratch + + addi t3, t1, 0 # t3=t1=start address for any cache + add t2, t3, a3 # t2=end address+1 of secondary cache + sub t2, t2, a0 # t2=address of last line in secondary cache +5: + cache INDEX_WRITEBACK_INVALIDATE_SD,0(t3) + bne t3, t2, 5b + addu t3, a0 # (delay slot) increment by line size + + +6: # Any optional secondary cache done. Now do I-cache and return. + + # At this point, + # a1 = primary Icache line size in bytes + # a2 = primary Icache size in bytes + # t1 = a round unmapped cached base address (we are in kernel mode) + # t2,t3 scratch + + add t2, t1, a2 # t2=end adress+1 of Icache + sub t2, t2, a1 # t2=address of last line in Icache +7: + cache INDEX_INVALIDATE_I,0(t1) + bne t1, t2, 7b + addu t1, a1 # (delay slot) increment by Icache line size + + j ra # return to the caller + nop + +8: + +# Vr5432 version of the cpu_flush code. +# (The distinctions being: CONFIG can not be trusted about secondary +# cache (which does not exist). The primary caches use Virtual Address Bit 0 +# to control set selection. + +# Code does not consult CONFIG about cache sizes: knows the hardwired sizes. +# Since both I and D have the same size and line size, uses a merged loop. + + li a0, VR5432_LINE + li a1, VR5432_SIZE + lui t1, ((K0BASE >> 16) & 0xFFFF) + ori t1, t1, (K0BASE & 0xFFFF) + + # a0 = cache line size in bytes + # a1 = 1/2 cache size in bytes + # t1 = a round unmapped cached base address (we are in kernel mode) + + add t2, t1, a1 # t2=end address+1 + sub t2, t2, a0 # t2=address of last line in Icache + +9: + cache INDEX_WRITEBACK_INVALIDATE_D,0(t1) # set 0 + cache INDEX_WRITEBACK_INVALIDATE_D,1(t1) # set 1 + cache INDEX_INVALIDATE_I,0(t1) # set 0 + cache INDEX_INVALIDATE_I,1(t1) # set 1 + bne t1, t2, 9b + addu t1, a0 + + j ra # return to the caller + nop + .set reorder + .end __cpu_flush + + # NOTE: This variable should *NOT* be addressed relative to + # the $gp register since this code is executed before $gp is + # initialised... hence we leave it in the text area. This will + # cause problems if this routine is ever ROMmed: + + .globl __buserr_cnt +__buserr_cnt: + .word 0 + .align 3 +__k1_save: + .word 0 + .word 0 + .align 2 + + .ent __buserr + .globl __buserr +__buserr: + .set noat + .set noreorder + # k0 and k1 available for use: + mfc0 k0,C0_CAUSE + nop + nop + andi k0,k0,0x7c + sub k0,k0,7 << 2 + beq k0,$0,__buserr_do + nop + # call the previous handler + la k0,__previous + jr k0 + nop + # +__buserr_do: + # TODO: check that the cause is indeed a bus error + # - if not then just jump to the previous handler + la k0,__k1_save + sd k1,0(k0) + # + la k1,__buserr_cnt + lw k0,0(k1) # increment counter + addu k0,1 + sw k0,0(k1) + # + la k0,__k1_save + ld k1,0(k0) + # + mfc0 k0,C0_EPC + nop + nop + addu k0,k0,4 # skip offending instruction + mtc0 k0,C0_EPC # update EPC + nop + nop + eret +# j k0 +# rfe + .set reorder + .set at + .end __buserr + +__exception_code: + .set noreorder + lui k0,%hi(__buserr) + daddiu k0,k0,%lo(__buserr) + jr k0 + nop + .set reorder +__exception_code_end: + + .data +__previous: + .space (__exception_code_end - __exception_code) + # This subtracting two addresses is working + # but is not garenteed to continue working. + # The assemble reserves the right to put these + # two labels into different frags, and then + # cant take their difference. + + .text + + .ent __default_buserr_handler + .globl __default_buserr_handler +__default_buserr_handler: + .set noreorder + # attach our simple bus error handler: + # in: void + # out: void + mfc0 a0,C0_SR + nop + li a1,SR_BEV + and a1,a1,a0 + beq a1,$0,baseaddr + lui a0,0x8000 # delay slot + lui a0,0xbfc0 + daddiu a0,a0,0x0200 +baseaddr: + daddiu a0,a0,0x0180 + # a0 = base vector table address + la a1,__exception_code_end + la a2,__exception_code + subu a1,a1,a2 + la a3,__previous + # there must be a better way of doing this???? +copyloop: + lw v0,0(a0) + sw v0,0(a3) + lw v0,0(a2) + sw v0,0(a0) + daddiu a0,a0,4 + daddiu a2,a2,4 + daddiu a3,a3,4 + subu a1,a1,4 + bne a1,$0,copyloop + nop + la a0,__buserr_cnt + sw $0,0(a0) + j ra + nop + .set reorder + .end __default_buserr_handler + + .ent __restore_buserr_handler + .globl __restore_buserr_handler +__restore_buserr_handler: + .set noreorder + # restore original (monitor) bus error handler + # in: void + # out: void + mfc0 a0,C0_SR + nop + li a1,SR_BEV + and a1,a1,a0 + beq a1,$0,res_baseaddr + lui a0,0x8000 # delay slot + lui a0,0xbfc0 + daddiu a0,a0,0x0200 +res_baseaddr: + daddiu a0,a0,0x0180 + # a0 = base vector table address + la a1,__exception_code_end + la a3,__exception_code + subu a1,a1,a3 + la a3,__previous + # there must be a better way of doing this???? +res_copyloop: + lw v0,0(a3) + sw v0,0(a0) + daddiu a0,a0,4 + daddiu a3,a3,4 + subu a1,a1,4 + bne a1,$0,res_copyloop + nop + j ra + nop + .set reorder + .end __restore_buserr_handler + + .ent __buserr_count + .globl __buserr_count +__buserr_count: + .set noreorder + # restore original (monitor) bus error handler + # in: void + # out: unsigned int __buserr_cnt + la v0,__buserr_cnt + lw v0,0(v0) + j ra + nop + .set reorder + .end __buserr_count + +/* EOF vr5xxx.S */ diff --git a/libgloss/mn10200/Makefile.in b/libgloss/mn10200/Makefile.in new file mode 100644 index 0000000..9ed0055 --- /dev/null +++ b/libgloss/mn10200/Makefile.in @@ -0,0 +1,148 @@ +# Copyright (c) 1998 Cygnus Support +# +# The authors hereby grant permission to use, copy, modify, distribute, +# and license this software and its documentation for any purpose, provided +# that existing copyright notices are retained in all copies and that this +# notice is included verbatim in any distributions. No written agreement, +# license, or royalty fee is required for any of the authorized uses. +# Modifications to this software may be copyrighted by their authors +# and need not follow the licensing terms described here, provided that +# the new terms are clearly indicated on the first page of each file where +# they apply. + +VPATH = @srcdir@ +srcdir = @srcdir@ +objdir = . +srcroot = $(srcdir)/../.. +objroot = $(objdir)/../.. + +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +host_alias = @host_alias@ +target_alias = @target_alias@ +program_transform_name = @program_transform_name@ + +bindir = @bindir@ +libdir = @libdir@ +tooldir = $(exec_prefix)/$(target_alias) + +# Multilib support variables. +# TOP is used instead of MULTI{BUILD,SRC}TOP. +MULTIDIRS = +MULTISUBDIR = +MULTIDO = true +MULTICLEAN = true + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ + +SHELL = /bin/sh + +CC = @CC@ + +#AS = @AS@ +AS = `if [ -f ${objroot}/../gas/as.new ] ; \ + then echo ${objroot}/../gas/as.new ; \ + else echo as ; fi` + +AR = @AR@ + +#LD = @LD@ +LD = `if [ -f ${objroot}/../ld/ld.new ] ; \ + then echo ${objroot}/../ld/ld.new ; \ + else echo ld ; fi` + +RANLIB = @RANLIB@ + +OBJDUMP = `if [ -f ${objroot}/../binutils/objdump ] ; \ + then echo ${objroot}/../binutils/objdump ; \ + else t='$(program_transform_name)'; echo objdump | sed -e $$t ; fi` +OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \ + then echo ${objroot}/../binutils/objcopy ; \ + else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi` + +CRT0 = crt0.o + +# Generic object files common to all targets. +GENOBJS = _exit.o access.o chmod.o close.o crt1.o \ + fstat.o getpid.o isatty.o \ + kill.o lseek.o open.o read.o \ + sbrk.o stat.o time.o trap.o unlink.o utime.o write.o + +# Object files specific to particular targets. +EVALOBJS = ${GENOBJS} + +CFLAGS = -g + +GCC_LDFLAGS = `if [ -d ${objroot}/../gcc ] ; \ + then echo -L${objroot}/../gcc ; fi` + +SCRIPTS = eval sim +BSP = libeval.a + +# Host specific makefile fragment comes in here. +@host_makefile_frag@ + +# +# 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. +# + +all: ${CRT0} test.o ${BSP} + +# +# here's where we build the board support packages for each target +# + +libeval.a: $(EVALOBJS) + ${AR} ${ARFLAGS} $@ $(EVALOBJS) + ${RANLIB} $@ + + +# compile a fully linked binary. The -Wl,-T*.ld is for the linker +# script. By using -Wl, the linker script is put on the proper place +# in the comand line for ld, and all the symbols will get fully +# resolved. + +test: $(CRT0) test.o + ${CC} $(CFLAGS_FOR_TARGET) -L${srcdir} -L${objdir} \ + test.o -o $@ $(NEWLIB_LDFLAGS) -Wl,-Teval.ld + @echo Done... + +doc: + +clean mostlyclean: + rm -f a.out core *.i *~ *.o *-test *.srec *.dis *.map *.x + +distclean maintainer-clean realclean: clean + rm -f Makefile config.status a.out + +.PHONY: install info install-info clean-info +install: + $(INSTALL_PROGRAM) $(CRT0) $(tooldir)/lib${MULTISUBDIR}/$(CRT0) + @for bsp in ${BSP}; do\ + $(INSTALL_PROGRAM) $${bsp} $(tooldir)/lib${MULTISUBDIR}; \ + done + @for script in ${SCRIPTS}; do\ + $(INSTALL_DATA) ${srcdir}/$${script}.ld $(tooldir)/lib${MULTISUBDIR}/$${script}.ld; \ + done + +info: +install-info: +clean-info: + +test.o: ${srcdir}/test.c + +# these are for the BSPs +${CRT0}: ${srcdir}/crt0.S + +# target specific makefile fragment comes in here. +@target_makefile_frag@ + +Makefile: Makefile.in config.status @host_makefile_frag_path@ @target_makefile_frag_path@ + $(SHELL) config.status + +config.status: configure + $(SHELL) config.status --recheck diff --git a/libgloss/mn10200/_exit.c b/libgloss/mn10200/_exit.c new file mode 100644 index 0000000..ec51d40 --- /dev/null +++ b/libgloss/mn10200/_exit.c @@ -0,0 +1,29 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" + + +static void _do_dtors() +{ + /* The loop variable is static so that if a destructor calls exit, + and we return here, we simply continue with the next destructor. */ + typedef void (*pfunc) (); + extern pfunc __dtors[]; + extern pfunc __dtors_end[]; + static pfunc *p = __dtors; + + while (p < __dtors_end) + (*p++) (); +} + + +void _exit (n) +{ + /* Destructors should be done earlier because they need to be done before the + files are closed, but here is better than nowhere (and this balances the + constructors done in crt1.c. */ + _do_dtors(); + + TRAP0 (SYS_exit, n, 0, 0); +} diff --git a/libgloss/mn10200/access.c b/libgloss/mn10200/access.c new file mode 100644 index 0000000..ad368ca --- /dev/null +++ b/libgloss/mn10200/access.c @@ -0,0 +1,34 @@ +/* This is file ACCESS.C */ +/* +** Copyright (C) 1993 DJ Delorie, 24 Kirsten Ave, Rochester NH 03867-2954 +** +** This file is distributed under the terms listed in the document +** "copying.dj", available from DJ Delorie at the address above. +** A copy of "copying.dj" should accompany this file; if not, a copy +** should be available from where this file was obtained. This file +** may not be distributed without a verbatim copy of "copying.dj". +** +** This file is distributed WITHOUT ANY WARRANTY; without even the implied +** warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ + +#include <fcntl.h> +#include <sys/stat.h> +#include <unistd.h> + +int access(const char *fn, int flags) +{ + struct stat s; + if (stat(fn, &s)) + return -1; + if (s.st_mode & S_IFDIR) + return 0; + if (flags & W_OK) + { + if (s.st_mode & S_IWRITE) + return 0; + return -1; + } + return 0; +} + diff --git a/libgloss/mn10200/chmod.c b/libgloss/mn10200/chmod.c new file mode 100644 index 0000000..8200506 --- /dev/null +++ b/libgloss/mn10200/chmod.c @@ -0,0 +1,11 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" + + +int +chmod (const char *path, mode_t mode) +{ + return TRAP0 (SYS_chmod, path, mode, 0); +} diff --git a/libgloss/mn10200/chown.c b/libgloss/mn10200/chown.c new file mode 100644 index 0000000..6630d3b --- /dev/null +++ b/libgloss/mn10200/chown.c @@ -0,0 +1,12 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" + + + +int +chown (const char *path, short owner, short group) +{ + return TRAP0 (SYS_chown, path, owner, group); +} diff --git a/libgloss/mn10200/close.c b/libgloss/mn10200/close.c new file mode 100644 index 0000000..8474b38 --- /dev/null +++ b/libgloss/mn10200/close.c @@ -0,0 +1,11 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" + + +int +_close (int file) +{ + return TRAP0 (SYS_close, file, 0, 0); +} diff --git a/libgloss/mn10200/configure b/libgloss/mn10200/configure new file mode 100755 index 0000000..d96f5b8 --- /dev/null +++ b/libgloss/mn10200/configure @@ -0,0 +1,1213 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.12.2 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.12.2" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=crt0.S + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +ac_exeext= +ac_objext=o +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + +if test "${enable_shared}" = "yes" ; then + echo "Shared libraries not supported for cross compiling, ignored" +fi + +if test "$srcdir" = "." ; then + if test "${with_target_subdir}" != "." ; then + libgloss_topdir="${srcdir}/${with_multisrctop}../../.." + else + libgloss_topdir="${srcdir}/${with_multisrctop}../.." + fi +else + libgloss_topdir="${srcdir}/../.." +fi +ac_aux_dir= +for ac_dir in $libgloss_topdir $srcdir/$libgloss_topdir; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $libgloss_topdir $srcdir/$libgloss_topdir" 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + + + +# Do some error checking and defaulting for the host and target type. +# The inputs are: +# configure --host=HOST --target=TARGET --build=BUILD NONOPT +# +# The rules are: +# 1. You are not allowed to specify --host, --target, and nonopt at the +# same time. +# 2. Host defaults to nonopt. +# 3. If nonopt is not specified, then host defaults to the current host, +# as determined by config.guess. +# 4. Target and build default to nonopt. +# 5. If nonopt is not specified, then target and build default to host. + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +case $host---$target---$nonopt in +NONE---*---* | *---NONE---* | *---*---NONE) ;; +*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;; +esac + + +# Make sure we can run config.sub. +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi + +echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:587: checking host system type" >&5 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + +echo $ac_n "checking target system type""... $ac_c" 1>&6 +echo "configure:608: checking target system type" >&5 + +target_alias=$target +case "$target_alias" in +NONE) + case $nonopt in + NONE) target_alias=$host_alias ;; + *) target_alias=$nonopt ;; + esac ;; +esac + +target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias` +target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$target" 1>&6 + +echo $ac_n "checking build system type""... $ac_c" 1>&6 +echo "configure:626: checking build system type" >&5 + +build_alias=$build +case "$build_alias" in +NONE) + case $nonopt in + NONE) build_alias=$host_alias ;; + *) build_alias=$nonopt ;; + esac ;; +esac + +build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` +build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$build" 1>&6 + +test "$host_alias" != "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + +if test "$program_transform_name" = s,x,x,; then + program_transform_name= +else + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed +s,\\,\\\\,g; s,\$,$$,g +EOF_SED + program_transform_name="`echo $program_transform_name|sed -f conftestsed`" + rm -f conftestsed +fi +test "$program_prefix" != NONE && + program_transform_name="s,^,${program_prefix},; $program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" + +# sed with no file args requires a program. +test "$program_transform_name" = "" && program_transform_name="s,x,x," + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:680: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +# FIXME: We temporarily define our own version of AC_PROG_CC. This is +# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We +# are building a library that must be included in all links, so we +# can't link an executable until this lib is built. +# autoconf should provide a way to do this. + + + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:742: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:771: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +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 $# -gt 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 + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:819: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <<EOF +#ifdef __GNUC__ + yes; +#endif +EOF +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:828: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:843: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi + +AS=${AS-as} + +AR=${AR-ar} + +LD=${LD-ld} + +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:879: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +case "${target}" in + *) + part_specific_obj=vr4300.o + ;; +esac + +host_makefile_frag=${srcdir}/../config/default.mh +target_makefile_frag=${srcdir}/../config/mn10200.mt + +host_makefile_frag_path=$host_makefile_frag + + +target_makefile_frag_path=$target_makefile_frag + + + + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set) 2>&1 | grep ac_space` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs + + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS <<EOF +#! /bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.12.2" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS <<EOF + +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; + s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@host@%$host%g +s%@host_alias@%$host_alias%g +s%@host_cpu@%$host_cpu%g +s%@host_vendor@%$host_vendor%g +s%@host_os@%$host_os%g +s%@target@%$target%g +s%@target_alias@%$target_alias%g +s%@target_cpu@%$target_cpu%g +s%@target_vendor@%$target_vendor%g +s%@target_os@%$target_os%g +s%@build@%$build%g +s%@build_alias@%$build_alias%g +s%@build_cpu@%$build_cpu%g +s%@build_vendor@%$build_vendor%g +s%@build_os@%$build_os%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@CC@%$CC%g +s%@AS@%$AS%g +s%@AR@%$AR%g +s%@LD@%$LD%g +s%@RANLIB@%$RANLIB%g +s%@host_makefile_frag_path@%$host_makefile_frag_path%g +/@host_makefile_frag@/r $host_makefile_frag +s%@host_makefile_frag@%%g +s%@target_makefile_frag_path@%$target_makefile_frag_path%g +/@target_makefile_frag@/r $target_makefile_frag +s%@target_makefile_frag@%%g +s%@part_specific_obj@%$part_specific_obj%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <<EOF + +CONFIG_FILES=\${CONFIG_FILES-"Makefile"} +EOF +cat >> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +EOF +cat >> $CONFIG_STATUS <<EOF +srcdir=${srcdir} +target=${target} +ac_configure_args="${ac_configure_args} --enable-multilib" +CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} +libgloss_topdir=${libgloss_topdir} + +EOF +cat >> $CONFIG_STATUS <<\EOF +. ${libgloss_topdir}/config-ml.in +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + + + diff --git a/libgloss/mn10200/configure.in b/libgloss/mn10200/configure.in new file mode 100644 index 0000000..0551425 --- /dev/null +++ b/libgloss/mn10200/configure.in @@ -0,0 +1,115 @@ +# Copyright (c) 1995, 1996, 1997, 1998 Cygnus Support +# +# The authors hereby grant permission to use, copy, modify, distribute, +# and license this software and its documentation for any purpose, provided +# that existing copyright notices are retained in all copies and that this +# notice is included verbatim in any distributions. No written agreement, +# license, or royalty fee is required for any of the authorized uses. +# Modifications to this software may be copyrighted by their authors +# and need not follow the licensing terms described here, provided that +# the new terms are clearly indicated on the first page of each file where +# they apply. +# +# Process this file with autoconf to produce a configure script. +# +AC_PREREQ(2.5)dnl +AC_INIT(crt0.S) + +if test "${enable_shared}" = "yes" ; then + echo "Shared libraries not supported for cross compiling, ignored" +fi + +if test "$srcdir" = "." ; then + if test "${with_target_subdir}" != "." ; then + libgloss_topdir="${srcdir}/${with_multisrctop}../../.." + else + libgloss_topdir="${srcdir}/${with_multisrctop}../.." + fi +else + libgloss_topdir="${srcdir}/../.." +fi +AC_CONFIG_AUX_DIR($libgloss_topdir) + +AC_CANONICAL_SYSTEM +AC_ARG_PROGRAM + +AC_PROG_INSTALL + +# FIXME: We temporarily define our own version of AC_PROG_CC. This is +# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We +# are building a library that must be included in all links, so we +# can't link an executable until this lib is built. +# autoconf should provide a way to do this. + +AC_DEFUN(LIB_AC_PROG_CC, +[AC_BEFORE([$0], [AC_PROG_CPP])dnl +AC_CHECK_PROG(CC, gcc, gcc) +if test -z "$CC"; then + AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) + test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) +fi + +AC_PROG_CC_GNU + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +dnl Check whether -g works, even if CFLAGS is set, in case the package +dnl plays around with CFLAGS (such as to build both debugging and +dnl normal versions of a library), tasteless as that idea is. + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + AC_PROG_CC_G + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi +]) + +LIB_AC_PROG_CC +AS=${AS-as} +AC_SUBST(AS) +AR=${AR-ar} +AC_SUBST(AR) +LD=${LD-ld} +AC_SUBST(LD) +AC_PROG_RANLIB + +case "${target}" in + *) + part_specific_obj=vr4300.o + ;; +esac + +host_makefile_frag=${srcdir}/../config/default.mh +target_makefile_frag=${srcdir}/../config/mn10200.mt + +dnl We have to assign the same value to other variables because autoconf +dnl doesn't provide a mechanism to substitute a replacement keyword with +dnl arbitrary data or pathnames. +dnl +host_makefile_frag_path=$host_makefile_frag +AC_SUBST(host_makefile_frag_path) +AC_SUBST_FILE(host_makefile_frag) +target_makefile_frag_path=$target_makefile_frag +AC_SUBST(target_makefile_frag_path) +AC_SUBST_FILE(target_makefile_frag) +AC_SUBST(part_specific_obj) + +AC_OUTPUT(Makefile, +. ${libgloss_topdir}/config-ml.in, +srcdir=${srcdir} +target=${target} +ac_configure_args="${ac_configure_args} --enable-multilib" +CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} +libgloss_topdir=${libgloss_topdir} +) + + diff --git a/libgloss/mn10200/creat.c b/libgloss/mn10200/creat.c new file mode 100644 index 0000000..1003a2a --- /dev/null +++ b/libgloss/mn10200/creat.c @@ -0,0 +1,12 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" + + +int +creat (const char *path, + int mode) +{ + return TRAP0 (SYS_creat, path, mode, 0); +} diff --git a/libgloss/mn10200/crt0.S b/libgloss/mn10200/crt0.S new file mode 100644 index 0000000..d41abfc --- /dev/null +++ b/libgloss/mn10200/crt0.S @@ -0,0 +1,58 @@ +##============================================================================== +## +## crt0.S +## +## MN10200 startup code +## +##============================================================================== +## +## Copyright (c) 1995, 1996, 1997, 1998 Cygnus Solutions +## +## 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. +## + +##------------------------------------------------------------------------------ + + .file "crt0.S" + +##------------------------------------------------------------------------------ +## Startup code + .section .text + .global _start +_start: + mov _stack,a3 # Load up the stack pointer and allocate + # our current frame. + + mov _edata,a0 # Get the start/end of bss + mov _end,a1 + + cmp a0,a1 # If no bss, then do nothing + beqx .L0 + + sub d0,d0 # clear d0 + +.L1: + movb d0,(a0) # Clear a byte and bump pointer + add 1,a0 + cmp a0,a1 + bnex .L1 + +.L0: + jsr ___main + sub d0,d0 + mov d0,d1 + mov d0,(a3) + jsr _main # Call main program + jmp _exit # All done, no need to return or + # deallocate our stack. + + .section .stack +_stack: .long 1 diff --git a/libgloss/mn10200/crt1.c b/libgloss/mn10200/crt1.c new file mode 100644 index 0000000..dd0be31 --- /dev/null +++ b/libgloss/mn10200/crt1.c @@ -0,0 +1,16 @@ +void __main () +{ + static int initialized; + if (! initialized) + { + typedef void (*pfunc) (); + extern pfunc __ctors[]; + extern pfunc __ctors_end[]; + pfunc *p; + + initialized = 1; + for (p = __ctors_end; p > __ctors; ) + (*--p) (); + + } +} diff --git a/libgloss/mn10200/eval.ld b/libgloss/mn10200/eval.ld new file mode 100644 index 0000000..7c91ed7 --- /dev/null +++ b/libgloss/mn10200/eval.ld @@ -0,0 +1,157 @@ +/* Linker script for the MN10200 Evaluation Board. + It differs from the default linker script only in the + addresses assigned to text and stack sections. +*/ + +OUTPUT_FORMAT("elf32-mn10200", "elf32-mn10200", + "elf32-mn10200") +OUTPUT_ARCH(mn10200) +ENTRY(_start) +GROUP(-lc -leval -lgcc) +SEARCH_DIR(.); +/* Do we need any of these for elf? + __DYNAMIC = 0; */ +SECTIONS +{ + /* Read-only sections, merged into text segment: */ + /* Start of RAM (leaving room for Cygmon data) */ + . = 0x408000; + + .interp : { *(.interp) } + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .gnu.version : { *(.gnu.version) } + .gnu.version_d : { *(.gnu.version_d) } + .gnu.version_r : { *(.gnu.version_r) } + .rel.text : + { *(.rel.text) *(.rel.gnu.linkonce.t*) } + .rela.text : + { *(.rela.text) *(.rela.gnu.linkonce.t*) } + .rel.data : + { *(.rel.data) *(.rel.gnu.linkonce.d*) } + .rela.data : + { *(.rela.data) *(.rela.gnu.linkonce.d*) } + .rel.rodata : + { *(.rel.rodata) *(.rel.gnu.linkonce.r*) } + .rela.rodata : + { *(.rela.rodata) *(.rela.gnu.linkonce.r*) } + .rel.got : { *(.rel.got) } + .rela.got : { *(.rela.got) } + .rel.ctors : { *(.rel.ctors) } + .rela.ctors : { *(.rela.ctors) } + .rel.dtors : { *(.rel.dtors) } + .rela.dtors : { *(.rela.dtors) } + .rel.init : { *(.rel.init) } + .rela.init : { *(.rela.init) } + .rel.fini : { *(.rel.fini) } + .rela.fini : { *(.rela.fini) } + .rel.bss : { *(.rel.bss) } + .rela.bss : { *(.rela.bss) } + .rel.plt : { *(.rel.plt) } + .rela.plt : { *(.rela.plt) } + .init : { *(.init) } =0 + .plt : { *(.plt) } + .text : + { + *(.text) + *(.stub) + /* .gnu.warning sections are handled specially by elf32.em. */ + *(.gnu.warning) + *(.gnu.linkonce.t*) + } =0 + _etext = .; + PROVIDE (etext = .); + .fini : { *(.fini) } =0 + .rodata : { *(.rodata) *(.gnu.linkonce.r*) } + .rodata1 : { *(.rodata1) } + /* Adjust the address for the data segment. We want to adjust up to + the same address within the page on the next page up. */ + . = ALIGN(1) + (. & (1 - 1)); + .data : + { + *(.data) + *(.gnu.linkonce.d*) + CONSTRUCTORS + } + .data1 : { *(.data1) } + .ctors : + { + ___ctors = .; + /* gcc uses crtbegin.o to find the start of the constructors, so + we make sure it is first. Because this is a wildcard, it + doesn't matter if the user does not actually link against + crtbegin.o; the linker won't look for a file to match a + wildcard. The wildcard also means that it doesn't matter which + directory crtbegin.o is in. */ + *crtbegin.o(.ctors) + *(SORT(.ctors.*)) + *(.ctors) + ___ctors_end = .; + } + .dtors : + { + ___dtors = .; + *crtbegin.o(.dtors) + *(SORT(.dtors.*)) + *(.dtors) + ___dtors_end = .; + } + .got : { *(.got.plt) *(.got) } + .dynamic : { *(.dynamic) } + /* We want the small data sections together, so single-instruction offsets + can access them all, and initialized data all before uninitialized, so + we can shorten the on-disk segment size. */ + .sdata : { *(.sdata) } + _edata = .; + PROVIDE (edata = .); + __bss_start = .; + .sbss : { *(.sbss) *(.scommon) } + .bss : + { + *(.dynbss) + *(.bss) + *(COMMON) + } + . = ALIGN(32 / 8); + _end = . ; + PROVIDE (end = .); + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + /* 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) } + .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) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + + /* Top of RAM is 0x43ffff, but Cygmon uses the top 4K for its stack. */ + .stack 0x43f000 : { _stack = .; *(.stack) *(._stack) } + + /* These must appear regardless of . */ +} diff --git a/libgloss/mn10200/execv.c b/libgloss/mn10200/execv.c new file mode 100644 index 0000000..16f3ca5 --- /dev/null +++ b/libgloss/mn10200/execv.c @@ -0,0 +1,11 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" + + +int +execv (const char *path, char *const argv[]) +{ + return TRAP0 (SYS_execv, path, argv, 0); +} diff --git a/libgloss/mn10200/execve.c b/libgloss/mn10200/execve.c new file mode 100644 index 0000000..bd6c7a2 --- /dev/null +++ b/libgloss/mn10200/execve.c @@ -0,0 +1,11 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" + + +int +_execve (const char *path, char *const argv[], char *const envp[]) +{ + return TRAP0 (SYS_execve, path, argv, envp); +} diff --git a/libgloss/mn10200/fork.c b/libgloss/mn10200/fork.c new file mode 100644 index 0000000..53df5a9 --- /dev/null +++ b/libgloss/mn10200/fork.c @@ -0,0 +1,11 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" + + +int +_fork () +{ + return TRAP0 (SYS_fork, 0, 0, 0); +} diff --git a/libgloss/mn10200/fstat.c b/libgloss/mn10200/fstat.c new file mode 100644 index 0000000..c3b2fa0 --- /dev/null +++ b/libgloss/mn10200/fstat.c @@ -0,0 +1,14 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" + + +int +_fstat (int file, + struct stat *st) +{ + st->st_mode = S_IFCHR; + st->st_blksize = 4096; + return 0; +} diff --git a/libgloss/mn10200/getpid.c b/libgloss/mn10200/getpid.c new file mode 100644 index 0000000..20ab186 --- /dev/null +++ b/libgloss/mn10200/getpid.c @@ -0,0 +1,10 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" + + +_getpid (n) +{ + return 1; +} diff --git a/libgloss/mn10200/gettime.c b/libgloss/mn10200/gettime.c new file mode 100644 index 0000000..1a04267 --- /dev/null +++ b/libgloss/mn10200/gettime.c @@ -0,0 +1,12 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" +#include "sys/time.h" + + +int +_gettimeofday (struct timeval *tp, void *tzp) +{ + return TRAP0 (SYS_gettimeofday, tp, tzp, 0); +} diff --git a/libgloss/mn10200/isatty.c b/libgloss/mn10200/isatty.c new file mode 100644 index 0000000..0930a53 --- /dev/null +++ b/libgloss/mn10200/isatty.c @@ -0,0 +1,11 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" + + +isatty (fd) + int fd; +{ + return 1; +} diff --git a/libgloss/mn10200/kill.c b/libgloss/mn10200/kill.c new file mode 100644 index 0000000..40afa6a --- /dev/null +++ b/libgloss/mn10200/kill.c @@ -0,0 +1,11 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" + + +_kill (n, m) +{ + return TRAP0 (SYS_exit, 0xdead, 0, 0); +} + diff --git a/libgloss/mn10200/lseek.c b/libgloss/mn10200/lseek.c new file mode 100644 index 0000000..339baea --- /dev/null +++ b/libgloss/mn10200/lseek.c @@ -0,0 +1,14 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <sys/unistd.h> +#include "trap.h" + + +off_t +_lseek (int file, + off_t ptr, + int dir) +{ + return TRAP0 (SYS_lseek, file, ptr, dir); +} diff --git a/libgloss/mn10200/open.c b/libgloss/mn10200/open.c new file mode 100644 index 0000000..770defe --- /dev/null +++ b/libgloss/mn10200/open.c @@ -0,0 +1,12 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" + + +int +_open (const char *path, + int flags) +{ + return TRAP0 (SYS_open, path, flags, 0); +} diff --git a/libgloss/mn10200/pipe.c b/libgloss/mn10200/pipe.c new file mode 100644 index 0000000..dfade5c --- /dev/null +++ b/libgloss/mn10200/pipe.c @@ -0,0 +1,11 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" + + +int +pipe (int fd) +{ + return TRAP0 (SYS_pipe, fd, 0, 0); +} diff --git a/libgloss/mn10200/read.c b/libgloss/mn10200/read.c new file mode 100644 index 0000000..31d24cc --- /dev/null +++ b/libgloss/mn10200/read.c @@ -0,0 +1,12 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" + + +_read (int file, + char *ptr, + size_t len) +{ + return TRAP0 (SYS_read, file, ptr, len); +} diff --git a/libgloss/mn10200/sbrk.c b/libgloss/mn10200/sbrk.c new file mode 100644 index 0000000..376fd32 --- /dev/null +++ b/libgloss/mn10200/sbrk.c @@ -0,0 +1,31 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" + + +caddr_t +_sbrk (size_t incr) +{ + extern char end; /* Defined by the linker */ + static char *heap_end; + char *prev_heap_end; +#if 0 + char *sp = (char *)stack_ptr; +#else + char *sp = (char *)&sp; +#endif + + if (heap_end == 0) + { + heap_end = &end; + } + prev_heap_end = heap_end; + heap_end += incr; + if (heap_end > sp) + { + _write (1, "Heap and stack collision\n", 25); + abort (); + } + return (caddr_t) prev_heap_end; +} diff --git a/libgloss/mn10200/sim.ld b/libgloss/mn10200/sim.ld new file mode 100644 index 0000000..90c9e57 --- /dev/null +++ b/libgloss/mn10200/sim.ld @@ -0,0 +1,152 @@ +/* Linker script for the MN10200 simulator. */ + +OUTPUT_FORMAT("elf32-mn10200", "elf32-mn10200", + "elf32-mn10200") +OUTPUT_ARCH(mn10200) +ENTRY(_start) +GROUP(-lc -leval -lgcc) +SEARCH_DIR(.); +/* Do we need any of these for elf? + __DYNAMIC = 0; */ +SECTIONS +{ + /* Read-only sections, merged into text segment: */ + . = 0x0; + + .interp : { *(.interp) } + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .gnu.version : { *(.gnu.version) } + .gnu.version_d : { *(.gnu.version_d) } + .gnu.version_r : { *(.gnu.version_r) } + .rel.text : + { *(.rel.text) *(.rel.gnu.linkonce.t*) } + .rela.text : + { *(.rela.text) *(.rela.gnu.linkonce.t*) } + .rel.data : + { *(.rel.data) *(.rel.gnu.linkonce.d*) } + .rela.data : + { *(.rela.data) *(.rela.gnu.linkonce.d*) } + .rel.rodata : + { *(.rel.rodata) *(.rel.gnu.linkonce.r*) } + .rela.rodata : + { *(.rela.rodata) *(.rela.gnu.linkonce.r*) } + .rel.got : { *(.rel.got) } + .rela.got : { *(.rela.got) } + .rel.ctors : { *(.rel.ctors) } + .rela.ctors : { *(.rela.ctors) } + .rel.dtors : { *(.rel.dtors) } + .rela.dtors : { *(.rela.dtors) } + .rel.init : { *(.rel.init) } + .rela.init : { *(.rela.init) } + .rel.fini : { *(.rel.fini) } + .rela.fini : { *(.rela.fini) } + .rel.bss : { *(.rel.bss) } + .rela.bss : { *(.rela.bss) } + .rel.plt : { *(.rel.plt) } + .rela.plt : { *(.rela.plt) } + .init : { *(.init) } =0 + .plt : { *(.plt) } + .text : + { + *(.text) + *(.stub) + /* .gnu.warning sections are handled specially by elf32.em. */ + *(.gnu.warning) + *(.gnu.linkonce.t*) + } =0 + _etext = .; + PROVIDE (etext = .); + .fini : { *(.fini) } =0 + .rodata : { *(.rodata) *(.gnu.linkonce.r*) } + .rodata1 : { *(.rodata1) } + /* Adjust the address for the data segment. We want to adjust up to + the same address within the page on the next page up. */ + . = ALIGN(1) + (. & (1 - 1)); + .data : + { + *(.data) + *(.gnu.linkonce.d*) + CONSTRUCTORS + } + .data1 : { *(.data1) } + .ctors : + { + ___ctors = .; + /* gcc uses crtbegin.o to find the start of the constructors, so + we make sure it is first. Because this is a wildcard, it + doesn't matter if the user does not actually link against + crtbegin.o; the linker won't look for a file to match a + wildcard. The wildcard also means that it doesn't matter which + directory crtbegin.o is in. */ + *crtbegin.o(.ctors) + *(SORT(.ctors.*)) + *(.ctors) + ___ctors_end = .; + } + .dtors : + { + ___dtors = .; + *crtbegin.o(.dtors) + *(SORT(.dtors.*)) + *(.dtors) + ___dtors_end = .; + } + .got : { *(.got.plt) *(.got) } + .dynamic : { *(.dynamic) } + /* We want the small data sections together, so single-instruction offsets + can access them all, and initialized data all before uninitialized, so + we can shorten the on-disk segment size. */ + .sdata : { *(.sdata) } + _edata = .; + PROVIDE (edata = .); + __bss_start = .; + .sbss : { *(.sbss) *(.scommon) } + .bss : + { + *(.dynbss) + *(.bss) + *(COMMON) + } + . = ALIGN(32 / 8); + _end = . ; + PROVIDE (end = .); + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + /* 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) } + .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) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + + .stack 0x80000 : { _stack = .; *(.stack) *(._stack) } + + /* These must appear regardless of . */ +} diff --git a/libgloss/mn10200/stat.c b/libgloss/mn10200/stat.c new file mode 100644 index 0000000..4e1fddf --- /dev/null +++ b/libgloss/mn10200/stat.c @@ -0,0 +1,12 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" + + +int +_stat (const char *path, struct stat *st) + +{ + return TRAP0 (SYS_stat, path, st, 0); +} diff --git a/libgloss/mn10200/test.c b/libgloss/mn10200/test.c new file mode 100644 index 0000000..9928958 --- /dev/null +++ b/libgloss/mn10200/test.c @@ -0,0 +1,40 @@ +#include <stdio.h> +#include <string.h> + +static void +send_msg1 (void) +{ + static char msg[] = "Hello World\r\n"; + write(1, msg, strlen (msg)); +} + +static void +send_msg2 (void) +{ + static char msg[] = "Goodnight Irene\r\n"; + write(1, msg, strlen (msg)); +} + +static void +delay (void) +{ + int i; + + for (i = 0; i < 32000; i++) + ; +} + +int +main(int argc, char *argv[]) +{ + int i, j; + for (i = 0; i < 10; i++) + { + send_msg1 (); + delay (); + send_msg2 (); + } + return 0; +} + + diff --git a/libgloss/mn10200/time.c b/libgloss/mn10200/time.c new file mode 100644 index 0000000..2df8d48 --- /dev/null +++ b/libgloss/mn10200/time.c @@ -0,0 +1,11 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" + + +time_t +time (time_t *tloc) +{ + return TRAP0 (SYS_time, tloc, 0, 0); +} diff --git a/libgloss/mn10200/times.c b/libgloss/mn10200/times.c new file mode 100644 index 0000000..b804be4 --- /dev/null +++ b/libgloss/mn10200/times.c @@ -0,0 +1,12 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" +#include "sys/times.h" + + +clock_t +times (struct tms *buffer) +{ + return TRAP0 (SYS_times, buffer, 0, 0); +} diff --git a/libgloss/mn10200/trap.S b/libgloss/mn10200/trap.S new file mode 100644 index 0000000..cda7a20 --- /dev/null +++ b/libgloss/mn10200/trap.S @@ -0,0 +1,9 @@ + .text + .global ___trap0 +___trap0: + syscall + cmp 0,d0 + beq noerr + mov d0,(_errno) +noerr: + rts diff --git a/libgloss/mn10200/trap.h b/libgloss/mn10200/trap.h new file mode 100644 index 0000000..27636c0 --- /dev/null +++ b/libgloss/mn10200/trap.h @@ -0,0 +1,5 @@ +#include "syscall.h" + +int __trap0 (); + +#define TRAP0(f, p1, p2, p3) __trap0(f, (p1), (p2), (p3)) diff --git a/libgloss/mn10200/unlink.c b/libgloss/mn10200/unlink.c new file mode 100644 index 0000000..84fb711 --- /dev/null +++ b/libgloss/mn10200/unlink.c @@ -0,0 +1,11 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" + + +int +_unlink () +{ + return -1; +} diff --git a/libgloss/mn10200/utime.c b/libgloss/mn10200/utime.c new file mode 100644 index 0000000..3fce7e3 --- /dev/null +++ b/libgloss/mn10200/utime.c @@ -0,0 +1,13 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" + + +int +utime (path, times) + const char *path; + char *times; +{ + return TRAP0 (SYS_utime, path, times, 0); +} diff --git a/libgloss/mn10200/wait.c b/libgloss/mn10200/wait.c new file mode 100644 index 0000000..c8d8b4c --- /dev/null +++ b/libgloss/mn10200/wait.c @@ -0,0 +1,12 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" + + +int +_wait (statusp) + int *statusp; +{ + return TRAP0 (SYS_wait, 0, 0, 0); +} diff --git a/libgloss/mn10200/write.c b/libgloss/mn10200/write.c new file mode 100644 index 0000000..3ecf4a8 --- /dev/null +++ b/libgloss/mn10200/write.c @@ -0,0 +1,13 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" + + +int +_write ( int file, + char *ptr, + size_t len) +{ + return TRAP0 (SYS_write, file, ptr, len); +} diff --git a/libgloss/mn10300/Makefile.in b/libgloss/mn10300/Makefile.in new file mode 100644 index 0000000..9ed0055 --- /dev/null +++ b/libgloss/mn10300/Makefile.in @@ -0,0 +1,148 @@ +# Copyright (c) 1998 Cygnus Support +# +# The authors hereby grant permission to use, copy, modify, distribute, +# and license this software and its documentation for any purpose, provided +# that existing copyright notices are retained in all copies and that this +# notice is included verbatim in any distributions. No written agreement, +# license, or royalty fee is required for any of the authorized uses. +# Modifications to this software may be copyrighted by their authors +# and need not follow the licensing terms described here, provided that +# the new terms are clearly indicated on the first page of each file where +# they apply. + +VPATH = @srcdir@ +srcdir = @srcdir@ +objdir = . +srcroot = $(srcdir)/../.. +objroot = $(objdir)/../.. + +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +host_alias = @host_alias@ +target_alias = @target_alias@ +program_transform_name = @program_transform_name@ + +bindir = @bindir@ +libdir = @libdir@ +tooldir = $(exec_prefix)/$(target_alias) + +# Multilib support variables. +# TOP is used instead of MULTI{BUILD,SRC}TOP. +MULTIDIRS = +MULTISUBDIR = +MULTIDO = true +MULTICLEAN = true + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ + +SHELL = /bin/sh + +CC = @CC@ + +#AS = @AS@ +AS = `if [ -f ${objroot}/../gas/as.new ] ; \ + then echo ${objroot}/../gas/as.new ; \ + else echo as ; fi` + +AR = @AR@ + +#LD = @LD@ +LD = `if [ -f ${objroot}/../ld/ld.new ] ; \ + then echo ${objroot}/../ld/ld.new ; \ + else echo ld ; fi` + +RANLIB = @RANLIB@ + +OBJDUMP = `if [ -f ${objroot}/../binutils/objdump ] ; \ + then echo ${objroot}/../binutils/objdump ; \ + else t='$(program_transform_name)'; echo objdump | sed -e $$t ; fi` +OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \ + then echo ${objroot}/../binutils/objcopy ; \ + else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi` + +CRT0 = crt0.o + +# Generic object files common to all targets. +GENOBJS = _exit.o access.o chmod.o close.o crt1.o \ + fstat.o getpid.o isatty.o \ + kill.o lseek.o open.o read.o \ + sbrk.o stat.o time.o trap.o unlink.o utime.o write.o + +# Object files specific to particular targets. +EVALOBJS = ${GENOBJS} + +CFLAGS = -g + +GCC_LDFLAGS = `if [ -d ${objroot}/../gcc ] ; \ + then echo -L${objroot}/../gcc ; fi` + +SCRIPTS = eval sim +BSP = libeval.a + +# Host specific makefile fragment comes in here. +@host_makefile_frag@ + +# +# 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. +# + +all: ${CRT0} test.o ${BSP} + +# +# here's where we build the board support packages for each target +# + +libeval.a: $(EVALOBJS) + ${AR} ${ARFLAGS} $@ $(EVALOBJS) + ${RANLIB} $@ + + +# compile a fully linked binary. The -Wl,-T*.ld is for the linker +# script. By using -Wl, the linker script is put on the proper place +# in the comand line for ld, and all the symbols will get fully +# resolved. + +test: $(CRT0) test.o + ${CC} $(CFLAGS_FOR_TARGET) -L${srcdir} -L${objdir} \ + test.o -o $@ $(NEWLIB_LDFLAGS) -Wl,-Teval.ld + @echo Done... + +doc: + +clean mostlyclean: + rm -f a.out core *.i *~ *.o *-test *.srec *.dis *.map *.x + +distclean maintainer-clean realclean: clean + rm -f Makefile config.status a.out + +.PHONY: install info install-info clean-info +install: + $(INSTALL_PROGRAM) $(CRT0) $(tooldir)/lib${MULTISUBDIR}/$(CRT0) + @for bsp in ${BSP}; do\ + $(INSTALL_PROGRAM) $${bsp} $(tooldir)/lib${MULTISUBDIR}; \ + done + @for script in ${SCRIPTS}; do\ + $(INSTALL_DATA) ${srcdir}/$${script}.ld $(tooldir)/lib${MULTISUBDIR}/$${script}.ld; \ + done + +info: +install-info: +clean-info: + +test.o: ${srcdir}/test.c + +# these are for the BSPs +${CRT0}: ${srcdir}/crt0.S + +# target specific makefile fragment comes in here. +@target_makefile_frag@ + +Makefile: Makefile.in config.status @host_makefile_frag_path@ @target_makefile_frag_path@ + $(SHELL) config.status + +config.status: configure + $(SHELL) config.status --recheck diff --git a/libgloss/mn10300/_exit.c b/libgloss/mn10300/_exit.c new file mode 100644 index 0000000..ec51d40 --- /dev/null +++ b/libgloss/mn10300/_exit.c @@ -0,0 +1,29 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" + + +static void _do_dtors() +{ + /* The loop variable is static so that if a destructor calls exit, + and we return here, we simply continue with the next destructor. */ + typedef void (*pfunc) (); + extern pfunc __dtors[]; + extern pfunc __dtors_end[]; + static pfunc *p = __dtors; + + while (p < __dtors_end) + (*p++) (); +} + + +void _exit (n) +{ + /* Destructors should be done earlier because they need to be done before the + files are closed, but here is better than nowhere (and this balances the + constructors done in crt1.c. */ + _do_dtors(); + + TRAP0 (SYS_exit, n, 0, 0); +} diff --git a/libgloss/mn10300/access.c b/libgloss/mn10300/access.c new file mode 100644 index 0000000..ad368ca --- /dev/null +++ b/libgloss/mn10300/access.c @@ -0,0 +1,34 @@ +/* This is file ACCESS.C */ +/* +** Copyright (C) 1993 DJ Delorie, 24 Kirsten Ave, Rochester NH 03867-2954 +** +** This file is distributed under the terms listed in the document +** "copying.dj", available from DJ Delorie at the address above. +** A copy of "copying.dj" should accompany this file; if not, a copy +** should be available from where this file was obtained. This file +** may not be distributed without a verbatim copy of "copying.dj". +** +** This file is distributed WITHOUT ANY WARRANTY; without even the implied +** warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +*/ + +#include <fcntl.h> +#include <sys/stat.h> +#include <unistd.h> + +int access(const char *fn, int flags) +{ + struct stat s; + if (stat(fn, &s)) + return -1; + if (s.st_mode & S_IFDIR) + return 0; + if (flags & W_OK) + { + if (s.st_mode & S_IWRITE) + return 0; + return -1; + } + return 0; +} + diff --git a/libgloss/mn10300/chmod.c b/libgloss/mn10300/chmod.c new file mode 100644 index 0000000..8200506 --- /dev/null +++ b/libgloss/mn10300/chmod.c @@ -0,0 +1,11 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" + + +int +chmod (const char *path, mode_t mode) +{ + return TRAP0 (SYS_chmod, path, mode, 0); +} diff --git a/libgloss/mn10300/chown.c b/libgloss/mn10300/chown.c new file mode 100644 index 0000000..6630d3b --- /dev/null +++ b/libgloss/mn10300/chown.c @@ -0,0 +1,12 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" + + + +int +chown (const char *path, short owner, short group) +{ + return TRAP0 (SYS_chown, path, owner, group); +} diff --git a/libgloss/mn10300/close.c b/libgloss/mn10300/close.c new file mode 100644 index 0000000..8474b38 --- /dev/null +++ b/libgloss/mn10300/close.c @@ -0,0 +1,11 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" + + +int +_close (int file) +{ + return TRAP0 (SYS_close, file, 0, 0); +} diff --git a/libgloss/mn10300/configure b/libgloss/mn10300/configure new file mode 100755 index 0000000..95680d2 --- /dev/null +++ b/libgloss/mn10300/configure @@ -0,0 +1,1209 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.12.1 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.12.1" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=crt0.S + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + +if test "${enable_shared}" = "yes" ; then + echo "Shared libraries not supported for cross compiling, ignored" +fi + +if test "$srcdir" = "." ; then + if test "${with_target_subdir}" != "." ; then + libgloss_topdir="${srcdir}/${with_multisrctop}../../.." + else + libgloss_topdir="${srcdir}/${with_multisrctop}../.." + fi +else + libgloss_topdir="${srcdir}/../.." +fi +ac_aux_dir= +for ac_dir in $libgloss_topdir $srcdir/$libgloss_topdir; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $libgloss_topdir $srcdir/$libgloss_topdir" 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + + + +# Do some error checking and defaulting for the host and target type. +# The inputs are: +# configure --host=HOST --target=TARGET --build=BUILD NONOPT +# +# The rules are: +# 1. You are not allowed to specify --host, --target, and nonopt at the +# same time. +# 2. Host defaults to nonopt. +# 3. If nonopt is not specified, then host defaults to the current host, +# as determined by config.guess. +# 4. Target and build default to nonopt. +# 5. If nonopt is not specified, then target and build default to host. + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +case $host---$target---$nonopt in +NONE---*---* | *---NONE---* | *---*---NONE) ;; +*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;; +esac + + +# Make sure we can run config.sub. +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi + +echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:585: checking host system type" >&5 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + +echo $ac_n "checking target system type""... $ac_c" 1>&6 +echo "configure:606: checking target system type" >&5 + +target_alias=$target +case "$target_alias" in +NONE) + case $nonopt in + NONE) target_alias=$host_alias ;; + *) target_alias=$nonopt ;; + esac ;; +esac + +target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias` +target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$target" 1>&6 + +echo $ac_n "checking build system type""... $ac_c" 1>&6 +echo "configure:624: checking build system type" >&5 + +build_alias=$build +case "$build_alias" in +NONE) + case $nonopt in + NONE) build_alias=$host_alias ;; + *) build_alias=$nonopt ;; + esac ;; +esac + +build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` +build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$build" 1>&6 + +test "$host_alias" != "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + +if test "$program_transform_name" = s,x,x,; then + program_transform_name= +else + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed +s,\\,\\\\,g; s,\$,$$,g +EOF_SED + program_transform_name="`echo $program_transform_name|sed -f conftestsed`" + rm -f conftestsed +fi +test "$program_prefix" != NONE && + program_transform_name="s,^,${program_prefix},; $program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" + +# sed with no file args requires a program. +test "$program_transform_name" = "" && program_transform_name="s,x,x," + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:677: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + for ac_prog in ginstall installbsd scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + # OSF/1 installbsd also uses dspmsg, but is usable. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +# FIXME: We temporarily define our own version of AC_PROG_CC. This is +# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We +# are building a library that must be included in all links, so we +# can't link an executable until this lib is built. +# autoconf should provide a way to do this. + + + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:738: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:767: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + ac_prog_rejected=no + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +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 $# -gt 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 + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:815: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <<EOF +#ifdef __GNUC__ + yes; +#endif +EOF +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:824: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:839: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi + +AS=${AS-as} + +AR=${AR-ar} + +LD=${LD-ld} + +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:875: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +case "${target}" in + *) + part_specific_obj=vr4300.o + ;; +esac + +host_makefile_frag=${srcdir}/../config/default.mh +target_makefile_frag=${srcdir}/../config/mn10300.mt + +host_makefile_frag_path=$host_makefile_frag + + +target_makefile_frag_path=$target_makefile_frag + + + + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set) 2>&1 | grep ac_space` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs + + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS <<EOF +#! /bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.12.1" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS <<EOF + +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; + s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@host@%$host%g +s%@host_alias@%$host_alias%g +s%@host_cpu@%$host_cpu%g +s%@host_vendor@%$host_vendor%g +s%@host_os@%$host_os%g +s%@target@%$target%g +s%@target_alias@%$target_alias%g +s%@target_cpu@%$target_cpu%g +s%@target_vendor@%$target_vendor%g +s%@target_os@%$target_os%g +s%@build@%$build%g +s%@build_alias@%$build_alias%g +s%@build_cpu@%$build_cpu%g +s%@build_vendor@%$build_vendor%g +s%@build_os@%$build_os%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@CC@%$CC%g +s%@AS@%$AS%g +s%@AR@%$AR%g +s%@LD@%$LD%g +s%@RANLIB@%$RANLIB%g +s%@host_makefile_frag_path@%$host_makefile_frag_path%g +/@host_makefile_frag@/r $host_makefile_frag +s%@host_makefile_frag@%%g +s%@target_makefile_frag_path@%$target_makefile_frag_path%g +/@target_makefile_frag@/r $target_makefile_frag +s%@target_makefile_frag@%%g +s%@part_specific_obj@%$part_specific_obj%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <<EOF + +CONFIG_FILES=\${CONFIG_FILES-"Makefile"} +EOF +cat >> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +EOF +cat >> $CONFIG_STATUS <<EOF +srcdir=${srcdir} +target=${target} +ac_configure_args="${ac_configure_args} --enable-multilib" +CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} +libgloss_topdir=${libgloss_topdir} + +EOF +cat >> $CONFIG_STATUS <<\EOF +. ${libgloss_topdir}/config-ml.in +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + + + diff --git a/libgloss/mn10300/configure.in b/libgloss/mn10300/configure.in new file mode 100644 index 0000000..2c7814b --- /dev/null +++ b/libgloss/mn10300/configure.in @@ -0,0 +1,115 @@ +# Copyright (c) 1995, 1996 Cygnus Support +# +# The authors hereby grant permission to use, copy, modify, distribute, +# and license this software and its documentation for any purpose, provided +# that existing copyright notices are retained in all copies and that this +# notice is included verbatim in any distributions. No written agreement, +# license, or royalty fee is required for any of the authorized uses. +# Modifications to this software may be copyrighted by their authors +# and need not follow the licensing terms described here, provided that +# the new terms are clearly indicated on the first page of each file where +# they apply. +# +# Process this file with autoconf to produce a configure script. +# +AC_PREREQ(2.5)dnl +AC_INIT(crt0.S) + +if test "${enable_shared}" = "yes" ; then + echo "Shared libraries not supported for cross compiling, ignored" +fi + +if test "$srcdir" = "." ; then + if test "${with_target_subdir}" != "." ; then + libgloss_topdir="${srcdir}/${with_multisrctop}../../.." + else + libgloss_topdir="${srcdir}/${with_multisrctop}../.." + fi +else + libgloss_topdir="${srcdir}/../.." +fi +AC_CONFIG_AUX_DIR($libgloss_topdir) + +AC_CANONICAL_SYSTEM +AC_ARG_PROGRAM + +AC_PROG_INSTALL + +# FIXME: We temporarily define our own version of AC_PROG_CC. This is +# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We +# are building a library that must be included in all links, so we +# can't link an executable until this lib is built. +# autoconf should provide a way to do this. + +AC_DEFUN(LIB_AC_PROG_CC, +[AC_BEFORE([$0], [AC_PROG_CPP])dnl +AC_CHECK_PROG(CC, gcc, gcc) +if test -z "$CC"; then + AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) + test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) +fi + +AC_PROG_CC_GNU + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +dnl Check whether -g works, even if CFLAGS is set, in case the package +dnl plays around with CFLAGS (such as to build both debugging and +dnl normal versions of a library), tasteless as that idea is. + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + AC_PROG_CC_G + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi +]) + +LIB_AC_PROG_CC +AS=${AS-as} +AC_SUBST(AS) +AR=${AR-ar} +AC_SUBST(AR) +LD=${LD-ld} +AC_SUBST(LD) +AC_PROG_RANLIB + +case "${target}" in + *) + part_specific_obj=vr4300.o + ;; +esac + +host_makefile_frag=${srcdir}/../config/default.mh +target_makefile_frag=${srcdir}/../config/mn10300.mt + +dnl We have to assign the same value to other variables because autoconf +dnl doesn't provide a mechanism to substitute a replacement keyword with +dnl arbitrary data or pathnames. +dnl +host_makefile_frag_path=$host_makefile_frag +AC_SUBST(host_makefile_frag_path) +AC_SUBST_FILE(host_makefile_frag) +target_makefile_frag_path=$target_makefile_frag +AC_SUBST(target_makefile_frag_path) +AC_SUBST_FILE(target_makefile_frag) +AC_SUBST(part_specific_obj) + +AC_OUTPUT(Makefile, +. ${libgloss_topdir}/config-ml.in, +srcdir=${srcdir} +target=${target} +ac_configure_args="${ac_configure_args} --enable-multilib" +CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} +libgloss_topdir=${libgloss_topdir} +) + + diff --git a/libgloss/mn10300/creat.c b/libgloss/mn10300/creat.c new file mode 100644 index 0000000..1003a2a --- /dev/null +++ b/libgloss/mn10300/creat.c @@ -0,0 +1,12 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" + + +int +creat (const char *path, + int mode) +{ + return TRAP0 (SYS_creat, path, mode, 0); +} diff --git a/libgloss/mn10300/crt0-eval.S b/libgloss/mn10300/crt0-eval.S new file mode 100644 index 0000000..78a5263 --- /dev/null +++ b/libgloss/mn10300/crt0-eval.S @@ -0,0 +1,82 @@ +##============================================================================== +## +## crt0-eval.S +## +## MN10300 Series Evaluation Board C startup code +## +##============================================================================== +######COPYRIGHTBEGIN#### +## +## Copyright (c) 1995, 1996, 1997, 1998 Cygnus Solutions +## +## 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. +## +######COPYRIGHTEND#### + +##------------------------------------------------------------------------------ + + .file "crt0-eval.S" + +##------------------------------------------------------------------------------ +## Startup code + + .equ DRAM_TOP,0x48100000 + + .text + + .globl __start +__start: + # Set up stack. Leave 4K at top for use by Cygmon. + + mov DRAM_TOP - 0x1000,a0 + sub 8,a0 + mov a0,sp + + # Clear BSS + + mov __bss_start,a0 + mov _end,a1 + + cmp a0,a1 + beq 8f + clr d0 +1: + movbu d0,(a0) + inc a0 + cmp a0,a1 + bne 1b +8: + # Call constructors + + .extern ___main + call ___main,[],0 + + # Call main + clr d0 + clr d1 + mov d0,(4,sp) + +9: + or 0x0800,psw # Enable interrupts + + .extern _main + call _main,[],0 + + .extern __exit + call __exit,[],0 + +# bra 9b # Loop if we return + + + +##------------------------------------------------------------------------------ +## end of crt0-eval.S + diff --git a/libgloss/mn10300/crt0.S b/libgloss/mn10300/crt0.S new file mode 100644 index 0000000..f50e425 --- /dev/null +++ b/libgloss/mn10300/crt0.S @@ -0,0 +1,58 @@ +##============================================================================== +## +## crt0.S +## +## MN10300 startup code +## +##============================================================================== +## +## Copyright (c) 1995, 1996, 1997, 1998 Cygnus Solutions +## +## 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. +## + +##------------------------------------------------------------------------------ + + .file "crt0.S" + +##------------------------------------------------------------------------------ +## Startup code + .section .text + .global _start +_start: + mov _stack-8,a0 # Load up the stack pointer + mov a0,sp + + mov _edata,a0 # Get the start/end of bss + mov _end,a1 + + cmp a0,a1 # If no bss, then do nothing + beq .L0 + + clr d0 # clear d0 + +.L1: + movbu d0,(a0) # Clear a byte and bump pointer + inc a0 + cmp a0,a1 + bne .L1 + +.L0: + call ___main,[],0 # Call __main to run ctors/dtors + clr d0 + clr d1 + mov d0,(4,sp) + call _main,[],0 # Call main program + call _exit,[],0 # All done, no need to return or + # deallocate our stack. + + .section .stack +_stack: .long 1 diff --git a/libgloss/mn10300/crt1.c b/libgloss/mn10300/crt1.c new file mode 100644 index 0000000..dd0be31 --- /dev/null +++ b/libgloss/mn10300/crt1.c @@ -0,0 +1,16 @@ +void __main () +{ + static int initialized; + if (! initialized) + { + typedef void (*pfunc) (); + extern pfunc __ctors[]; + extern pfunc __ctors_end[]; + pfunc *p; + + initialized = 1; + for (p = __ctors_end; p > __ctors; ) + (*--p) (); + + } +} diff --git a/libgloss/mn10300/eval.ld b/libgloss/mn10300/eval.ld new file mode 100644 index 0000000..ca54949 --- /dev/null +++ b/libgloss/mn10300/eval.ld @@ -0,0 +1,150 @@ +/* Linker script for the MN10300 Series Evaluation Board. + It differs from the default linker script only in the + addresses assigned to text and stack sections. +*/ + +OUTPUT_FORMAT("elf32-mn10300", "elf32-mn10300", + "elf32-mn10300") +OUTPUT_ARCH(mn10300) +ENTRY(_start) +GROUP(-lc -leval -lgcc) + SEARCH_DIR(.); +/* Do we need any of these for elf? + __DYNAMIC = 0; */ +SECTIONS +{ + /* Read-only sections, merged into text segment: */ + /* Start of RAM (leaving room for Cygmon data) */ + . = 0x48008000; + + .interp : { *(.interp) } + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .gnu.version : { *(.gnu.version) } + .gnu.version_d : { *(.gnu.version_d) } + .gnu.version_r : { *(.gnu.version_r) } + .rel.text : + { *(.rel.text) *(.rel.gnu.linkonce.t*) } + .rela.text : + { *(.rela.text) *(.rela.gnu.linkonce.t*) } + .rel.data : + { *(.rel.data) *(.rel.gnu.linkonce.d*) } + .rela.data : + { *(.rela.data) *(.rela.gnu.linkonce.d*) } + .rel.rodata : + { *(.rel.rodata) *(.rel.gnu.linkonce.r*) } + .rela.rodata : + { *(.rela.rodata) *(.rela.gnu.linkonce.r*) } + .rel.got : { *(.rel.got) } + .rela.got : { *(.rela.got) } + .rel.ctors : { *(.rel.ctors) } + .rela.ctors : { *(.rela.ctors) } + .rel.dtors : { *(.rel.dtors) } + .rela.dtors : { *(.rela.dtors) } + .rel.init : { *(.rel.init) } + .rela.init : { *(.rela.init) } + .rel.fini : { *(.rel.fini) } + .rela.fini : { *(.rela.fini) } + .rel.bss : { *(.rel.bss) } + .rela.bss : { *(.rela.bss) } + .rel.plt : { *(.rel.plt) } + .rela.plt : { *(.rela.plt) } + .init : { *(.init) } =0 + .plt : { *(.plt) } + .text : + { + *(.text) + /* .gnu.warning sections are handled specially by elf32.em. */ + *(.gnu.warning) + *(.gnu.linkonce.t*) + *(.gcc_except_table) + } =0 + _etext = .; + PROVIDE (etext = .); + .fini : { *(.fini) } =0 + .rodata : { *(.rodata) *(.gnu.linkonce.r*) } + .rodata1 : { *(.rodata1) } + /* Adjust the address for the data segment. We want to adjust up to + the same address within the page on the next page up. */ + . = ALIGN(1) + (. & (1 - 1)); + .data : + { + *(.data) + *(.gnu.linkonce.d*) + CONSTRUCTORS + } + .data1 : { *(.data1) } + .ctors : + { + ___ctors = .; + KEEP(*crtbegin.o(.ctors)) + KEEP(*(SORT(.ctors.*))) + KEEP(*(.ctors)) + ___ctors_end = .; + } + .dtors : + { + ___dtors = .; + KEEP(*crtbegin.o(.dtors)) + KEEP(*(SORT(.dtors.*))) + KEEP(*(.dtors)) + ___dtors_end = .; + } + .got : { *(.got.plt) *(.got) } + .dynamic : { *(.dynamic) } + /* We want the small data sections together, so single-instruction offsets + can access them all, and initialized data all before uninitialized, so + we can shorten the on-disk segment size. */ + .sdata : { *(.sdata) } + _edata = .; + PROVIDE (edata = .); + __bss_start = .; + .sbss : { *(.sbss) *(.scommon) } + .bss : + { + *(.dynbss) + *(.bss) + *(COMMON) + } + _end = . ; + PROVIDE (end = .); + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + /* 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) } + .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) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + + /* Top of RAM is 0x48100000, but Cygmon uses the top 4K for its stack. */ + .stack 0x480ff000 : { _stack = .; *(.stack) *(._stack) } + + /* These must appear regardless of . */ +} diff --git a/libgloss/mn10300/execv.c b/libgloss/mn10300/execv.c new file mode 100644 index 0000000..16f3ca5 --- /dev/null +++ b/libgloss/mn10300/execv.c @@ -0,0 +1,11 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" + + +int +execv (const char *path, char *const argv[]) +{ + return TRAP0 (SYS_execv, path, argv, 0); +} diff --git a/libgloss/mn10300/execve.c b/libgloss/mn10300/execve.c new file mode 100644 index 0000000..bd6c7a2 --- /dev/null +++ b/libgloss/mn10300/execve.c @@ -0,0 +1,11 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" + + +int +_execve (const char *path, char *const argv[], char *const envp[]) +{ + return TRAP0 (SYS_execve, path, argv, envp); +} diff --git a/libgloss/mn10300/fork.c b/libgloss/mn10300/fork.c new file mode 100644 index 0000000..53df5a9 --- /dev/null +++ b/libgloss/mn10300/fork.c @@ -0,0 +1,11 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" + + +int +_fork () +{ + return TRAP0 (SYS_fork, 0, 0, 0); +} diff --git a/libgloss/mn10300/fstat.c b/libgloss/mn10300/fstat.c new file mode 100644 index 0000000..c3b2fa0 --- /dev/null +++ b/libgloss/mn10300/fstat.c @@ -0,0 +1,14 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" + + +int +_fstat (int file, + struct stat *st) +{ + st->st_mode = S_IFCHR; + st->st_blksize = 4096; + return 0; +} diff --git a/libgloss/mn10300/getpid.c b/libgloss/mn10300/getpid.c new file mode 100644 index 0000000..20ab186 --- /dev/null +++ b/libgloss/mn10300/getpid.c @@ -0,0 +1,10 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" + + +_getpid (n) +{ + return 1; +} diff --git a/libgloss/mn10300/gettime.c b/libgloss/mn10300/gettime.c new file mode 100644 index 0000000..1a04267 --- /dev/null +++ b/libgloss/mn10300/gettime.c @@ -0,0 +1,12 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" +#include "sys/time.h" + + +int +_gettimeofday (struct timeval *tp, void *tzp) +{ + return TRAP0 (SYS_gettimeofday, tp, tzp, 0); +} diff --git a/libgloss/mn10300/isatty.c b/libgloss/mn10300/isatty.c new file mode 100644 index 0000000..0930a53 --- /dev/null +++ b/libgloss/mn10300/isatty.c @@ -0,0 +1,11 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" + + +isatty (fd) + int fd; +{ + return 1; +} diff --git a/libgloss/mn10300/kill.c b/libgloss/mn10300/kill.c new file mode 100644 index 0000000..40afa6a --- /dev/null +++ b/libgloss/mn10300/kill.c @@ -0,0 +1,11 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" + + +_kill (n, m) +{ + return TRAP0 (SYS_exit, 0xdead, 0, 0); +} + diff --git a/libgloss/mn10300/lseek.c b/libgloss/mn10300/lseek.c new file mode 100644 index 0000000..339baea --- /dev/null +++ b/libgloss/mn10300/lseek.c @@ -0,0 +1,14 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <sys/unistd.h> +#include "trap.h" + + +off_t +_lseek (int file, + off_t ptr, + int dir) +{ + return TRAP0 (SYS_lseek, file, ptr, dir); +} diff --git a/libgloss/mn10300/open.c b/libgloss/mn10300/open.c new file mode 100644 index 0000000..770defe --- /dev/null +++ b/libgloss/mn10300/open.c @@ -0,0 +1,12 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" + + +int +_open (const char *path, + int flags) +{ + return TRAP0 (SYS_open, path, flags, 0); +} diff --git a/libgloss/mn10300/pipe.c b/libgloss/mn10300/pipe.c new file mode 100644 index 0000000..dfade5c --- /dev/null +++ b/libgloss/mn10300/pipe.c @@ -0,0 +1,11 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" + + +int +pipe (int fd) +{ + return TRAP0 (SYS_pipe, fd, 0, 0); +} diff --git a/libgloss/mn10300/read.c b/libgloss/mn10300/read.c new file mode 100644 index 0000000..31d24cc --- /dev/null +++ b/libgloss/mn10300/read.c @@ -0,0 +1,12 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" + + +_read (int file, + char *ptr, + size_t len) +{ + return TRAP0 (SYS_read, file, ptr, len); +} diff --git a/libgloss/mn10300/sbrk.c b/libgloss/mn10300/sbrk.c new file mode 100644 index 0000000..376fd32 --- /dev/null +++ b/libgloss/mn10300/sbrk.c @@ -0,0 +1,31 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" + + +caddr_t +_sbrk (size_t incr) +{ + extern char end; /* Defined by the linker */ + static char *heap_end; + char *prev_heap_end; +#if 0 + char *sp = (char *)stack_ptr; +#else + char *sp = (char *)&sp; +#endif + + if (heap_end == 0) + { + heap_end = &end; + } + prev_heap_end = heap_end; + heap_end += incr; + if (heap_end > sp) + { + _write (1, "Heap and stack collision\n", 25); + abort (); + } + return (caddr_t) prev_heap_end; +} diff --git a/libgloss/mn10300/sim.ld b/libgloss/mn10300/sim.ld new file mode 100644 index 0000000..6824cdd --- /dev/null +++ b/libgloss/mn10300/sim.ld @@ -0,0 +1,147 @@ +/* Linker script for the MN10300 simulator. +*/ + +OUTPUT_FORMAT("elf32-mn10300", "elf32-mn10300", + "elf32-mn10300") +OUTPUT_ARCH(mn10300) +ENTRY(_start) +GROUP(-lc -leval -lgcc) + SEARCH_DIR(.); +/* Do we need any of these for elf? + __DYNAMIC = 0; */ +SECTIONS +{ + /* Read-only sections, merged into text segment: */ + /* Start of RAM (leaving room for Cygmon data) */ + . = 0; + + .interp : { *(.interp) } + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .gnu.version : { *(.gnu.version) } + .gnu.version_d : { *(.gnu.version_d) } + .gnu.version_r : { *(.gnu.version_r) } + .rel.text : + { *(.rel.text) *(.rel.gnu.linkonce.t*) } + .rela.text : + { *(.rela.text) *(.rela.gnu.linkonce.t*) } + .rel.data : + { *(.rel.data) *(.rel.gnu.linkonce.d*) } + .rela.data : + { *(.rela.data) *(.rela.gnu.linkonce.d*) } + .rel.rodata : + { *(.rel.rodata) *(.rel.gnu.linkonce.r*) } + .rela.rodata : + { *(.rela.rodata) *(.rela.gnu.linkonce.r*) } + .rel.got : { *(.rel.got) } + .rela.got : { *(.rela.got) } + .rel.ctors : { *(.rel.ctors) } + .rela.ctors : { *(.rela.ctors) } + .rel.dtors : { *(.rel.dtors) } + .rela.dtors : { *(.rela.dtors) } + .rel.init : { *(.rel.init) } + .rela.init : { *(.rela.init) } + .rel.fini : { *(.rel.fini) } + .rela.fini : { *(.rela.fini) } + .rel.bss : { *(.rel.bss) } + .rela.bss : { *(.rela.bss) } + .rel.plt : { *(.rel.plt) } + .rela.plt : { *(.rela.plt) } + .init : { *(.init) } =0 + .plt : { *(.plt) } + .text : + { + *(.text) + /* .gnu.warning sections are handled specially by elf32.em. */ + *(.gnu.warning) + *(.gnu.linkonce.t*) + *(.gcc_except_table) + } =0 + _etext = .; + PROVIDE (etext = .); + .fini : { *(.fini) } =0 + .rodata : { *(.rodata) *(.gnu.linkonce.r*) } + .rodata1 : { *(.rodata1) } + /* Adjust the address for the data segment. We want to adjust up to + the same address within the page on the next page up. */ + . = ALIGN(1) + (. & (1 - 1)); + .data : + { + *(.data) + *(.gnu.linkonce.d*) + CONSTRUCTORS + } + .data1 : { *(.data1) } + .ctors : + { + ___ctors = .; + KEEP(*crtbegin.o(.ctors)) + KEEP(*(SORT(.ctors.*))) + KEEP(*(.ctors)) + ___ctors_end = .; + } + .dtors : + { + ___dtors = .; + KEEP(*crtbegin.o(.dtors)) + KEEP(*(SORT(.dtors.*))) + KEEP(*(.dtors)) + ___dtors_end = .; + } + .got : { *(.got.plt) *(.got) } + .dynamic : { *(.dynamic) } + /* We want the small data sections together, so single-instruction offsets + can access them all, and initialized data all before uninitialized, so + we can shorten the on-disk segment size. */ + .sdata : { *(.sdata) } + _edata = .; + PROVIDE (edata = .); + __bss_start = .; + .sbss : { *(.sbss) *(.scommon) } + .bss : + { + *(.dynbss) + *(.bss) + *(COMMON) + } + _end = . ; + PROVIDE (end = .); + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + /* 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) } + .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) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + + .stack 0x80000 : { _stack = .; *(.stack) *(._stack) } + + /* These must appear regardless of . */ +} diff --git a/libgloss/mn10300/stat.c b/libgloss/mn10300/stat.c new file mode 100644 index 0000000..4e1fddf --- /dev/null +++ b/libgloss/mn10300/stat.c @@ -0,0 +1,12 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" + + +int +_stat (const char *path, struct stat *st) + +{ + return TRAP0 (SYS_stat, path, st, 0); +} diff --git a/libgloss/mn10300/test.c b/libgloss/mn10300/test.c new file mode 100644 index 0000000..9ea873a --- /dev/null +++ b/libgloss/mn10300/test.c @@ -0,0 +1,39 @@ +#include <stdio.h> + +static void +send_msg1 (void) +{ + static char msg[] = "Hello World\r\n"; + write(1, msg, strlen (msg)); +} + +static void +send_msg2 (void) +{ + static char msg[] = "Goodnight Irene\r\n"; + write(1, msg, strlen (msg)); +} + +static void +delay (void) +{ + int i; + + for (i = 0; i < 1000000; i++) + ; +} + +int +main(int argc, char *argv[]) +{ + int i, j; + for (i = 0; i < 10; i++) + { + send_msg1 (); + delay (); + send_msg2 (); + } + return 0; +} + + diff --git a/libgloss/mn10300/time.c b/libgloss/mn10300/time.c new file mode 100644 index 0000000..2df8d48 --- /dev/null +++ b/libgloss/mn10300/time.c @@ -0,0 +1,11 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" + + +time_t +time (time_t *tloc) +{ + return TRAP0 (SYS_time, tloc, 0, 0); +} diff --git a/libgloss/mn10300/times.c b/libgloss/mn10300/times.c new file mode 100644 index 0000000..b804be4 --- /dev/null +++ b/libgloss/mn10300/times.c @@ -0,0 +1,12 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" +#include "sys/times.h" + + +clock_t +times (struct tms *buffer) +{ + return TRAP0 (SYS_times, buffer, 0, 0); +} diff --git a/libgloss/mn10300/trap.S b/libgloss/mn10300/trap.S new file mode 100644 index 0000000..05939b9 --- /dev/null +++ b/libgloss/mn10300/trap.S @@ -0,0 +1,9 @@ + .text + .global ___trap0 +___trap0: + syscall + cmp 0,d0 + beq .L0 + mov d0,(_errno) +.L0: + rets diff --git a/libgloss/mn10300/trap.h b/libgloss/mn10300/trap.h new file mode 100644 index 0000000..27636c0 --- /dev/null +++ b/libgloss/mn10300/trap.h @@ -0,0 +1,5 @@ +#include "syscall.h" + +int __trap0 (); + +#define TRAP0(f, p1, p2, p3) __trap0(f, (p1), (p2), (p3)) diff --git a/libgloss/mn10300/unlink.c b/libgloss/mn10300/unlink.c new file mode 100644 index 0000000..84fb711 --- /dev/null +++ b/libgloss/mn10300/unlink.c @@ -0,0 +1,11 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" + + +int +_unlink () +{ + return -1; +} diff --git a/libgloss/mn10300/utime.c b/libgloss/mn10300/utime.c new file mode 100644 index 0000000..3fce7e3 --- /dev/null +++ b/libgloss/mn10300/utime.c @@ -0,0 +1,13 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" + + +int +utime (path, times) + const char *path; + char *times; +{ + return TRAP0 (SYS_utime, path, times, 0); +} diff --git a/libgloss/mn10300/wait.c b/libgloss/mn10300/wait.c new file mode 100644 index 0000000..c8d8b4c --- /dev/null +++ b/libgloss/mn10300/wait.c @@ -0,0 +1,12 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" + + +int +_wait (statusp) + int *statusp; +{ + return TRAP0 (SYS_wait, 0, 0, 0); +} diff --git a/libgloss/mn10300/write.c b/libgloss/mn10300/write.c new file mode 100644 index 0000000..3ecf4a8 --- /dev/null +++ b/libgloss/mn10300/write.c @@ -0,0 +1,13 @@ +#include <_ansi.h> +#include <sys/types.h> +#include <sys/stat.h> +#include "trap.h" + + +int +_write ( int file, + char *ptr, + size_t len) +{ + return TRAP0 (SYS_write, file, ptr, len); +} diff --git a/libgloss/open.c b/libgloss/open.c new file mode 100644 index 0000000..468b11c --- /dev/null +++ b/libgloss/open.c @@ -0,0 +1,31 @@ +/* open.c -- open a file. + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include <errno.h> +#include "glue.h" + +/* + * open -- open a file descriptor. We don't have a filesystem, so + * we return an error. + */ +int +_DEFUN (open, (buf, flags, mode), + const char *buf _AND + int flags _AND + int mode) +{ + errno = EIO; + return (-1); +} + diff --git a/libgloss/pa/Makefile.in b/libgloss/pa/Makefile.in new file mode 100644 index 0000000..f33c15a --- /dev/null +++ b/libgloss/pa/Makefile.in @@ -0,0 +1,155 @@ +# Copyright (c) 1995, 1996 Cygnus Support +# +# The authors hereby grant permission to use, copy, modify, distribute, +# and license this software and its documentation for any purpose, provided +# that existing copyright notices are retained in all copies and that this +# notice is included verbatim in any distributions. No written agreement, +# license, or royalty fee is required for any of the authorized uses. +# Modifications to this software may be copyrighted by their authors +# and need not follow the licensing terms described here, provided that +# the new terms are clearly indicated on the first page of each file where +# they apply. +# +VPATH = @srcdir@ +srcdir = @srcdir@ +objdir = . +srcroot = $(srcdir)/../.. +objroot = $(objdir)/../.. + +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +host_alias = @host_alias@ +target_alias = @target_alias@ + +bindir = @bindir@ +libdir = @libdir@ +tooldir = $(exec_prefix)/$(target_alias) + +# Multilib support variables. +# TOP is used instead of MULTI{BUILD,SRC}TOP. +MULTIDIRS = +MULTISUBDIR = +MULTIDO = true +MULTICLEAN = true + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ + +SHELL = /bin/sh + +CC = @CC@ + +AS = @AS@ +AR = @AR@ +LD = @LD@ +RANLIB = @RANLIB@ + +OBJDUMP = `if [ -f ${objroot}/../binutils/objdump ] ; \ + then echo ${objroot}/../binutils/objdump ; \ + else t='$(program_transform_name)'; echo objdump | sed -e $$t ; fi` +OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \ + then echo ${objroot}/../binutils/objcopy ; \ + else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi` + +SCRIPTS = w89k op50n +CRT0 = crt0.o +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 hp-milli.o + +CFLAGS = -g +# ARFLAGS = rv + +# +# here's all the Oki OP50N target stuff +# +OKI_LDFLAGS= -L${srcdir} -Top50n.ld $(LDFLAGS_FOR_TARGET) -Ttext 40000 -Map oki.map +OKI_BSP= libop50n.a +OKI_OBJS= op50nled.o op50n-io.o + +# +# here's all the WinBind W89k target stuff +# +WEC_LDFLAGS= -L${srcdir} -Tw89k.ld $(LDFLAGS_FOR_TARGET) -Ttext 100000 -Map wec.map +WEC_BSP= libw89k.a +WEC_OBJS= w89k-io.o + +# Host specific makefile fragment comes in here. +@host_makefile_frag@ + +# +# 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. +# + +all: ${CRT0} ${OKI_BSP} ${WEC_BSP} + +test: ${CRT0} test.o ${OKI_BSP} ${WEC_BSP} + @for script in ${SCRIPTS}; do \ + echo Building $@ for $${script}... ; \ + ${CC} $(CFLAGS_FOR_TARGET) $(INCLUDES) -L${objdir} \ + -m$${script} test.o -L. \ + -o $${script}-test.x $(LIBS_FOR_TARGET) ; \ + if [ -s $${script}-test.x ] ; then \ + echo "Making an srecord for $${script}-test.x..." ; \ + ${OBJCOPY} -O srec $${script}-test.x $${script}-test.srec ; \ + echo "Making an disassembly file for $${script}-test.x..." ; \ + rm -f $${script}-test.dis ; \ + ${OBJDUMP} -d $${script}-test.x > $${script}-test.dis ; \ + else \ + rm $${script}-test.x ; \ + echo "WARNING: $${script}-test didn't build." ; \ + fi ; \ + done + +# +# here's where we build the board support packages for each target +# +${OKI_BSP}: $(OBJS) ${OKI_OBJS} + ${AR} ${ARFLAGS} $@ $(OBJS) ${OKI_OBJS} + ${RANLIB} $@ + +${WEC_BSP}: $(OBJS) ${WEC_OBJS} + ${AR} ${ARFLAGS} $@ $(OBJS) ${WEC_OBJS} + ${RANLIB} $@ + +op50n-test.x: test.o ${srcdir}/test.c ${OKI_BSP} ${WEC_BSP} +w89k-test.x: test.o ${srcdir}/test.c ${OKI_BSP} ${WEC_BSP} + +doc: + +clean mostlyclean: + rm -f a.out core *.i *~ *.o *-test *.srec *.dis *.map *.x + +distclean maintainer-clean realclean: clean + rm -f Makefile config.cache config.log config.status + +.PHONY: install info install-info clean-info +install: + $(INSTALL_PROGRAM) $(CRT0) $(tooldir)/lib${MULTISUBDIR}/$(CRT0) + # install Oki stuff + $(INSTALL_PROGRAM) $(OKI_BSP) $(tooldir)/lib${MULTISUBDIR}/$(OKI_BSP) + $(INSTALL_DATA) ${srcdir}/op50n.ld $(tooldir)/lib${MULTISUBDIR}/op50n.ld + # install WinBond stuff + $(INSTALL_PROGRAM) $(WEC_BSP) $(tooldir)/lib${MULTISUBDIR}/$(WEC_BSP) + $(INSTALL_DATA) ${srcdir}/w89k.ld $(tooldir)/lib${MULTISUBDIR}/w89k.ld + +info: +install-info: +clean-info: + +test.o: ${srcdir}/test.c +${CRT0}:${srcdir}/crt0.S +op50n-io.o: ${srcdir}/op50n-io.S +op50nled.o: ${srcdir}/op50nled.c + +# target specific makefile fragment comes in here. +@target_makefile_frag@ + +Makefile: Makefile.in config.status @host_makefile_frag_path@ @target_makefile_frag_path@ + $(SHELL) config.status + +config.status: configure + $(SHELL) config.status --recheck diff --git a/libgloss/pa/README b/libgloss/pa/README new file mode 100644 index 0000000..6037c57 --- /dev/null +++ b/libgloss/pa/README @@ -0,0 +1,82 @@ + Misc + .... + +Naming Conventions +------------------ + The basic naming convention for Unix machines is that + hppa1.1-hp-proelf- is prepended to the front of each tool + name. For DOS machines, the names are truncated to just the base + tool name, like GCC. + +Installation +------------ + For this beta release, there are three tar files on the tape. A + simple "tar xvf [device name]" will work. One of the tarfiles is + all the sources, the others are binaries. One set is for a HP-UX + host, and the other set is for a sun4 host. + + First, make a directory called /usr/cygnus/beta-941019. Cd into + this directory and type the tar command to extract the three tar + files. Once the tar files are off the tape, you can uncompress + and extract them. Typically, once they are installed, it's common + practice to make a symbolic link so the path + /usr/cygnus/beta-941019 works regardless which host. The actual + binaries are in /usr/cygnus/beta-941019/$host/bin, where host is + the configuration string for this machine. + + + WinBond W89k board + .................. +Downloading +----------- + To download type the "U" command to the ROM monitor. This will + load to the address as specified in the srecord. This address is + 0x100000. + +To compile +---------- + Use these arguments on the command line for either the linker or + the compiler: + + -Tw89k.ld -Ttext 100000 + +To execute +---------- + Type a "g = 100000" at thr ROM monitor after downloading to the + target. After downloading, PC will be set to the correct address, + but this command will *always* restart the execution from the + beginning. + +To debug +-------- + To connect GDB to the target, use the "target w89k [devicename]". + + Oki OP50N board + ............... + +Downloading +----------- + To download, type "r 0" to the ROM monitor. The 0 is cause the + monitor wants to offset the address in the srecord to 0x40000. The + problem is that it doesn't relocate data right. So, we set the + address for .text and .data to 0x40000, and we don't want any + offset. + +To compile +---------- + Use these arguments on the command line for either the linker or + the compiler: + + -Top50n.ld -Ttext 40000 + + To execute +---------- + Type a "g 40000" at thr ROM monitor after downloading to the + target. After downloading, PC will be set to the correct address, + but this command will *always* restart the execution from the + beginning + +To debug +-------- + To connect GDB to the target, use the "target op50n [devicename]". + diff --git a/libgloss/pa/configure b/libgloss/pa/configure new file mode 100755 index 0000000..406b78a --- /dev/null +++ b/libgloss/pa/configure @@ -0,0 +1,1117 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.10 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.10" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set LANG and LC_ALL to C if already set. +# These must not be set unconditionally because not all systems understand +# e.g. LANG=C (notably SCO). +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LANG+set}" = set; then LANG=C; export LANG; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=crt0.S + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' + +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + +if test "${enable_shared}" = "yes" ; then + echo "Shared libraries not supported for cross compiling, ignored" +fi + +if test "$srcdir" = "." ; then + if test "${with_target_subdir}" != "." ; then + libgloss_topdir="${srcdir}/${with_multisrctop}../../.." + else + libgloss_topdir="${srcdir}/${with_multisrctop}../.." + fi +else + libgloss_topdir="${srcdir}/../.." +fi +ac_aux_dir= +for ac_dir in $libgloss_topdir $srcdir/$libgloss_topdir; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $libgloss_topdir $srcdir/$libgloss_topdir" 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + + + +# Do some error checking and defaulting for the host and target type. +# The inputs are: +# configure --host=HOST --target=TARGET --build=BUILD NONOPT +# +# The rules are: +# 1. You are not allowed to specify --host, --target, and nonopt at the +# same time. +# 2. Host defaults to nonopt. +# 3. If nonopt is not specified, then host defaults to the current host, +# as determined by config.guess. +# 4. Target and build default to nonopt. +# 5. If nonopt is not specified, then target and build default to host. + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +case $host---$target---$nonopt in +NONE---*---* | *---NONE---* | *---*---NONE) ;; +*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;; +esac + + +# Make sure we can run config.sub. +if $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi + +echo $ac_n "checking host system type""... $ac_c" 1>&6 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`$ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`$ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + +echo $ac_n "checking target system type""... $ac_c" 1>&6 + +target_alias=$target +case "$target_alias" in +NONE) + case $nonopt in + NONE) target_alias=$host_alias ;; + *) target_alias=$nonopt ;; + esac ;; +esac + +target=`$ac_config_sub $target_alias` +target_cpu=`echo $target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` +target_vendor=`echo $target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` +target_os=`echo $target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` +echo "$ac_t""$target" 1>&6 + +echo $ac_n "checking build system type""... $ac_c" 1>&6 + +build_alias=$build +case "$build_alias" in +NONE) + case $nonopt in + NONE) build_alias=$host_alias ;; + *) build_alias=$nonopt ;; + esac ;; +esac + +build=`$ac_config_sub $build_alias` +build_cpu=`echo $build | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` +build_vendor=`echo $build | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` +build_os=`echo $build | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` +echo "$ac_t""$build" 1>&6 + +test "$host_alias" != "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + +if test "$program_transform_name" = s,x,x,; then + program_transform_name= +else + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed +s,\\,\\\\,g; s,\$,$$,g +EOF_SED + program_transform_name="`echo $program_transform_name|sed -f conftestsed`" + rm -f conftestsed +fi +test "$program_prefix" != NONE && + program_transform_name="s,^,${program_prefix},; $program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" + +# sed with no file args requires a program. +test "$program_transform_name" = "" && program_transform_name="s,x,x," + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + for ac_prog in ginstall installbsd scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + # OSF/1 installbsd also uses dspmsg, but is usable. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_ifs" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + ac_prog_rejected=no + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +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 $# -gt 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 + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <<EOF +#ifdef __GNUC__ + yes; +#endif +EOF +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:802: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 +if test $ac_cv_prog_gcc = yes; then + GCC=yes + if test "${CFLAGS+set}" != set; then + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_gcc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_gcc_g=yes +else + ac_cv_prog_gcc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_gcc_g" 1>&6 + if test $ac_cv_prog_gcc_g = yes; then + CFLAGS="-g -O" + else + CFLAGS="-O" + fi + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi + +AS=${AS-as} + +AR=${AR-ar} + +LD=${LD-ld} + +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +host_makefile_frag=${srcdir}/../config/default.mh +target_makefile_frag=${srcdir}/../config/default.mt + +host_makefile_frag_path=$host_makefile_frag + + +target_makefile_frag_path=$target_makefile_frag + + + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1='\2'}/p" \ + >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs + + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS <<EOF +#! /bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.10" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS <<EOF + +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; + s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@host@%$host%g +s%@host_alias@%$host_alias%g +s%@host_cpu@%$host_cpu%g +s%@host_vendor@%$host_vendor%g +s%@host_os@%$host_os%g +s%@target@%$target%g +s%@target_alias@%$target_alias%g +s%@target_cpu@%$target_cpu%g +s%@target_vendor@%$target_vendor%g +s%@target_os@%$target_os%g +s%@build@%$build%g +s%@build_alias@%$build_alias%g +s%@build_cpu@%$build_cpu%g +s%@build_vendor@%$build_vendor%g +s%@build_os@%$build_os%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@CC@%$CC%g +s%@AS@%$AS%g +s%@AR@%$AR%g +s%@LD@%$LD%g +s%@RANLIB@%$RANLIB%g +s%@host_makefile_frag_path@%$host_makefile_frag_path%g +/@host_makefile_frag@/r $host_makefile_frag +s%@host_makefile_frag@%%g +s%@target_makefile_frag_path@%$target_makefile_frag_path%g +/@target_makefile_frag@/r $target_makefile_frag +s%@target_makefile_frag@%%g + +CEOF +EOF +cat >> $CONFIG_STATUS <<EOF + +CONFIG_FILES=\${CONFIG_FILES-"Makefile"} +EOF +cat >> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust relative srcdir, etc. for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" -f conftest.subs $ac_given_srcdir/$ac_file_in > $ac_file +fi; done +rm -f conftest.subs + +EOF +cat >> $CONFIG_STATUS <<EOF +srcdir=${srcdir} +target=${target} +ac_configure_args="${ac_configure_args} --enable-multilib" +CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} +libgloss_topdir=${libgloss_topdir} + +EOF +cat >> $CONFIG_STATUS <<\EOF +. ${libgloss_topdir}/config-ml.in +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + diff --git a/libgloss/pa/configure.in b/libgloss/pa/configure.in new file mode 100644 index 0000000..b479a2f --- /dev/null +++ b/libgloss/pa/configure.in @@ -0,0 +1,68 @@ +/* Copyright (c) 1995, 1996 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + * + * Process this file with autoconf to produce a configure script. + */ +AC_PREREQ(2.5)dnl +AC_INIT(crt0.S) + +if test "${enable_shared}" = "yes" ; then + echo "Shared libraries not supported for cross compiling, ignored" +fi + +if test "$srcdir" = "." ; then + if test "${with_target_subdir}" != "." ; then + libgloss_topdir="${srcdir}/${with_multisrctop}../../.." + else + libgloss_topdir="${srcdir}/${with_multisrctop}../.." + fi +else + libgloss_topdir="${srcdir}/../.." +fi +AC_CONFIG_AUX_DIR($libgloss_topdir) + +AC_CANONICAL_SYSTEM +AC_ARG_PROGRAM + +AC_PROG_INSTALL + +AC_PROG_CC +AS=${AS-as} +AC_SUBST(AS) +AR=${AR-ar} +AC_SUBST(AR) +LD=${LD-ld} +AC_SUBST(LD) +AC_PROG_RANLIB + +host_makefile_frag=${srcdir}/../config/default.mh +target_makefile_frag=${srcdir}/../config/default.mt + +dnl We have to assign the same value to other variables because autoconf +dnl doesn't provide a mechanism to substitute a replacement keyword with +dnl arbitrary data or pathnames. +dnl +host_makefile_frag_path=$host_makefile_frag +AC_SUBST(host_makefile_frag_path) +AC_SUBST_FILE(host_makefile_frag) +target_makefile_frag_path=$target_makefile_frag +AC_SUBST(target_makefile_frag_path) +AC_SUBST_FILE(target_makefile_frag) + +AC_OUTPUT(Makefile, +. ${libgloss_topdir}/config-ml.in, +srcdir=${srcdir} +target=${target} +ac_configure_args="${ac_configure_args} --enable-multilib" +CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} +libgloss_topdir=${libgloss_topdir} +) diff --git a/libgloss/pa/crt0.S b/libgloss/pa/crt0.S new file mode 100644 index 0000000..e9ea525 --- /dev/null +++ b/libgloss/pa/crt0.S @@ -0,0 +1,128 @@ +/* crt0.S -- startup file for hppa. + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + .VERSION "1.0" + .COPYRIGHT "crt0.o for the PA" + + .DATA + +/* + * Set up the standard spaces (sections) These definitions come + * from /lib/pcc_prefix.s. + */ + .TEXT + +/* + * stuff we need that's defined elsewhere. + */ + .IMPORT main, CODE + .IMPORT exit, CODE + .IMPORT _bss_start, DATA + .IMPORT _end, DATA + .IMPORT environ, DATA + +/* + * start -- set things up so the application will run. + * + */ + .PROC + .CALLINFO SAVE_SP, FRAME=48 + .EXPORT $START$,ENTRY +$START$ + + /* FIXME: this writes to page zero */ + ;; setup the %30 (stack pointer) with some memory + ldil L%_stack,%r30 + ldo R%_stack(%r30),%r30 + + ;; we need to set %r27 (global data pointer) here too + ldil L%$global$,%r27 + ldo R%$global$(%r27),%r27 ; same problem as above + +/* + * zerobss -- zero out the bss section + */ + ; load the start of bss + ldil L%_bss_start,%r4 + ldo R%_bss_start(%r4),%r4 + + ; load the end of bss + ldil L%_end,%r5 + ldo R%_end(%r5),%r5 + + +L$bssloop + addi -1,%r5,%r5 ; decrement _bss_end + stb %r0,0(0,%r5) ; we do this by bytes for now even + ; though it's slower, it's safer + combf,= %r4,%r5, L$bssloop + nop + + ldi 1,%ret0 + +/* + * Call the main routine from the application to get it going. + * main (argc, argv, environ) + * We pass argv as a pointer to NULL. + */ + + ldil L%main,%r22 + ble R%main(%sr4,%r22) + copy %r31,%r2 +/* + * Call exit() from the C library with the return value from main() + */ + copy %r28,%r26 + ldil L%exit,%r22 + ble R%exit(%sr4,%r22) + copy %r31,%r2 + + .PROCEND +/* + * _exit -- Exit from the application. Normally we cause a user trap + * to return to the ROM monitor for another run. + */ + .EXPORT _exit, ENTRY +_exit + .PROC + .CALLINFO + .ENTRY + + ;; This just causes a breakpoint exception + break 0x0,0x0 + bv,n (%rp) + nop + .EXIT + .PROCEND + +/* + * _sr4export -- support for called functions. (mostly for GDB) + */ + .EXPORT _sr4export, ENTRY +_sr4export: + .PROC + .CALLINFO + .ENTRY + + ble 0(%sr4,%r22) + copy %r31,%rp + ldw -24(%sr0,%sp),%rp + ldsid (%sr0,%rp),%r1 + mtsp %r1,%sr0 + be,n 0(%sr0,%rp) + nop + .EXIT + .PROCEND + + diff --git a/libgloss/pa/hp-milli.s b/libgloss/pa/hp-milli.s new file mode 100644 index 0000000..85aaa08 --- /dev/null +++ b/libgloss/pa/hp-milli.s @@ -0,0 +1,1998 @@ +; +; (c) Copyright 1986 HEWLETT-PACKARD COMPANY +; +; To anyone who acknowledges that this file is provided "AS IS" +; without any express or implied warranty: +; permission to use, copy, modify, and distribute this file +; for any purpose is hereby granted without fee, provided that +; the above copyright notice and this notice appears in all +; copies, and that the name of Hewlett-Packard Company not be +; used in advertising or publicity pertaining to distribution +; of the software without specific, written prior permission. +; Hewlett-Packard Company makes no representations about the +; suitability of this software for any purpose. +; + +; Standard Hardware Register Definitions for Use with Assembler +; version A.08.06 +; - fr16-31 added at Utah +;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +; Hardware General Registers +r0: .equ 0 + +r1: .equ 1 + +r2: .equ 2 + +r3: .equ 3 + +r4: .equ 4 + +r5: .equ 5 + +r6: .equ 6 + +r7: .equ 7 + +r8: .equ 8 + +r9: .equ 9 + +r10: .equ 10 + +r11: .equ 11 + +r12: .equ 12 + +r13: .equ 13 + +r14: .equ 14 + +r15: .equ 15 + +r16: .equ 16 + +r17: .equ 17 + +r18: .equ 18 + +r19: .equ 19 + +r20: .equ 20 + +r21: .equ 21 + +r22: .equ 22 + +r23: .equ 23 + +r24: .equ 24 + +r25: .equ 25 + +r26: .equ 26 + +r27: .equ 27 + +r28: .equ 28 + +r29: .equ 29 + +r30: .equ 30 + +r31: .equ 31 + +; Hardware Space Registers +sr0: .equ 0 + +sr1: .equ 1 + +sr2: .equ 2 + +sr3: .equ 3 + +sr4: .equ 4 + +sr5: .equ 5 + +sr6: .equ 6 + +sr7: .equ 7 + +; Hardware Floating Point Registers +fr0: .equ 0 + +fr1: .equ 1 + +fr2: .equ 2 + +fr3: .equ 3 + +fr4: .equ 4 + +fr5: .equ 5 + +fr6: .equ 6 + +fr7: .equ 7 + +fr8: .equ 8 + +fr9: .equ 9 + +fr10: .equ 10 + +fr11: .equ 11 + +fr12: .equ 12 + +fr13: .equ 13 + +fr14: .equ 14 + +fr15: .equ 15 + +fr16: .equ 16 + +fr17: .equ 17 + +fr18: .equ 18 + +fr19: .equ 19 + +fr20: .equ 20 + +fr21: .equ 21 + +fr22: .equ 22 + +fr23: .equ 23 + +fr24: .equ 24 + +fr25: .equ 25 + +fr26: .equ 26 + +fr27: .equ 27 + +fr28: .equ 28 + +fr29: .equ 29 + +fr30: .equ 30 + +fr31: .equ 31 + +; Hardware Control Registers +cr0: .equ 0 + +rctr: .equ 0 ; Recovery Counter Register + + +cr8: .equ 8 ; Protection ID 1 + +pidr1: .equ 8 + + +cr9: .equ 9 ; Protection ID 2 + +pidr2: .equ 9 + + +cr10: .equ 10 + +ccr: .equ 10 ; Coprocessor Confiquration Register + + +cr11: .equ 11 + +sar: .equ 11 ; Shift Amount Register + + +cr12: .equ 12 + +pidr3: .equ 12 ; Protection ID 3 + + +cr13: .equ 13 + +pidr4: .equ 13 ; Protection ID 4 + + +cr14: .equ 14 + +iva: .equ 14 ; Interrupt Vector Address + + +cr15: .equ 15 + +eiem: .equ 15 ; External Interrupt Enable Mask + + +cr16: .equ 16 + +itmr: .equ 16 ; Interval Timer + + +cr17: .equ 17 + +pcsq: .equ 17 ; Program Counter Space queue + + +cr18: .equ 18 + +pcoq: .equ 18 ; Program Counter Offset queue + + +cr19: .equ 19 + +iir: .equ 19 ; Interruption Instruction Register + + +cr20: .equ 20 + +isr: .equ 20 ; Interruption Space Register + + +cr21: .equ 21 + +ior: .equ 21 ; Interruption Offset Register + + +cr22: .equ 22 + +ipsw: .equ 22 ; Interrpution Processor Status Word + + +cr23: .equ 23 + +eirr: .equ 23 ; External Interrupt Request + + +cr24: .equ 24 + +ppda: .equ 24 ; Physcial Page Directory Address + +tr0: .equ 24 ; Temporary register 0 + + +cr25: .equ 25 + +hta: .equ 25 ; Hash Table Address + +tr1: .equ 25 ; Temporary register 1 + + +cr26: .equ 26 + +tr2: .equ 26 ; Temporary register 2 + + +cr27: .equ 27 + +tr3: .equ 27 ; Temporary register 3 + + +cr28: .equ 28 + +tr4: .equ 28 ; Temporary register 4 + + +cr29: .equ 29 + +tr5: .equ 29 ; Temporary register 5 + + +cr30: .equ 30 + +tr6: .equ 30 ; Temporary register 6 + + +cr31: .equ 31 + +tr7: .equ 31 ; Temporary register 7 + +;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +; Procedure Call Convention ~ +; Register Definitions for Use with Assembler ~ +; version A.08.06 +;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +; Software Architecture General Registers +rp: .equ r2 ; return pointer + +mrp: .equ r31 ; millicode return pointer + +ret0: .equ r28 ; return value + +ret1: .equ r29 ; return value (high part of double) + +sl: .equ r29 ; static link + +sp: .equ r30 ; stack pointer + +dp: .equ r27 ; data pointer + +arg0: .equ r26 ; argument + +arg1: .equ r25 ; argument or high part of double argument + +arg2: .equ r24 ; argument + +arg3: .equ r23 ; argument or high part of double argument + +;_____________________________________________________________________________ +; Software Architecture Space Registers +; sr0 ; return link form BLE +sret: .equ sr1 ; return value + +sarg: .equ sr1 ; argument + +; sr4 ; PC SPACE tracker +; sr5 ; process private data +;_____________________________________________________________________________ +; Software Architecture Pseudo Registers +previous_sp: .equ 64 ; old stack pointer (locates previous frame) + +;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +; Standard space and subspace definitions. version A.08.06 +; These are generally suitable for programs on HP_UX and HPE. +; Statements commented out are used when building such things as operating +; system kernels. +;;;;;;;;;;;;;;;; + .SPACE $TEXT$, SPNUM=0,SORT=8 + .subspa $MILLICODE$, QUAD=0,ALIGN=8,ACCESS=0x2c,SORT=8 + .subspa $LIT$, QUAD=0,ALIGN=8,ACCESS=0x2c,SORT=16 + .subspa $CODE$, QUAD=0,ALIGN=8,ACCESS=0x2c,SORT=24 +; Additional code subspaces should have ALIGN=8 for an interspace BV +; and should have SORT=24. +; +; For an incomplete executable (program bound to shared libraries), +; sort keys $GLOBAL$ -1 and $GLOBAL$ -2 are reserved for the $DLT$ +; and $PLT$ subspaces respectively. +;;;;;;;;;;;;;;; + .SPACE $PRIVATE$, SPNUM=1,PRIVATE,SORT=16 + .subspa $GLOBAL$, QUAD=1,ALIGN=8,ACCESS=0x1f,SORT=40 + .import $global$ + .subspa $DATA$, QUAD=1,ALIGN=8,ACCESS=0x1f,SORT=16 + .subspa $BSS$, QUAD=1,ALIGN=8,ACCESS=0x1f,SORT=82,ZERO + + .SPACE $TEXT$ + .SUBSPA $MILLICODE$ + + .align 8 + .EXPORT $$remI,millicode +; .IMPORT cerror +$$remI: + .PROC + .CALLINFO millicode + .ENTRY + addit,= 0,arg1,r0 + add,>= r0,arg0,ret1 + sub r0,ret1,ret1 + sub r0,arg1,r1 + ds r0,r1,r0 + or r0,r0,r1 + add ret1,ret1,ret1 + ds r1,arg1,r1 + addc ret1,ret1,ret1 + ds r1,arg1,r1 + addc ret1,ret1,ret1 + ds r1,arg1,r1 + addc ret1,ret1,ret1 + ds r1,arg1,r1 + addc ret1,ret1,ret1 + ds r1,arg1,r1 + addc ret1,ret1,ret1 + ds r1,arg1,r1 + addc ret1,ret1,ret1 + ds r1,arg1,r1 + addc ret1,ret1,ret1 + ds r1,arg1,r1 + addc ret1,ret1,ret1 + ds r1,arg1,r1 + addc ret1,ret1,ret1 + ds r1,arg1,r1 + addc ret1,ret1,ret1 + ds r1,arg1,r1 + addc ret1,ret1,ret1 + ds r1,arg1,r1 + addc ret1,ret1,ret1 + ds r1,arg1,r1 + addc ret1,ret1,ret1 + ds r1,arg1,r1 + addc ret1,ret1,ret1 + ds r1,arg1,r1 + addc ret1,ret1,ret1 + ds r1,arg1,r1 + addc ret1,ret1,ret1 + ds r1,arg1,r1 + addc ret1,ret1,ret1 + ds r1,arg1,r1 + addc ret1,ret1,ret1 + ds r1,arg1,r1 + addc ret1,ret1,ret1 + ds r1,arg1,r1 + addc ret1,ret1,ret1 + ds r1,arg1,r1 + addc ret1,ret1,ret1 + ds r1,arg1,r1 + addc ret1,ret1,ret1 + ds r1,arg1,r1 + addc ret1,ret1,ret1 + ds r1,arg1,r1 + addc ret1,ret1,ret1 + ds r1,arg1,r1 + addc ret1,ret1,ret1 + ds r1,arg1,r1 + addc ret1,ret1,ret1 + ds r1,arg1,r1 + addc ret1,ret1,ret1 + ds r1,arg1,r1 + addc ret1,ret1,ret1 + ds r1,arg1,r1 + addc ret1,ret1,ret1 + ds r1,arg1,r1 + addc ret1,ret1,ret1 + ds r1,arg1,r1 + addc ret1,ret1,ret1 + ds r1,arg1,r1 + addc ret1,ret1,ret1 + movb,>=,n r1,ret1,remI300 + add,< arg1,r0,r0 + add,tr r1,arg1,ret1 + sub r1,arg1,ret1 +remI300: add,>= arg0,r0,r0 + + sub r0,ret1,ret1 + bv r0(r31) + nop + .EXIT + .PROCEND + +bit1: .equ 1 + +bit30: .equ 30 +bit31: .equ 31 + +len2: .equ 2 + +len4: .equ 4 + + +$$dyncall: + .proc + .callinfo NO_CALLS + .entry + .export $$dyncall,MILLICODE + + bb,>=,n 22,bit30,noshlibs + + depi 0,bit31,len2,22 + ldw 4(22),19 + ldw 0(22),22 +noshlibs: + ldsid (22),r1 + mtsp r1,sr0 + be 0(sr0,r22) + stw rp,-24(sp) + .exit + .procend + +temp: .EQU r1 + +retreg: .EQU ret1 ; r29 + + + .export $$divU,millicode + .import $$divU_3,millicode + .import $$divU_5,millicode + .import $$divU_6,millicode + .import $$divU_7,millicode + .import $$divU_9,millicode + .import $$divU_10,millicode + .import $$divU_12,millicode + .import $$divU_14,millicode + .import $$divU_15,millicode +$$divU: + .proc + .callinfo millicode + .entry +; The subtract is not nullified since it does no harm and can be used +; by the two cases that branch back to "normal". + comib,>= 15,arg1,special_divisor + sub r0,arg1,temp ; clear carry, negate the divisor + ds r0,temp,r0 ; set V-bit to 1 +normal: + add arg0,arg0,retreg ; shift msb bit into carry + ds r0,arg1,temp ; 1st divide step, if no carry + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 2nd divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 3rd divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 4th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 5th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 6th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 7th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 8th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 9th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 10th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 11th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 12th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 13th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 14th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 15th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 16th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 17th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 18th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 19th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 20th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 21st divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 22nd divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 23rd divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 24th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 25th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 26th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 27th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 28th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 29th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 30th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 31st divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 32nd divide step, + bv 0(r31) + addc retreg,retreg,retreg ; shift last retreg bit into retreg +;_____________________________________________________________________________ +; handle the cases where divisor is a small constant or has high bit on +special_divisor: + comib,> 0,arg1,big_divisor + nop + blr arg1,r0 + nop +zero_divisor: ; this label is here to provide external visibility + + addit,= 0,arg1,0 ; trap for zero dvr + nop + bv 0(r31) ; divisor == 1 + copy arg0,retreg + bv 0(r31) ; divisor == 2 + extru arg0,30,31,retreg + b,n $$divU_3 ; divisor == 3 + nop + bv 0(r31) ; divisor == 4 + extru arg0,29,30,retreg + b,n $$divU_5 ; divisor == 5 + nop + b,n $$divU_6 ; divisor == 6 + nop + b,n $$divU_7 ; divisor == 7 + nop + bv 0(r31) ; divisor == 8 + extru arg0,28,29,retreg + b,n $$divU_9 ; divisor == 9 + nop + b,n $$divU_10 ; divisor == 10 + nop + b normal ; divisor == 11 + ds r0,temp,r0 ; set V-bit to 1 + b,n $$divU_12 ; divisor == 12 + nop + b normal ; divisor == 13 + ds r0,temp,r0 ; set V-bit to 1 + b,n $$divU_14 ; divisor == 14 + nop + b,n $$divU_15 ; divisor == 15 + nop +;_____________________________________________________________________________ +; Handle the case where the high bit is on in the divisor. +; Compute: if( dividend>=divisor) quotient=1; else quotient=0; +; Note: dividend>==divisor iff dividend-divisor does not borrow +; and not borrow iff carry +big_divisor: + sub arg0,arg1,r0 + bv 0(r31) + addc r0,r0,retreg + .exit + .procend + .end + +t2: .EQU r1 + +; x2 .EQU arg0 ; r26 +t1: .EQU arg1 ; r25 + +; x1 .EQU ret1 ; r29 +;_____________________________________________________________________________ + +$$divide_by_constant: + .PROC + .CALLINFO millicode + .entry + + + .export $$divide_by_constant,millicode +; Provides a "nice" label for the code covered by the unwind descriptor +; for things like gprof. + + + + + + + + + +$$divI_2: + .EXPORT $$divI_2,MILLICODE + COMCLR,>= arg0,0,0 + ADDI 1,arg0,arg0 + bv 0(r31) + EXTRS arg0,30,31,ret1 + + + +$$divI_4: + .EXPORT $$divI_4,MILLICODE + COMCLR,>= arg0,0,0 + ADDI 3,arg0,arg0 + bv 0(r31) + EXTRS arg0,29,30,ret1 + + + +$$divI_8: + .EXPORT $$divI_8,MILLICODE + COMCLR,>= arg0,0,0 + ADDI 7,arg0,arg0 + bv 0(r31) + EXTRS arg0,28,29,ret1 + + +$$divI_16: + .EXPORT $$divI_16,MILLICODE + COMCLR,>= arg0,0,0 + ADDI 15,arg0,arg0 + bv 0(r31) + EXTRS arg0,27,28,ret1 + + + + + + + + + + + +$$divI_3: + .EXPORT $$divI_3,MILLICODE + COMB,<,N arg0,0,$neg3 + + ADDI 1,arg0,arg0 + EXTRU arg0,1,2,ret1 + SH2ADD arg0,arg0,arg0 + B $pos + ADDC ret1,0,ret1 + +$neg3: + SUBI 1,arg0,arg0 + EXTRU arg0,1,2,ret1 + SH2ADD arg0,arg0,arg0 + B $neg + ADDC ret1,0,ret1 + +$$divU_3: + .EXPORT $$divU_3,MILLICODE + ADDI 1,arg0,arg0 + ADDC 0,0,ret1 + SHD ret1,arg0,30,t1 + SH2ADD arg0,arg0,arg0 + B $pos + ADDC ret1,t1,ret1 + + + +$$divI_5: + .EXPORT $$divI_5,MILLICODE + COMB,<,N arg0,0,$neg5 + ADDI 3,arg0,t1 + SH1ADD arg0,t1,arg0 + B $pos + ADDC 0,0,ret1 + +$neg5: + SUB 0,arg0,arg0 + ADDI 1,arg0,arg0 + SHD 0,arg0,31,ret1 + SH1ADD arg0,arg0,arg0 + B $neg + ADDC ret1,0,ret1 + +$$divU_5: + .EXPORT $$divU_5,MILLICODE + ADDI 1,arg0,arg0 + ADDC 0,0,ret1 + SHD ret1,arg0,31,t1 + SH1ADD arg0,arg0,arg0 + B $pos + ADDC t1,ret1,ret1 + + +$$divI_6: + .EXPORT $$divI_6,MILLICODE + COMB,<,N arg0,0,$neg6 + EXTRU arg0,30,31,arg0 + ADDI 5,arg0,t1 + SH2ADD arg0,t1,arg0 + B $pos + ADDC 0,0,ret1 + +$neg6: + SUBI 2,arg0,arg0 + + + EXTRU arg0,30,31,arg0 + SHD 0,arg0,30,ret1 + SH2ADD arg0,arg0,arg0 + B $neg + ADDC ret1,0,ret1 + +$$divU_6: + .EXPORT $$divU_6,MILLICODE + EXTRU arg0,30,31,arg0 + ADDI 1,arg0,arg0 + SHD 0,arg0,30,ret1 + SH2ADD arg0,arg0,arg0 + B $pos + ADDC ret1,0,ret1 + + +$$divU_10: + .EXPORT $$divU_10,MILLICODE + EXTRU arg0,30,31,arg0 + ADDI 3,arg0,t1 + SH1ADD arg0,t1,arg0 + ADDC 0,0,ret1 +$pos: + SHD ret1,arg0,28,t1 + SHD arg0,0,28,t2 + ADD arg0,t2,arg0 + ADDC ret1,t1,ret1 +$pos_for_17: + SHD ret1,arg0,24,t1 + SHD arg0,0,24,t2 + ADD arg0,t2,arg0 + ADDC ret1,t1,ret1 + + SHD ret1,arg0,16,t1 + SHD arg0,0,16,t2 + ADD arg0,t2,arg0 + bv 0(r31) + ADDC ret1,t1,ret1 + +$$divI_10: + .EXPORT $$divI_10,MILLICODE + COMB,< arg0,0,$neg10 + COPY 0,ret1 + EXTRU arg0,30,31,arg0 + ADDIB,TR 1,arg0,$pos + SH1ADD arg0,arg0,arg0 + +$neg10: + SUBI 2,arg0,arg0 + + + EXTRU arg0,30,31,arg0 + SH1ADD arg0,arg0,arg0 +$neg: + SHD ret1,arg0,28,t1 + SHD arg0,0,28,t2 + ADD arg0,t2,arg0 + ADDC ret1,t1,ret1 +$neg_for_17: + SHD ret1,arg0,24,t1 + SHD arg0,0,24,t2 + ADD arg0,t2,arg0 + ADDC ret1,t1,ret1 + + SHD ret1,arg0,16,t1 + SHD arg0,0,16,t2 + ADD arg0,t2,arg0 + ADDC ret1,t1,ret1 + bv 0(r31) + SUB 0,ret1,ret1 + + +$$divI_12: + .EXPORT $$divI_12,MILLICODE + COMB,< arg0,0,$neg12 + COPY 0,ret1 + EXTRU arg0,29,30,arg0 + ADDIB,TR 1,arg0,$pos + SH2ADD arg0,arg0,arg0 + +$neg12: + SUBI 4,arg0,arg0 + + + EXTRU arg0,29,30,arg0 + B $neg + SH2ADD arg0,arg0,arg0 + +$$divU_12: + .EXPORT $$divU_12,MILLICODE + EXTRU arg0,29,30,arg0 + ADDI 5,arg0,t1 + SH2ADD arg0,t1,arg0 + B $pos + ADDC 0,0,ret1 + + +$$divI_15: + .EXPORT $$divI_15,MILLICODE + COMB,< arg0,0,$neg15 + COPY 0,ret1 + ADDIB,TR 1,arg0,$pos+4 + SHD ret1,arg0,28,t1 + +$neg15: + B $neg + SUBI 1,arg0,arg0 + +$$divU_15: + .EXPORT $$divU_15,MILLICODE + ADDI 1,arg0,arg0 + B $pos + ADDC 0,0,ret1 + + +$$divI_17: + .EXPORT $$divI_17,MILLICODE + COMB,<,N arg0,0,$neg17 + ADDI 1,arg0,arg0 + SHD 0,arg0,28,t1 + SHD arg0,0,28,t2 + SUB t2,arg0,arg0 + B $pos_for_17 + SUBB t1,0,ret1 + +$neg17: + SUBI 1,arg0,arg0 + SHD 0,arg0,28,t1 + SHD arg0,0,28,t2 + SUB t2,arg0,arg0 + B $neg_for_17 + SUBB t1,0,ret1 + +$$divU_17: + .EXPORT $$divU_17,MILLICODE + ADDI 1,arg0,arg0 + ADDC 0,0,ret1 + SHD ret1,arg0,28,t1 +$u17: + SHD arg0,0,28,t2 + SUB t2,arg0,arg0 + B $pos_for_17 + SUBB t1,ret1,ret1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +$$divI_7: + .EXPORT $$divI_7,MILLICODE + COMB,<,N arg0,0,$neg7 +$7: + ADDI 1,arg0,arg0 + SHD 0,arg0,29,ret1 + SH3ADD arg0,arg0,arg0 + ADDC ret1,0,ret1 +$pos7: + SHD ret1,arg0,26,t1 + SHD arg0,0,26,t2 + ADD arg0,t2,arg0 + ADDC ret1,t1,ret1 + + SHD ret1,arg0,20,t1 + SHD arg0,0,20,t2 + ADD arg0,t2,arg0 + ADDC ret1,t1,t1 + + + + COPY 0,ret1 + SHD,= t1,arg0,24,t1 +$1: + ADDB,TR t1,ret1,$2 + EXTRU arg0,31,24,arg0 + + bv,n 0(r31) + +$2: + ADDB,TR t1,arg0,$1 + EXTRU,= arg0,7,8,t1 + +$neg7: + SUBI 1,arg0,arg0 +$8: + SHD 0,arg0,29,ret1 + SH3ADD arg0,arg0,arg0 + ADDC ret1,0,ret1 + +$neg7_shift: + SHD ret1,arg0,26,t1 + SHD arg0,0,26,t2 + ADD arg0,t2,arg0 + ADDC ret1,t1,ret1 + + SHD ret1,arg0,20,t1 + SHD arg0,0,20,t2 + ADD arg0,t2,arg0 + ADDC ret1,t1,t1 + + + + COPY 0,ret1 + SHD,= t1,arg0,24,t1 +$3: + ADDB,TR t1,ret1,$4 + EXTRU arg0,31,24,arg0 + + bv 0(r31) + SUB 0,ret1,ret1 + +$4: + ADDB,TR t1,arg0,$3 + EXTRU,= arg0,7,8,t1 + +$$divU_7: + .EXPORT $$divU_7,MILLICODE + ADDI 1,arg0,arg0 + ADDC 0,0,ret1 + SHD ret1,arg0,29,t1 + SH3ADD arg0,arg0,arg0 + B $pos7 + ADDC t1,ret1,ret1 + + +$$divI_9: + .EXPORT $$divI_9,MILLICODE + COMB,<,N arg0,0,$neg9 + ADDI 1,arg0,arg0 + SHD 0,arg0,29,t1 + SHD arg0,0,29,t2 + SUB t2,arg0,arg0 + B $pos7 + SUBB t1,0,ret1 + +$neg9: + SUBI 1,arg0,arg0 + SHD 0,arg0,29,t1 + SHD arg0,0,29,t2 + SUB t2,arg0,arg0 + B $neg7_shift + SUBB t1,0,ret1 + +$$divU_9: + .EXPORT $$divU_9,MILLICODE + ADDI 1,arg0,arg0 + ADDC 0,0,ret1 + SHD ret1,arg0,29,t1 + SHD arg0,0,29,t2 + SUB t2,arg0,arg0 + B $pos7 + SUBB t1,ret1,ret1 + + +$$divI_14: + .EXPORT $$divI_14,MILLICODE + COMB,<,N arg0,0,$neg14 +$$divU_14: + .EXPORT $$divU_14,MILLICODE + B $7 + EXTRU arg0,30,31,arg0 + +$neg14: + SUBI 2,arg0,arg0 + B $8 + EXTRU arg0,30,31,arg0 + + .exit + .PROCEND + .END + +rmndr: .EQU ret1 ; r29 + + + .export $$remU,millicode +$$remU: + .proc + .callinfo millicode + .entry + + comib,>=,n 0,arg1,special_case + sub r0,arg1,rmndr ; clear carry, negate the divisor + ds r0,rmndr,r0 ; set V-bit to 1 + add arg0,arg0,temp ; shift msb bit into carry + ds r0,arg1,rmndr ; 1st divide step, if no carry + addc temp,temp,temp ; shift temp with/into carry + ds rmndr,arg1,rmndr ; 2nd divide step + addc temp,temp,temp ; shift temp with/into carry + ds rmndr,arg1,rmndr ; 3rd divide step + addc temp,temp,temp ; shift temp with/into carry + ds rmndr,arg1,rmndr ; 4th divide step + addc temp,temp,temp ; shift temp with/into carry + ds rmndr,arg1,rmndr ; 5th divide step + addc temp,temp,temp ; shift temp with/into carry + ds rmndr,arg1,rmndr ; 6th divide step + addc temp,temp,temp ; shift temp with/into carry + ds rmndr,arg1,rmndr ; 7th divide step + addc temp,temp,temp ; shift temp with/into carry + ds rmndr,arg1,rmndr ; 8th divide step + addc temp,temp,temp ; shift temp with/into carry + ds rmndr,arg1,rmndr ; 9th divide step + addc temp,temp,temp ; shift temp with/into carry + ds rmndr,arg1,rmndr ; 10th divide step + addc temp,temp,temp ; shift temp with/into carry + ds rmndr,arg1,rmndr ; 11th divide step + addc temp,temp,temp ; shift temp with/into carry + ds rmndr,arg1,rmndr ; 12th divide step + addc temp,temp,temp ; shift temp with/into carry + ds rmndr,arg1,rmndr ; 13th divide step + addc temp,temp,temp ; shift temp with/into carry + ds rmndr,arg1,rmndr ; 14th divide step + addc temp,temp,temp ; shift temp with/into carry + ds rmndr,arg1,rmndr ; 15th divide step + addc temp,temp,temp ; shift temp with/into carry + ds rmndr,arg1,rmndr ; 16th divide step + addc temp,temp,temp ; shift temp with/into carry + ds rmndr,arg1,rmndr ; 17th divide step + addc temp,temp,temp ; shift temp with/into carry + ds rmndr,arg1,rmndr ; 18th divide step + addc temp,temp,temp ; shift temp with/into carry + ds rmndr,arg1,rmndr ; 19th divide step + addc temp,temp,temp ; shift temp with/into carry + ds rmndr,arg1,rmndr ; 20th divide step + addc temp,temp,temp ; shift temp with/into carry + ds rmndr,arg1,rmndr ; 21st divide step + addc temp,temp,temp ; shift temp with/into carry + ds rmndr,arg1,rmndr ; 22nd divide step + addc temp,temp,temp ; shift temp with/into carry + ds rmndr,arg1,rmndr ; 23rd divide step + addc temp,temp,temp ; shift temp with/into carry + ds rmndr,arg1,rmndr ; 24th divide step + addc temp,temp,temp ; shift temp with/into carry + ds rmndr,arg1,rmndr ; 25th divide step + addc temp,temp,temp ; shift temp with/into carry + ds rmndr,arg1,rmndr ; 26th divide step + addc temp,temp,temp ; shift temp with/into carry + ds rmndr,arg1,rmndr ; 27th divide step + addc temp,temp,temp ; shift temp with/into carry + ds rmndr,arg1,rmndr ; 28th divide step + addc temp,temp,temp ; shift temp with/into carry + ds rmndr,arg1,rmndr ; 29th divide step + addc temp,temp,temp ; shift temp with/into carry + ds rmndr,arg1,rmndr ; 30th divide step + addc temp,temp,temp ; shift temp with/into carry + ds rmndr,arg1,rmndr ; 31st divide step + addc temp,temp,temp ; shift temp with/into carry + ds rmndr,arg1,rmndr ; 32nd divide step, + comiclr,<= 0,rmndr,r0 + add rmndr,arg1,rmndr ; correction +; .exit + bv,n 0(r31) + nop +; Putting >= on the last DS and deleting COMICLR does not work! +;_____________________________________________________________________________ +special_case: + addit,= 0,arg1,r0 ; trap on div by zero + sub,>>= arg0,arg1,rmndr + copy arg0,rmndr + bv,n 0(r31) + nop + .exit + .procend + .end + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +; Use bv 0(r31) and bv,n 0(r31) instead. +; #define return bv 0(%mrp) +; #define return_n bv,n 0(%mrp) + + + + + + + + + + + + + + + + + + + + + + + + + + + + .subspa $MILLICODE$ + .align 16 +$$mulI: + + .proc + .callinfo millicode + .entry + .export $$mulI, millicode + combt,<<= %r25,%r26,l4 ; swap args if unsigned %r25>%r26 + copy 0,%r29 ; zero out the result + xor %r26,%r25,%r26 ; swap %r26 & %r25 using the + xor %r26,%r25,%r25 ; old xor trick + xor %r26,%r25,%r26 +l4: combt,<= 0,%r26,l3 ; if %r26>=0 then proceed like unsigned + + zdep %r25,30,8,%r1 ; %r1 = (%r25&0xff)<<1 ********* + sub,> 0,%r25,%r1 ; otherwise negate both and + combt,<=,n %r26,%r1,l2 ; swap back if |%r26|<|%r25| + sub 0,%r26,%r25 + movb,tr,n %r1,%r26,l2 ; 10th inst. + +l0: add %r29,%r1,%r29 ; add in this partial product + +l1: zdep %r26,23,24,%r26 ; %r26 <<= 8 ****************** + +l2: zdep %r25,30,8,%r1 ; %r1 = (%r25&0xff)<<1 ********* + +l3: blr %r1,0 ; case on these 8 bits ****** + + extru %r25,23,24,%r25 ; %r25 >>= 8 ****************** + +;16 insts before this. +; %r26 <<= 8 ************************** +x0: comb,<> %r25,0,l2 ! zdep %r26,23,24,%r26 ! bv,n 0(r31) ! nop + +x1: comb,<> %r25,0,l1 ! add %r29,%r26,%r29 ! bv,n 0(r31) ! nop + +x2: comb,<> %r25,0,l1 ! sh1add %r26,%r29,%r29 ! bv,n 0(r31) ! nop + +x3: comb,<> %r25,0,l0 ! sh1add %r26,%r26,%r1 ! bv 0(r31) ! add %r29,%r1,%r29 + +x4: comb,<> %r25,0,l1 ! sh2add %r26,%r29,%r29 ! bv,n 0(r31) ! nop + +x5: comb,<> %r25,0,l0 ! sh2add %r26,%r26,%r1 ! bv 0(r31) ! add %r29,%r1,%r29 + +x6: sh1add %r26,%r26,%r1 ! comb,<> %r25,0,l1 ! sh1add %r1,%r29,%r29 ! bv,n 0(r31) + +x7: sh1add %r26,%r26,%r1 ! comb,<> %r25,0,l0 ! sh2add %r26,%r29,%r29 ! b,n ret_t0 + +x8: comb,<> %r25,0,l1 ! sh3add %r26,%r29,%r29 ! bv,n 0(r31) ! nop + +x9: comb,<> %r25,0,l0 ! sh3add %r26,%r26,%r1 ! bv 0(r31) ! add %r29,%r1,%r29 + +x10: sh2add %r26,%r26,%r1 ! comb,<> %r25,0,l1 ! sh1add %r1,%r29,%r29 ! bv,n 0(r31) + +x11: sh1add %r26,%r26,%r1 ! comb,<> %r25,0,l0 ! sh3add %r26,%r29,%r29 ! b,n ret_t0 + +x12: sh1add %r26,%r26,%r1 ! comb,<> %r25,0,l1 ! sh2add %r1,%r29,%r29 ! bv,n 0(r31) + +x13: sh2add %r26,%r26,%r1 ! comb,<> %r25,0,l0 ! sh3add %r26,%r29,%r29 ! b,n ret_t0 + +x14: sh1add %r26,%r26,%r1 ! sh1add %r1,%r26,%r1 ! b e_shift ! sh1add %r1,%r29,%r29 + +x15: sh2add %r26,%r26,%r1 ! comb,<> %r25,0,l0 ! sh1add %r1,%r1,%r1 ! b,n ret_t0 + +x16: zdep %r26,27,28,%r1 ! comb,<> %r25,0,l1 ! add %r29,%r1,%r29 ! bv,n 0(r31) + +x17: sh3add %r26,%r26,%r1 ! comb,<> %r25,0,l0 ! sh3add %r26,%r1,%r1 ! b,n ret_t0 + +x18: sh3add %r26,%r26,%r1 ! comb,<> %r25,0,l1 ! sh1add %r1,%r29,%r29 ! bv,n 0(r31) + +x19: sh3add %r26,%r26,%r1 ! comb,<> %r25,0,l0 ! sh1add %r1,%r26,%r1 ! b,n ret_t0 + +x20: sh2add %r26,%r26,%r1 ! comb,<> %r25,0,l1 ! sh2add %r1,%r29,%r29 ! bv,n 0(r31) + +x21: sh2add %r26,%r26,%r1 ! comb,<> %r25,0,l0 ! sh2add %r1,%r26,%r1 ! b,n ret_t0 + +x22: sh2add %r26,%r26,%r1 ! sh1add %r1,%r26,%r1 ! b e_shift ! sh1add %r1,%r29,%r29 + +x23: sh2add %r26,%r26,%r1 ! sh1add %r1,%r26,%r1 ! b e_t0 ! sh1add %r1,%r26,%r1 + +x24: sh1add %r26,%r26,%r1 ! comb,<> %r25,0,l1 ! sh3add %r1,%r29,%r29 ! bv,n 0(r31) + +x25: sh2add %r26,%r26,%r1 ! comb,<> %r25,0,l0 ! sh2add %r1,%r1,%r1 ! b,n ret_t0 + +x26: sh1add %r26,%r26,%r1 ! sh2add %r1,%r26,%r1 ! b e_shift ! sh1add %r1,%r29,%r29 + +x27: sh1add %r26,%r26,%r1 ! comb,<> %r25,0,l0 ! sh3add %r1,%r1,%r1 ! b,n ret_t0 + +x28: sh1add %r26,%r26,%r1 ! sh1add %r1,%r26,%r1 ! b e_shift ! sh2add %r1,%r29,%r29 + +x29: sh1add %r26,%r26,%r1 ! sh1add %r1,%r26,%r1 ! b e_t0 ! sh2add %r1,%r26,%r1 + +x30: sh2add %r26,%r26,%r1 ! sh1add %r1,%r1,%r1 ! b e_shift ! sh1add %r1,%r29,%r29 + +x31: zdep %r26,26,27,%r1 ! comb,<> %r25,0,l0 ! sub %r1,%r26,%r1 ! b,n ret_t0 + +x32: zdep %r26,26,27,%r1 ! comb,<> %r25,0,l1 ! add %r29,%r1,%r29 ! bv,n 0(r31) + +x33: sh3add %r26,0,%r1 ! comb,<> %r25,0,l0 ! sh2add %r1,%r26,%r1 ! b,n ret_t0 + +x34: zdep %r26,27,28,%r1 ! add %r1,%r26,%r1 ! b e_shift ! sh1add %r1,%r29,%r29 + +x35: sh3add %r26,%r26,%r1 ! sh1add %r1,%r1,%r1 ! b e_t0 ! sh3add %r26,%r1,%r1 + +x36: sh3add %r26,%r26,%r1 ! comb,<> %r25,0,l1 ! sh2add %r1,%r29,%r29 ! bv,n 0(r31) + +x37: sh3add %r26,%r26,%r1 ! comb,<> %r25,0,l0 ! sh2add %r1,%r26,%r1 ! b,n ret_t0 + +x38: sh3add %r26,%r26,%r1 ! sh1add %r1,%r26,%r1 ! b e_shift ! sh1add %r1,%r29,%r29 + +x39: sh3add %r26,%r26,%r1 ! sh1add %r1,%r26,%r1 ! b e_t0 ! sh1add %r1,%r26,%r1 + +x40: sh2add %r26,%r26,%r1 ! comb,<> %r25,0,l1 ! sh3add %r1,%r29,%r29 ! bv,n 0(r31) + +x41: sh2add %r26,%r26,%r1 ! comb,<> %r25,0,l0 ! sh3add %r1,%r26,%r1 ! b,n ret_t0 + +x42: sh2add %r26,%r26,%r1 ! sh2add %r1,%r26,%r1 ! b e_shift ! sh1add %r1,%r29,%r29 + +x43: sh2add %r26,%r26,%r1 ! sh2add %r1,%r26,%r1 ! b e_t0 ! sh1add %r1,%r26,%r1 + +x44: sh2add %r26,%r26,%r1 ! sh1add %r1,%r26,%r1 ! b e_shift ! sh2add %r1,%r29,%r29 + +x45: sh3add %r26,%r26,%r1 ! comb,<> %r25,0,l0 ! sh2add %r1,%r1,%r1 ! b,n ret_t0 + +x46: sh3add %r26,%r26,%r1 ! sh2add %r1,%r1,%r1 ! b e_t0 ! add %r1,%r26,%r1 + +x47: sh3add %r26,%r26,%r1 ! sh2add %r1,%r1,%r1 ! b e_t0 ! sh1add %r26,%r1,%r1 + +x48: sh1add %r26,%r26,%r1 ! comb,<> %r25,0,l0 ! zdep %r1,27,28,%r1 ! b,n ret_t0 + +x49: sh3add %r26,%r26,%r1 ! sh2add %r1,%r1,%r1 ! b e_t0 ! sh2add %r26,%r1,%r1 + +x50: sh2add %r26,%r26,%r1 ! sh2add %r1,%r1,%r1 ! b e_shift ! sh1add %r1,%r29,%r29 + +x51: sh3add %r26,%r26,%r1 ! sh3add %r26,%r1,%r1 ! b e_t0 ! sh1add %r1,%r1,%r1 + +x52: sh1add %r26,%r26,%r1 ! sh2add %r1,%r26,%r1 ! b e_shift ! sh2add %r1,%r29,%r29 + +x53: sh1add %r26,%r26,%r1 ! sh2add %r1,%r26,%r1 ! b e_t0 ! sh2add %r1,%r26,%r1 + +x54: sh3add %r26,%r26,%r1 ! sh1add %r1,%r1,%r1 ! b e_shift ! sh1add %r1,%r29,%r29 + +x55: sh3add %r26,%r26,%r1 ! sh1add %r1,%r1,%r1 ! b e_t0 ! sh1add %r1,%r26,%r1 + +x56: sh1add %r26,%r26,%r1 ! sh1add %r1,%r26,%r1 ! b e_shift ! sh3add %r1,%r29,%r29 + +x57: sh3add %r26,%r26,%r1 ! sh1add %r1,%r26,%r1 ! b e_t0 ! sh1add %r1,%r1,%r1 + +x58: sh1add %r26,%r26,%r1 ! sh1add %r1,%r26,%r1 ! b e_2t0 ! sh2add %r1,%r26,%r1 + +x59: sh3add %r26,%r26,%r1 ! sh1add %r1,%r26,%r1 ! b e_t02a0 ! sh1add %r1,%r1,%r1 + +x60: sh2add %r26,%r26,%r1 ! sh1add %r1,%r1,%r1 ! b e_shift ! sh2add %r1,%r29,%r29 + +x61: sh2add %r26,%r26,%r1 ! sh1add %r1,%r1,%r1 ! b e_t0 ! sh2add %r1,%r26,%r1 + +x62: zdep %r26,26,27,%r1 ! sub %r1,%r26,%r1 ! b e_shift ! sh1add %r1,%r29,%r29 + +x63: zdep %r26,25,26,%r1 ! comb,<> %r25,0,l0 ! sub %r1,%r26,%r1 ! b,n ret_t0 + +x64: zdep %r26,25,26,%r1 ! comb,<> %r25,0,l1 ! add %r29,%r1,%r29 ! bv,n 0(r31) + +x65: sh3add %r26,0,%r1 ! comb,<> %r25,0,l0 ! sh3add %r1,%r26,%r1 ! b,n ret_t0 + +x66: zdep %r26,26,27,%r1 ! add %r1,%r26,%r1 ! b e_shift ! sh1add %r1,%r29,%r29 + +x67: sh3add %r26,0,%r1 ! sh2add %r1,%r26,%r1 ! b e_t0 ! sh1add %r1,%r26,%r1 + +x68: sh3add %r26,0,%r1 ! sh1add %r1,%r26,%r1 ! b e_shift ! sh2add %r1,%r29,%r29 + +x69: sh3add %r26,0,%r1 ! sh1add %r1,%r26,%r1 ! b e_t0 ! sh2add %r1,%r26,%r1 + +x70: zdep %r26,25,26,%r1 ! sh2add %r26,%r1,%r1 ! b e_t0 ! sh1add %r26,%r1,%r1 + +x71: sh3add %r26,%r26,%r1 ! sh3add %r1,0,%r1 ! b e_t0 ! sub %r1,%r26,%r1 + +x72: sh3add %r26,%r26,%r1 ! comb,<> %r25,0,l1 ! sh3add %r1,%r29,%r29 ! bv,n 0(r31) + +x73: sh3add %r26,%r26,%r1 ! sh3add %r1,%r26,%r1 ! b e_shift ! add %r29,%r1,%r29 + +x74: sh3add %r26,%r26,%r1 ! sh2add %r1,%r26,%r1 ! b e_shift ! sh1add %r1,%r29,%r29 + +x75: sh3add %r26,%r26,%r1 ! sh2add %r1,%r26,%r1 ! b e_t0 ! sh1add %r1,%r26,%r1 + +x76: sh3add %r26,%r26,%r1 ! sh1add %r1,%r26,%r1 ! b e_shift ! sh2add %r1,%r29,%r29 + +x77: sh3add %r26,%r26,%r1 ! sh1add %r1,%r26,%r1 ! b e_t0 ! sh2add %r1,%r26,%r1 + +x78: sh3add %r26,%r26,%r1 ! sh1add %r1,%r26,%r1 ! b e_2t0 ! sh1add %r1,%r26,%r1 + +x79: zdep %r26,27,28,%r1 ! sh2add %r1,%r1,%r1 ! b e_t0 ! sub %r1,%r26,%r1 + +x80: zdep %r26,27,28,%r1 ! sh2add %r1,%r1,%r1 ! b e_shift ! add %r29,%r1,%r29 + +x81: sh3add %r26,%r26,%r1 ! sh3add %r1,%r1,%r1 ! b e_shift ! add %r29,%r1,%r29 + +x82: sh2add %r26,%r26,%r1 ! sh3add %r1,%r26,%r1 ! b e_shift ! sh1add %r1,%r29,%r29 + +x83: sh2add %r26,%r26,%r1 ! sh3add %r1,%r26,%r1 ! b e_t0 ! sh1add %r1,%r26,%r1 + +x84: sh2add %r26,%r26,%r1 ! sh2add %r1,%r26,%r1 ! b e_shift ! sh2add %r1,%r29,%r29 + +x85: sh3add %r26,0,%r1 ! sh1add %r1,%r26,%r1 ! b e_t0 ! sh2add %r1,%r1,%r1 + +x86: sh2add %r26,%r26,%r1 ! sh2add %r1,%r26,%r1 ! b e_2t0 ! sh1add %r1,%r26,%r1 + +x87: sh3add %r26,%r26,%r1 ! sh3add %r1,%r1,%r1 ! b e_t02a0 ! sh2add %r26,%r1,%r1 + +x88: sh2add %r26,%r26,%r1 ! sh1add %r1,%r26,%r1 ! b e_shift ! sh3add %r1,%r29,%r29 + +x89: sh2add %r26,%r26,%r1 ! sh1add %r1,%r26,%r1 ! b e_t0 ! sh3add %r1,%r26,%r1 + +x90: sh3add %r26,%r26,%r1 ! sh2add %r1,%r1,%r1 ! b e_shift ! sh1add %r1,%r29,%r29 + +x91: sh3add %r26,%r26,%r1 ! sh2add %r1,%r1,%r1 ! b e_t0 ! sh1add %r1,%r26,%r1 + +x92: sh2add %r26,%r26,%r1 ! sh1add %r1,%r26,%r1 ! b e_4t0 ! sh1add %r1,%r26,%r1 + +x93: zdep %r26,26,27,%r1 ! sub %r1,%r26,%r1 ! b e_t0 ! sh1add %r1,%r1,%r1 + +x94: sh3add %r26,%r26,%r1 ! sh2add %r1,%r1,%r1 ! b e_2t0 ! sh1add %r26,%r1,%r1 + +x95: sh3add %r26,%r26,%r1 ! sh1add %r1,%r26,%r1 ! b e_t0 ! sh2add %r1,%r1,%r1 + +x96: sh3add %r26,0,%r1 ! sh1add %r1,%r1,%r1 ! b e_shift ! sh2add %r1,%r29,%r29 + +x97: sh3add %r26,0,%r1 ! sh1add %r1,%r1,%r1 ! b e_t0 ! sh2add %r1,%r26,%r1 + +x98: zdep %r26,26,27,%r1 ! sh1add %r1,%r1,%r1 ! b e_t0 ! sh1add %r26,%r1,%r1 + +x99: sh3add %r26,0,%r1 ! sh2add %r1,%r26,%r1 ! b e_t0 ! sh1add %r1,%r1,%r1 + +x100: sh2add %r26,%r26,%r1 ! sh2add %r1,%r1,%r1 ! b e_shift ! sh2add %r1,%r29,%r29 + +x101: sh2add %r26,%r26,%r1 ! sh2add %r1,%r1,%r1 ! b e_t0 ! sh2add %r1,%r26,%r1 + +x102: zdep %r26,26,27,%r1 ! sh1add %r26,%r1,%r1 ! b e_t0 ! sh1add %r1,%r1,%r1 + +x103: sh2add %r26,%r26,%r1 ! sh2add %r1,%r1,%r1 ! b e_t02a0 ! sh2add %r1,%r26,%r1 + +x104: sh1add %r26,%r26,%r1 ! sh2add %r1,%r26,%r1 ! b e_shift ! sh3add %r1,%r29,%r29 + +x105: sh2add %r26,%r26,%r1 ! sh2add %r1,%r26,%r1 ! b e_t0 ! sh2add %r1,%r1,%r1 + +x106: sh1add %r26,%r26,%r1 ! sh2add %r1,%r26,%r1 ! b e_2t0 ! sh2add %r1,%r26,%r1 + +x107: sh3add %r26,%r26,%r1 ! sh2add %r26,%r1,%r1 ! b e_t02a0 ! sh3add %r1,%r26,%r1 + +x108: sh3add %r26,%r26,%r1 ! sh1add %r1,%r1,%r1 ! b e_shift ! sh2add %r1,%r29,%r29 + +x109: sh3add %r26,%r26,%r1 ! sh1add %r1,%r1,%r1 ! b e_t0 ! sh2add %r1,%r26,%r1 + +x110: sh3add %r26,%r26,%r1 ! sh1add %r1,%r1,%r1 ! b e_2t0 ! sh1add %r1,%r26,%r1 + +x111: sh3add %r26,%r26,%r1 ! sh2add %r1,%r26,%r1 ! b e_t0 ! sh1add %r1,%r1,%r1 + +x112: sh1add %r26,%r26,%r1 ! sh1add %r1,%r26,%r1 ! b e_t0 ! zdep %r1,27,28,%r1 + +x113: sh3add %r26,%r26,%r1 ! sh2add %r1,%r26,%r1 ! b e_t02a0 ! sh1add %r1,%r1,%r1 + +x114: sh3add %r26,%r26,%r1 ! sh1add %r1,%r26,%r1 ! b e_2t0 ! sh1add %r1,%r1,%r1 + +x115: sh3add %r26,%r26,%r1 ! sh1add %r1,%r26,%r1 ! b e_2t0a0 ! sh1add %r1,%r1,%r1 + +x116: sh1add %r26,%r26,%r1 ! sh1add %r1,%r26,%r1 ! b e_4t0 ! sh2add %r1,%r26,%r1 + +x117: sh1add %r26,%r26,%r1 ! sh2add %r1,%r26,%r1 ! b e_t0 ! sh3add %r1,%r1,%r1 + +x118: sh1add %r26,%r26,%r1 ! sh2add %r1,%r26,%r1 ! b e_t0a0 ! sh3add %r1,%r1,%r1 + +x119: sh1add %r26,%r26,%r1 ! sh2add %r1,%r26,%r1 ! b e_t02a0 ! sh3add %r1,%r1,%r1 + +x120: sh2add %r26,%r26,%r1 ! sh1add %r1,%r1,%r1 ! b e_shift ! sh3add %r1,%r29,%r29 + +x121: sh2add %r26,%r26,%r1 ! sh1add %r1,%r1,%r1 ! b e_t0 ! sh3add %r1,%r26,%r1 + +x122: sh2add %r26,%r26,%r1 ! sh1add %r1,%r1,%r1 ! b e_2t0 ! sh2add %r1,%r26,%r1 + +x123: sh2add %r26,%r26,%r1 ! sh3add %r1,%r26,%r1 ! b e_t0 ! sh1add %r1,%r1,%r1 + +x124: zdep %r26,26,27,%r1 ! sub %r1,%r26,%r1 ! b e_shift ! sh2add %r1,%r29,%r29 + +x125: sh2add %r26,%r26,%r1 ! sh2add %r1,%r1,%r1 ! b e_t0 ! sh2add %r1,%r1,%r1 + +x126: zdep %r26,25,26,%r1 ! sub %r1,%r26,%r1 ! b e_shift ! sh1add %r1,%r29,%r29 + +x127: zdep %r26,24,25,%r1 ! comb,<> %r25,0,l0 ! sub %r1,%r26,%r1 ! b,n ret_t0 + +x128: zdep %r26,24,25,%r1 ! comb,<> %r25,0,l1 ! add %r29,%r1,%r29 ! bv,n 0(r31) + +x129: zdep %r26,24,25,%r1 ! comb,<> %r25,0,l0 ! add %r1,%r26,%r1 ! b,n ret_t0 + +x130: zdep %r26,25,26,%r1 ! add %r1,%r26,%r1 ! b e_shift ! sh1add %r1,%r29,%r29 + +x131: sh3add %r26,0,%r1 ! sh3add %r1,%r26,%r1 ! b e_t0 ! sh1add %r1,%r26,%r1 + +x132: sh3add %r26,0,%r1 ! sh2add %r1,%r26,%r1 ! b e_shift ! sh2add %r1,%r29,%r29 + +x133: sh3add %r26,0,%r1 ! sh2add %r1,%r26,%r1 ! b e_t0 ! sh2add %r1,%r26,%r1 + +x134: sh3add %r26,0,%r1 ! sh2add %r1,%r26,%r1 ! b e_2t0 ! sh1add %r1,%r26,%r1 + +x135: sh3add %r26,%r26,%r1 ! sh2add %r1,%r1,%r1 ! b e_t0 ! sh1add %r1,%r1,%r1 + +x136: sh3add %r26,0,%r1 ! sh1add %r1,%r26,%r1 ! b e_shift ! sh3add %r1,%r29,%r29 + +x137: sh3add %r26,0,%r1 ! sh1add %r1,%r26,%r1 ! b e_t0 ! sh3add %r1,%r26,%r1 + +x138: sh3add %r26,0,%r1 ! sh1add %r1,%r26,%r1 ! b e_2t0 ! sh2add %r1,%r26,%r1 + +x139: sh3add %r26,0,%r1 ! sh1add %r1,%r26,%r1 ! b e_2t0a0 ! sh2add %r1,%r26,%r1 + +x140: sh1add %r26,%r26,%r1 ! sh1add %r1,%r26,%r1 ! b e_4t0 ! sh2add %r1,%r1,%r1 + +x141: sh3add %r26,0,%r1 ! sh1add %r1,%r26,%r1 ! b e_4t0a0 ! sh1add %r1,%r26,%r1 + +x142: sh3add %r26,%r26,%r1 ! sh3add %r1,0,%r1 ! b e_2t0 ! sub %r1,%r26,%r1 + +x143: zdep %r26,27,28,%r1 ! sh3add %r1,%r1,%r1 ! b e_t0 ! sub %r1,%r26,%r1 + +x144: sh3add %r26,%r26,%r1 ! sh3add %r1,0,%r1 ! b e_shift ! sh1add %r1,%r29,%r29 + +x145: sh3add %r26,%r26,%r1 ! sh3add %r1,0,%r1 ! b e_t0 ! sh1add %r1,%r26,%r1 + +x146: sh3add %r26,%r26,%r1 ! sh3add %r1,%r26,%r1 ! b e_shift ! sh1add %r1,%r29,%r29 + +x147: sh3add %r26,%r26,%r1 ! sh3add %r1,%r26,%r1 ! b e_t0 ! sh1add %r1,%r26,%r1 + +x148: sh3add %r26,%r26,%r1 ! sh2add %r1,%r26,%r1 ! b e_shift ! sh2add %r1,%r29,%r29 + +x149: sh3add %r26,%r26,%r1 ! sh2add %r1,%r26,%r1 ! b e_t0 ! sh2add %r1,%r26,%r1 + +x150: sh3add %r26,%r26,%r1 ! sh2add %r1,%r26,%r1 ! b e_2t0 ! sh1add %r1,%r26,%r1 + +x151: sh3add %r26,%r26,%r1 ! sh2add %r1,%r26,%r1 ! b e_2t0a0 ! sh1add %r1,%r26,%r1 + +x152: sh3add %r26,%r26,%r1 ! sh1add %r1,%r26,%r1 ! b e_shift ! sh3add %r1,%r29,%r29 + +x153: sh3add %r26,%r26,%r1 ! sh1add %r1,%r26,%r1 ! b e_t0 ! sh3add %r1,%r26,%r1 + +x154: sh3add %r26,%r26,%r1 ! sh1add %r1,%r26,%r1 ! b e_2t0 ! sh2add %r1,%r26,%r1 + +x155: zdep %r26,26,27,%r1 ! sub %r1,%r26,%r1 ! b e_t0 ! sh2add %r1,%r1,%r1 + +x156: sh3add %r26,%r26,%r1 ! sh1add %r1,%r26,%r1 ! b e_4t0 ! sh1add %r1,%r26,%r1 + +x157: zdep %r26,26,27,%r1 ! sub %r1,%r26,%r1 ! b e_t02a0 ! sh2add %r1,%r1,%r1 + +x158: zdep %r26,27,28,%r1 ! sh2add %r1,%r1,%r1 ! b e_2t0 ! sub %r1,%r26,%r1 + +x159: zdep %r26,26,27,%r1 ! sh2add %r1,%r1,%r1 ! b e_t0 ! sub %r1,%r26,%r1 + +x160: sh2add %r26,%r26,%r1 ! sh2add %r1,0,%r1 ! b e_shift ! sh3add %r1,%r29,%r29 + +x161: sh3add %r26,0,%r1 ! sh2add %r1,%r1,%r1 ! b e_t0 ! sh2add %r1,%r26,%r1 + +x162: sh3add %r26,%r26,%r1 ! sh3add %r1,%r1,%r1 ! b e_shift ! sh1add %r1,%r29,%r29 + +x163: sh3add %r26,%r26,%r1 ! sh3add %r1,%r1,%r1 ! b e_t0 ! sh1add %r1,%r26,%r1 + +x164: sh2add %r26,%r26,%r1 ! sh3add %r1,%r26,%r1 ! b e_shift ! sh2add %r1,%r29,%r29 + +x165: sh3add %r26,0,%r1 ! sh2add %r1,%r26,%r1 ! b e_t0 ! sh2add %r1,%r1,%r1 + +x166: sh2add %r26,%r26,%r1 ! sh3add %r1,%r26,%r1 ! b e_2t0 ! sh1add %r1,%r26,%r1 + +x167: sh2add %r26,%r26,%r1 ! sh3add %r1,%r26,%r1 ! b e_2t0a0 ! sh1add %r1,%r26,%r1 + +x168: sh2add %r26,%r26,%r1 ! sh2add %r1,%r26,%r1 ! b e_shift ! sh3add %r1,%r29,%r29 + +x169: sh2add %r26,%r26,%r1 ! sh2add %r1,%r26,%r1 ! b e_t0 ! sh3add %r1,%r26,%r1 + +x170: zdep %r26,26,27,%r1 ! sh1add %r26,%r1,%r1 ! b e_t0 ! sh2add %r1,%r1,%r1 + +x171: sh3add %r26,%r26,%r1 ! sh1add %r1,%r26,%r1 ! b e_t0 ! sh3add %r1,%r1,%r1 + +x172: sh2add %r26,%r26,%r1 ! sh2add %r1,%r26,%r1 ! b e_4t0 ! sh1add %r1,%r26,%r1 + +x173: sh3add %r26,%r26,%r1 ! sh1add %r1,%r26,%r1 ! b e_t02a0 ! sh3add %r1,%r1,%r1 + +x174: zdep %r26,26,27,%r1 ! sh1add %r26,%r1,%r1 ! b e_t04a0 ! sh2add %r1,%r1,%r1 + +x175: sh3add %r26,0,%r1 ! sh1add %r1,%r26,%r1 ! b e_5t0 ! sh1add %r1,%r26,%r1 + +x176: sh2add %r26,%r26,%r1 ! sh2add %r1,%r26,%r1 ! b e_8t0 ! add %r1,%r26,%r1 + +x177: sh2add %r26,%r26,%r1 ! sh2add %r1,%r26,%r1 ! b e_8t0a0 ! add %r1,%r26,%r1 + +x178: sh2add %r26,%r26,%r1 ! sh1add %r1,%r26,%r1 ! b e_2t0 ! sh3add %r1,%r26,%r1 + +x179: sh2add %r26,%r26,%r1 ! sh1add %r1,%r26,%r1 ! b e_2t0a0 ! sh3add %r1,%r26,%r1 + +x180: sh3add %r26,%r26,%r1 ! sh2add %r1,%r1,%r1 ! b e_shift ! sh2add %r1,%r29,%r29 + +x181: sh3add %r26,%r26,%r1 ! sh2add %r1,%r1,%r1 ! b e_t0 ! sh2add %r1,%r26,%r1 + +x182: sh3add %r26,%r26,%r1 ! sh2add %r1,%r1,%r1 ! b e_2t0 ! sh1add %r1,%r26,%r1 + +x183: sh3add %r26,%r26,%r1 ! sh2add %r1,%r1,%r1 ! b e_2t0a0 ! sh1add %r1,%r26,%r1 + +x184: sh2add %r26,%r26,%r1 ! sh3add %r1,%r1,%r1 ! b e_4t0 ! add %r1,%r26,%r1 + +x185: sh3add %r26,%r26,%r1 ! sh2add %r1,%r26,%r1 ! b e_t0 ! sh2add %r1,%r1,%r1 + +x186: zdep %r26,26,27,%r1 ! sub %r1,%r26,%r1 ! b e_2t0 ! sh1add %r1,%r1,%r1 + +x187: sh3add %r26,%r26,%r1 ! sh2add %r1,%r26,%r1 ! b e_t02a0 ! sh2add %r1,%r1,%r1 + +x188: sh3add %r26,%r26,%r1 ! sh2add %r1,%r1,%r1 ! b e_4t0 ! sh1add %r26,%r1,%r1 + +x189: sh2add %r26,%r26,%r1 ! sh2add %r1,%r26,%r1 ! b e_t0 ! sh3add %r1,%r1,%r1 + +x190: sh3add %r26,%r26,%r1 ! sh1add %r1,%r26,%r1 ! b e_2t0 ! sh2add %r1,%r1,%r1 + +x191: zdep %r26,25,26,%r1 ! sh1add %r1,%r1,%r1 ! b e_t0 ! sub %r1,%r26,%r1 + +x192: sh3add %r26,0,%r1 ! sh1add %r1,%r1,%r1 ! b e_shift ! sh3add %r1,%r29,%r29 + +x193: sh3add %r26,0,%r1 ! sh1add %r1,%r1,%r1 ! b e_t0 ! sh3add %r1,%r26,%r1 + +x194: sh3add %r26,0,%r1 ! sh1add %r1,%r1,%r1 ! b e_2t0 ! sh2add %r1,%r26,%r1 + +x195: sh3add %r26,0,%r1 ! sh3add %r1,%r26,%r1 ! b e_t0 ! sh1add %r1,%r1,%r1 + +x196: sh3add %r26,0,%r1 ! sh1add %r1,%r1,%r1 ! b e_4t0 ! sh1add %r1,%r26,%r1 + +x197: sh3add %r26,0,%r1 ! sh1add %r1,%r1,%r1 ! b e_4t0a0 ! sh1add %r1,%r26,%r1 + +x198: zdep %r26,25,26,%r1 ! sh1add %r26,%r1,%r1 ! b e_t0 ! sh1add %r1,%r1,%r1 + +x199: sh3add %r26,0,%r1 ! sh2add %r1,%r26,%r1 ! b e_2t0a0 ! sh1add %r1,%r1,%r1 + +x200: sh2add %r26,%r26,%r1 ! sh2add %r1,%r1,%r1 ! b e_shift ! sh3add %r1,%r29,%r29 + +x201: sh2add %r26,%r26,%r1 ! sh2add %r1,%r1,%r1 ! b e_t0 ! sh3add %r1,%r26,%r1 + +x202: sh2add %r26,%r26,%r1 ! sh2add %r1,%r1,%r1 ! b e_2t0 ! sh2add %r1,%r26,%r1 + +x203: sh2add %r26,%r26,%r1 ! sh2add %r1,%r1,%r1 ! b e_2t0a0 ! sh2add %r1,%r26,%r1 + +x204: sh3add %r26,0,%r1 ! sh1add %r1,%r26,%r1 ! b e_4t0 ! sh1add %r1,%r1,%r1 + +x205: sh2add %r26,%r26,%r1 ! sh3add %r1,%r26,%r1 ! b e_t0 ! sh2add %r1,%r1,%r1 + +x206: zdep %r26,25,26,%r1 ! sh2add %r26,%r1,%r1 ! b e_t02a0 ! sh1add %r1,%r1,%r1 + +x207: sh3add %r26,0,%r1 ! sh1add %r1,%r26,%r1 ! b e_3t0 ! sh2add %r1,%r26,%r1 + +x208: sh2add %r26,%r26,%r1 ! sh2add %r1,%r1,%r1 ! b e_8t0 ! add %r1,%r26,%r1 + +x209: sh2add %r26,%r26,%r1 ! sh2add %r1,%r1,%r1 ! b e_8t0a0 ! add %r1,%r26,%r1 + +x210: sh2add %r26,%r26,%r1 ! sh2add %r1,%r26,%r1 ! b e_2t0 ! sh2add %r1,%r1,%r1 + +x211: sh2add %r26,%r26,%r1 ! sh2add %r1,%r26,%r1 ! b e_2t0a0 ! sh2add %r1,%r1,%r1 + +x212: sh1add %r26,%r26,%r1 ! sh2add %r1,%r26,%r1 ! b e_4t0 ! sh2add %r1,%r26,%r1 + +x213: sh1add %r26,%r26,%r1 ! sh2add %r1,%r26,%r1 ! b e_4t0a0 ! sh2add %r1,%r26,%r1 + +x214: sh3add %r26,%r26,%r1 ! sh2add %r26,%r1,%r1 ! b e2t04a0 ! sh3add %r1,%r26,%r1 + +x215: sh2add %r26,%r26,%r1 ! sh2add %r1,%r26,%r1 ! b e_5t0 ! sh1add %r1,%r26,%r1 + +x216: sh3add %r26,%r26,%r1 ! sh1add %r1,%r1,%r1 ! b e_shift ! sh3add %r1,%r29,%r29 + +x217: sh3add %r26,%r26,%r1 ! sh1add %r1,%r1,%r1 ! b e_t0 ! sh3add %r1,%r26,%r1 + +x218: sh3add %r26,%r26,%r1 ! sh1add %r1,%r1,%r1 ! b e_2t0 ! sh2add %r1,%r26,%r1 + +x219: sh3add %r26,%r26,%r1 ! sh3add %r1,%r26,%r1 ! b e_t0 ! sh1add %r1,%r1,%r1 + +x220: sh1add %r26,%r26,%r1 ! sh3add %r1,%r1,%r1 ! b e_4t0 ! sh1add %r1,%r26,%r1 + +x221: sh1add %r26,%r26,%r1 ! sh3add %r1,%r1,%r1 ! b e_4t0a0 ! sh1add %r1,%r26,%r1 + +x222: sh3add %r26,%r26,%r1 ! sh2add %r1,%r26,%r1 ! b e_2t0 ! sh1add %r1,%r1,%r1 + +x223: sh3add %r26,%r26,%r1 ! sh2add %r1,%r26,%r1 ! b e_2t0a0 ! sh1add %r1,%r1,%r1 + +x224: sh3add %r26,%r26,%r1 ! sh1add %r1,%r1,%r1 ! b e_8t0 ! add %r1,%r26,%r1 + +x225: sh3add %r26,%r26,%r1 ! sh2add %r1,%r1,%r1 ! b e_t0 ! sh2add %r1,%r1,%r1 + +x226: sh1add %r26,%r26,%r1 ! sh1add %r1,%r26,%r1 ! b e_t02a0 ! zdep %r1,26,27,%r1 + +x227: sh3add %r26,%r26,%r1 ! sh2add %r1,%r1,%r1 ! b e_t02a0 ! sh2add %r1,%r1,%r1 + +x228: sh3add %r26,%r26,%r1 ! sh1add %r1,%r26,%r1 ! b e_4t0 ! sh1add %r1,%r1,%r1 + +x229: sh3add %r26,%r26,%r1 ! sh1add %r1,%r26,%r1 ! b e_4t0a0 ! sh1add %r1,%r1,%r1 + +x230: sh3add %r26,%r26,%r1 ! sh2add %r1,%r1,%r1 ! b e_5t0 ! add %r1,%r26,%r1 + +x231: sh3add %r26,%r26,%r1 ! sh1add %r1,%r26,%r1 ! b e_3t0 ! sh2add %r1,%r26,%r1 + +x232: sh1add %r26,%r26,%r1 ! sh1add %r1,%r26,%r1 ! b e_8t0 ! sh2add %r1,%r26,%r1 + +x233: sh1add %r26,%r26,%r1 ! sh1add %r1,%r26,%r1 ! b e_8t0a0 ! sh2add %r1,%r26,%r1 + +x234: sh1add %r26,%r26,%r1 ! sh2add %r1,%r26,%r1 ! b e_2t0 ! sh3add %r1,%r1,%r1 + +x235: sh1add %r26,%r26,%r1 ! sh2add %r1,%r26,%r1 ! b e_2t0a0 ! sh3add %r1,%r1,%r1 + +x236: sh3add %r26,%r26,%r1 ! sh1add %r1,%r26,%r1 ! b e4t08a0 ! sh1add %r1,%r1,%r1 + +x237: zdep %r26,27,28,%r1 ! sh2add %r1,%r1,%r1 ! b e_3t0 ! sub %r1,%r26,%r1 + +x238: sh1add %r26,%r26,%r1 ! sh2add %r1,%r26,%r1 ! b e2t04a0 ! sh3add %r1,%r1,%r1 + +x239: zdep %r26,27,28,%r1 ! sh2add %r1,%r1,%r1 ! b e_t0ma0 ! sh1add %r1,%r1,%r1 + +x240: sh3add %r26,%r26,%r1 ! add %r1,%r26,%r1 ! b e_8t0 ! sh1add %r1,%r1,%r1 + +x241: sh3add %r26,%r26,%r1 ! add %r1,%r26,%r1 ! b e_8t0a0 ! sh1add %r1,%r1,%r1 + +x242: sh2add %r26,%r26,%r1 ! sh1add %r1,%r1,%r1 ! b e_2t0 ! sh3add %r1,%r26,%r1 + +x243: sh3add %r26,%r26,%r1 ! sh3add %r1,%r1,%r1 ! b e_t0 ! sh1add %r1,%r1,%r1 + +x244: sh2add %r26,%r26,%r1 ! sh1add %r1,%r1,%r1 ! b e_4t0 ! sh2add %r1,%r26,%r1 + +x245: sh3add %r26,0,%r1 ! sh1add %r1,%r1,%r1 ! b e_5t0 ! sh1add %r1,%r26,%r1 + +x246: sh2add %r26,%r26,%r1 ! sh3add %r1,%r26,%r1 ! b e_2t0 ! sh1add %r1,%r1,%r1 + +x247: sh2add %r26,%r26,%r1 ! sh3add %r1,%r26,%r1 ! b e_2t0a0 ! sh1add %r1,%r1,%r1 + +x248: zdep %r26,26,27,%r1 ! sub %r1,%r26,%r1 ! b e_shift ! sh3add %r1,%r29,%r29 + +x249: zdep %r26,26,27,%r1 ! sub %r1,%r26,%r1 ! b e_t0 ! sh3add %r1,%r26,%r1 + +x250: sh2add %r26,%r26,%r1 ! sh2add %r1,%r1,%r1 ! b e_2t0 ! sh2add %r1,%r1,%r1 + +x251: sh2add %r26,%r26,%r1 ! sh2add %r1,%r1,%r1 ! b e_2t0a0 ! sh2add %r1,%r1,%r1 + +x252: zdep %r26,25,26,%r1 ! sub %r1,%r26,%r1 ! b e_shift ! sh2add %r1,%r29,%r29 + +x253: zdep %r26,25,26,%r1 ! sub %r1,%r26,%r1 ! b e_t0 ! sh2add %r1,%r26,%r1 + +x254: zdep %r26,24,25,%r1 ! sub %r1,%r26,%r1 ! b e_shift ! sh1add %r1,%r29,%r29 + +x255: zdep %r26,23,24,%r1 ! comb,<> %r25,0,l0 ! sub %r1,%r26,%r1 ! b,n ret_t0 + +;1040 insts before this. +ret_t0: bv 0(r31) + +e_t0: add %r29,%r1,%r29 + +e_shift: comb,<> %r25,0,l2 + + zdep %r26,23,24,%r26 ; %r26 <<= 8 *********** + bv,n 0(r31) +e_t0ma0: comb,<> %r25,0,l0 + + sub %r1,%r26,%r1 + bv 0(r31) + add %r29,%r1,%r29 +e_t0a0: comb,<> %r25,0,l0 + + add %r1,%r26,%r1 + bv 0(r31) + add %r29,%r1,%r29 +e_t02a0: comb,<> %r25,0,l0 + + sh1add %r26,%r1,%r1 + bv 0(r31) + add %r29,%r1,%r29 +e_t04a0: comb,<> %r25,0,l0 + + sh2add %r26,%r1,%r1 + bv 0(r31) + add %r29,%r1,%r29 +e_2t0: comb,<> %r25,0,l1 + + sh1add %r1,%r29,%r29 + bv,n 0(r31) +e_2t0a0: comb,<> %r25,0,l0 + + sh1add %r1,%r26,%r1 + bv 0(r31) + add %r29,%r1,%r29 +e2t04a0: sh1add %r26,%r1,%r1 + + comb,<> %r25,0,l1 + sh1add %r1,%r29,%r29 + bv,n 0(r31) +e_3t0: comb,<> %r25,0,l0 + + sh1add %r1,%r1,%r1 + bv 0(r31) + add %r29,%r1,%r29 +e_4t0: comb,<> %r25,0,l1 + + sh2add %r1,%r29,%r29 + bv,n 0(r31) +e_4t0a0: comb,<> %r25,0,l0 + + sh2add %r1,%r26,%r1 + bv 0(r31) + add %r29,%r1,%r29 +e4t08a0: sh1add %r26,%r1,%r1 + + comb,<> %r25,0,l1 + sh2add %r1,%r29,%r29 + bv,n 0(r31) +e_5t0: comb,<> %r25,0,l0 + + sh2add %r1,%r1,%r1 + bv 0(r31) + add %r29,%r1,%r29 +e_8t0: comb,<> %r25,0,l1 + + sh3add %r1,%r29,%r29 + bv,n 0(r31) +e_8t0a0: comb,<> %r25,0,l0 + + sh3add %r1,%r26,%r1 + bv 0(r31) + add %r29,%r1,%r29 + + .exit + .procend + .end + + .import $$divI_2,millicode + .import $$divI_3,millicode + .import $$divI_4,millicode + .import $$divI_5,millicode + .import $$divI_6,millicode + .import $$divI_7,millicode + .import $$divI_8,millicode + .import $$divI_9,millicode + .import $$divI_10,millicode + .import $$divI_12,millicode + .import $$divI_14,millicode + .import $$divI_15,millicode + .export $$divI,millicode + .export $$divoI,millicode +$$divoI: + .proc + .callinfo millicode + .entry + comib,=,n -1,arg1,negative1 ; when divisor == -1 +$$divI: + comib,>>=,n 15,arg1,small_divisor + add,>= 0,arg0,retreg ; move dividend, if retreg < 0, +normal1: + sub 0,retreg,retreg ; make it positive + sub 0,arg1,temp ; clear carry, + ; negate the divisor + ds 0,temp,0 ; set V-bit to the comple- + ; ment of the divisor sign + add retreg,retreg,retreg ; shift msb bit into carry + ds r0,arg1,temp ; 1st divide step, if no carry + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 2nd divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 3rd divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 4th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 5th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 6th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 7th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 8th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 9th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 10th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 11th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 12th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 13th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 14th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 15th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 16th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 17th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 18th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 19th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 20th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 21st divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 22nd divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 23rd divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 24th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 25th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 26th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 27th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 28th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 29th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 30th divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 31st divide step + addc retreg,retreg,retreg ; shift retreg with/into carry + ds temp,arg1,temp ; 32nd divide step, + addc retreg,retreg,retreg ; shift last retreg bit into retreg + xor,>= arg0,arg1,0 ; get correct sign of quotient + sub 0,retreg,retreg ; based on operand signs + bv,n 0(r31) + nop +;______________________________________________________________________ +small_divisor: + blr,n arg1,r0 + nop +; table for divisor == 0,1, ... ,15 + addit,= 0,arg1,r0 ; trap if divisor == 0 + nop + bv 0(r31) ; divisor == 1 + copy arg0,retreg + b,n $$divI_2 ; divisor == 2 + nop + b,n $$divI_3 ; divisor == 3 + nop + b,n $$divI_4 ; divisor == 4 + nop + b,n $$divI_5 ; divisor == 5 + nop + b,n $$divI_6 ; divisor == 6 + nop + b,n $$divI_7 ; divisor == 7 + nop + b,n $$divI_8 ; divisor == 8 + nop + b,n $$divI_9 ; divisor == 9 + nop + b,n $$divI_10 ; divisor == 10 + nop + b normal1 ; divisor == 11 + add,>= 0,arg0,retreg + b,n $$divI_12 ; divisor == 12 + nop + b normal1 ; divisor == 13 + add,>= 0,arg0,retreg + b,n $$divI_14 ; divisor == 14 + nop + b,n $$divI_15 ; divisor == 15 + nop +;______________________________________________________________________ +negative1: + sub 0,arg0,retreg ; result is negation of dividend + bv 0(r31) + addo arg0,arg1,r0 ; trap iff dividend==0x80000000 && divisor==-1 + .exit + .procend + + .subspa $LIT$ +___hp_free_copyright: + .export ___hp_free_copyright,data + .align 4 + .string "(c) Copyright 1986 HEWLETT-PACKARD COMPANY\x0aTo anyone who acknowledges that this file is provided \"AS IS\"\x0awithout any express or implied warranty:\x0a permission to use, copy, modify, and distribute this file\x0afor any purpose is hereby granted without fee, provided that\x0athe above copyright notice and this notice appears in all\x0acopies, and that the name of Hewlett-Packard Company not be\x0aused in advertising or publicity pertaining to distribution\x0aof the software without specific, written prior permission.\x0aHewlett-Packard Company makes no representations about the\x0asuitability of this software for any purpose.\x0a\x00" + .align 4 + .end diff --git a/libgloss/pa/op50n-io.S b/libgloss/pa/op50n-io.S new file mode 100644 index 0000000..25328ef --- /dev/null +++ b/libgloss/pa/op50n-io.S @@ -0,0 +1,120 @@ +/* op50n-io.S -- low-level I/O routines for the Oki OP50N eval board. + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +mon_start .EQU 0xd0000000 +where_dp .EQU mon_start+4*4 +where_ci .EQU mon_start+14*4 +where_co .EQU mon_start+15*4 +where_read .EQU mon_start+22*4 +where_write .EQU mon_start+23*4 + +/* + *int c = inbyte(wait); + */ + .space $TEXT$ + .align 4 + .EXPORT inbyte,CODE,ARGW0=GR,RTNVAL=GR +inbyte + .PROC + .CALLINFO CALLER,FRAME=64,SAVE_RP + .ENTRY + stw %r2,-20(0,%r30) + ldo 64(%r30),%r30 + stw %r27,-56(0,%r30) ; save my dp + ldil l%where_dp,%r27 ; load monitors dp + ldw r%where_dp(0,%r27),%r27 + ldil l%where_ci,%r1 + ldw r%where_ci(0,%r1),%r1 + ble 0(0,%r1) + copy %r31,%r2 + ldw -56(0,%r30),%r27 ; load my dp + ldw -84(0,%r30),%r2 + ldo -64(%r30),%r30 + bv %r0(%r2) + nop + .EXIT + .PROCEND + +/* int c = outbyte(c); +*/ + .EXPORT outbyte,CODE,ARGW0=GR,RTNVAL=GR +outbyte + .PROC + .CALLINFO CALLER,FRAME=64,SAVE_RP + .ENTRY + stw %r2,-20(0,%r30) + ldo 64(%r30),%r30 + stw %r27,-56(0,%r30) ; save my dp + ldil l%where_dp,%r27 ; load monitors dp + ldw r%where_dp(0,%r27),%r27 + ldil l%where_co,%r1 + ldw r%where_co(0,%r1),%r1 + ble 0(0,%r1) + copy %r31,%r2 + ldw -56(0,%r30),%r27 ; load my dp + ldw -84(0,%r30),%r2 + ldo -64(%r30),%r30 + bv %r0(%r2) + nop + .EXIT + .PROCEND + +#if 0 +/* cnt = read(fd, bufp, cnt); +*/ + .EXPORT read,CODE,ARGW0=NO,ARGW1=NO,ARGW2=NO,ARGW3=NO,RTNVAL=NO +read + .PROC + .CALLINFO FRAME=64,CALLS,SAVE_RP + .ENTRY + stw %r2,-20(0,%r30) + ldo 64(%r30),%r30 + stw %dp,-56(0,%r30) ; save my dp + ldil l%where_dp,%dp ; load monitors dp + ldw r%where_dp(0,%dp), %dp + ldil l%where_read,%r1 + ldw r%where_read(0,%r1), %r1 + ble 0(0,%r1) + copy %r31,%r2 + ldw -56(0,%r30),%dp ; load my dp + ldw -84(0,%r30),%r2 + bv %r0(%r2) + ldo -64(%r30),%r30 + .EXIT + .PROCEND + +/* cnt = write(fd, bufp, cnt); +*/ + .EXPORT write,CODE,ARGW0=NO,ARGW1=NO,ARGW2=NO,ARGW3=NO,RTNVAL=NO +write + .PROC + .CALLINFO FRAME=64,CALLS,SAVE_RP + .ENTRY + stw %r2,-20(0,%r30) + ldo 64(%r30),%r30 + stw %dp,-56(0,%r30) ; save my dp + ldil l%where_dp,%dp ; load monitors dp + ldw r%where_dp(0,%dp), %dp + ldil l%where_write,%r1 + ldw r%where_write(0,%r1), %r1 + ble 0(0,%r1) + copy %r31,%r2 + ldw -56(0,%r30),%dp ; load my dp + ldw -84(0,%r30),%r2 + bv %r0(%r2) + ldo -64(%r30),%r30 + .EXIT + .PROCEND +#endif diff --git a/libgloss/pa/op50n.h b/libgloss/pa/op50n.h new file mode 100644 index 0000000..7f73109 --- /dev/null +++ b/libgloss/pa/op50n.h @@ -0,0 +1,31 @@ +/* op50n.h -- Support definitions for the Oki OP50N target board + * + * Copyright (c) 1995 Cygnus Support + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#ifndef __OP50N_H__ +#define __OP50N_H__ + +#define LED_ADDR 0xfc000059 +#define LED_0 0x1 +#define LED_1 0x2 +#define LED_2 0x4 +#define LED_3 0x8 +#define LED_4 0x10 + +extern void led_putnum( char ); +#define FUDGE(x) ((x >= 0xa && x <= 0xf) ? (x + 'a') & 0x7f : (x + '0') & 0x7f) + +#endif /* __OP50N_H__ */ + + + diff --git a/libgloss/pa/op50n.ld b/libgloss/pa/op50n.ld new file mode 100644 index 0000000..0d8601f --- /dev/null +++ b/libgloss/pa/op50n.ld @@ -0,0 +1,54 @@ +OUTPUT_ARCH(hppa) +ENTRY("$START$") +STARTUP(crt0.o) +GROUP(-lc -lop50n -lgcc) +SEARCH_DIR(.) + +MEMORY +{ + ram (rwx) : ORIGIN = 0x40000, LENGTH = 0x100000 +} + +SECTIONS +{ + .text : + { + CREATE_OBJECT_SYMBOLS + *(.PARISC.stubs) + *(.text) + etext = . ; + _etext = . ; + __CTOR_LIST__ = . ; + LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) + *(.ctors) + LONG(0) + __CTOR_END__ = . ; + __DTOR_LIST__ = . ; + LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) + *(.dtors) + LONG(0) + __DTOR_END__ = . ; + *(.lit) + *(.shdata) + $global$ = ALIGN(4) ; + . += 4; + } > ram + + .data : { + *(.data) + CONSTRUCTORS + edata = . ; + _edata = . ; + } > ram + + .bss : { + _bss_start = ALIGN(4) ; + *(.bss) + *(COMMON) + _stack = ALIGN(64) ; /* Stack grows up on the PA!!! */ + . += 0x2000 ; + end = . ; + _end = . ; + } > ram + +} diff --git a/libgloss/pa/op50nled.c b/libgloss/pa/op50nled.c new file mode 100644 index 0000000..b6b35be --- /dev/null +++ b/libgloss/pa/op50nled.c @@ -0,0 +1,81 @@ +/* op50nled.c -- fucntions that manipulate the LEDs. + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include "op50n.h" + +void zylons(); +void strobe(); +void led_putnum(); +void delay(); + +/* + * led_putnum -- print a hex number on the LED. the value of num must be a byte. + * The max number 15, since the front panel only has 4 LEDs. + */ +void +led_putnum ( num ) +char num; +{ + static unsigned char *leds = (unsigned char *)LED_ADDR; + +/** *leds = (num << 4); **/ + *leds = num; +} + +/* + * strobe -- do a zylons thing, toggling each led in sequence forever... + */ +void +zylons() +{ + while (1) { + strobe(); + } +} + +/* + * strobe -- toggle each led in sequence up and back once. + */ +void +strobe() +{ + static unsigned char curled; + static unsigned char dir; + + curled = 1; + dir = 0; + while (curled != 0) { + led_putnum (curled); + delay (70000); + if (dir) + curled >>= 1; + else + curled <<= 1; + + if (curled == 0x100) { + dir = ~dir; + } + } + curled = 1; + dir = 0; +} + +void +delay (x) + int x; +{ + int y = 17; + while (x-- !=0) + y = y^2; +} diff --git a/libgloss/pa/setjmp.S b/libgloss/pa/setjmp.S new file mode 100644 index 0000000..aa10087 --- /dev/null +++ b/libgloss/pa/setjmp.S @@ -0,0 +1,140 @@ +/* + * Copyright (c) 1990,1994 The University of Utah and + * the Computer Systems Laboratory (CSL). All rights reserved. + * + * Permission to use, copy, modify and distribute this software is hereby + * granted provided that (1) source code retains these copyright, permission, + * and disclaimer notices, and (2) redistributions including binaries + * reproduce the notices in supporting documentation, and (3) all advertising + * materials mentioning features or use of this software display the following + * acknowledgement: ``This product includes software developed by the + * Computer Systems Laboratory at the University of Utah.'' + * + * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS + * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF + * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * CSL requests users of this software to return to csl-dist@cs.utah.edu any + * improvements that they make and grant CSL redistribution rights. + * + * Utah $Hdr: _setjmp.s 1.9 94/12/16$ + */ + + .space $TEXT$ + .subspa $CODE$ + +/* + * The PA jmp_buf is 48 words arranged as follows: + * + * 0- 9: sigcontext + * 10-26: callee save GRs (r3-r18) and DP (r27) + * 27: callee save SRs (sr3) + * 28-47: callee save FRs (fr12-fr21) + */ + +/* + * int + * setjmp(env) + * jmp_buf env; + * + * This routine does not restore signal state. + */ + + .export setjmp,entry + .export _setjmp,entry + .proc + .callinfo +setjmp +_setjmp + .entry + + /* + * save sp and rp in sigcontext, skip the rest + */ + stw %r30,8(%r26) + stw %r2,24(%r26) + ldo 40(%r26),%r26 + + /* + * save dp and the callee saves registers + */ + stwm %r3,4(%r26) + stwm %r4,4(%r26) + stwm %r5,4(%r26) + stwm %r6,4(%r26) + stwm %r7,4(%r26) + stwm %r8,4(%r26) + stwm %r9,4(%r26) + stwm %r10,4(%r26) + stwm %r11,4(%r26) + stwm %r12,4(%r26) + stwm %r13,4(%r26) + stwm %r14,4(%r26) + stwm %r15,4(%r26) + stwm %r16,4(%r26) + stwm %r17,4(%r26) + stwm %r18,4(%r26) + stwm %r27,4(%r26) + + mfsp %sr3,%r9 + stwm %r9,4(%r26) + + bv 0(%r2) + copy %r0,%r28 + .exit + .procend + +/* + * void + * longjmp(env, val) + * jmp_buf env; + * int val; + * + * This routine does not retore signal state. + * This routine does not override a zero val. + */ + + .export longjmp,entry + .export _longjmp,entry + .proc + .callinfo +longjmp +_longjmp + + .entry + + /* + * restore sp and rp + */ + ldw 8(%r26),%r30 + ldw 24(%r26),%r2 + ldo 40(%r26),%r26 + + /* + * restore callee saves registers + */ + ldwm 4(%r26),%r3 + ldwm 4(%r26),%r4 + ldwm 4(%r26),%r5 + ldwm 4(%r26),%r6 + ldwm 4(%r26),%r7 + ldwm 4(%r26),%r8 + ldwm 4(%r26),%r9 + ldwm 4(%r26),%r10 + ldwm 4(%r26),%r11 + ldwm 4(%r26),%r12 + ldwm 4(%r26),%r13 + ldwm 4(%r26),%r14 + ldwm 4(%r26),%r15 + ldwm 4(%r26),%r16 + ldwm 4(%r26),%r17 + ldwm 4(%r26),%r18 + ldwm 4(%r26),%r27 + + ldwm 4(%r26),%r9 + mtsp %r9,%sr3 + + bv 0(%r2) + copy %r25,%r28 + .exit + .procend diff --git a/libgloss/pa/test.c b/libgloss/pa/test.c new file mode 100644 index 0000000..4aefee6 --- /dev/null +++ b/libgloss/pa/test.c @@ -0,0 +1,41 @@ +/* Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +extern int led_putnum(); +extern char putDebugChar(),print(),putnum(); +#include <stdio.h> + +main() +{ + float a1,b1,c1; + int a2, b2, c2; + + a1 = 0.41; + b1 = 3.12; + c1 = a1+b1; + + a2 = 1; + b2 = 2; + c2 = a2 + b2; + + iprintf ("Print integer, result = %d\n", c2); + fflush (stdout); + putnum (c1); + outbyte ('\n'); + printf ("Print float, result with 'f' = %f\n", c1); + printf ("Print float, result with 'e' = %e\n", c1); + printf ("Print float, result with 'E' = %E\n", c1); + printf ("Print float, result with 'g' = %g\n", c1); + printf ("Print float, result with 'G' = %G\n", c1); + fflush (stdout); + print ("Done...\n"); +} diff --git a/libgloss/pa/w89k-io.c b/libgloss/pa/w89k-io.c new file mode 100644 index 0000000..2d98a81 --- /dev/null +++ b/libgloss/pa/w89k-io.c @@ -0,0 +1,74 @@ +/* w89k-io.c -- I/O code for the Winbond Cougar board. + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include "w89k.h" + +void zylons(); +void led_putnum(); +void delay(); + +/* + * outbyte -- shove a byte out the serial port. We wait till the byte + */ +void +outbyte (byte) + unsigned char byte; +{ + while ((inp(COM1_LSR) & TRANSMIT) == 0x0) ; + + outp (COM1_DATA, byte); + + return; +} + +/* + * inbyte -- get a byte from the serial port + */ +unsigned char +inbyte () +{ + while ((inp(COM1_LSR) & RECEIVE) == 0x0) ; + + return (inp(COM1_DATA)); +} + +/* + * led_putnum -- print a hex number on the LED. the value of num must be a byte. + * The max number 15, since the front panel only has 4 LEDs. + */ +void +led_putnum ( num ) +char num; +{ + print ("Sorry, no LED's on the WinBond W89k board, using putnum instead\r\n"); + putnum (num); +} + +/* + * zylons -- draw a rotating pattern. NOTE: this function never returns. + */ +void +zylons() +{ + print ("Sorry, no LED's on the WinBond W89k board\r\n"); +} + +void +delay (x) + int x; +{ + int y = 17; + while (x-- !=0) + y = y^2; +} diff --git a/libgloss/pa/w89k.h b/libgloss/pa/w89k.h new file mode 100644 index 0000000..9e16e91 --- /dev/null +++ b/libgloss/pa/w89k.h @@ -0,0 +1,25 @@ +/* Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + * + * The w89k uses a memory mapped I/O scheme as well as a PC style ISA bus. + * All I/O accesses are via a port. + */ +#define IOSPACE 0xf0000000 +#define outp(port,val) *((volatile unsigned char*)(IOSPACE+port))=val +#define inp(port) *((volatile unsigned char*)(IOSPACE+port)) +#define RS232PORT 0x3f8 +#define COM1_LSR (0x3f8 + 5) +#define COM1_DATA (0x3f8 + 0) + +#define RS232REG 0x3fd +#define TRANSMIT 0x20 +#define RECEIVE 0x01 diff --git a/libgloss/pa/w89k.ld b/libgloss/pa/w89k.ld new file mode 100644 index 0000000..721e83b --- /dev/null +++ b/libgloss/pa/w89k.ld @@ -0,0 +1,54 @@ +OUTPUT_ARCH(hppa) +ENTRY("$START$") +STARTUP(crt0.o) +GROUP(-lc -lw89k -lgcc) +SEARCH_DIR(.) + +MEMORY +{ + ram (rwx) : ORIGIN = 0x100000, LENGTH = 0x100000 +} + +SECTIONS +{ + .text : + { + CREATE_OBJECT_SYMBOLS + *(.PARISC.stubs) + *(.text) + etext = . ; + _etext = . ; + __CTOR_LIST__ = . ; + LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) + *(.ctors) + LONG(0) + __CTOR_END__ = . ; + __DTOR_LIST__ = . ; + LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) + *(.dtors) + LONG(0) + __DTOR_END__ = . ; + *(.lit) + *(.shdata) + $global$ = ALIGN(4) ; + . += 4; + } > ram + + .data : { + *(.data) + CONSTRUCTORS + edata = . ; + _edata = . ; + } > ram + + .bss : { + _bss_start = ALIGN(4) ; + *(.bss) + *(COMMON) + _stack = ALIGN(64) ; /* Stack grows up on the PA!!! */ + . += 0x2000 ; + end = . ; + _end = . ; + } > ram + +} diff --git a/libgloss/print.c b/libgloss/print.c new file mode 100644 index 0000000..8f78ff2 --- /dev/null +++ b/libgloss/print.c @@ -0,0 +1,27 @@ +/* print.c -- print a string on the output device. + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include "glue.h" + +/* + * print -- do a raw print of a string + */ +void +_DEFUN (print, (ptr), +char *ptr) +{ + while (*ptr) { + outbyte (*ptr++); + } +} diff --git a/libgloss/putnum.c b/libgloss/putnum.c new file mode 100644 index 0000000..842e10f --- /dev/null +++ b/libgloss/putnum.c @@ -0,0 +1,41 @@ +/* putnum.c -- put a hex number on the output device. + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include "glue.h" + +/* + * putnum -- print a 32 bit number in hex + */ +void +_DEFUN (putnum, (num), + unsigned int num) +{ + char buf[9]; + int cnt; + char *ptr; + int digit; + + ptr = buf; + for (cnt = 7 ; cnt >= 0 ; cnt--) { + digit = (num >> (cnt * 4)) & 0xf; + + if (digit <= 9) + *ptr++ = (char) ('0' + digit); + else + *ptr++ = (char) ('a' - 10 + digit); + } + + *ptr = (char) 0; + print (buf); +} diff --git a/libgloss/read.c b/libgloss/read.c new file mode 100644 index 0000000..eb86ea3 --- /dev/null +++ b/libgloss/read.c @@ -0,0 +1,39 @@ +/* read.c -- read bytes from a input device. + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include "glue.h" + +extern char _DEFUN_VOID (inbyte); + +/* + * read -- read bytes from the serial port. Ignore fd, since + * we only have stdin. + */ +int +_DEFUN (read, (fd, buf, nbytes), + int fd _AND + char *buf _AND + int nbytes) +{ + int i = 0; + + for (i = 0; i < nbytes; i++) { + *(buf + i) = inbyte(); + if ((*(buf + i) == '\n') || (*(buf + i) == '\r')) { + (*(buf + i + 1)) = 0; + break; + } + } + return (i); +} diff --git a/libgloss/rs6000/Makefile.in b/libgloss/rs6000/Makefile.in new file mode 100644 index 0000000..6f1deae --- /dev/null +++ b/libgloss/rs6000/Makefile.in @@ -0,0 +1,350 @@ +# Copyright (c) 1995, 1996, 1998 Cygnus Support +# +# The authors hereby grant permission to use, copy, modify, distribute, +# and license this software and its documentation for any purpose, provided +# that existing copyright notices are retained in all copies and that this +# notice is included verbatim in any distributions. No written agreement, +# license, or royalty fee is required for any of the authorized uses. +# Modifications to this software may be copyrighted by their authors +# and need not follow the licensing terms described here, provided that +# the new terms are clearly indicated on the first page of each file where +# they apply. +# + +# +# This currently works with the PPC simulator. +# + +VPATH = @srcdir@ @srcdir@/.. +srcdir = @srcdir@ +objdir = . +srcroot = $(srcdir)/../.. +objroot = $(objdir)/../.. + +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +host_alias = @host_alias@ +target_alias = @target_alias@ + +bindir = @bindir@ +libdir = @libdir@ +tooldir = $(exec_prefix)/$(target_alias) + +# Multilib support variables. +# TOP is used instead of MULTI{BUILD,SRC}TOP. +MULTIDIRS = +MULTISUBDIR = +MULTIDO = true +MULTICLEAN = true + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ + +SHELL = /bin/sh + +CC = @CC@ + +AS = @AS@ +AR = @AR@ +LD = @LD@ +RANLIB = @RANLIB@ + +OBJDUMP = `if [ -f ${objroot}/../binutils/objdump ] ; \ + then echo ${objroot}/../binutils/objdump ; \ + else t='$(program_transform_name)'; echo objdump | sed -e $$t ; fi` +OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \ + then echo ${objroot}/../binutils/objcopy ; \ + else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi` + +OBJS = fstat.o getpid.o isatty.o kill.o putnum.o stat.o unlink.o mcount.o +CFLAGS = -g +SCRIPTS = ${SIM_SCRIPTS} ${MVME_SCRIPTS} ${YELLOWKNIFE_SCRIPTS} ${ADS_SCRIPTS} + +# Here is all of the simulator stuff +SIM_SCRIPTS = +SIM_LDFLAGS = +SIM_BSP = libsim.a +SIM_CRT0 = sim-crt0.o +SIM_OBJS = sim-print.o sim-inbyte.o sim-sbrk.o sim-abort.o sim-errno.o simulator.o +SIM_TEST = sim-test +SIM_INSTALL = install-sim + +# Here is all the mvme stuff +MVME_SCRIPTS = +MVME_LDFLAGS = +MVME_BSP = libmvme.a +MVME_CRT0 = crt0.o +MVME_OBJS = mvme-exit.o mvme-inbyte.o mvme-outbyte.o open.o close.o lseek.o sbrk.o mvme-read.o mvme-print.o +MVME_TEST = mvme-test +MVME_INSTALL = install-mvme + +# Here is the Solaris stuff +#SOLARIS_SCRIPTS= +#SOLARIS_LDFLAGS= +#SOLARIS_BSP = libsolaris.a +#SOLARIS_CRT0 = +#SOLARIS_OBJS = sol-cfuncs.o sol-syscall.o +#SOLARIS_TEST = sol-test +#SOLARIS_INSTALL= install-solaris + +# Here is the Linux stuff +#LINUX_SCRIPTS = +#LINUX_LDFLAGS = +#LINUX_BSP = liblinux.a +#LINUX_CRT0 = +#LINUX_OBJS = lin-cfuncs.o lin-syscall.o +#LINUX_TEST = linux-test +#LINUX_INSTALL = install-linux + +YELLOWKNIFE_SCRIPTS = yellowknife.ld +YELLOWKNIFE_CRT0 = crt0.o +YELLOWKNIFE_BSP = libyk.a +YELLOWKNIFE_OBJS = open.o close.o lseek.o sbrk.o mvme-exit.o mvme-inbyte.o mvme-outbyte.o mvme-read.o mvme-print.o +YELLOWKNIFE_TEST = yellowknife-test +YELLOWKNIFE_INSTALL = install-yellowknife + +ADS_SCRIPTS = ads.ld +ADS_CRT0 = crt0.o +ADS_BSP = libads.a +ADS_OBJS = open.o close.o lseek.o sbrk.o ads-exit.o ads-io.o +ADS_TEST = ads-test +ADS_INSTALL = install-ads + +MBX_SCRIPTS = mbx.ld +MBX_SPECS = mbx.specs +MBX_CRT0 = crt0.o +MBX_BSP = libmbx.a +MBX_OBJS = open.o close.o lseek.o sbrk.o read.o write.o mbx-exit.o mbx-inbyte.o mbx-outbyte.o mbx-print.o +MBX_TEST = mbx-test +MBX_INSTALL = install-mbx + +# Host specific makefile fragment comes in here. +@host_makefile_frag@ + +# +# 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. +# +all: \ + ${SIM_CRT0} ${SIM_BSP} \ + ${MVME_CRT0} ${MVME_BSP} \ + ${SOLARIS_CRT0} ${SOLARIS_BSP} \ + ${LINUX_CRT0} ${LINUX_BSP} \ + ${YELLOWKNIFE_CRT0} ${YELLOWKNIFE_BSP} \ + ${ADS_CRT0} ${ADS_BSP} \ + ${MBX_CRT0} ${MBX_BSP} + +# +# here's where we build the board support packages for each target +# + +${SIM_BSP}: ${OBJS} ${SIM_OBJS} + ${AR} ${ARFLAGS} $@ ${SIM_OBJS} ${OBJS} + ${RANLIB} $@ + +${MVME_BSP}: ${OBJS} ${MVME_OBJS} + ${AR} ${ARFLAGS} $@ ${MVME_OBJS} ${OBJS} + ${RANLIB} $@ + +${LINUX_BSP}: ${OBJS} ${LINUX_OBJS} + ${AR} ${ARFLAGS} $@ ${LINUX_OBJS} ${OBJS} + ${RANLIB} $@ + +${SOLARIS_BSP}: ${OBJS} ${SOLARIS_OBJS} + ${AR} ${ARFLAGS} $@ ${SOLARIS_OBJS} + ${RANLIB} $@ + +${YELLOWKNIFE_BSP}: ${OBJS} ${YELLOWKNIFE_OBJS} + ${AR} ${ARFLAGS} $@ ${YELLOWKNIFE_OBJS} ${OBJS} + ${RANLIB} $@ + +${ADS_BSP}: ${OBJS} ${ADS_OBJS} + ${AR} ${ARFLAGS} $@ ${ADS_OBJS} ${OBJS} + ${RANLIB} $@ + +${MBX_BSP}: ${OBJS} ${MBX_OBJS} + ${AR} ${ARFLAGS} $@ ${MBX_OBJS} ${OBJS} + ${RANLIB} $@ + +# +# here's where we build the test programs for each target +# +.PHONY: test +test: ${SIM_TEST} ${MVME_TEST} ${YELLOWKNIFE_TEST} ${ADS_TEST} ${MBX_TEST} + +sim-test: sim-test.x sim-test.dis + +sim-test.x: test.o ${SIM_CRT0} ${SIM_BSP} + ${CC} ${LDFLAGS_FOR_TARGET} -L${objdir} \ + ${SIM_CRT0} test.o \ + -o sim-test.x ${LIBS_FOR_TARGET} -lc ${SIM_BSP} + +sim-test.dis: sim-test.x + ${OBJDUMP} -d sim-test.x > sim-test.dis + +mvme-test: mvme-test.x mvme-test.dis mvme-test.srec + +mvme-test.x: test.o ${MVME_CRT0} ${MVME_BSP} + ${CC} ${LDFLAGS_FOR_TARGET} -L${objdir} \ + ${SIM_CRT0} test.o \ + -o mvme-test.x ${LIBS_FOR_TARGET} -lc ${MVME_BSP} + +mvme-test.dis: mvme-test.x + ${OBJDUMP} -d mvme-test.x > mvme-test.dis + +mvme-test.srec: mvme-test.x + ${OBJCOPY} -O srec mvme-test.x mvme-test.srec + +sol-test: sol-test.x sol-test.dis sol-test.srec + +sol-test.x: test.o ${SOLARIS_CRT0} ${SOLARIS_BSP} + ${CC} ${LDFLAGS_FOR_TARGET} -L${objdir} \ + ${SIM_CRT0} test.o \ + -o sol-test.x ${LIBS_FOR_TARGET} -lc ${SOLARIS_BSP} + +sol-test.dis: sol-test.x + ${OBJDUMP} -d sol-test.x > sol-test.dis + +sol-test.srec: sol-test.x + ${OBJCOPY} -O srec sol-test.x sol-test.srec + +linux-test: linux-test.x linux-test.dis linux-test.srec + +linux-test.x: test.o ${LINUX_CRT0} ${LINUX_BSP} + ${CC} ${LDFLAGS_FOR_TARGET} -L${objdir} \ + ${SIM_CRT0} test.o \ + -o linux-test.x ${LIBS_FOR_TARGET} -lc ${LINUX_BSP} + +linux-test.dis: linux-test.x + ${OBJDUMP} -d linux-test.x > linux-test.dis + +linux-test.srec: linux-test.x + ${OBJCOPY} -O srec linux-test.x linux-test.srec + +yellowknife-test: yellowknife-test.x yellowknife-test.dis yellowknife-test.srec + +yellowknife-test.x: test.o ${YELLOWKNIFE_CRT0} ${YELLOWKNIFE_BSP} + ${CC} ${LDFLAGS_FOR_TARGET} -L${objdir} \ + -T${srcdir}/yellowknife.ld ${YELLOWKNIFE_CRT0} test.o \ + -o yellowknife-test.x $(LIBS_FOR_TARGET) ${YELLOWKNIFE_BSP} -lc ${YELLOWKNIFE_BSP} + +yellowknife-test.dis: yellowknife-test.x + ${OBJDUMP} -d yellowknife-test.x > yellowknife-test.dis + +yellowknife-test.srec: yellowknife-test.x + ${OBJCOPY} -O srec yellowknife-test.x yellowknife-test.srec + +ads-test: ads-test.x ads-test.dis ads-test.srec + +ads-test.x: test.o ${ADS_CRT0} ${ADS_BSP} + ${CC} ${LDFLAGS_FOR_TARGET} -L${objdir} \ + -T${srcdir}/ads.ld ${ADS_CRT0} test.o \ + -o ads-test.x $(LIBS_FOR_TARGET) ${ADS_BSP} -lc ${ADS_BSP} + +ads-test.dis: ads-test.x + ${OBJDUMP} -d ads-test.x > ads-test.dis + +ads-test.srec: ads-test.x + ${OBJCOPY} -O srec ads-test.x ads-test.srec + +mbx-test: mbx-test.x mbx-test.dis mbx-test.srec + +mbx-test.x: test.o ${MBX_CRT0} ${MBX_BSP} + ${CC} ${LDFLAGS_FOR_TARGET} -L${objdir} \ + -T${srcdir}/mbx.ld ${MBX_CRT0} test.o \ + -o mbx-test.x $(LIBS_FOR_TARGET) ${MBX_BSP} -lc ${MBX_BSP} + +mbx-test.dis: mbx-test.x + ${OBJDUMP} -d mbx-test.x > mbx-test.dis + +mbx-test.srec: mbx-test.x + ${OBJCOPY} -O srec mbx-test.x mbx-test.srec + +# +# +# + +crt0.o: crt0.S + +simulator.o: simulator.S +sim-crt0.o: sim-crt0.S +mount.o: mount.S + +mvme-exit.o: mvme-exit.S +mvme-inbyte.o: mvme-inbyte.S +mvme-outbyte.o: mvme-outbyte.S + +ads-exit.o: ads-exit.S +ads-io.o: ads-io.c + +mbx-exit.o: mbx-exit.c +mbx-inbyte.o: mbx-inbyte.c +mbx-outbyte.o: mbx-outbyte.c +mbx-print.o: mbx-print.c + +sol-cfuncs.o: sol-cfuncs.c +sol-syscall.o: sol-syscall.S + +close.o: $(srcdir)/../close.c +fstat.o: $(srcdir)/../fstat.c +getpid.o: $(srcdir)/../getpid.c +isatty.o: $(srcdir)/../isatty.c +kill.o: $(srcdir)/../kill.c +lseek.o: $(srcdir)/../lseek.c +open.o: $(srcdir)/../open.c +putnum.o: $(srcdir)/../putnum.c +sbrk.o: $(srcdir)/../sbrk.c +stat.o: $(srcdir)/../stat.c +unlink.o: $(srcdir)/../unlink.c + +# Don't optimize when compiling the test program, makes confusion in +# the debugger. + +test.o: $(srcdir)/test.c + $(CC) -g $(CFLAGS_MRELOCATABLE) $(INCLUDES) -c $(CFLAGS) $< + +clean mostlyclean: + rm -f a.out core *.i *.o *-test *.srec *.dis *.x + +distclean maintainer-clean realclean: clean + rm -f Makefile config.status *~ + +.PHONY: install info install-info clean-info +install: ${SIM_INSTALL} ${MVME_INSTALL} ${SOLARIS_INSTALL} ${LINUX_INSTALL} ${YELLOWKNIFE_INSTALL} ${ADS_INSTALL} ${MBX_INSTALL} + +install-sim: + set -e; for x in ${SIM_CRT0} ${SIM_BSP} ${SIM_SCRIPTS}; do ${INSTALL_DATA} $$x ${tooldir}/lib${MULTISUBDIR}/$$x; done + +install-mvme: + set -e; for x in ${MVME_CRT0} ${MVME_BSP} ${MVME_SCRIPTS}; do ${INSTALL_DATA} $$x ${tooldir}/lib${MULTISUBDIR}/$$x; done + +install-solaris: + set -e; for x in ${SOLARIS_CRT0} ${SOLARIS_BSP} ${SOLARIS_SCRIPTS}; do ${INSTALL_DATA} $$x ${tooldir}/lib${MULTISUBDIR}/$$x; done + +install-linux: + set -e; for x in ${LINUX_CRT0} ${LINUX_BSP} ${LINUX_SCRIPTS}; do ${INSTALL_DATA} $$x ${tooldir}/lib${MULTISUBDIR}/$$x; done + +install-yellowknife: + set -e; for x in ${YELLOWKNIFE_CRT0} ${YELLOWKNIFE_BSP}; do ${INSTALL_DATA} $$x ${tooldir}/lib${MULTISUBDIR}/$$x; done + set -e; for x in ${YELLOWKNIFE_SCRIPTS}; do ${INSTALL_DATA} $(srcdir)/$$x ${tooldir}/lib${MULTISUBDIR}/$$x; done + +install-ads: + set -e; for x in ${ADS_CRT0} ${ADS_BSP}; do ${INSTALL_DATA} $$x ${tooldir}/lib${MULTISUBDIR}/$$x; done + set -e; for x in ${ADS_SCRIPTS}; do ${INSTALL_DATA} $(srcdir)/$$x ${tooldir}/lib${MULTISUBDIR}/$$x; done + +install-mbx: + set -e; for x in ${MBX_CRT0} ${MBX_BSP}; do ${INSTALL_DATA} $$x ${tooldir}/lib${MULTISUBDIR}/$$x; done + set -e; for x in ${MBX_SCRIPTS} ${MBX_SPECS}; do ${INSTALL_DATA} $(srcdir)/$$x ${tooldir}/lib${MULTISUBDIR}/$$x; done + +doc: +info: +install-info: +clean-info: + +Makefile: Makefile.in config.status @host_makefile_frag_path@ + $(SHELL) config.status + +config.status: configure + $(SHELL) config.status --recheck diff --git a/libgloss/rs6000/ads-exit.S b/libgloss/rs6000/ads-exit.S new file mode 100644 index 0000000..1a381c8 --- /dev/null +++ b/libgloss/rs6000/ads-exit.S @@ -0,0 +1,28 @@ +/* + * ads-exit.S -- _exit stub for targets using the sds monitor + * + * Copyright (c) 1998 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#include "ppc-asm.h" + +FUNC_START(_exit) +/* + * Insure that the debugger tells the client that the PC is in _exit, + * not whatever function happens to follow this function. + */ + +0: trap + b 0b +FUNC_END(_exit) + diff --git a/libgloss/rs6000/ads-io.c b/libgloss/rs6000/ads-io.c new file mode 100644 index 0000000..d57b297 --- /dev/null +++ b/libgloss/rs6000/ads-io.c @@ -0,0 +1,55 @@ +/* + * ads-io.c -- stub io functions for targets using the sds monitor + * + * Copyright (c) 1998 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +int inbyte(void) +{ + return -1; +} + + +void outbyte(char c) +{ +} + + +/* + * write -- write some bytes to the output device. + */ + +int +write (int fd, char *ptr, unsigned len) +{ + return len; +} + + +/* + * print -- do a raw print of a string + */ +void +print (char *ptr) +{ +} + + +/* + * read -- read bytes from the serial port. Ignore fd, since + * we only have stdin. + */ +int read (int fd, char *buf, int nbytes) +{ + return -1; +} diff --git a/libgloss/rs6000/ads.ld b/libgloss/rs6000/ads.ld new file mode 100644 index 0000000..1fe80d8 --- /dev/null +++ b/libgloss/rs6000/ads.ld @@ -0,0 +1,154 @@ +OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", + "elf32-powerpc") +OUTPUT_ARCH(powerpc) +ENTRY(_start) +/* Do we need any of these for elf? + __DYNAMIC = 0; */ + +PROVIDE (__stack = 0x2000000); + +MEMORY +{ + ram (rwx) : ORIGIN = 0x10000, LENGTH = 0x2000000 +} + +SECTIONS +{ + /* Read-only sections, merged into text segment: */ + . = 0x10000 + SIZEOF_HEADERS; + .interp : { *(.interp) } + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .rela.text : + { *(.rela.text) *(.rela.gnu.linkonce.t*) } + .rela.data : + { *(.rela.data) *(.rela.gnu.linkonce.d*) } + .rela.rodata : + { *(.rela.rodata) *(.rela.gnu.linkonce.r*) } + .rela.got : { *(.rela.got) } + .rela.got1 : { *(.rela.got1) } + .rela.got2 : { *(.rela.got2) } + .rela.ctors : { *(.rela.ctors) } + .rela.dtors : { *(.rela.dtors) } + .rela.init : { *(.rela.init) } + .rela.fini : { *(.rela.fini) } + .rela.bss : { *(.rela.bss) } + .rela.plt : { *(.rela.plt) } + .rela.sdata : { *(.rela.sdata2) } + .rela.sbss : { *(.rela.sbss2) } + .rela.sdata2 : { *(.rela.sdata2) } + .rela.sbss2 : { *(.rela.sbss2) } + .plt : { *(.plt) } + .text : + { + *(.text) + /* .gnu.warning sections are handled specially by elf32.em. */ + *(.gnu.warning) + *(.gnu.linkonce.t*) + } =0 + .init : { *(.init) } =0 + .fini : { *(.fini) } =0 + .rodata : { *(.rodata) *(.gnu.linkonce.r*) } + .rodata1 : { *(.rodata1) } + .gcc_except_table : { *(.gcc_except_table) } + _etext = .; + PROVIDE (etext = .); + .sdata2 : { *(.sdata2) } + .sbss2 : { *(.sbss2) } + /* Adjust the address for the data segment. We want to adjust up to + the same address within the page on the next page up. It would + be more correct to do this: + . = ALIGN(0x10000) + (ALIGN(8) & (0x10000 - 1)); + The current expression does not correctly handle the case of a + text segment ending precisely at the end of a page; it causes the + data segment to skip a page. The above expression does not have + this problem, but it will currently (2/95) cause BFD to allocate + a single segment, combining both text and data, for this case. + This will prevent the text segment from being shared among + multiple executions of the program; I think that is more + important than losing a page of the virtual address space (note + that no actual memory is lost; the page which is skipped can not + be referenced). */ + . = ALIGN(8) + 0x10000; + .data : + { + *(.data) + *(.gnu.linkonce.d*) + CONSTRUCTORS + } + .data1 : { *(.data1) } + .got1 : { *(.got1) } + .dynamic : { *(.dynamic) } + /* Put .ctors and .dtors next to the .got2 section, so that the pointers + get relocated with -mrelocatable. Also put in the .fixup pointers. + The current compiler no longer needs this, but keep it around for 2.7.2 */ + PROVIDE (_GOT2_START_ = .); + .got2 : { *(.got2) } + PROVIDE (__CTOR_LIST__ = .); + .ctors : { *(.ctors) } + PROVIDE (__CTOR_END__ = .); + PROVIDE (__DTOR_LIST__ = .); + .dtors : { *(.dtors) } + PROVIDE (__DTOR_END__ = .); + PROVIDE (_FIXUP_START_ = .); + .fixup : { *(.fixup) } + PROVIDE (_FIXUP_END_ = .); + PROVIDE (_GOT2_END_ = .); + PROVIDE (_GOT_START_ = .); + .got : { *(.got) } + .got.plt : { *(.got.plt) } + PROVIDE (_GOT_END_ = .); + /* We want the small data sections together, so single-instruction offsets + can access them all, and initialized data all before uninitialized, so + we can shorten the on-disk segment size. */ + .sdata : { *(.sdata) } + _edata = .; + PROVIDE (edata = .); + .sbss : + { + PROVIDE (__sbss_start = .); + *(.sbss) + *(.scommon) + PROVIDE (__sbss_end = .); + } + .bss : + { + PROVIDE (__bss_start = .); + *(.dynbss) + *(.bss) + *(COMMON) + } + _end = . ; + PROVIDE (end = .); + /* These are needed for ELF backends which have not yet been + converted to the new style linker. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.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) } + .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) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + /* These must appear regardless of . */ +} diff --git a/libgloss/rs6000/configure b/libgloss/rs6000/configure new file mode 100755 index 0000000..d2a163d --- /dev/null +++ b/libgloss/rs6000/configure @@ -0,0 +1,1191 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.12 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.12" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=sim-crt0.S + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + +if test "${enable_shared}" = "yes" ; then + echo "Shared libraries not supported for cross compiling, ignored" +fi + +if test "$srcdir" = "." ; then + if test "${with_target_subdir}" != "." ; then + libgloss_topdir="${srcdir}/${with_multisrctop}../../.." + else + libgloss_topdir="${srcdir}/${with_multisrctop}../.." + fi +else + libgloss_topdir="${srcdir}/../.." +fi +ac_aux_dir= +for ac_dir in $libgloss_topdir $srcdir/$libgloss_topdir; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $libgloss_topdir $srcdir/$libgloss_topdir" 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + + + +# Do some error checking and defaulting for the host and target type. +# The inputs are: +# configure --host=HOST --target=TARGET --build=BUILD NONOPT +# +# The rules are: +# 1. You are not allowed to specify --host, --target, and nonopt at the +# same time. +# 2. Host defaults to nonopt. +# 3. If nonopt is not specified, then host defaults to the current host, +# as determined by config.guess. +# 4. Target and build default to nonopt. +# 5. If nonopt is not specified, then target and build default to host. + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +case $host---$target---$nonopt in +NONE---*---* | *---NONE---* | *---*---NONE) ;; +*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;; +esac + + +# Make sure we can run config.sub. +if $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi + +echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:584: checking host system type" >&5 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`$ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`$ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + +echo $ac_n "checking target system type""... $ac_c" 1>&6 +echo "configure:605: checking target system type" >&5 + +target_alias=$target +case "$target_alias" in +NONE) + case $nonopt in + NONE) target_alias=$host_alias ;; + *) target_alias=$nonopt ;; + esac ;; +esac + +target=`$ac_config_sub $target_alias` +target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$target" 1>&6 + +echo $ac_n "checking build system type""... $ac_c" 1>&6 +echo "configure:623: checking build system type" >&5 + +build_alias=$build +case "$build_alias" in +NONE) + case $nonopt in + NONE) build_alias=$host_alias ;; + *) build_alias=$nonopt ;; + esac ;; +esac + +build=`$ac_config_sub $build_alias` +build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$build" 1>&6 + +test "$host_alias" != "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + +if test "$program_transform_name" = s,x,x,; then + program_transform_name= +else + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed +s,\\,\\\\,g; s,\$,$$,g +EOF_SED + program_transform_name="`echo $program_transform_name|sed -f conftestsed`" + rm -f conftestsed +fi +test "$program_prefix" != NONE && + program_transform_name="s,^,${program_prefix},; $program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" + +# sed with no file args requires a program. +test "$program_transform_name" = "" && program_transform_name="s,x,x," + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:676: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + for ac_prog in ginstall installbsd scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + # OSF/1 installbsd also uses dspmsg, but is usable. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +# FIXME: We temporarily define our own version of AC_PROG_CC. This is +# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We +# are probably using a cross compiler, which will not be able to fully +# link an executable. This should really be fixed in autoconf +# itself. + + + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:737: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:766: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + ac_prog_rejected=no + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +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 $# -gt 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 + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:814: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <<EOF +#ifdef __GNUC__ + yes; +#endif +EOF +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:823: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:838: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi + + +AS=${AS-as} + +AR=${AR-ar} + +LD=${LD-ld} + +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:875: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +host_makefile_frag=${srcdir}/../config/ppc.mh + +host_makefile_frag_path=$host_makefile_frag + + + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs + + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS <<EOF +#! /bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.12" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS <<EOF + +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; + s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@host@%$host%g +s%@host_alias@%$host_alias%g +s%@host_cpu@%$host_cpu%g +s%@host_vendor@%$host_vendor%g +s%@host_os@%$host_os%g +s%@target@%$target%g +s%@target_alias@%$target_alias%g +s%@target_cpu@%$target_cpu%g +s%@target_vendor@%$target_vendor%g +s%@target_os@%$target_os%g +s%@build@%$build%g +s%@build_alias@%$build_alias%g +s%@build_cpu@%$build_cpu%g +s%@build_vendor@%$build_vendor%g +s%@build_os@%$build_os%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@CC@%$CC%g +s%@AS@%$AS%g +s%@AR@%$AR%g +s%@LD@%$LD%g +s%@RANLIB@%$RANLIB%g +s%@host_makefile_frag_path@%$host_makefile_frag_path%g +/@host_makefile_frag@/r $host_makefile_frag +s%@host_makefile_frag@%%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <<EOF + +CONFIG_FILES=\${CONFIG_FILES-"Makefile"} +EOF +cat >> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +EOF +cat >> $CONFIG_STATUS <<EOF +srcdir=${srcdir} +target=${target} +ac_configure_args="${ac_configure_args} --enable-multilib" +CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} +libgloss_topdir=${libgloss_topdir} + +EOF +cat >> $CONFIG_STATUS <<\EOF +. ${libgloss_topdir}/config-ml.in +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + diff --git a/libgloss/rs6000/configure.in b/libgloss/rs6000/configure.in new file mode 100644 index 0000000..ce1126b --- /dev/null +++ b/libgloss/rs6000/configure.in @@ -0,0 +1,90 @@ +dnl Process this file with autoconf to produce a configure script. +AC_PREREQ(2.5)dnl +AC_INIT(sim-crt0.S) + +if test "${enable_shared}" = "yes" ; then + echo "Shared libraries not supported for cross compiling, ignored" +fi + +if test "$srcdir" = "." ; then + if test "${with_target_subdir}" != "." ; then + libgloss_topdir="${srcdir}/${with_multisrctop}../../.." + else + libgloss_topdir="${srcdir}/${with_multisrctop}../.." + fi +else + libgloss_topdir="${srcdir}/../.." +fi +AC_CONFIG_AUX_DIR($libgloss_topdir) + +AC_CANONICAL_SYSTEM +AC_ARG_PROGRAM + +AC_PROG_INSTALL + +# FIXME: We temporarily define our own version of AC_PROG_CC. This is +# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We +# are probably using a cross compiler, which will not be able to fully +# link an executable. This should really be fixed in autoconf +# itself. + +AC_DEFUN(LIB_AC_PROG_CC, +[AC_BEFORE([$0], [AC_PROG_CPP])dnl +AC_CHECK_PROG(CC, gcc, gcc) +if test -z "$CC"; then + AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) + test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) +fi + +AC_PROG_CC_GNU + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +dnl Check whether -g works, even if CFLAGS is set, in case the package +dnl plays around with CFLAGS (such as to build both debugging and +dnl normal versions of a library), tasteless as that idea is. + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + AC_PROG_CC_G + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi +]) + +LIB_AC_PROG_CC + +AS=${AS-as} +AC_SUBST(AS) +AR=${AR-ar} +AC_SUBST(AR) +LD=${LD-ld} +AC_SUBST(LD) +AC_PROG_RANLIB + +host_makefile_frag=${srcdir}/../config/ppc.mh + +dnl We have to assign the same value to other variables because autoconf +dnl doesn't provide a mechanism to substitute a replacement keyword with +dnl arbitrary data or pathnames. +dnl +host_makefile_frag_path=$host_makefile_frag +AC_SUBST(host_makefile_frag_path) +AC_SUBST_FILE(host_makefile_frag) + +AC_OUTPUT(Makefile, +. ${libgloss_topdir}/config-ml.in, +srcdir=${srcdir} +target=${target} +ac_configure_args="${ac_configure_args} --enable-multilib" +CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} +libgloss_topdir=${libgloss_topdir} +) diff --git a/libgloss/rs6000/crt0.S b/libgloss/rs6000/crt0.S new file mode 100644 index 0000000..9a59819 --- /dev/null +++ b/libgloss/rs6000/crt0.S @@ -0,0 +1,128 @@ +/* + * crt0.S -- startup file for PowerPC systems. + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#include "ppc-asm.h" + + .file "crt0.S" + .section ".got2","aw" + .align 2 + +.LCTOC1 = .+32768 + + .extern FUNC_NAME(atexit) + .globl FUNC_NAME(__atexit) + .section ".sdata","aw" + .align 2 +FUNC_NAME(__atexit): /* tell C's eabi-ctor's we have an atexit function */ + .long FUNC_NAME(atexit)@fixup /* and that it is to register __do_global_dtors */ + + .section ".fixup","aw" + .align 2 + .long FUNC_NAME(__atexit) + + .section ".got2","aw" +.Ltable = .-.LCTOC1 + .long .LCTOC1 /* address we think .LCTOC1 is loaded at */ + +.Lsbss_start = .-.LCTOC1 + .long __sbss_start + +.Lsbss_end = .-.LCTOC1 + .long __sbss_end + +.Lbss_start = .-.LCTOC1 + .long __bss_start + +.Lend = .-.LCTOC1 + .long _end + +.Lstack = .-.LCTOC1 /* stack address if set by user */ + .long __stack + + .text +.Lptr: + .long .LCTOC1-.Laddr + + .globl _start + .type _start,@function +_start: + bl .Laddr /* get current address */ +.Laddr: + mflr r4 /* real address of .Laddr */ + lwz r5,(.Lptr-.Laddr)(r4) /* linker generated address of .LCTOC1 */ + add r5,r5,r4 /* correct to real pointer */ + lwz r4,.Ltable(r5) /* get linker's idea of where .Laddr is */ + subf r4,r4,r5 /* calculate difference between where linked and current */ + + /* clear bss and sbss */ + lwz r6,.Lbss_start(r5) /* calculate beginning of the BSS */ + lwz r7,.Lend(r5) /* calculate end of the BSS */ + add r6,r6,r4 /* adjust pointers */ + add r7,r7,r4 + + cmplw 1,r6,r7 + bc 4,4,.Ldone1 + + subf r8,r6,r7 /* number of bytes to zero */ + srwi r9,r8,2 /* number of words to zero */ + mtctr r9 + li r0,0 /* zero to clear memory */ + addi r6,r6,-4 /* adjust so we can use stwu */ +.Lloop: + stwu r0,4(r6) /* zero bss */ + bdnz .Lloop + +.Ldone1: + + lwz r6,.Lsbss_start(r5) /* calculate beginning of the SBSS */ + lwz r7,.Lsbss_end(r5) /* calculate end of the SBSS */ + add r6,r6,r4 /* adjust pointers */ + add r7,r7,r4 + + cmplw 1,r6,r7 + bc 4,4,.Ldone + + subf r8,r6,r7 /* number of bytes to zero */ + srwi r9,r8,2 /* number of words to zero */ + mtctr r9 + li r0,0 /* zero to clear memory */ + addi r6,r6,-4 /* adjust so we can use stwu */ +.Lloop2: + stwu r0,4(r6) /* zero bss */ + bdnz .Lloop2 + +.Ldone: + + lwz r0,.Lstack(r5) /* stack address or 0 */ + cmplwi 1,r0,0 /* equal to 0? */ + bc 12,6,.Lnostack /* use default stack if == 0 */ + mr sp,r0 /* use user defined stack */ + +.Lnostack: + /* set up initial stack frame */ + addi sp,sp,-4 /* make sure we don't overwrite debug mem */ + lis r0,0 + stw r0,0(sp) /* clear back chain */ + stwu sp,-64(sp) /* push another stack frame */ + + /* Let her rip */ + bl FUNC_NAME(main) + + /* return value from main is argument to exit */ + bl FUNC_NAME(exit) + trap +.Lstart: + .size _start,.Lstart-_start diff --git a/libgloss/rs6000/mbx-exit.c b/libgloss/rs6000/mbx-exit.c new file mode 100644 index 0000000..d295414 --- /dev/null +++ b/libgloss/rs6000/mbx-exit.c @@ -0,0 +1,27 @@ +/* + * mbx-exit.c -- exit function for targets using the eppcbug monitor + * + * Copyright (c) 1998 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#include "ppc-asm.h" + +void _exit(int stat) +{ + asm volatile ("li 10,0xf00; sc\n"); + + while (1) ; + + return; +} + diff --git a/libgloss/rs6000/mbx-inbyte.c b/libgloss/rs6000/mbx-inbyte.c new file mode 100644 index 0000000..bd06aa0 --- /dev/null +++ b/libgloss/rs6000/mbx-inbyte.c @@ -0,0 +1,60 @@ +/* + * mbx-inbyte.c -- inbyte function for targets using the eppcbug monitor + * + * Copyright (c) 1998 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#include "ppc-asm.h" + +int inbyte(void) +{ + struct { + unsigned clun; + unsigned dlun; + char *data; + unsigned len; + unsigned rsrvd; + char buf[4]; + } ipb, *inpb; + + struct { + int status; + int cnt; + } opb, *outpb; + + inpb = &ipb; + outpb = &opb; + + do { + inpb->clun = 0; + inpb->dlun = 0; + inpb->data = ipb.buf; + inpb->len = 1; + inpb->rsrvd = 0; + + asm volatile ( + "mr 3,%0\n" + "mr 4,%1\n" + "li 10,0x200\n" + "sc" + : /* no outputs */ + : "r" (inpb), "r" (outpb) + : "3", "4", "10" + ); + } while (outpb->status == 0 && outpb->cnt == 0); + + if (outpb->status == 0) + return ipb.buf[0] & 0xff; + + return -1; +} diff --git a/libgloss/rs6000/mbx-outbyte.c b/libgloss/rs6000/mbx-outbyte.c new file mode 100644 index 0000000..0ebf0c6 --- /dev/null +++ b/libgloss/rs6000/mbx-outbyte.c @@ -0,0 +1,71 @@ +/* + * mbx-outbyte.c -- outbyte function for targets using the eppcbug monitor + * + * Copyright (c) 1998 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#include "ppc-asm.h" + +static int sendbyte(char c) +{ + struct { + unsigned clun; + unsigned dlun; + char *data; + unsigned len; + unsigned rsrvd; + char buf[4]; + } ipb, *inpb; + + struct { + int status; + int cnt; + } opb, *outpb; + + inpb = &ipb; + outpb = &opb; + + inpb->clun = 0; + inpb->dlun = 0; + inpb->data = ipb.buf; + inpb->len = 1; + inpb->rsrvd = 0; + inpb->buf[0] = c; + + asm volatile ( + "mr 3,%0\n" + "mr 4,%1\n" + "li 10,0x201\n" + "sc" + : /* no outputs */ + : "r" (inpb), "r" (outpb) + : "3", "4", "10" + ); + + return (outpb->status == 0 && outpb->cnt == 1); +} + +#define GDB_QUOTE_OUTBYTES 1 + +void outbyte(char c) +{ +#ifdef GDB_QUOTE_OUTBYTES + /* + * GDB monitor.c will echo characters quoted with ^O + */ + while (!sendbyte('\017')) ; +#endif + while (!sendbyte(c)) ; +} + + diff --git a/libgloss/rs6000/mbx-print.c b/libgloss/rs6000/mbx-print.c new file mode 100644 index 0000000..64472ee --- /dev/null +++ b/libgloss/rs6000/mbx-print.c @@ -0,0 +1,31 @@ +/* mbx-print.c -- print a string on the output device. + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +/* + * print -- do a raw print of a string + */ +void +print (ptr) + char *ptr; +{ + int len = 0; + char *p = ptr; + + while (*p != '\0') + p++; + + write (1, ptr, p-ptr); +} + diff --git a/libgloss/rs6000/mbx.ld b/libgloss/rs6000/mbx.ld new file mode 100644 index 0000000..7ba3db9 --- /dev/null +++ b/libgloss/rs6000/mbx.ld @@ -0,0 +1,134 @@ +OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", + "elf32-powerpc") +OUTPUT_ARCH(powerpc) +ENTRY(_start) +/* Do we need any of these for elf? + __DYNAMIC = 0; */ + +PROVIDE (__stack = 0x0); + +SECTIONS +{ + /* Read-only sections, merged into text segment: */ + . = 0x2000 + SIZEOF_HEADERS; + .interp : { *(.interp) } + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .rela.text : + { *(.rela.text) *(.rela.gnu.linkonce.t*) } + .rela.data : + { *(.rela.data) *(.rela.gnu.linkonce.d*) } + .rela.rodata : + { *(.rela.rodata) *(.rela.gnu.linkonce.r*) } + .rela.got : { *(.rela.got) } + .rela.got1 : { *(.rela.got1) } + .rela.got2 : { *(.rela.got2) } + .rela.ctors : { *(.rela.ctors) } + .rela.dtors : { *(.rela.dtors) } + .rela.init : { *(.rela.init) } + .rela.fini : { *(.rela.fini) } + .rela.bss : { *(.rela.bss) } + .rela.plt : { *(.rela.plt) } + .rela.sdata : { *(.rela.sdata2) } + .rela.sbss : { *(.rela.sbss2) } + .rela.sdata2 : { *(.rela.sdata2) } + .rela.sbss2 : { *(.rela.sbss2) } + .plt : { *(.plt) } + .text : + { + *(.text) + /* .gnu.warning sections are handled specially by elf32.em. */ + *(.gnu.warning) + *(.gnu.linkonce.t*) + } =0 + .init : { *(.init) } =0 + .fini : { *(.fini) } =0 + .rodata : { *(.rodata) *(.gnu.linkonce.r*) } + .rodata1 : { *(.rodata1) } + _etext = .; + PROVIDE (etext = .); + .sdata2 : { *(.sdata2) } + .sbss2 : { *(.sbss2) } + . = ALIGN(8); + .data : + { + *(.data) + *(.gnu.linkonce.d*) + CONSTRUCTORS + } + .data1 : { *(.data1) } + .got1 : { *(.got1) } + .dynamic : { *(.dynamic) } + /* Put .ctors and .dtors next to the .got2 section, so that the pointers + get relocated with -mrelocatable. Also put in the .fixup pointers. + The current compiler no longer needs this, but keep it around for 2.7.2 */ + PROVIDE (_GOT2_START_ = .); + .got2 : { *(.got2) } + PROVIDE (__CTOR_LIST__ = .); + .ctors : { *(.ctors) } + PROVIDE (__CTOR_END__ = .); + PROVIDE (__DTOR_LIST__ = .); + .dtors : { *(.dtors) } + PROVIDE (__DTOR_END__ = .); + PROVIDE (_FIXUP_START_ = .); + .fixup : { *(.fixup) } + PROVIDE (_FIXUP_END_ = .); + PROVIDE (_GOT2_END_ = .); + PROVIDE (_GOT_START_ = .); + .got : { *(.got) } + .got.plt : { *(.got.plt) } + PROVIDE (_GOT_END_ = .); + /* We want the small data sections together, so single-instruction offsets + can access them all, and initialized data all before uninitialized, so + we can shorten the on-disk segment size. */ + .sdata : { *(.sdata) } + _edata = .; + PROVIDE (edata = .); + .sbss : + { + PROVIDE (__sbss_start = .); + *(.sbss) + *(.scommon) + PROVIDE (__sbss_end = .); + } + .bss : + { + PROVIDE (__bss_start = .); + *(.dynbss) + *(.bss) + *(COMMON) + } + _end = . ; + PROVIDE (end = .); + /* These are needed for ELF backends which have not yet been + converted to the new style linker. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.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) } + .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) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + /* These must appear regardless of . */ +} diff --git a/libgloss/rs6000/mbx.specs b/libgloss/rs6000/mbx.specs new file mode 100644 index 0000000..dd01cc8 --- /dev/null +++ b/libgloss/rs6000/mbx.specs @@ -0,0 +1,12 @@ +*lib_default: +--start-group -lmbx -lc --end-group + +*startfile_default: +ecrti.o%s crt0.o%s + +*endfile_default: +ecrtn.o%s + +*link_start_default: +-T mbx.ld%s + diff --git a/libgloss/rs6000/mcount.S b/libgloss/rs6000/mcount.S new file mode 100644 index 0000000..3ea5ef9 --- /dev/null +++ b/libgloss/rs6000/mcount.S @@ -0,0 +1,27 @@ +/* + * mcount.S -- dummy module for profiling. + * + * Copyright (c) 1997 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#include "ppc-asm.h" + + .file "mcount-dummy.S" + .text +FUNC_START(_mcount) + mflr r11 + lwz r0,4(sp) + mtctr r11 + mtlr r0 + bctr +FUNC_END(_mcount) diff --git a/libgloss/rs6000/mvme-errno.c b/libgloss/rs6000/mvme-errno.c new file mode 100644 index 0000000..17386d8 --- /dev/null +++ b/libgloss/rs6000/mvme-errno.c @@ -0,0 +1,23 @@ +/* + * sim-errno.c -- return address of errno for current thread. + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +int errno; + +int * +__errno () +{ + return &errno; +} diff --git a/libgloss/rs6000/mvme-exit.S b/libgloss/rs6000/mvme-exit.S new file mode 100644 index 0000000..a33a5e0 --- /dev/null +++ b/libgloss/rs6000/mvme-exit.S @@ -0,0 +1,32 @@ +/* + * mvme-exit.S -- _exit function for targets using the ppcbug monitor + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#include "ppc-asm.h" + + .file "mvme-exit.S" + .text +FUNC_START(_exit) + li r10,0x63 + sc + +/* + * Insure that the debugger tells the client that the PC is in _exit, + * not whatever function happens to follow this function. + */ + +0: trap + b 0b /* we never should return, but... */ +FUNC_END(_exit) diff --git a/libgloss/rs6000/mvme-inbyte.S b/libgloss/rs6000/mvme-inbyte.S new file mode 100644 index 0000000..f5c781b --- /dev/null +++ b/libgloss/rs6000/mvme-inbyte.S @@ -0,0 +1,31 @@ +/* + * mvme-inbyte.S -- inbyte function for targets using the ppcbug monitor + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#include "ppc-asm.h" + + .file "mvme-inbyte.S" + .text +FUNC_START(inbyte) + li r10,0x0 + sc + blr +FUNC_END(inbyte) + +FUNC_START(__inln) + li r10,0x2 + sc + blr +FUNC_END(__inln) diff --git a/libgloss/rs6000/mvme-outbyte.S b/libgloss/rs6000/mvme-outbyte.S new file mode 100644 index 0000000..3940874 --- /dev/null +++ b/libgloss/rs6000/mvme-outbyte.S @@ -0,0 +1,43 @@ +/* + * mvme-outbyte.S -- outbyte function for targets using the ppcbug monitor + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#include "ppc-asm.h" + + .file "mvme-outbyte.S" + .text +FUNC_START(outbyte) + li r10,0x20 + sc + blr +FUNC_END(outbyte) + +FUNC_START(__outstr) + li r10,0x21 + sc + blr +FUNC_END(__outstr) + +FUNC_START(__outln) + li r10,0x22 + sc + blr +FUNC_END(__outln) + +FUNC_START(__pcrlf) + li r10,0x26 + sc + blr +FUNC_END(__pcrlf) diff --git a/libgloss/rs6000/mvme-print.c b/libgloss/rs6000/mvme-print.c new file mode 100644 index 0000000..8d19542 --- /dev/null +++ b/libgloss/rs6000/mvme-print.c @@ -0,0 +1,76 @@ +/* mvme-print.c -- print a string on the output device. + * + * Copyright (c) 1996 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +/* + * write -- write some bytes to the output device. + */ + +int +write (fd, ptr, len) + int fd; + char *ptr; + unsigned len; +{ + char *done = ptr + len; + char *q; + unsigned len2; + + while (ptr < done) + { + if (*ptr == '\n') + { + __pcrlf (); + ptr++; + } + else + { + q = ptr; + while ( (q < done) && ((ptr - q) < 254)) + { + if (*q == '\n') + { + __outln (ptr, q); + ptr = ++q; + } + else + q++; + } + + if (ptr != q) + { + __outstr (ptr, q); + ptr = q; + } + } + } + return len; +} + +/* + * print -- do a raw print of a string + */ + +void +print (ptr) + char *ptr; +{ + int len = 0; + char *p = ptr; + + while (*p != '\0') + p++; + + write (1, ptr, p-ptr); +} diff --git a/libgloss/rs6000/mvme-read.c b/libgloss/rs6000/mvme-read.c new file mode 100644 index 0000000..1c823b4 --- /dev/null +++ b/libgloss/rs6000/mvme-read.c @@ -0,0 +1,49 @@ +/* mvme-read.c -- read bytes from a input device. + * + * Copyright (c) 1996 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +extern int inbyte (); +extern char * __inln (); + +/* + * read -- read bytes from the serial port. Ignore fd, since + * we only have stdin. + */ +int +read (fd, buf, nbytes) + int fd; + char *buf; + int nbytes; +{ + if (nbytes >= 256) + { + char *read_end = __inln (buf); + *read_end = '\n'; + return read_end - buf + 1; + } + else + { + int i, c; + for (i = 0; i < nbytes; i++) { + *buf++ = c = inbyte (); + if (c == '\n' || c == '\r') { + buf[-1] = '\n'; /* convert \r to \n */ + buf[0] = '\0'; + break; + } + } + + return i; + } +} diff --git a/libgloss/rs6000/sim-abort.c b/libgloss/rs6000/sim-abort.c new file mode 100644 index 0000000..e1b59cf --- /dev/null +++ b/libgloss/rs6000/sim-abort.c @@ -0,0 +1,21 @@ +/* + * sim-abort.c -- PowerPC abort support when running under the simulator. + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +void abort(void) +{ + write (2, "Abort called.\n", sizeof("Abort called.\n")-1); + exit (1); +} diff --git a/libgloss/rs6000/sim-crt0.S b/libgloss/rs6000/sim-crt0.S new file mode 100644 index 0000000..e0d3bb9 --- /dev/null +++ b/libgloss/rs6000/sim-crt0.S @@ -0,0 +1,45 @@ +/* + * crt0.S -- startup file for PowerPC systems. + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#include "ppc-asm.h" + + .file "sim-crt0.S" + .text + .globl _start + .type _start,@function +_start: + lis r0,0 + stw r0,0(sp) /* clear back chain */ + stwu sp,-64(sp) /* push another stack frame */ + + /* Let her rip */ + bl FUNC_NAME(main) + + /* return value from main is argument to exit */ + bl FUNC_NAME(exit) +.Lstart: + .size _start,.Lstart-_start + + .extern FUNC_NAME(atexit) + .globl FUNC_NAME(__atexit) + .section ".sdata","aw" + .align 2 +FUNC_NAME(__atexit): /* tell C's eabi-ctor's we have an atexit function */ + .long FUNC_NAME(atexit)@fixup /* and that it is to register __do_global_dtors */ + + .section ".fixup","aw" + .align 2 + .long FUNC_NAME(__atexit) diff --git a/libgloss/rs6000/sim-errno.c b/libgloss/rs6000/sim-errno.c new file mode 100644 index 0000000..9a771b4 --- /dev/null +++ b/libgloss/rs6000/sim-errno.c @@ -0,0 +1,33 @@ +/* + * sim-errno.c -- return address of errno for current thread. + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +int errno; + +int * +__errno () +{ + return &errno; +} + +/* syscall handler branches here in case of error. */ + +int +_cerror (e) + int e; +{ + errno = e; + return -1; +} diff --git a/libgloss/rs6000/sim-inbyte.c b/libgloss/rs6000/sim-inbyte.c new file mode 100644 index 0000000..787b689 --- /dev/null +++ b/libgloss/rs6000/sim-inbyte.c @@ -0,0 +1,26 @@ +/* + * sim-inbyte.c -- read a character from standard input. + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +int +inbyte () +{ + char c; + + if (read (0, &c, 1) <= 0) + return -1; + + return c; +} diff --git a/libgloss/rs6000/sim-print.c b/libgloss/rs6000/sim-print.c new file mode 100644 index 0000000..c0b9adc --- /dev/null +++ b/libgloss/rs6000/sim-print.c @@ -0,0 +1,43 @@ +/* sim-print.c -- print a string on the output device. + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +/* + * print -- do a raw print of a string + */ +void +print (ptr) + char *ptr; +{ + int len = 0; + char *p = ptr; + + while (*p != '\0') + p++; + + write (1, ptr, p-ptr); +} + +/* + * outbyte -- write a single character. + */ + +void +outbyte (c_int) + int c_int; +{ + char c = c_int; + + write (1, &c, 1); +} diff --git a/libgloss/rs6000/sim-sbrk.c b/libgloss/rs6000/sim-sbrk.c new file mode 100644 index 0000000..5c8bd65 --- /dev/null +++ b/libgloss/rs6000/sim-sbrk.c @@ -0,0 +1,30 @@ +/* + * sim-sbrk.c -- PowerPC sbrk support when running under the simulator. + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +extern char _end[]; +static char *curbrk = _end; + +char * +sbrk (incr) + int incr; +{ + char *oldbrk = curbrk; + curbrk += incr; + if (brk (curbrk) == -1) + return (char *) -1; + + return oldbrk; +} diff --git a/libgloss/rs6000/simulator.S b/libgloss/rs6000/simulator.S new file mode 100644 index 0000000..1e925e0 --- /dev/null +++ b/libgloss/rs6000/simulator.S @@ -0,0 +1,79 @@ +/* + * simulator.S -- PowerPC simulator system calls. + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#include "ppc-asm.h" + +FUNC_START(_exit) + li r0, 1 + sc + +/* + * Insure that the debugger tells the client that the PC is in _exit, + * not whatever function happens to follow this function. + */ + +0: trap + b 0b /* we never should return, but... */ + +FUNC_END(_exit) + +FUNC_START(read) + li r0,3 + sc + bns+ 0f + b FUNC_NAME(_cerror) +0: blr +FUNC_END(read) + +FUNC_START(write) + li r0,4 + sc + bns+ 0f + b FUNC_NAME(_cerror) +0: blr +FUNC_END(write) + +FUNC_START(open) + li r0,5 + sc + bns+ 0f + b FUNC_NAME(_cerror) +0: blr +FUNC_END(open) + +FUNC_START(close) + li r0,6 + sc + bns+ 0f + b FUNC_NAME(_cerror) +0: blr +FUNC_END(close) + +FUNC_START(brk) + li r0,17 + sc + bns+ 0f + b FUNC_NAME(_cerror) +0: blr +FUNC_END(brk) + +FUNC_START(lseek) + li r0,199 + sc + bns+ 0f + b FUNC_NAME(_cerror) +0: blr +FUNC_END(lseek) diff --git a/libgloss/rs6000/sol-cfuncs.c b/libgloss/rs6000/sol-cfuncs.c new file mode 100644 index 0000000..9827167 --- /dev/null +++ b/libgloss/rs6000/sol-cfuncs.c @@ -0,0 +1,277 @@ +/* + * solaris-cfuncs.S -- C functions for Solaris. + * + * Copyright (c) 1996 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#include <errno.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <sys/unistd.h> + +#ifndef __STDC__ +#define const +#endif + +/* Solaris stat packet */ +typedef long solaris_off_t; +typedef long solaris_uid_t; +typedef long solaris_gid_t; +typedef long unsigned solaris_mode_t; +typedef long unsigned solaris_nlink_t; +typedef long unsigned solaris_dev_t; +typedef long unsigned solaris_ino_t; +typedef long solaris_time_t; + +typedef struct { + solaris_time_t tv_sec; + long tv_nsec; +} solaris_timestruc_t; + +#define _ST_FSTYPSZ 16 + +struct solaris_stat { + solaris_dev_t st_dev; + long st_pad1[3]; + solaris_ino_t st_ino; + solaris_mode_t st_mode; + solaris_nlink_t st_nlink; + solaris_uid_t st_uid; + solaris_gid_t st_gid; + solaris_dev_t st_rdev; + long st_pad2[2]; + solaris_off_t st_size; + long st_pad3; + solaris_timestruc_t st_atim; + solaris_timestruc_t st_mtim; + solaris_timestruc_t st_ctim; + long st_blksize; + long st_blocks; + char st_fstype[_ST_FSTYPSZ]; + long st_pad4[8]; +}; + +/* Solaris termios packet */ +#define SOLARIS_NCCS 19 +typedef unsigned long solaris_tcflag_t; +typedef unsigned char solaris_cc_t; +typedef unsigned long solaris_speed_t; + +struct solaris_termios { + solaris_tcflag_t c_iflag; + solaris_tcflag_t c_oflag; + solaris_tcflag_t c_cflag; + solaris_tcflag_t c_lflag; + solaris_cc_t c_cc[SOLARIS_NCCS]; +}; + +#define SOLARIS_TIOC ('T'<<8) +#define SOLARIS_TCGETS (SOLARIS_TIOC|13) + + + +/* Debug support */ +#ifdef DEBUG +#define TRACE(msg) trace (msg) +#define TRACE1(msg,num) trace1 (msg,(unsigned)num) + +static void +trace (msg) + const char *msg; +{ + const char *p; + + for (p = msg; *p != '\0'; p++) + ; + + (void) write (2, msg, p-msg); +} + +static void +trace1 (msg, num) + const char *msg; + unsigned int num; +{ + char buffer[16]; + char *p = &buffer[ sizeof(buffer) ]; + + trace (msg); + *--p = '\0'; + *--p = '\n'; + do { + *--p = '0' + (num % 10); + num /= 10; + } while (num != 0); + trace (p); +} + +#else +#define TRACE(msg) +#define TRACE1(msg,num) +#endif + + +/* Errno support */ + +int errno; + +int * +__errno () +{ + return &errno; +} + +/* syscall handler branches here to set errno. Error codes + that are common between newlib and Solaris are the same. */ + +int +_cerror (e) + int e; +{ + TRACE1("got to _cerror ",e); + errno = e; + return -1; +} + + +/* Sbrk support */ + +extern char _end[]; +static char *curbrk = _end; + +void * +sbrk (incr) + size_t incr; +{ + char *oldbrk = curbrk; + TRACE("got to sbrk\n"); + curbrk += incr; + if (brk (curbrk) == -1) + return (char *) -1; + + return (void *)oldbrk; +} + + +/* Isatty support */ + +int +isatty (fd) + int fd; +{ + struct solaris_termios t; + int ret; + + ret = (ioctl (fd, SOLARIS_TCGETS, &t) == 0); + + TRACE1("got to isatty, returned ", ret); + return ret; +} + + +/* Convert Solaris {,f}stat to newlib. + Fortunately, the st_mode bits are the same. */ + +static void +solaris_to_newlib_stat (solaris, newlib) + struct solaris_stat *solaris; + struct stat *newlib; +{ + static struct stat zero_stat; + + *newlib = zero_stat; + newlib->st_dev = solaris->st_dev; + newlib->st_ino = solaris->st_ino; + newlib->st_mode = solaris->st_mode; + newlib->st_nlink = solaris->st_nlink; + newlib->st_uid = solaris->st_uid; + newlib->st_gid = solaris->st_gid; + newlib->st_rdev = solaris->st_rdev; + newlib->st_size = solaris->st_size; + newlib->st_blksize = solaris->st_blksize; + newlib->st_blocks = solaris->st_blocks; + newlib->st_atime = solaris->st_atim.tv_sec; + newlib->st_mtime = solaris->st_mtim.tv_sec; + newlib->st_ctime = solaris->st_ctim.tv_sec; +} + +int +stat (file, newlib_stat) + const char *file; + struct stat *newlib_stat; +{ + int ret; + struct solaris_stat st; + + TRACE("got to stat\n"); + ret = _stat (file, &st); + if (ret >= 0) + solaris_to_newlib_stat (&st, newlib_stat); + + return ret; +} + +int +lstat (file, newlib_stat) + const char *file; + struct stat *newlib_stat; +{ + int ret; + struct solaris_stat st; + + TRACE("got to lstat\n"); + ret = _lstat (file, &st); + if (ret >= 0) + solaris_to_newlib_stat (&st, newlib_stat); + + return ret; +} + +int +fstat (fd, newlib_stat) + int fd; + struct stat *newlib_stat; +{ + int ret; + struct solaris_stat st; + + TRACE("got to fstat\n"); + ret = _fstat (fd, &st); + if (ret >= 0) + solaris_to_newlib_stat (&st, newlib_stat); + + return ret; +} + + +/* Nops */ + +int +getrusage () +{ + _cerror (EINVAL); + return -1; +} + +char * +getcwd(buf, size) + char *buf; + size_t size; +{ + if (!buf || size < 2) + return "."; + + buf[0] = '.'; + buf[1] = '\0'; + return buf; +} diff --git a/libgloss/rs6000/sol-syscall.S b/libgloss/rs6000/sol-syscall.S new file mode 100644 index 0000000..352253d --- /dev/null +++ b/libgloss/rs6000/sol-syscall.S @@ -0,0 +1,280 @@ +/* + * solaris-syscall.S -- System call stubs for Solaris. + * + * Copyright (c) 1996 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#include "ppc-asm.h" + + .file "solaris-syscall.S" + +#define SYS_syscall 0 +#define SYS_exit 1 +#define SYS_fork 2 +#define SYS_read 3 +#define SYS_write 4 +#define SYS_open 5 +#define SYS_close 6 +#define SYS_wait 7 +#define SYS_creat 8 +#define SYS_link 9 +#define SYS_unlink 10 +#define SYS_exec 11 +#define SYS_chdir 12 +#define SYS_time 13 +#define SYS_mknod 14 +#define SYS_chmod 15 +#define SYS_chown 16 +#define SYS_brk 17 +#define SYS_stat 18 +#define SYS_lseek 19 +#define SYS_getpid 20 +#define SYS_mount 21 +#define SYS_umount 22 +#define SYS_setuid 23 +#define SYS_getuid 24 +#define SYS_stime 25 +#define SYS_ptrace 26 +#define SYS_alarm 27 +#define SYS_fstat 28 +#define SYS_pause 29 +#define SYS_utime 30 +#define SYS_stty 31 +#define SYS_gtty 32 +#define SYS_access 33 +#define SYS_nice 34 +#define SYS_statfs 35 +#define SYS_sync 36 +#define SYS_kill 37 +#define SYS_fstatfs 38 +#define SYS_pgrpsys 39 +#define SYS_xenix 40 +#define SYS_dup 41 +#define SYS_pipe 42 +#define SYS_times 43 +#define SYS_profil 44 +#define SYS_plock 45 +#define SYS_setgid 46 +#define SYS_getgid 47 +#define SYS_signal 48 +#define SYS_msgsys 49 +#define SYS_syssun 50 +#define SYS_sysi86 50 +#define SYS_sysppc 50 +#define SYS_acct 51 +#define SYS_shmsys 52 +#define SYS_semsys 53 +#define SYS_ioctl 54 +#define SYS_uadmin 55 +#define SYS_utssys 57 +#define SYS_fdsync 58 +#define SYS_execve 59 +#define SYS_umask 60 +#define SYS_chroot 61 +#define SYS_fcntl 62 +#define SYS_ulimit 63 +#define SYS_rmdir 79 +#define SYS_mkdir 80 +#define SYS_getdents 81 +#define SYS_sysfs 84 +#define SYS_getmsg 85 +#define SYS_putmsg 86 +#define SYS_poll 87 +#define SYS_lstat 88 +#define SYS_symlink 89 +#define SYS_readlink 90 +#define SYS_setgroups 91 +#define SYS_getgroups 92 +#define SYS_fchmod 93 +#define SYS_fchown 94 +#define SYS_sigprocmask 95 +#define SYS_sigsuspend 96 +#define SYS_sigaltstack 97 +#define SYS_sigaction 98 +#define SYS_sigpending 99 +#define SYS_context 100 +#define SYS_evsys 101 +#define SYS_evtrapret 102 +#define SYS_statvfs 103 +#define SYS_fstatvfs 104 +#define SYS_nfssys 106 +#define SYS_waitsys 107 +#define SYS_sigsendsys 108 +#define SYS_hrtsys 109 +#define SYS_acancel 110 +#define SYS_async 111 +#define SYS_priocntlsys 112 +#define SYS_pathconf 113 +#define SYS_mincore 114 +#define SYS_mmap 115 +#define SYS_mprotect 116 +#define SYS_munmap 117 +#define SYS_fpathconf 118 +#define SYS_vfork 119 +#define SYS_fchdir 120 +#define SYS_readv 121 +#define SYS_writev 122 +#define SYS_xstat 123 +#define SYS_lxstat 124 +#define SYS_fxstat 125 +#define SYS_xmknod 126 +#define SYS_clocal 127 +#define SYS_setrlimit 128 +#define SYS_getrlimit 129 +#define SYS_lchown 130 +#define SYS_memcntl 131 +#define SYS_getpmsg 132 +#define SYS_putpmsg 133 +#define SYS_rename 134 +#define SYS_uname 135 +#define SYS_setegid 136 +#define SYS_sysconfig 137 +#define SYS_adjtime 138 +#define SYS_systeminfo 139 +#define SYS_seteuid 141 +#define SYS_vtrace 142 +#define SYS_fork1 143 +#define SYS_sigtimedwait 144 +#define SYS_lwp_info 145 +#define SYS_yield 146 +#define SYS_lwp_sema_wait 147 +#define SYS_lwp_sema_post 148 +#define SYS_modctl 152 +#define SYS_fchroot 153 +#define SYS_utimes 154 +#define SYS_vhangup 155 +#define SYS_gettimeofday 156 +#define SYS_getitimer 157 +#define SYS_setitimer 158 +#define SYS_lwp_create 159 +#define SYS_lwp_exit 160 +#define SYS_lwp_suspend 161 +#define SYS_lwp_continue 162 +#define SYS_lwp_kill 163 +#define SYS_lwp_self 164 +#define SYS_lwp_setprivate 165 +#define SYS_lwp_getprivate 166 +#define SYS_lwp_wait 167 +#define SYS_lwp_mutex_unlock 168 +#define SYS_lwp_mutex_lock 169 +#define SYS_lwp_cond_wait 170 +#define SYS_lwp_cond_signal 171 +#define SYS_lwp_cond_broadcast 172 +#define SYS_pread 173 +#define SYS_pwrite 174 +#define SYS_llseek 175 +#define SYS_inst_sync 176 +#define SYS_kaio 178 +#define SYS_tsolsys 184 +#define SYS_acl 185 +#define SYS_auditsys 186 +#define SYS_processor_bind 187 +#define SYS_processor_info 188 +#define SYS_p_online 189 +#define SYS_sigqueue 190 +#define SYS_clock_gettime 191 +#define SYS_clock_settime 192 +#define SYS_clock_getres 193 +#define SYS_timer_create 194 +#define SYS_timer_delete 195 +#define SYS_timer_settime 196 +#define SYS_timer_gettime 197 +#define SYS_timer_getoverrun 198 +#define SYS_nanosleep 199 +#define SYS_facl 200 +#define SYS_door 201 +#define SYS_setreuid 202 +#define SYS_setregid 203 +#define SYS_install_utrap 204 +#define SYS_signotifywait 210 +#define SYS_lwp_sigredirect 211 +#define SYS_lwp_alarm 212 + + .text +FUNC_START(_exit) + li r0,SYS_exit + sc + +/* + * Insure that the debugger tells the client that the PC is in _exit, + * not whatever function happens to follow this function. + */ + +0: trap + b 0b /* we never should return, but... */ +FUNC_END(_exit) + +#define SYSCALL(syscall,name) \ +FUNC_START(name); \ + li r0,syscall; \ + sc; \ + bns+ 0f; \ + b FUNC_NAME(_cerror); \ +0: blr; \ +FUNC_END(name) + +SYSCALL(SYS_access,access) +SYSCALL(SYS_alarm,alarm) +SYSCALL(SYS_brk,brk) +SYSCALL(SYS_chdir,chdir) +SYSCALL(SYS_chmod,chomd) +SYSCALL(SYS_chown,chown) +SYSCALL(SYS_close,close) +SYSCALL(SYS_creat,creat) +SYSCALL(SYS_dup,dup) +SYSCALL(SYS_exec,exec) +SYSCALL(SYS_fork,fork) +SYSCALL(SYS_fstat,_fstat) +SYSCALL(SYS_getpid,getpid) +SYSCALL(SYS_ioctl,ioctl) +SYSCALL(SYS_kill,kill) +SYSCALL(SYS_link,link) +SYSCALL(SYS_lseek,lseek) +SYSCALL(SYS_nice,nice) +SYSCALL(SYS_open,open) +SYSCALL(SYS_pause,pause) +SYSCALL(SYS_pipe,pipe) +SYSCALL(SYS_ptrace,ptrace) +SYSCALL(SYS_read,read) +SYSCALL(SYS_signal,signal) +SYSCALL(SYS_stat,_stat) +SYSCALL(SYS_sync,sync) +SYSCALL(SYS_sysppc,sysppc) +SYSCALL(SYS_time,time) +SYSCALL(SYS_times,times) +SYSCALL(SYS_unlink,unlink) +SYSCALL(SYS_wait,wait) +SYSCALL(SYS_write,write) +SYSCALL(SYS_umask,umask) +SYSCALL(SYS_execve,execve) +SYSCALL(SYS_fcntl,fcntl) +SYSCALL(SYS_ulimit,ulimit) +SYSCALL(SYS_mkdir,mkdir) +SYSCALL(SYS_rmdir,rmdir) +SYSCALL(SYS_getdents,getdents) +SYSCALL(SYS_lstat,_lstat) +SYSCALL(SYS_symlink,symlink) +SYSCALL(SYS_readlink,readlink) +SYSCALL(SYS_sigprocmask,sigprocmask) +SYSCALL(SYS_sigsuspend,sigsuspend) +SYSCALL(SYS_sigaction,sigaction) +SYSCALL(SYS_mmap,mmap) +SYSCALL(SYS_mprotect,mprotect) +SYSCALL(SYS_munmap,munmap) +SYSCALL(SYS_fpathconf,fpathconf) +SYSCALL(SYS_vfork,vfork) +SYSCALL(SYS_setrlimit,setrlimit) +SYSCALL(SYS_getrlimit,getrlimit) +SYSCALL(SYS_rename,rename) +SYSCALL(SYS_utimes,utimes) +SYSCALL(SYS_gettimeofday,gettimeofday) diff --git a/libgloss/rs6000/test.c b/libgloss/rs6000/test.c new file mode 100644 index 0000000..f8f8ea1 --- /dev/null +++ b/libgloss/rs6000/test.c @@ -0,0 +1,23 @@ +extern int led_putnum(); +extern char putDebugChar(),print(),putnum(); + +main() +{ + char buf[20]; + + outbyte ('&'); + outbyte ('@'); + outbyte ('$'); + outbyte ('%'); + print ("FooBar\r\n"); + +#if 0 + write (2, "Enter 5 characters... ", 24); + read (0, buf, 5); + print (buf); + print ("\r\n"); +#endif + + /* whew, we made it */ + print ("\r\nDone..."); +} diff --git a/libgloss/rs6000/yellowknife.ld b/libgloss/rs6000/yellowknife.ld new file mode 100644 index 0000000..96c4260 --- /dev/null +++ b/libgloss/rs6000/yellowknife.ld @@ -0,0 +1,146 @@ +OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", + "elf32-powerpc") +OUTPUT_ARCH(powerpc) +ENTRY(_start) +/* Do we need any of these for elf? + __DYNAMIC = 0; */ +PROVIDE (__stack = 0); +SECTIONS +{ + /* Read-only sections, merged into text segment: */ + . = 0x50000 + SIZEOF_HEADERS; + .interp : { *(.interp) } + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .rela.text : + { *(.rela.text) *(.rela.gnu.linkonce.t*) } + .rela.data : + { *(.rela.data) *(.rela.gnu.linkonce.d*) } + .rela.rodata : + { *(.rela.rodata) *(.rela.gnu.linkonce.r*) } + .rela.got : { *(.rela.got) } + .rela.got1 : { *(.rela.got1) } + .rela.got2 : { *(.rela.got2) } + .rela.ctors : { *(.rela.ctors) } + .rela.dtors : { *(.rela.dtors) } + .rela.init : { *(.rela.init) } + .rela.fini : { *(.rela.fini) } + .rela.bss : { *(.rela.bss) } + .rela.plt : { *(.rela.plt) } + .rela.sdata : { *(.rela.sdata2) } + .rela.sbss : { *(.rela.sbss2) } + .rela.sdata2 : { *(.rela.sdata2) } + .rela.sbss2 : { *(.rela.sbss2) } + .plt : { *(.plt) } + .text : + { + *(.text) + /* .gnu.warning sections are handled specially by elf32.em. */ + *(.gnu.warning) + *(.gnu.linkonce.t*) + } =0 + .init : { *(.init) } =0 + .fini : { *(.fini) } =0 + .rodata : { *(.rodata) *(.gnu.linkonce.r*) } + .rodata1 : { *(.rodata1) } + _etext = .; + PROVIDE (etext = .); + .sdata2 : { *(.sdata2) } + .sbss2 : { *(.sbss2) } + /* Adjust the address for the data segment. We want to adjust up to + the same address within the page on the next page up. It would + be more correct to do this: + . = ALIGN(0x50000) + (ALIGN(8) & (0x50000 - 1)); + The current expression does not correctly handle the case of a + text segment ending precisely at the end of a page; it causes the + data segment to skip a page. The above expression does not have + this problem, but it will currently (2/95) cause BFD to allocate + a single segment, combining both text and data, for this case. + This will prevent the text segment from being shared among + multiple executions of the program; I think that is more + important than losing a page of the virtual address space (note + that no actual memory is lost; the page which is skipped can not + be referenced). */ + . = ALIGN(8) + 0x50000; + .data : + { + *(.data) + *(.gnu.linkonce.d*) + CONSTRUCTORS + } + .data1 : { *(.data1) } + .got1 : { *(.got1) } + .dynamic : { *(.dynamic) } + /* Put .ctors and .dtors next to the .got2 section, so that the pointers + get relocated with -mrelocatable. Also put in the .fixup pointers. + The current compiler no longer needs this, but keep it around for 2.7.2 */ + PROVIDE (_GOT2_START_ = .); + .got2 : { *(.got2) } + PROVIDE (__CTOR_LIST__ = .); + .ctors : { *(.ctors) } + PROVIDE (__CTOR_END__ = .); + PROVIDE (__DTOR_LIST__ = .); + .dtors : { *(.dtors) } + PROVIDE (__DTOR_END__ = .); + PROVIDE (_FIXUP_START_ = .); + .fixup : { *(.fixup) } + PROVIDE (_FIXUP_END_ = .); + PROVIDE (_GOT2_END_ = .); + PROVIDE (_GOT_START_ = .); + .got : { *(.got) } + .got.plt : { *(.got.plt) } + PROVIDE (_GOT_END_ = .); + /* We want the small data sections together, so single-instruction offsets + can access them all, and initialized data all before uninitialized, so + we can shorten the on-disk segment size. */ + .sdata : { *(.sdata) } + _edata = .; + PROVIDE (edata = .); + .sbss : + { + PROVIDE (__sbss_start = .); + *(.sbss) + *(.scommon) + PROVIDE (__sbss_end = .); + } + .bss : + { + PROVIDE (__bss_start = .); + *(.dynbss) + *(.bss) + *(COMMON) + } + _end = . ; + PROVIDE (end = .); + /* These are needed for ELF backends which have not yet been + converted to the new style linker. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.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) } + .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) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + /* These must appear regardless of . */ +} diff --git a/libgloss/sbrk.c b/libgloss/sbrk.c new file mode 100644 index 0000000..c222b4b --- /dev/null +++ b/libgloss/sbrk.c @@ -0,0 +1,55 @@ +/* sbrk.c -- allocate memory dynamically. + * + * Copyright (c) 1995,1996 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include <errno.h> +#include "glue.h" + +/* just in case, most boards have at least some memory */ +#ifndef RAMSIZE +# define RAMSIZE (caddr_t)0x100000 +#endif + +char *heap_ptr; + +/* + * sbrk -- changes heap size size. Get nbytes more + * RAM. We just increment a pointer in what's + * left of memory on the board. + */ +char * +sbrk (nbytes) + int nbytes; +{ + char *base; + + if (!heap_ptr) + heap_ptr = (char *)&_end; + base = heap_ptr; + heap_ptr += nbytes; + + return base; +/* FIXME: We really want to make sure we don't run out of RAM, but this + * isn't very portable. + */ +#if 0 + if ((RAMSIZE - heap_ptr - nbytes) >= 0) { + base = heap_ptr; + heap_ptr += nbytes; + return (base); + } else { + errno = ENOMEM; + return ((char *)-1); + } +#endif +} diff --git a/libgloss/sh/sh1lcevb.ld b/libgloss/sh/sh1lcevb.ld new file mode 100644 index 0000000..efe9ab3 --- /dev/null +++ b/libgloss/sh/sh1lcevb.ld @@ -0,0 +1,113 @@ +/* Linker script for the SH1 Low-Cost Eval Board. */ + +SEARCH_DIR(.) +GROUP(-lc -lgcc) +__DYNAMIC = 0; + +/* The location of RAM comes from the manual. We also leave an 8K pad + for the monitor's own working data and stack. Note that the smallest + boards only have 64K of RAM, so no room for SPEC benchmarks here! */ + +MEMORY +{ + ram (rwx) : ORIGIN = 0xa002000, LENGTH = 0x10000 +} + +/* Put the stack up high. */ +/* (Commented out because it doesn't seem to work right) */ +/*PROVIDE (__stack = 0xa00ff00);*/ + +/* Initalize some symbols to be zero so we can reference them in the + crt0 without core dumping. These functions are all optional, but + we do this so we can have our crt0 always use them if they exist. + This is so BSPs work better when using the crt0 installed with gcc. + We have to initalize them twice, so we cover a.out (which prepends + an underscore) and coff object file formats. */ + +PROVIDE (hardware_init_hook = 0); +PROVIDE (_hardware_init_hook = 0); +PROVIDE (software_init_hook = 0); +PROVIDE (_software_init_hook = 0); + +/* Put everything in ram (of course). */ + +SECTIONS +{ + .text : + { + *(.text) + . = ALIGN(0x4); + __CTOR_LIST__ = .; + LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) + ___ctors = .; + *(.ctors) + ___ctors_end = .; + LONG(0) + __CTOR_END__ = .; + __DTOR_LIST__ = .; + LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) + ___dtors = .; + *(.dtors) + ___dtors_end = .; + LONG(0) + __DTOR_END__ = .; + *(.rodata) + *(.gcc_except_table) + + _etext = .; + *(.lit) + } > ram + + .data BLOCK (0x4) : + { + *(.shdata) + *(.data) + _edata = .; + } > ram + + .bss BLOCK (0x4) : + { + __bss_start = . ; + *(.shbss) + *(.bss) + *(COMMON) + _end = ALIGN (0x8); + __end = _end; + } > ram + + /* I know, I know, stack sections are supposed to be useless; but + this actually worked for me, as opposed to the PROVIDE. */ + .stack 0xa00ff00 : + { + __stack = .; + } > ram + + .stab 0 (NOLOAD) : { *(.stab) } + .stabstr 0 (NOLOAD) : { *(.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) } + .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) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } +} diff --git a/libgloss/sh/sh2lcevb.ld b/libgloss/sh/sh2lcevb.ld new file mode 100644 index 0000000..8ae7f31 --- /dev/null +++ b/libgloss/sh/sh2lcevb.ld @@ -0,0 +1,109 @@ +/* Linker script for the SH2 Low-Cost Eval Board. */ + +SEARCH_DIR(.) +GROUP(-lc -lgcc) +__DYNAMIC = 0; + +MEMORY +{ + ram (rwx) : ORIGIN = 0x4004000, LENGTH = 0x40000 +} + +/* Put the stack up high. */ +/* (Commented out because it doesn't seem to work right) */ +/*PROVIDE (__stack = 0x403ff00);*/ + +/* Initalize some symbols to be zero so we can reference them in the + crt0 without core dumping. These functions are all optional, but + we do this so we can have our crt0 always use them if they exist. + This is so BSPs work better when using the crt0 installed with gcc. + We have to initalize them twice, so we cover a.out (which prepends + an underscore) and coff object file formats. */ + +PROVIDE (hardware_init_hook = 0); +PROVIDE (_hardware_init_hook = 0); +PROVIDE (software_init_hook = 0); +PROVIDE (_software_init_hook = 0); + +/* Put everything in ram (of course). */ + +SECTIONS +{ + .text : + { + *(.text) + . = ALIGN(0x4); + __CTOR_LIST__ = .; + LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) + ___ctors = .; + *(.ctors) + ___ctors_end = .; + LONG(0) + __CTOR_END__ = .; + __DTOR_LIST__ = .; + LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) + ___dtors = .; + *(.dtors) + ___dtors_end = .; + LONG(0) + __DTOR_END__ = .; + *(.rodata) + *(.gcc_except_table) + + _etext = .; + *(.lit) + } > ram + + .data BLOCK (0x4) : + { + *(.shdata) + *(.data) + _edata = .; + } > ram + + .bss BLOCK (0x4) : + { + __bss_start = . ; + *(.shbss) + *(.bss) + *(COMMON) + _end = ALIGN (0x8); + __end = _end; + } > ram + + /* I know, I know, stack sections are supposed to be useless; but + this actually worked for me, as opposed to the PROVIDE. */ + .stack 0x403ff00 : + { + __stack = .; + } > ram + + .stab 0 (NOLOAD) : { *(.stab) } + .stabstr 0 (NOLOAD) : { *(.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) } + .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) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } +} diff --git a/libgloss/sh/sh3bb.ld b/libgloss/sh/sh3bb.ld new file mode 100644 index 0000000..c3fc657 --- /dev/null +++ b/libgloss/sh/sh3bb.ld @@ -0,0 +1,111 @@ +/* Linker script for the "SH3 Target System", also known as "the big box". */ + +/*STARTUP(crt0.o) */ +/*OUTPUT_ARCH(shl)*/ +SEARCH_DIR(.) +GROUP(-lc -lgcc) +__DYNAMIC = 0; + +MEMORY +{ + ram (rwx) : ORIGIN = 0xc008000, LENGTH = 0x2000000 +} + +/* Put the stack up high. */ +/* (Commented out because it doesn't seem to work right) */ +/*PROVIDE (__stack = 0xc800000);*/ + +/* Initalize some symbols to be zero so we can reference them in the + crt0 without core dumping. These functions are all optional, but + we do this so we can have our crt0 always use them if they exist. + This is so BSPs work better when using the crt0 installed with gcc. + We have to initalize them twice, so we cover a.out (which prepends + an underscore) and coff object file formats. */ + +PROVIDE (hardware_init_hook = 0); +PROVIDE (_hardware_init_hook = 0); +PROVIDE (software_init_hook = 0); +PROVIDE (_software_init_hook = 0); + +/* Put everything in ram (of course). */ + +SECTIONS +{ + .text : + { + *(.text) + . = ALIGN(0x4); + __CTOR_LIST__ = .; + LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) + ___ctors = .; + *(.ctors) + ___ctors_end = .; + LONG(0) + __CTOR_END__ = .; + __DTOR_LIST__ = .; + LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) + ___dtors = .; + *(.dtors) + ___dtors_end = .; + LONG(0) + __DTOR_END__ = .; + *(.rodata) + *(.gcc_except_table) + + _etext = .; + *(.lit) + } > ram + + .data BLOCK (0x4) : + { + *(.shdata) + *(.data) + _edata = .; + } > ram + + .bss BLOCK (0x4) : + { + __bss_start = . ; + *(.shbss) + *(.bss) + *(COMMON) + _end = ALIGN (0x8); + __end = _end; + } > ram + + /* I know, I know, stack sections are supposed to be useless; but + this actually worked for me, as opposed to the PROVIDE. */ + .stack 0xc800000 : + { + __stack = .; + } > ram + + .stab 0 (NOLOAD) : { *(.stab) } + .stabstr 0 (NOLOAD) : { *(.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) } + .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) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } +} diff --git a/libgloss/sh/sh3lcevb.ld b/libgloss/sh/sh3lcevb.ld new file mode 100644 index 0000000..0129921 --- /dev/null +++ b/libgloss/sh/sh3lcevb.ld @@ -0,0 +1,109 @@ +/* Linker script for the SH3 Low-Cost Eval Board. */ + +SEARCH_DIR(.) +GROUP(-lc -lgcc) +__DYNAMIC = 0; + +MEMORY +{ + ram (rwx) : ORIGIN = 0x8004000, LENGTH = 0x2000000 +} + +/* Put the stack up high. */ +/* (Commented out because it doesn't seem to work right) */ +/*PROVIDE (__stack = 0x8100000);*/ + +/* Initalize some symbols to be zero so we can reference them in the + crt0 without core dumping. These functions are all optional, but + we do this so we can have our crt0 always use them if they exist. + This is so BSPs work better when using the crt0 installed with gcc. + We have to initalize them twice, so we cover a.out (which prepends + an underscore) and coff object file formats. */ + +PROVIDE (hardware_init_hook = 0); +PROVIDE (_hardware_init_hook = 0); +PROVIDE (software_init_hook = 0); +PROVIDE (_software_init_hook = 0); + +/* Put everything in ram (of course). */ + +SECTIONS +{ + .text : + { + *(.text) + . = ALIGN(0x4); + __CTOR_LIST__ = .; + LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) + ___ctors = .; + *(.ctors) + ___ctors_end = .; + LONG(0) + __CTOR_END__ = .; + __DTOR_LIST__ = .; + LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) + ___dtors = .; + *(.dtors) + ___dtors_end = .; + LONG(0) + __DTOR_END__ = .; + *(.rodata) + *(.gcc_except_table) + + _etext = .; + *(.lit) + } > ram + + .data BLOCK (0x4) : + { + *(.shdata) + *(.data) + _edata = .; + } > ram + + .bss BLOCK (0x4) : + { + __bss_start = . ; + *(.shbss) + *(.bss) + *(COMMON) + _end = ALIGN (0x8); + __end = _end; + } > ram + + /* I know, I know, stack sections are supposed to be useless; but + this actually worked for me, as opposed to the PROVIDE. */ + .stack 0x8100000 : + { + __stack = .; + } > ram + + .stab 0 (NOLOAD) : { *(.stab) } + .stabstr 0 (NOLOAD) : { *(.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) } + .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) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } +} diff --git a/libgloss/sparc/Makefile.in b/libgloss/sparc/Makefile.in new file mode 100644 index 0000000..fcf5448 --- /dev/null +++ b/libgloss/sparc/Makefile.in @@ -0,0 +1,286 @@ +# Copyright (c) 1995, 1996, 1997 Cygnus Support +# +# The authors hereby grant permission to use, copy, modify, distribute, +# and license this software and its documentation for any purpose, provided +# that existing copyright notices are retained in all copies and that this +# notice is included verbatim in any distributions. No written agreement, +# license, or royalty fee is required for any of the authorized uses. +# Modifications to this software may be copyrighted by their authors +# and need not follow the licensing terms described here, provided that +# the new terms are clearly indicated on the first page of each file where +# they apply. + +# Makefile for libgloss/sparc. This is the board support +# code for the various sparc targets. + +VPATH = @srcdir@ +srcdir = @srcdir@ +objdir = . +srcroot = $(srcdir)/../.. +objroot = $(objdir)/../.. + +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +host_alias = @host_alias@ +target_alias = @target_alias@ + +bindir = @bindir@ +libdir = @libdir@ +tooldir = $(exec_prefix)/$(target_alias) + +# Multilib support variables. +# TOP is used instead of MULTI{BUILD,SRC}TOP. +MULTIDIRS = +MULTISUBDIR = +MULTIDO = true +MULTICLEAN = true + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ + +SHELL = /bin/sh + +CC = @CC@ + +AS = @AS@ +AR = @AR@ +LD = @LD@ +RANLIB = @RANLIB@ +AR_FLAGS = qrv + +OBJDUMP = `if [ -f ${objroot}/../binutils/objdump ] ; \ + then echo ${objroot}/../binutils/objdump ; \ + else t='$(program_transform_name)'; echo objdump | sed -e $$t ; fi` +OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \ + then echo ${objroot}/../binutils/objcopy ; \ + else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi` + +CYGMON_CRT0 = cygmon-crt0.o +CYGMON_BSP = libcygmon.a +CYGMON_OBJS = cygmon-salib.o + +701_CRT0 = crt0-701.o +701_BSP = libsplet701.a +701_OBJS = sysc-701.o salib-701.o sparclet-stub.o + +930_BSP = libslite930.a +931_BSP = libslite931.a +934_BSP = libslite934.a +86X_BSP = libslite86x.a + +# for the time being, built the stub without hardware breakpoint support +SLITE_OBJS = salib.o sparcl-stub.o cache.o + +# ERC32: SIS simulator, see sim/erc32. +ERC32_CRT0 = erc32-crt0.o +ERC32_BSP = liberc32.a +ERC32_OBJS = erc32-io.o traps.o erc32-stub.o debug.o fixctors.o +ERC32_ALL = $(ERC32_CRT0) $(ERC32_BSP) + +CRT0 = crt0.o +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 + +# This is set to one of SPARC, SLITE, or SPLET by configure. +# It's not clear what to do here. +# One could certainly build everything. The assembler supports all cpu +# variants (via runtime switches). However, the compiler [currently] doesn't. +# Of course, it may be the case that there isn't any cpu specific code in +# C source files, but there might be in the future. +CPU = @CPU@ + +# sparc stuff (not sparclite or sparclet) +SPARC_ALL = $(CYGMON_BSP) $(CYGMON_CRT0) $(objdir)/cygmon.ld +SPARC_INSTALL = sparc-install +SPARC_OBJ_FORMAT = sparc +SPARC_RAM_START = 0x4000 + +# sparc 64 stuff +SPARC64_ALL = $(CYGMON_BSP) $(CYGMON_CRT0) $(objdir)/cygmon.ld +SPARC64_INSTALL = sparc-install +SPARC64_OBJ_FORMAT = sparc:v9 +SPARC64_RAM_START = 0x4000 + +# sparclite stuff +SLITE_ALL = $(930_BSP) $(931_BSP) $(CYGMON_BSP) $(CYGMON_CRT0) $(objdir)/cygmon.ld $(934_BSP) $(86X_BSP) +SLITE_INSTALL = slite-install +SLITE_OBJ_FORMAT = sparc +SLITE_RAM_START = 0x40050000 + +# sparclet stuff +SPLET_ALL = $(701_CRT0) $(701_BSP) +SPLET_INSTALL = splet-install + +#### Host specific Makefile fragment comes in here. +@host_makefile_frag@ + +all: ${CRT0} $($(CPU)_ALL) $(ERC32_ALL) + +$(CYGMON_CRT0): cygmon-crt0.S + $(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) -DTARGET_CPU_$(CPU) $(INCLUDES) -o $@ -c $(srcdir)/cygmon-crt0.S + +$(CYGMON_BSP): $(CYGMON_OBJS) + @rm -f $@ + ${AR} ${AR_FLAGS} $@ $(CYGMON_OBJS) + ${RANLIB} $@ + +#$(STUBLIBS): $(OBJS) $(SLITE_OBJS) $(CRT0) +# ${CC} -nostdlib -r $(SLITE_OBJS) $(SHARED_OBJS) -o $(930_BSP) +# ${CC} -DSL931 -nostdlib -r $(SLITE_OBJS) $(SHARED_OBJS) -o $(931_BSP) +# ${CC} -nostdlib -r $(SLITE_OBJS) $(SHARED_OBJS) -o $(934_BSP) + +$(CRT0): $(srcdir)/crt0.S $(srcdir)/asm.h $(srcdir)/slite.h + $(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -o $@ -c $(srcdir)/crt0.S + +$(930_BSP) $(931_BSP) $(934_BSP) $(86X_BSP): $(OBJS) $(SLITE_OBJS) + @rm -f $@ + ${AR} ${AR_FLAGS} $@ $(OBJS) $(SLITE_OBJS) + ${RANLIB} $@ + +$(701_BSP): $(701_OBJS) + @rm -f $@ + ${AR} ${AR_FLAGS} $@ $(701_OBJS) + ${RANLIB} $@ + +erc32-crt0.o: $(srcdir)/erc32-crt0.S $(srcdir)/asm.h $(srcdir)/slite.h + $(CC) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -o $@ -c $(srcdir)/erc32-crt0.S + +liberc32.a: $(OBJS) $(ERC32_OBJS) + @rm -f $@ + ${AR} ${AR_FLAGS} $@ $(OBJS) $(ERC32_OBJS) + ${RANLIB} $@ + +crt0-701.o: crt0-701.S +sysc-701.o: sysc-701.c +salib-701.o: salib-701.c +sparclet-stub.o: sparclet-stub.c +cygmon-salib.o: cygmon-salib.c + $(CC) -DTARGET_CPU_$(CPU) $(CFLAGS_FOR_TARGET) $(CFLAGS) $(INCLUDES) -o $@ -c $(srcdir)/cygmon-salib.c +cache.o: $(srcdir)/cache.c +salib.o: $(srcdir)/salib.c +win.o: $(srcdir)/win.S +syscalls.o: $(srcdir)/syscalls.c +sparcl-stub.o: $(srcdir)/sparcl-stub.c $(srcdir)/../debug.h $(srcdir)/../debug.c +erc32-stub.o: $(srcdir)/erc32-stub.c $(srcdir)/../debug.h $(srcdir)/../debug.c +fixctors.o : $(srcdir)/fixctors.c + +$(objdir)/cygmon.ld: @CYGMONLDSCRIPTTEMPL@ + sed 's/TARGET_OBJ_FORMAT/$($(CPU)_OBJ_FORMAT)/g;s/TARGET_RAM_START/$($(CPU)_RAM_START)/g;' < $(<) > $(objdir)/cygmon.ld + +install: $($(CPU)_INSTALL) + $(INSTALL_DATA) $(CRT0) $(tooldir)/lib${MULTISUBDIR}/$(CRT0) + +sparc-install: + $(INSTALL_DATA) $(CYGMON_BSP) $(tooldir)/lib${MULTISUBDIR} + $(INSTALL_DATA) $(CYGMON_OBJS) $(tooldir)/lib${MULTISUBDIR} + $(INSTALL_DATA) $(objdir)/cygmon.ld $(tooldir)/lib${MULTISUBDIR} + $(INSTALL_DATA) $(CYGMON_CRT0) $(tooldir)/lib${MULTISUBDIR} + +slite-install: + $(INSTALL_DATA) $(930_BSP) $(tooldir)/lib${MULTISUBDIR}/$(930_BSP) + $(INSTALL_DATA) $(931_BSP) $(tooldir)/lib${MULTISUBDIR}/$(931_BSP) + $(INSTALL_DATA) $(934_BSP) $(tooldir)/lib${MULTISUBDIR}/$(934_BSP) + $(INSTALL_DATA) $(86X_BSP) $(tooldir)/lib${MULTISUBDIR}/$(86X_BSP) + $(INSTALL_DATA) $(srcdir)/ex930.ld $(tooldir)/lib${MULTISUBDIR} + $(INSTALL_DATA) $(srcdir)/ex931.ld $(tooldir)/lib${MULTISUBDIR} + $(INSTALL_DATA) $(srcdir)/ex934.ld $(tooldir)/lib${MULTISUBDIR} + $(INSTALL_DATA) $(srcdir)/sparc86x.ld $(tooldir)/lib${MULTISUBDIR} + $(INSTALL_DATA) $(srcdir)/elfsim.ld $(tooldir)/lib${MULTISUBDIR} + $(INSTALL_DATA) $(ERC32_CRT0) $(tooldir)/lib${MULTISUBDIR} + $(INSTALL_DATA) $(ERC32_BSP) $(tooldir)/lib${MULTISUBDIR} + $(INSTALL_DATA) $(objdir)/traps.o $(tooldir)/lib${MULTISUBDIR} + $(INSTALL_DATA) $(CYGMON_BSP) $(tooldir)/lib${MULTISUBDIR} + $(INSTALL_DATA) $(CYGMON_OBJS) $(tooldir)/lib${MULTISUBDIR} + $(INSTALL_DATA) $(objdir)/cygmon.ld $(tooldir)/lib${MULTISUBDIR} + $(INSTALL_DATA) $(CYGMON_CRT0) $(tooldir)/lib${MULTISUBDIR} + +splet-install: + $(INSTALL_DATA) $(701_CRT0) $(tooldir)/lib${MULTISUBDIR}/$(701_CRT0) + $(INSTALL_DATA) $(701_BSP) $(tooldir)/lib${MULTISUBDIR}/$(701_BSP) + $(INSTALL_DATA) $(srcdir)/tsc701.ld $(tooldir)/lib${MULTISUBDIR} + +# Make a simple test case to test the linker script, startup code, and +# I/O code +# +test: ex930-test.x ex931-test.x erc32-test.x + @echo Done... + +# compile a fully linked binary. The -N option is for a.out, so the +# base address will be zero, rather than the default of 0x2020. The +# -Wl,-T*.ld is for the linker script. By using -Wl, the linker script +# is put on the proper place in the comand line for ld, and all the +# symbols will get fully resolved. + +erc32-test.x: test.o ${ERC32_CRT0} ${srcdir}/erc32.ld Makefile ${ERC32_BSP} + ${CC} -L${srcdir} -L${objdir} test.o -o $@ $(LDFLAGS_FOR_TARGET) \ + -N -Wl,-Terc32.ld -Wl,-Map -Wl,erc32.map -nostdlib +erc32-test.srec: erc32-test.x + $(OBJCOPY) -O srec erc32-test.x $@ +erc32-test.dis: erc32-test.x + @rm -fr erc32-test.dis + $(OBJDUMP) -d erc32-test.x > $@ +erc32-test: erc32-test.srec erc32-test.dis + +ex930-test.x: test.o ${CRT0} ${srcdir}/ex930.ld Makefile ${930_BSP} + ${CC} -L${srcdir} -L${objdir} test.o -o $@ $(LDFLAGS_FOR_TARGET) \ + -N -Wl,-Tex930.ld -nostdlib +ex930-test.srec: ex930-test.x + $(OBJCOPY) -O srec ex930-test.x $@ +ex930-test.dis: ex930-test.x + @rm -fr ex930-test.dis + $(OBJDUMP) -d ex930-test.x > $@ +ex930-test: ex930-test.srec ex930-test.dis + +ex931-test.x: test.o ${CRT0} ${srcdir}/ex931.ld Makefile ${931_BSP} + ${CC} -L${srcdir} -L${objdir} test.o -o $@ $(LDFLAGS_FOR_TARGET) \ + -N -Wl,-Tex931.ld -nostdlib +ex931-test.srec: ex931-test.x + $(OBJCOPY) -O srec ex931-test.x $@ +ex931-test.dis: ex931-test.x + @rm -fr ex931-test.dis + $(OBJDUMP) -d ex931-test.x > $@ +ex931-test: ex931-test.srec ex931-test.dis + +ex934-test.x: test.o ${CRT0} ${srcdir}/ex934.ld Makefile ${934_BSP} + ${CC} -L${srcdir} -L${objdir} test.o -o $@ $(LDFLAGS_FOR_TARGET) \ + -N -Wl,-Tex934.ld -nostdlib +ex934-test.srec: ex934-test.x + $(OBJCOPY) -O srec ex934-test.x $@ +ex934-test.dis: ex934-test.x + @rm -fr ex934-test.dis + $(OBJDUMP) -d ex934-test.x > $@ +ex934-test: ex934-test.srec ex934-test.dis + +# a C++ test case +dtor.o: $(srcdir)/dtor.C + $(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) -o $@ -c $? +dtor.dis: dtor.x + @rm -fr dtor.dis + $(OBJDUMP) -d dtor.x > $@ +dtor.x: dtor.o ${ERC32_CRT0} ${srcdir}/erc32.ld Makefile ${ERC32_BSP} + ${CC} -L${srcdir} -L${objdir} dtor.o -o $@ $(LIBS_FOR_TARGET) \ + -N -Wl,-Terc32.ld + +# target specific makefile fragment comes in here. +@target_makefile_frag@ + +clean mostlyclean: + rm -f *.o *.a *.map *.x + +distclean maintainer-clean realclean: clean + rm -f Makefile config.cache config.log config.status + +.PHONY: info dvi doc install-info clean-info +info doc dvi: +install-info: +clean-info: + +Makefile: Makefile.in config.status @host_makefile_frag_path@ \ + @target_makefile_frag_path@ + $(SHELL) config.status + +config.status: configure + $(SHELL) config.status --recheck diff --git a/libgloss/sparc/asm.h b/libgloss/sparc/asm.h new file mode 100644 index 0000000..daeff34 --- /dev/null +++ b/libgloss/sparc/asm.h @@ -0,0 +1,39 @@ +/* asm.h -- macros for sparc asm + * + * Copyright (c) 1996 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#ifndef __SPARC_ASM_h +#define __SPARC_ASM_h + +/* Indicate we are in an assembly file and get the basic CPU definitions. */ +#define ASM + +/* ANSI concatenation macros. */ +#define CONCAT1(a, b) CONCAT2(a, b) +#define CONCAT2(a, b) a ## b + +/* Use the right prefix for global labels. + Note that it's too late to have coff have no underscores + (would break user programs). + One school of thought likes having underscores for both a.out and coff + (simplicity in consistency). */ +#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__,x) + +/* STRINGSYM makes a string out of a symbol name with the proper assembly + prefix. Useful for inline assembly language in C source files. */ +#define STRINGIT2(x) #x +#define STRINGIT1(x) STRINGIT2(x) +#define STRINGSYM(x) STRINGIT1(SYM(x)) + +#endif diff --git a/libgloss/sparc/cache.c b/libgloss/sparc/cache.c new file mode 100644 index 0000000..5b6e270 --- /dev/null +++ b/libgloss/sparc/cache.c @@ -0,0 +1,147 @@ +/* Cache code for SPARClite + * + * Copyright (c) 1998 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#include "sparclite.h" + +/* Ancillary registers on the DANlite */ + +#define DIAG 30 +#define ICCR 31 + +/* Bits in the DIAG register */ + +#define ICD 0x40000000 /* ICACHE disable */ +#define DCD 0x20000000 /* DCACHE disable */ + +/* Bits in the ICCR register */ + +#define CE 1 /* cache enable*/ + + +/* Forward declarations. */ + +void flush_i_cache (); + + +/* Determine if this is a DANlite (MB8686x), as opposed to an earlier + SPARClite (MB8683x). This is done by examining the impl and ver + fields in the PSR: + + MB8683x: impl(bit31-28)=0x0; ver(bit27-24)=0xf; + MB8686x: impl(bit31-28)=0x1; ver(bit27-24)=0xe; +*/ + +static int +is_danlite () +{ + static int checked = 0; + static int danlite = 0; + + if (!checked) + { + int psr = read_psr (); + danlite = (psr & 0xff000000) == 0x1e000000; + checked = 1; + } + return danlite; +} + +/* This cache code is known to work on both the 930 & 932 processors. It just + cheats and clears the all of the address space that could contain tags, as + opposed to striding the tags at 8 or 16 word intervals, or using the cache + flush registers, which don't exist on all processors. */ + +void +cache_off () +{ + if (is_danlite ()) + { + /* Disable the ICACHE. Disabling the DCACHE crashes the machine. */ + unsigned int diag = read_asr (DIAG); + write_asr (DIAG, diag | ICD); + } + else + { + write_asi (1, 0, 0); + } +} + +void +cache_on () +{ + if (is_danlite ()) + { + unsigned int diag; + + /* Flush the caches. */ + flush_i_cache (); + + /* Enable the ICACHE and DCACHE */ + diag = read_asr (DIAG); + write_asr (DIAG, diag & ~ (ICD | DCD)); + } + else + { + unsigned long addr; + + cache_off (); /* Make sure the cache is off */ + + /* Reset all of the cache line valid bits */ + + for (addr = 0; addr < 0x1000; addr += 8) + { + write_asi (0xc, addr, 0); /* Clear bank 1, icache */ + write_asi (0xc, addr + 0x80000000, 0); /* Clear bank 2, icache */ + + write_asi (0xe, addr, 0); /* Clear bank 1, dcache */ + write_asi (0xe, addr + 0x80000000, 0); /* Clear bank 2, dcache */ + } + + /* turn on the cache */ + + write_asi (1, 0, 0x35); /* Write buf ena, prefetch buf ena, data + & inst caches enab */ + } +} + +/* Flush the instruction cache. We need to do this for the debugger stub so + that breakpoints, et. al. become visible to the instruction stream after + storing them in memory. + */ + +void +flush_i_cache () +{ + if (is_danlite ()) + { + write_asi (0x31, 0, 0); /* Flush entire i/d caches */ + } + else + { + int cache_reg; + unsigned long addr; + + cache_reg = read_asi (1, 0); /* Read cache/bus interface reg */ + + if (!(cache_reg & 1)) + return; /* Just return if cache is already off */ + + for (addr = 0; addr < 0x1000; addr += 8) + { + write_asi (0xc, addr, 0); /* Clear bank 1, icache */ + write_asi (0xc, addr + 0x80000000, 0); /* Clear bank 2, icache */ + } + } +} diff --git a/libgloss/sparc/configure b/libgloss/sparc/configure new file mode 100755 index 0000000..8c5c76c --- /dev/null +++ b/libgloss/sparc/configure @@ -0,0 +1,1201 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.12.1 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.12.1" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=sparc-stub.c + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + +if test "${enable_shared}" = "yes" ; then + echo "Shared libraries not supported for cross compiling, ignored" +fi + +if test "$srcdir" = "." ; then + if test "${with_target_subdir}" != "." ; then + libgloss_topdir="${with_multisrctop}../../.." + else + libgloss_topdir="${with_multisrctop}../.." + fi +else + libgloss_topdir="${srcdir}/../.." +fi + +ac_aux_dir= +for ac_dir in $libgloss_topdir $srcdir/$libgloss_topdir; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $libgloss_topdir $srcdir/$libgloss_topdir" 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:570: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + + +# Do some error checking and defaulting for the host and target type. +# The inputs are: +# configure --host=HOST --target=TARGET --build=BUILD NONOPT +# +# The rules are: +# 1. You are not allowed to specify --host, --target, and nonopt at the +# same time. +# 2. Host defaults to nonopt. +# 3. If nonopt is not specified, then host defaults to the current host, +# as determined by config.guess. +# 4. Target and build default to nonopt. +# 5. If nonopt is not specified, then target and build default to host. + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +case $host---$target---$nonopt in +NONE---*---* | *---NONE---* | *---*---NONE) ;; +*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;; +esac + + +# Make sure we can run config.sub. +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi + +echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:649: checking host system type" >&5 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + +echo $ac_n "checking target system type""... $ac_c" 1>&6 +echo "configure:670: checking target system type" >&5 + +target_alias=$target +case "$target_alias" in +NONE) + case $nonopt in + NONE) target_alias=$host_alias ;; + *) target_alias=$nonopt ;; + esac ;; +esac + +target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias` +target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$target" 1>&6 + +echo $ac_n "checking build system type""... $ac_c" 1>&6 +echo "configure:688: checking build system type" >&5 + +build_alias=$build +case "$build_alias" in +NONE) + case $nonopt in + NONE) build_alias=$host_alias ;; + *) build_alias=$nonopt ;; + esac ;; +esac + +build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` +build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$build" 1>&6 + +test "$host_alias" != "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + + +# FIXME: We temporarily define our own version of AC_PROG_CC. This is +# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We +# are probably using a cross compiler, which will not be able to fully +# link an executable. This should really be fixed in autoconf +# itself. + + + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:722: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:751: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + ac_prog_rejected=no + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +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 $# -gt 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 + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:799: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <<EOF +#ifdef __GNUC__ + yes; +#endif +EOF +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:808: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:823: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi + +AS=${AS-as} + +AR=${AR-ar} + +LD=${LD-ld} + +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:859: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +case ${target_cpu} in +sparclite*) CPU=SLITE ;; +sparclet*) CPU=SPLET ;; +sparc64*) CPU=SPARC64 ;; +sparc86x*) CPU=SLITE ;; +*) CPU=SPARC ;; +esac + + +case ${target_cpu} in +sparc64*) CYGMONLDSCRIPTTEMPL=${srcdir}/cygmon-sparc64-ld.src ;; +*) CYGMONLDSCRIPTTEMPL=${srcdir}/cygmon.ld.src +esac + +host_makefile_frag=${srcdir}/../config/default.mh +target_makefile_frag=${srcdir}/../config/default.mt + +host_makefile_frag_path=$host_makefile_frag + + +target_makefile_frag_path=$target_makefile_frag + + + + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs + + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS <<EOF +#! /bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.12.1" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS <<EOF + +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; + s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@host@%$host%g +s%@host_alias@%$host_alias%g +s%@host_cpu@%$host_cpu%g +s%@host_vendor@%$host_vendor%g +s%@host_os@%$host_os%g +s%@target@%$target%g +s%@target_alias@%$target_alias%g +s%@target_cpu@%$target_cpu%g +s%@target_vendor@%$target_vendor%g +s%@target_os@%$target_os%g +s%@build@%$build%g +s%@build_alias@%$build_alias%g +s%@build_cpu@%$build_cpu%g +s%@build_vendor@%$build_vendor%g +s%@build_os@%$build_os%g +s%@CC@%$CC%g +s%@AS@%$AS%g +s%@AR@%$AR%g +s%@LD@%$LD%g +s%@RANLIB@%$RANLIB%g +s%@CPU@%$CPU%g +s%@host_makefile_frag_path@%$host_makefile_frag_path%g +/@host_makefile_frag@/r $host_makefile_frag +s%@host_makefile_frag@%%g +s%@target_makefile_frag_path@%$target_makefile_frag_path%g +/@target_makefile_frag@/r $target_makefile_frag +s%@target_makefile_frag@%%g +s%@CYGMONLDSCRIPTTEMPL@%$CYGMONLDSCRIPTTEMPL%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <<EOF + +CONFIG_FILES=\${CONFIG_FILES-"Makefile"} +EOF +cat >> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +EOF +cat >> $CONFIG_STATUS <<EOF +srcdir=${srcdir} +target=${target} +ac_configure_args="${ac_configure_args} --enable-multilib" +CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} +libgloss_topdir=${libgloss_topdir} + +EOF +cat >> $CONFIG_STATUS <<\EOF +. ${libgloss_topdir}/config-ml.in +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + + diff --git a/libgloss/sparc/configure.in b/libgloss/sparc/configure.in new file mode 100644 index 0000000..c836f6c --- /dev/null +++ b/libgloss/sparc/configure.in @@ -0,0 +1,120 @@ +# Copyright (c) 1995, 1996 Cygnus Support +# +# The authors hereby grant permission to use, copy, modify, distribute, +# and license this software and its documentation for any purpose, provided +# that existing copyright notices are retained in all copies and that this +# notice is included verbatim in any distributions. No written agreement, +# license, or royalty fee is required for any of the authorized uses. +# Modifications to this software may be copyrighted by their authors +# and need not follow the licensing terms described here, provided that +# the new terms are clearly indicated on the first page of each file where +# they apply. +dnl Process this file with autoconf to produce a configure script. +AC_PREREQ(2.5)dnl +AC_INIT(sparc-stub.c) + +if test "${enable_shared}" = "yes" ; then + echo "Shared libraries not supported for cross compiling, ignored" +fi + +if test "$srcdir" = "." ; then + if test "${with_target_subdir}" != "." ; then + libgloss_topdir="${with_multisrctop}../../.." + else + libgloss_topdir="${with_multisrctop}../.." + fi +else + libgloss_topdir="${srcdir}/../.." +fi + +AC_CONFIG_AUX_DIR($libgloss_topdir) + +AC_PROG_INSTALL + +AC_CANONICAL_SYSTEM + +# FIXME: We temporarily define our own version of AC_PROG_CC. This is +# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We +# are probably using a cross compiler, which will not be able to fully +# link an executable. This should really be fixed in autoconf +# itself. + +AC_DEFUN(LIB_AC_PROG_CC, +[AC_BEFORE([$0], [AC_PROG_CPP])dnl +AC_CHECK_PROG(CC, gcc, gcc) +if test -z "$CC"; then + AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) + test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) +fi + +AC_PROG_CC_GNU + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +dnl Check whether -g works, even if CFLAGS is set, in case the package +dnl plays around with CFLAGS (such as to build both debugging and +dnl normal versions of a library), tasteless as that idea is. + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + AC_PROG_CC_G + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi +]) + +LIB_AC_PROG_CC +AS=${AS-as} +AC_SUBST(AS) +AR=${AR-ar} +AC_SUBST(AR) +LD=${LD-ld} +AC_SUBST(LD) +AC_PROG_RANLIB + +case ${target_cpu} in +sparclite*) CPU=SLITE ;; +sparclet*) CPU=SPLET ;; +sparc64*) CPU=SPARC64 ;; +sparc86x*) CPU=SLITE ;; +*) CPU=SPARC ;; +esac +AC_SUBST(CPU) + +case ${target_cpu} in +sparc64*) CYGMONLDSCRIPTTEMPL=${srcdir}/cygmon-sparc64-ld.src ;; +*) CYGMONLDSCRIPTTEMPL=${srcdir}/cygmon.ld.src +esac + +host_makefile_frag=${srcdir}/../config/default.mh +target_makefile_frag=${srcdir}/../config/default.mt + +dnl We have to assign the same value to other variables because autoconf +dnl doesn't provide a mechanism to substitute a replacement keyword with +dnl arbitrary data or pathnames. +dnl +host_makefile_frag_path=$host_makefile_frag +AC_SUBST(host_makefile_frag_path) +AC_SUBST_FILE(host_makefile_frag) +target_makefile_frag_path=$target_makefile_frag +AC_SUBST(target_makefile_frag_path) +AC_SUBST_FILE(target_makefile_frag) +AC_SUBST(CYGMONLDSCRIPTTEMPL) + +AC_OUTPUT(Makefile, +. ${libgloss_topdir}/config-ml.in, +srcdir=${srcdir} +target=${target} +ac_configure_args="${ac_configure_args} --enable-multilib" +CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} +libgloss_topdir=${libgloss_topdir} +) + diff --git a/libgloss/sparc/crt0-701.S b/libgloss/sparc/crt0-701.S new file mode 100644 index 0000000..44ffadc --- /dev/null +++ b/libgloss/sparc/crt0-701.S @@ -0,0 +1,105 @@ +/* crt0.S for the sparclet 701. + + At the moment, all the necessary syscalls are here. + Convention has them in a separate file but libgloss is still in + too much flux. */ + + .text + + .global start +start: + +! zero bss + + sethi %hi(_end), %o1 + or %o1, %lo(_end), %o1 + sethi %hi(_edata), %o0 + or %o0, %lo (_edata), %o0 + sub %o1, %o0, %o1 +Lzero_bss: + subcc %o1, 4, %o1 + clr [%o0] + bne Lzero_bss + add %o0, 4, %o0 + +! set up argc, argv, envp (?) + + ld [%sp+64], %o0 + sll %o0, 2, %o2 + add %o2, 4, %o2 + add %sp, 68, %o1 + add %o1, %o2, %o2 + sethi %hi(_environ), %o3 + st %o2, [%o3+%lo(_environ)] + +! call main, exit + + call _main + sub %sp, 32, %sp + call _exit + nop + +! void _exit (int rc) + + .global __exit +__exit: + mov 1, %g1 + ta 0 +! If that does not work, just loop forever. +Lloop_forever: + b Lloop_forever + nop + +! int _open (char *, int) + + .global _open +_open: + mov 5, %g1 + ta 0 + bcc Lnoerr + nop + b Lcerror + nop + +! int _close (int) + + .global _close +_close: + mov 6, %g1 + ta 0 + bcc Lnoerr + nop + b Lcerror + nop + +! int read (int, char *, int) + + .global _read +_read: + mov 3, %g1 + ta 0 + bcc Lnoerr + nop + b Lcerror + nop + +! int write (int, char *, int) + + .global _write +_write: + mov 4, %g1 + ta 0 + bcc Lnoerr + nop + b Lcerror + nop + +Lnoerr: + retl + nop + +Lcerror: + sethi %hi(__impure_ptr), %g1 + st %o0, [%g1+%lo(__impure_ptr)] + retl + mov -1, %o0 diff --git a/libgloss/sparc/crt0.S b/libgloss/sparc/crt0.S new file mode 100644 index 0000000..90e18c5 --- /dev/null +++ b/libgloss/sparc/crt0.S @@ -0,0 +1,186 @@ +/* + * C startup code for the Fujitsu SPARClite demo board + * + * Copyright (c) 1995, 1996 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include "asm.h" + +.data + .align 8 + .ascii "DaTa" ! this is the first address in the data section + .long SYM(sdata) +SYM(environ): + .long 0 + + .text + .align 8 + + .globl SYM(_start) +SYM(_start): + .globl SYM(start) +SYM(start): + /* see if the stack is already setup. if not, then default + * to using the value of %sp as set by the ROM monitor + */ + sethi %hi(__stack), %g1 + or %g1,%lo(__stack),%g1 + cmp %g0,%g1 + be 1f + mov %g1, %sp ! set the stack pointer + mov %sp, %fp +1: + + /* zero the bss section */ + sethi %hi(__bss_start),%g2 + or %g2,%lo(__bss_start),%g2 ! start of bss + sethi %hi(_end),%g3 + or %g3,%lo(_end),%g3 ! end of bss + mov %g0,%g1 ! so std has two zeros +zerobss: + std %g0,[%g2] + add %g2,8,%g2 + cmp %g2,%g3 + bleu,a zerobss + nop + +/* + * copy prom & trap vectors to sram. + */ + set 0x30000000, %l0 + set 0xfff8, %l1 + tst %l1 ! Set condition codes + +copyloop: + ldd [%l1], %l2 + std %l2, [%l0 + %l1] + bg copyloop + deccc 8, %l1 + + set 0x30000000, %l0 ! Base of new trap vector + mov %l0, %tbr ! Install the new tbr + + set SYM(win_ovf_trap), %l1 ! Setup window overflow trap + ldd [%l1], %l2 + std %l2, [%l0 + 5 * 16] + ldd [%l1 + 8], %l2 + std %l2, [%l0 + 5 * 16 + 8] + + set SYM(win_unf_trap), %l1 ! Setup window underflow trap + ldd [%l1], %l2 + std %l2, [%l0 + 6 * 16] + ldd [%l1 + 8], %l2 + std %l2, [%l0 + 6 * 16 + 8] + +/* + * Try enabling the FPU by setting EF. If that causes a trap, then we probably + * don't have an FPU. + */ + + ldd [%l0 + 2 * 16], %l4 ! Save original trap routine + set SYM(no_fpu_trap), %l1 ! Install new one + ldd [%l1], %l2 + std %l2, [%l0 + 2 * 16] + + mov %psr, %l0 + sethi %hi(0x1000), %l1 + bset %l1, %l0 +! mov %l0, %psr + + std %l4, [2 * 16] ! Restore original trap routine + + +/* + * Move the data segment from it's ROM address to RAM where it + * belongs. + */ + +relocd: +#if 0 /* This code is broken. FIXME */ + set (_sdata),%g2 ! %g2 = start of data in aout file + set SYM(environ),%g4 ! %g4 = actual data base address + set (_edata),%g3 ! %g3 = end of where data should go + subcc %g3, %g4, %g5 ! %g5 = length of data + + subcc %g4, %g2, %g0 ! need to relocate data ? + ble init + ld [%g4], %g6 + subcc %g6, 1, %g0 + be init +mvdata: + subcc %g5, 8, %g5 + ldd [%g2 + %g5], %g6 + bg mvdata +#endif + +/* + * initialize target specific stuff. Only execute these + * functions it they exist. + */ +init: + sethi %hi(SYM(hardware_init_hook)), %g1 + or %g1,%lo(SYM(hardware_init_hook)),%g1 + cmp %g0,%g1 + be 1f + nop + call SYM(hardware_init_hook) + nop + +1: + sethi %hi(SYM(software_init_hook)), %g1 + or %g1,%lo(SYM(software_init_hook)),%g1 + cmp %g0,%g1 + be 2f + nop + call SYM(software_init_hook) + nop +2: + call SYM(main) + nop + + /* call exit from the C library so atexit gets called, and the + * C++ destructors get run. This calls our exit routine below + * when it's done. + */ + call SYM(exit) + nop + +/* + * This should drop control back to the ROM monitor, if there is + * one. + */ + .globl SYM(_exit) +SYM(_exit): + call 0 + nop + +/* + * Trap handlers. + */ + + .align 8 + +SYM(win_ovf_trap): + sethi %hi(SYM(win_ovf)), %l3 + jmpl %lo(SYM(win_ovf))+%l3, %g0 + mov %wim, %l0 + nop + +SYM(win_unf_trap): + sethi %hi(SYM(win_unf)), %l3 + jmpl %lo(SYM(win_unf))+%l3, %g0 + mov %wim, %l0 + nop + +SYM(no_fpu_trap): ! Come here when no fpu exists. + jmpl %l2, %g0 ! This just skips the + rett %l2+4 ! offending instruction. diff --git a/libgloss/sparc/cygmon-crt0.S b/libgloss/sparc/cygmon-crt0.S new file mode 100644 index 0000000..272c00d --- /dev/null +++ b/libgloss/sparc/cygmon-crt0.S @@ -0,0 +1,144 @@ +/* + * C startup code for the Fujitsu SPARClite demo board + * + * Copyright (c) 1995, 1996 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include "asm.h" + +#ifdef TARGET_CPU_SPARC64 +#define STACK_BIAS 2047 +#define SAVE_SIZE -128 +#else +#define SAVE_SIZE -64 +#endif + +.data + .align 8 +SYM(environ): ! this is the first address in the data section + .long 0 + +SYM(argc): + .long 0 + + .text + .align 8 + + .globl SYM(start) + .globl start +SYM(start): +start: + /* see if the stack is already setup. if not, then default + * to using the value of %sp as set by the ROM monitor + */ + sethi %hi(__stack), %g1 + or %g1,%lo(__stack),%g1 + cmp %g0,%g1 + be 1f + nop +#ifdef STACK_BIAS + sub %g1, STACK_BIAS, %g1 +#endif + mov %g1, %sp ! set the stack pointer + mov 0, %fp +1: + + /* zero the bss section */ + sethi %hi(__bss_start),%g2 + or %g2,%lo(__bss_start),%g2 ! start of bss + sethi %hi(_end),%g3 + or %g3,%lo(_end),%g3 ! end of bss + mov %g0,%g1 ! so std has two zeros +zerobss: + std %g0,[%g2] + add %g2,8,%g2 + cmp %g2,%g3 + bleu,a zerobss + nop + +/* + * initialize target specific stuff. Only execute these + * functions it they exist. + */ +init: + sethi %hi(SYM(hardware_init_hook)), %g1 + or %g1,%lo(SYM(hardware_init_hook)),%g1 + cmp %g0,%g1 + be 1f + nop + call SYM(hardware_init_hook) + nop + +1: + sethi %hi(SYM(software_init_hook)), %g1 + or %g1,%lo(SYM(software_init_hook)),%g1 + cmp %g0,%g1 + be 2f + nop + call SYM(software_init_hook) + nop +2: + set SYM(__sigtramp), %o0 + call SYM(__install_signal_handler) + nop + + set do_dtors,%o0 + call SYM(atexit) + nop + + call do_ctors + nop + + set SYM(argc), %o0 + call SYM(__getProgramArgs) + nop + + mov %o0, %o1 + set SYM(argc), %o0 + ld [%o0], %o0 + call SYM(main) + nop + + /* call exit from the C library so atexit gets called, and the + * C++ destructors get run. This calls our exit routine below + * when it's done. + */ + call SYM(exit) + nop + +do_ctors: + save %sp,SAVE_SIZE,%sp + set __CTOR_LIST__,%l0 +our_entry: + ld [%l0],%l1 + add %l0,4,%l0 + tst %l1 +1: + beq 2f + nop + ld [%l0],%l2 + add %l0,4,%l0 + + call %l2 + nop + deccc %l1 + b 1b + nop +2: + ret + restore + +do_dtors: + save %sp,SAVE_SIZE,%sp + set __DTOR_LIST__,%l0 + b our_entry + nop diff --git a/libgloss/sparc/cygmon-salib.c b/libgloss/sparc/cygmon-salib.c new file mode 100644 index 0000000..4f65c0f --- /dev/null +++ b/libgloss/sparc/cygmon-salib.c @@ -0,0 +1,220 @@ +#ifdef TARGET_CPU_SPARC64 +#include <sys/types.h> +#endif +#include <sys/time.h> + +void +putTtyChar(int c) +{ + /* 2 is fork under solaris; bad juju */ + asm(" mov %i0,%o0 + or %g0,2,%g1 + ta 8 + nop"); +} + +int +write(int fd,char *ptr,int amt) +{ + if (fd < 0 || fd > 2) + { + return -1; + } + asm(" or %g0, 4, %g1 + ta 8 + nop"); + return amt; +} + +int +read(int fd,char *ptr,int amt) +{ + if (fd < 0 || fd > 2) + { + return -1; + } + asm(" or %g0, 3, %g1 + ta 8 + nop"); + return amt; +} + +void +_exit(int code) +{ + while(1) { + asm(" or %g0,1,%g1 + ta 8 + nop + ta 1 + nop"); + } +} + +int +setitimer(int which, const struct itimerval *value, struct itimerval *ovalue) +{ + asm(" or %g0, 158, %g1 + ta 8 + nop"); +} + + + +long +sbrk (unsigned long amt) +{ + extern char _end; + static char *ptr = 0; + char *res; + if (ptr == 0) + ptr = &_end; + if (amt == 0) + return (long)ptr; + + if (((long)ptr) % 8) + ptr = ptr + (8 - (((long)(ptr)) % 8)); + res = ptr; + ptr += amt; + return (long)res; +} + +#ifdef TARGET_CPU_SPARC64 +long +_sbrk_r (void *foo, unsigned long amt) +{ + return sbrk(amt); +} + +long +_fstat_r (void *foo, void *bar, void *baz) +{ + return -1; +} + +long +_brk_r (void *foo) +{ + return sbrk(0); +} + +int +_open_r (char *filename, int mode) +{ + return open (filename, mode); +} + +int +_close_r (int fd) +{ + return close(fd); +} +#endif + +int +close (int fd) +{ + return 0; +} + +int +fstat(int des,void *buf) +{ + return -1; +} + +int +lseek(int des,unsigned long offset, int whence) +{ + return -1; +} + +int +isatty(int fd) +{ + return (fd < 3); +} + +int +kill (int pid, int signal) +{ + asm ("or %g0, 37, %g1 + ta 8 + nop"); +} + +int +getpid () +{ + return -1; +} + +int +getitimer (int which, struct itimerval *value) +{ + asm ("or %g0, 157, %g1 + ta 8 + nop"); +} + +void +__install_signal_handler (void *func) +{ + asm ("mov %o0, %o1 + mov %g0, %o0 + or %g0, 48, %g1 + ta 8 + nop"); +} + +int +gettimeofday (struct timeval *tp, struct timezone *tzp) +{ + asm ("or %g0, 156, %g1 + ta 8 + nop"); +} + +int +stime (long *seconds) +{ + asm ("or %g0, 25, %g1 + ta 8 + nop"); +} + +int +add_mapping (long vma, long pma, long size) +{ + asm ("or %g0, 115, %g1 + ta 8 + nop"); +} + +int +remove_mapping (long vma, long vma_end) +{ + asm ("or %g0, 117, %g1 + ta 8 + nop"); +} + +int +open (char *filename, int mode) +{ + return -1; +} + +void * +__getProgramArgs (int *argv) +{ + int *res; + + /* 184 is tsolsys under solaris; bad juju */ + asm ("mov %1, %%o0 + or %%g0, 184, %%g1 + ta 8 + nop + mov %%o0, %0" : "=r" (res) : "r" (argv): "g1"); + return res; +} diff --git a/libgloss/sparc/cygmon-sparc64-ld.src b/libgloss/sparc/cygmon-sparc64-ld.src new file mode 100644 index 0000000..efa0da1 --- /dev/null +++ b/libgloss/sparc/cygmon-sparc64-ld.src @@ -0,0 +1,159 @@ +/* + *uncomment this if you want the linker to output srecords. +OUTPUT_FORMAT(srec) + * + */ +ENTRY(start) +OUTPUT_ARCH(TARGET_OBJ_FORMAT) +SEARCH_DIR(.) +STARTUP(cygmon-crt0.o) +GROUP(cygmon-salib.o -lc -lgcc -lc) + +/* + * The memory map looks like this: + * +--------------------+ <- low memory + * | .text | + * | _stext | + * | _etext | + * | ctor list | the ctor and dtor lists are for + * | dtor list | C++ support + * | _end_text | + * +--------------------+ + * | .data | initialized data goes here + * | _sdata | + * | _edata | + * +--------------------+ + * | .bss | + * | __bss_start | start of bss, cleared by crt0 + * | _end | start of heap, used by sbrk() + * +--------------------+ + * | heap space | + * | _ENDHEAP | + * | stack space | + * | __stack | top of stack + * +--------------------+ <- high memory + */ + +_STACK_SIZE = (16 * 1024); +_RAM_SIZE = 1M; +_RAM_START = 0x4000; +_RAM_END = _RAM_START + _RAM_SIZE; + +/* + * Setup the standard memory map. The stack grows down towards low memory. + */ +MEMORY +{ + ram : ORIGIN = 0x4000, LENGTH = 1M +} + +__stack = (_RAM_START + _RAM_SIZE - 4 * 16) - _STACK_SIZE; + +/* + * All the symbols that might be accessed from C code need to be + * listed twice, once with an additional underscore. aout format needs + * and extra underscore, whereas coff & elf doesn't. This is to work + * with both. + */ +/* + * Initalize some symbols to be zero so we can reference them in the + * crt0 without core dumping. These functions are all optional, but + * we do this so we can have our crt0 always use them if they exist. + * This is so BSPs work better when using the crt0 installed with gcc. + * We have to initalize them twice, so we cover a.out (which prepends + * an underscore) and coff object file formats. + */ +PROVIDE (hardware_init_hook = 0); +PROVIDE (_hardware_init_hook = 0); +PROVIDE (software_init_hook = 0); +PROVIDE (_software_init_hook = 0); +SECTIONS +{ + .text : { + stext = .; + _stext = .; + CREATE_OBJECT_SYMBOLS + *(.text) + __CTOR_LIST__ = .; + LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) + *(.ctors) + LONG(0) + __CTOR_END__ = .; + __DTOR_LIST__ = .; + LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) + *(.dtors) + LONG(0) + __DTOR_END__ = .; + *(.init) + *(.lit) + *(.rodata) + *(.shdata) + *(.eh_frame) + *(.gnu.linkonce.t*) + *(.gnu.linkonce.r*) + *(.gcc_except_table) + *(.fini) + _etext = .; + } > ram + .shbss SIZEOF(.text) + ADDR(.text) : { + *(.shbss) + } + .talias : { } > ram + .data : { + sdata = .; + _sdata = .; + *(.data) + *(.gnu.linkonce.d*) + edata = .; + _edata = .; + } > ram + .bss SIZEOF(.data) + ADDR(.data) : { + sbss = . ; + _sbss = . ; + __bss_start = ALIGN(0x8); + __bss_start = ALIGN(0x8); + *(.bss) + *(COMMON) + end = ALIGN(0x8); + _end = ALIGN(0x8); + __end = ALIGN(0x8); + ebss = .; + _ebss = .; + } + .mstack : { } > ram + .rstack : { } > ram + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + /* 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) } + .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) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + /* These must appear regardless of . */ +} diff --git a/libgloss/sparc/cygmon.ld.src b/libgloss/sparc/cygmon.ld.src new file mode 100644 index 0000000..bf06825 --- /dev/null +++ b/libgloss/sparc/cygmon.ld.src @@ -0,0 +1,195 @@ +/* + *uncomment this if you want the linker to output srecords. +OUTPUT_FORMAT(srec) + * + */ +ENTRY(start) +OUTPUT_ARCH(TARGET_OBJ_FORMAT) +SEARCH_DIR(.) +STARTUP(cygmon-crt0.o) +GROUP(cygmon-salib.o -lc -lgcc -lc) + +/* + * The memory map looks like this: + * +--------------------+ <- low memory + * | .text | + * | _stext | + * | _etext | + * | ctor list | the ctor and dtor lists are for + * | dtor list | C++ support + * | _end_text | + * +--------------------+ + * | .data | initialized data goes here + * | _sdata | + * | _edata | + * +--------------------+ + * | .bss | + * | __bss_start | start of bss, cleared by crt0 + * | _end | start of heap, used by sbrk() + * +--------------------+ + * | heap space | + * | _ENDHEAP | + * | stack space | + * | __stack | top of stack + * +--------------------+ <- high memory + */ + +_STACK_SIZE = (16 * 1024); +_RAM_SIZE = 1M; +_RAM_START = TARGET_RAM_START; +_RAM_END = _RAM_START + _RAM_SIZE; + +/* + * Setup the standard memory map. The stack grows down towards low memory. + */ +MEMORY +{ + ram : ORIGIN = TARGET_RAM_START, LENGTH = 1M +} + +__stack = (_RAM_START + _RAM_SIZE - 4 * 16) - _STACK_SIZE; + +/* + * All the symbols that might be accessed from C code need to be + * listed twice, once with an additional underscore. aout format needs + * and extra underscore, whereas coff & elf doesn't. This is to work + * with both. + */ +/* + * Initalize some symbols to be zero so we can reference them in the + * crt0 without core dumping. These functions are all optional, but + * we do this so we can have our crt0 always use them if they exist. + * This is so BSPs work better when using the crt0 installed with gcc. + * We have to initalize them twice, so we cover a.out (which prepends + * an underscore) and coff object file formats. + */ +PROVIDE (hardware_init_hook = 0); +PROVIDE (_hardware_init_hook = 0); +PROVIDE (software_init_hook = 0); +PROVIDE (_software_init_hook = 0); +SECTIONS +{ + .text : { + stext = .; + _stext = .; + CREATE_OBJECT_SYMBOLS + *(.text) + __CTOR_LIST__ = .; + LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*crtend.o(.ctors)) + LONG(0) + __CTOR_END__ = .; + __DTOR_LIST__ = .; + LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*crtend.o(.dtors)) + LONG(0) + __DTOR_END__ = .; + *(.init) + *(.lit) + *(.rodata) + *(.shdata) + *(.eh_frame) + *(.gnu.linkonce.t*) + *(.gnu.linkonce.r*) + *(.gcc_except_table) + *(.fini) + _etext = .; + } > ram + .shbss SIZEOF(.text) + ADDR(.text) : { + *(.shbss) + } + .talias : { } > ram + .data : { + sdata = .; + _sdata = .; + *(.data) + *(.gnu.linkonce.d*) + edata = .; + _edata = .; + } > ram + .bss SIZEOF(.data) + ADDR(.data) : { + sbss = . ; + _sbss = . ; + __bss_start = ALIGN(0x8); + __bss_start = ALIGN(0x8); + *(.bss) + *(COMMON) + end = ALIGN(0x8); + _end = ALIGN(0x8); + __end = ALIGN(0x8); + ebss = .; + _ebss = .; + } + .mstack : { } > ram + .rstack : { } > ram + .stab 0 (NOLOAD) : { + [ .stab ] + } + .stabstr 0 (NOLOAD) : + { + [ .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 (NOLOAD) : + { + [ .debug ] + } + .line 0 (NOLOAD) : + { + [ .line ] + } +/* GNU DWARF 1 extensions */ + .debug_srcinfo 0 (NOLOAD) : + { + [ .debug_srcinfo ] + } + .debug_sfnames 0 (NOLOAD) : + { + [ .debug_sfnames ] + } +/* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 (NOLOAD) : + { + [ .debug_aranges ] + } + .debug_pubnames 0 (NOLOAD) : + { + [ .debug_pubnames ] + } +/* DWARF 2 */ + .debug_info 0 (NOLOAD) : + { + [ .debug_info ] + } + .debug_abbrev 0 (NOLOAD) : + { + [ .debug_abbrev ] + } + .debug_line 0 (NOLOAD) : + { + [ .debug_line ] + } + .debug_frame 0 (NOLOAD) : + { + [ .debug_frame ] + } + .debug_str 0 (NOLOAD) : + { + [ .debug_str ] + } + .debug_loc 0 (NOLOAD) : + { + [ .debug_loc ] + } + .debug_macinfo 0 (NOLOAD) : + { + [ .debug_macinfo ] + } +} diff --git a/libgloss/sparc/dtor.C b/libgloss/sparc/dtor.C new file mode 100644 index 0000000..abde4f1 --- /dev/null +++ b/libgloss/sparc/dtor.C @@ -0,0 +1,25 @@ +#include <stdio.h> + +extern "C" void print (char *, ...); + +class foo +{ +public: + foo () { print ("ctor\n"); } + ~foo () { print ("dtor\n"); } +}; + +foo x; + +main () +{ + outbyte ('&'); + outbyte ('@'); + outbyte ('$'); + outbyte ('%'); + print ("FooBar\r\n"); + + /* whew, we made it */ + print ("\r\nDone...\r\n"); +/* fflush(stdout); */ +} diff --git a/libgloss/sparc/elfsim.ld b/libgloss/sparc/elfsim.ld new file mode 100644 index 0000000..d1831be --- /dev/null +++ b/libgloss/sparc/elfsim.ld @@ -0,0 +1,202 @@ +/* Linker script for running ELF programs in the Sparc simulator */ + +/* OUTPUT_FORMAT("elf32-sparc", "elf32-sparc", "elf32-sparcle") */ +/* OUTPUT_FORMAT("elf32-sparc") */ +OUTPUT_ARCH(sparc) +STARTUP(traps.o) +INPUT(erc32-crt0.o) +ENTRY(_trap_table) +GROUP(-lc -lerc32 -lgcc) /* -lerc32 used to be -lsim */ + +SEARCH_DIR(.) +/* Do we need any of these for elf? + __DYNAMIC = 0; */ + +/* + * The memory map looks like this: + * +--------------------+ <- low memory + * | .text | + * | _stext | + * | _etext | + * | ctor list | the ctor and dtor lists are for + * | dtor list | C++ support + * | _end_text | + * +--------------------+ + * | .data | initialized data goes here + * | _sdata | + * | _edata | + * +--------------------+ + * | .bss | + * | __bss_start | start of bss, cleared by crt0 + * | _end | start of heap, used by sbrk() + * +--------------------+ + * | heap space | + * | _ENDHEAP | + * | stack space | + * | __stack | top of stack + * +--------------------+ <- high memory + */ + +/* + * User modifiable values: + * + * _CLOCK_SPEED in Mhz (used to program the counter/timers) + * + * _PROM_SIZE size of PROM (permissible values are 4K, 8K, 16K + * 32K, 64K, 128K, 256K, and 512K) + * _RAM_SIZE size of RAM (permissible values are 256K, 512K, + * 1MB, 2Mb, 4Mb, 8Mb, 16Mb, and 32Mb) + * + * These symbols are only used in assembler code, so they only need to + * be listed once. They should always be refered to without SYM(). + */ + +_CLOCK_SPEED = 10; + +_PROM_SIZE = 4M; +_RAM_SIZE = 256K; + +_RAM_START = 0x02000000; +_RAM_END = _RAM_START + _RAM_SIZE; +_STACK_SIZE = (16 * 1024); +_PROM_START = 0x00000000; +_PROM_END = _PROM_START + _PROM_SIZE; + + +/* + * Base address of the on-CPU peripherals + */ + +_ERC32_MEC = 0x01f80000; + +/* + * Setup the memory map for the SIS simulator. + * stack grows up towards low memory. + */ + +MEMORY +{ + rom : ORIGIN = 0x00000000, LENGTH = 4M + ram (rwx) : ORIGIN = 0x02000000, LENGTH = 2M +} + +__stack = _RAM_START + _RAM_SIZE - 4 * 16; +__trap_stack = (_RAM_START + _RAM_SIZE - 4 * 16) - _STACK_SIZE; + +/* + * All the symbols that might be accessed from C code need to be + * listed twice, once with an additional underscore. aout format needs + * and extra underscore, whereas coff & elf doesn't. This is to work + * with both. + */ +SECTIONS +{ + .text : + { + _stext = .; + PROVIDE (stext = .); + __EH_FRAME_BEGIN__ = .; + *(.text) + _etext = .; + PROVIDE (etext = .); + + /* For a.out. */ + CONSTRUCTORS + + /* For ELF. */ + __CTOR_LIST__ = .; + LONG(-1) + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*crtend.o(.ctors)) + LONG(0) + __CTOR_END__ = .; + __DTOR_LIST__ = .; + LONG(-1) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*crtend.o(.dtors)) + LONG(0) + __DTOR_END__ = .; + + *(.init) + *(.lit) + *(.rodata) + *(.shdata) + *(.eh_frame) + *(.gnu.linkonce.t*) + *(.gnu.linkonce.r*) + *(.gcc_except_table) + *(.fini) + + _endtext = .; + PROVIDE(endtext = .); + } > ram + + .shbss SIZEOF(.text) + ADDR(.text) : + { + *(.shbss) + } + + .talias : { } > ram + + .data : + { + _sdata = .; + PROVIDE (sdata = .); + *(.data) + *(.data.*) + *(.gnu.linkonce.d*) + _edata = .; + PROVIDE (edata = .); + } > ram + + .bss SIZEOF(.data) + ADDR(.data) : + { + _sbss = . ; + PROVIDE (sbss = . ); + __bss_start = ALIGN(0x8); + *(.bss) + *(COMMON) + _ebss = .; + PROVIDE (ebss = .); + _end = ALIGN(0x8); + __end = ALIGN(0x8); + PROVIDE (end = ALIGN(0x8)); + } + + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + /* 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) } + .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) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + /* These must appear regardless of . */ +} diff --git a/libgloss/sparc/erc32-crt0.S b/libgloss/sparc/erc32-crt0.S new file mode 100644 index 0000000..8f8b1ea --- /dev/null +++ b/libgloss/sparc/erc32-crt0.S @@ -0,0 +1,75 @@ +/* + * This is based on the file srt0.s provided with the binary + * distribution of the SPARC Instruction Simulator (SIS) found + * at ftp://ftp.estec.esa.nl/pub/ws/wsd/erc32. + */ + +#include "asm.h" + + .data + .align 8 +SYM(environ): + .long 0 + + .text + + .globl SYM(start) +SYM(start): + sethi %hi(__stack), %g1 + or %g1,%lo(__stack),%g1 + mov %g1, %sp ! set the stack pointer + mov %sp, %fp + + /* clear the bss */ + sethi %hi(__bss_start),%g2 + or %g2,%lo(__bss_start),%g2 ! start of bss + sethi %hi(_end),%g3 + or %g3,%lo(_end),%g3 ! end of bss + mov %g0,%g1 ! so std has two zeros +zerobss: + std %g0,[%g2] + add %g2,8,%g2 + cmp %g2,%g3 + bleu,a zerobss + nop + + /* move data segment to proper location */ + +#if 0 +relocd: + set (_endtext),%g2 ! g2 = start of data in aout file + set (_environ),%g4 ! g4 = start of where data should go + set (_edata),%g3 ! g3 = end of where data should go + subcc %g3, %g4, %g5 ! g5 = length of data + + subcc %g4, %g2, %g0 ! need to relocate data ? + ble initok + ld [%g4], %g6 + subcc %g6, 1, %g0 + be initok +mvdata: + subcc %g5, 8, %g5 + ldd [%g2 + %g5], %g6 + bg mvdata + std %g6, [%g4 + %g5] + +initok: +#endif + + call SYM(__fix_ctors) + nop + call SYM(main) + nop + + /* call exit from the C library so atexit gets called, and the + * C++ destructors get run. This calls our exit routine below * when it's done. + */ + call SYM(exit) + nop + + .globl SYM(_exit) +SYM(_exit): + set 0xdeadd00d, %o1 ! Magic number for simulator. + ta 0 ! Halt if _main returns ... + nop + diff --git a/libgloss/sparc/erc32-io.c b/libgloss/sparc/erc32-io.c new file mode 100644 index 0000000..082d9f9 --- /dev/null +++ b/libgloss/sparc/erc32-io.c @@ -0,0 +1,47 @@ +#define USE_PORT_A + +#define RXADATA (int *) 0x01F800E0 +#define RXBDATA (int *) 0x01F800E4 +#define RXSTAT (int *) 0x01F800E8 + +void +outbyte (int c) +{ + volatile int *rxstat; + volatile int *rxadata; + int rxmask; + + rxstat = RXSTAT; +#ifdef USE_PORT_A + rxadata = RXADATA; + rxmask = 6; +#else + rxadata = RXBDATA; + rxmask = 0x60000; +#endif + + while ((*rxstat & rxmask) == 0); + + *rxadata = c; +} + +int +inbyte (void) +{ + volatile int *rxstat; + volatile int *rxadata; + int rxmask; + + rxstat = RXSTAT; +#ifdef USE_PORT_A + rxadata = RXADATA; + rxmask = 1; +#else + rxadata = RXBDATA; + rxmask = 0x10000; +#endif + + while ((*rxstat & rxmask) == 0); + + return *rxadata; +} diff --git a/libgloss/sparc/erc32-stub.c b/libgloss/sparc/erc32-stub.c new file mode 100644 index 0000000..71a65b2 --- /dev/null +++ b/libgloss/sparc/erc32-stub.c @@ -0,0 +1,363 @@ +/* + * Copyright (c) 1996 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#include <string.h> +#include <signal.h> +#include "debug.h" +#include "asm.h" +#include "slite.h" + +extern unsigned long rdtbr(); +extern struct trap_entry fltr_proto; +extern void trap_low(); +exception_t default_trap_hook = trap_low; +void target_reset(); +void flush_i_cache(); +char *target_read_registers(unsigned long *); +char *target_write_registers(unsigned long *); +char *target_dump_state(unsigned long *); + +#define NUMREGS 72 + +/* Number of bytes of registers. */ +#define NUMREGBYTES (NUMREGS * 4) + +enum regnames {G0, G1, G2, G3, G4, G5, G6, G7, + O0, O1, O2, O3, O4, O5, SP, O7, + L0, L1, L2, L3, L4, L5, L6, L7, + I0, I1, I2, I3, I4, I5, FP, I7, + + F0, F1, F2, F3, F4, F5, F6, F7, + F8, F9, F10, F11, F12, F13, F14, F15, + F16, F17, F18, F19, F20, F21, F22, F23, + F24, F25, F26, F27, F28, F29, F30, F31, + Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR }; + +/* + * Each entry in the trap vector occupies four words, typically a jump + * to the processing routine. + */ +struct trap_entry { + unsigned sethi_filler:10; + unsigned sethi_imm22:22; + unsigned jmpl_filler:19; + unsigned jmpl_simm13:13; + unsigned long filler[2]; +}; + +/* + * This table contains the mapping between SPARC hardware trap types, and + * signals, which are primarily what GDB understands. It also indicates + * which hardware traps we need to commandeer when initializing the stub. + */ +struct trap_info hard_trap_info[] = { + {1, SIGSEGV}, /* instruction access error */ + {2, SIGILL}, /* privileged instruction */ + {3, SIGILL}, /* illegal instruction */ + {4, SIGEMT}, /* fp disabled */ + {36, SIGEMT}, /* cp disabled */ + {7, SIGBUS}, /* mem address not aligned */ + {9, SIGSEGV}, /* data access exception */ + {10, SIGEMT}, /* tag overflow */ + {128+1, SIGTRAP}, /* ta 1 - normal breakpoint instruction */ + {0, 0} /* Must be last */ +}; + +extern struct trap_entry fltr_proto; +void +exception_handler (int tt, unsigned long routine) +{ + struct trap_entry *tb; /* Trap vector base address */ + + DEBUG (1, "Entering exception_handler()"); + if (tt != 256) { + tb = (struct trap_entry *) (rdtbr() & ~0xfff); + } else { + tt = 255; + tb = (struct trap_entry *) 0; + } + + tb[tt] = fltr_proto; + + tb[tt].sethi_imm22 = routine >> 10; + tb[tt].jmpl_simm13 = routine & 0x3ff; + + DEBUG (1, "Leaving exception_handler()"); +} + +/* + * This is so we can trap a memory fault when reading or writing + * directly to memory. + */ +void +set_mem_fault_trap(enable) + int enable; +{ + extern void fltr_set_mem_err(); + + DEBUG (1, "Entering set_mem_fault_trap()"); + + mem_err = 0; + + if (enable) + exception_handler(9, (unsigned long)fltr_set_mem_err); + else + exception_handler(9, (unsigned long)trap_low); + + DEBUG (1, "Leaving set_mem_fault_trap()"); +} + +/* + * This function does all command procesing for interfacing to gdb. It + * returns 1 if you should skip the instruction at the trap address, 0 + * otherwise. + */ +extern void breakinst(); + +void +handle_exception (registers) + unsigned long *registers; +{ + int sigval; + + /* First, we must force all of the windows to be spilled out */ + + DEBUG (1, "Entering handle_exception()"); + +/* asm("mov %g0, %wim ; nop; nop; nop"); */ + asm(" save %sp, -64, %sp + save %sp, -64, %sp + save %sp, -64, %sp + save %sp, -64, %sp + save %sp, -64, %sp + save %sp, -64, %sp + save %sp, -64, %sp + save %sp, -64, %sp + restore + restore + restore + restore + restore + restore + restore + restore +"); + + if (registers[PC] == (unsigned long)breakinst) { + registers[PC] = registers[NPC]; + registers[NPC] += 4; + } + + /* get the last know signal number from the trap register */ + sigval = computeSignal((registers[TBR] >> 4) & 0xff); + + /* call the main command processing loop for gdb */ + gdb_event_loop (sigval, registers); +} + +/* + * This function will generate a breakpoint exception. It is used at the + * beginning of a program to sync up with a debugger and can be used + * otherwise as a quick means to stop program execution and "break" into + * the debugger. + */ +void +breakpoint() +{ + DEBUG (1, "Entering breakpoint()"); + + if (!initialized) + return; + + asm(" .globl " STRINGSYM(breakinst) " + " STRINGSYM(breakinst) ": ta 128+1 + nop + nop + "); +} + +/* + * This is just a test vector for debugging excpetions. + */ +void +bad_trap(tt) +int tt; +{ + print ("Got a bad trap #"); + outbyte (tt); + outbyte ('\n'); + asm("ta 0 + nop + nop + "); +} + +/* + * This is just a test vector for debugging excpetions. + */ +void +soft_trap(tt) +int tt; +{ + print ("Got a soft trap #"); + outbyte (tt); + outbyte ('\n'); + asm("ta 0 + nop + nop + "); +} + +/* + * Flush the instruction cache. We need to do this for the debugger stub so + * that breakpoints, et. al. become visible to the instruction stream after + * storing them in memory. + * + * For the sparclite, we need to do something here, but for a standard + * sparc (which SIS simulates), we don't. + */ + +void +flush_i_cache () +{ +} + +/* + * This will reset the processor, so we never return from here. + */ +void +target_reset() +{ + asm ("call 0 + nop "); +} + +/* + * g - read registers. + * no params. + * returns a vector of words, size is NUM_REGS. + */ +char * +target_read_registers(unsigned long *registers) +{ + char *ptr; + unsigned long *sp; + + DEBUG (1, "In target_read_registers()"); + + ptr = packet_out_buf; + ptr = mem2hex((char *)registers, ptr, 16 * 4, 0); /* G & O regs */ + ptr = mem2hex((unsigned char *)(sp + 0), ptr, 16 * 4, 0); /* L & I regs */ + memset(ptr, '0', 32 * 8); /* Floating point */ + mem2hex((char *)®isters[Y], + ptr + 32 * 4 * 2, + 8 * 4, + 0); /* Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR */ + return (ptr); +} + +/* + * G - write registers. + * param is a vector of words, size is NUM_REGS. + * returns an OK or an error number. + */ +char * +target_write_registers(unsigned long *registers) +{ + unsigned char *ptr; + unsigned long *sp; + unsigned long *newsp, psr; + + DEBUG (1, "In target_write_registers()"); + + psr = registers[PSR]; + + ptr = &packet_in_buf[1]; + + hex2mem(ptr, (char *)registers, 16 * 4, 0); /* G & O regs */ + hex2mem(ptr + 16 * 4 * 2, (unsigned char *)(sp + 0), 16 * 4, 0); /* L & I regs */ + hex2mem(ptr + 64 * 4 * 2, (char *)®isters[Y], + 8 * 4, 0); /* Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR */ + + /* + * see if the stack pointer has moved. If so, then copy the saved + * locals and ins to the new location. This keeps the window + * overflow and underflow routines happy. + */ + + newsp = (unsigned long *)registers[SP]; + if (sp != newsp) + sp = memcpy(newsp, sp, 16 * 4); + + /* Don't allow CWP to be modified. */ + + if (psr != registers[PSR]) + registers[PSR] = (psr & 0x1f) | (registers[PSR] & ~0x1f); + + return (ptr); +} + +char * +target_dump_state(unsigned long *registers) +{ + int tt; /* Trap type */ + int sigval; + char *ptr; + unsigned long *sp; + + DEBUG (1, "In target_dump_state()"); + + sp = (unsigned long *)registers[SP]; + + tt = (registers[TBR] >> 4) & 0xff; + + /* reply to host that an exception has occurred */ + sigval = computeSignal(tt); + ptr = packet_out_buf; + + *ptr++ = 'T'; + *ptr++ = hexchars[sigval >> 4]; + *ptr++ = hexchars[sigval & 0xf]; + + *ptr++ = hexchars[PC >> 4]; + *ptr++ = hexchars[PC & 0xf]; + *ptr++ = ':'; + ptr = mem2hex((unsigned char *)®isters[PC], ptr, 4, 0); + *ptr++ = ';'; + + *ptr++ = hexchars[FP >> 4]; + *ptr++ = hexchars[FP & 0xf]; + *ptr++ = ':'; + ptr = mem2hex((unsigned char *)(sp + 8 + 6), ptr, 4, 0); /* FP */ + *ptr++ = ';'; + + *ptr++ = hexchars[SP >> 4]; + *ptr++ = hexchars[SP & 0xf]; + *ptr++ = ':'; + ptr = mem2hex((unsigned char *)&sp, ptr, 4, 0); + *ptr++ = ';'; + + *ptr++ = hexchars[NPC >> 4]; + + return (packet_out_buf); +} + +void +write_pc(unsigned long *registers, unsigned long addr) +{ + DEBUG (1, "In write_pc"); + + registers[PC] = addr; + registers[NPC] = addr + 4; +} diff --git a/libgloss/sparc/erc32.ld b/libgloss/sparc/erc32.ld new file mode 100644 index 0000000..179dcc0 --- /dev/null +++ b/libgloss/sparc/erc32.ld @@ -0,0 +1,146 @@ +/* + *uncomment this if you want the linker to output srecords. +OUTPUT_FORMAT(srec) + * + */ +STARTUP(traps.o) +INPUT(sim-crt0.o) +OUTPUT_ARCH(sparc) +SEARCH_DIR(.) +__DYNAMIC = 0; +GROUP(-lc -lsim -lgcc) + +/* + * The memory map looks like this: + * +--------------------+ <- low memory + * | .text | + * | _stext | + * | _etext | + * | ctor list | the ctor and dtor lists are for + * | dtor list | C++ support + * | _end_text | + * +--------------------+ + * | .data | initialized data goes here + * | _sdata | + * | _edata | + * +--------------------+ + * | .bss | + * | __bss_start | start of bss, cleared by crt0 + * | _end | start of heap, used by sbrk() + * +--------------------+ + * | heap space | + * | _ENDHEAP | + * | stack space | + * | __stack | top of stack + * +--------------------+ <- high memory + */ + +/* + * User modifiable values: + * + * _CLOCK_SPEED in Mhz (used to program the counter/timers) + * + * _PROM_SIZE size of PROM (permissible values are 4K, 8K, 16K + * 32K, 64K, 128K, 256K, and 512K) + * _RAM_SIZE size of RAM (permissible values are 256K, 512K, + * 1MB, 2Mb, 4Mb, 8Mb, 16Mb, and 32Mb) + * + * These symbols are only used in assembler code, so they only need to + * be listed once. They should always be refered to without SYM(). + */ + +_CLOCK_SPEED = 10; + +_PROM_SIZE = 4M; +_RAM_SIZE = 2M; + +_RAM_START = 0x02020000; +_RAM_END = _RAM_START + _RAM_SIZE; +_STACK_SIZE = (16 * 1024); +_PROM_START = 0x00000000; +_PROM_END = _PROM_START + _PROM_SIZE; + + +/* + * Base address of the on-CPU peripherals + */ + +_ERC32_MEC = 0x01f80000; + +/* + * Setup the memory map for the SIS simulator. + * stack grows up towards low memory. + */ +/* +MEMORY +{ + rom : ORIGIN = 0x00000000, LENGTH = 4M + ram (rwx) : ORIGIN = 0x02000000, LENGTH = 2M +} +*/ + +__stack = _RAM_START + _RAM_SIZE - 4 * 16; +__trap_stack = (_RAM_START + _RAM_SIZE - 4 * 16) - _STACK_SIZE; + +/* + * All the symbols that might be accessed from C code need to be + * listed twice, once with an additional underscore. aout format needs + * and extra underscore, whereas coff & elf doesn't. This is to work + * with both. + */ +SECTIONS +{ + .text 0x02000000 : { + stext = .; + _stext = .; + *(.text) + _etext = .; + __CTOR_LIST__ = .; + LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) + *(.ctors) + LONG(0) + __CTOR_END__ = .; + __DTOR_LIST__ = .; + LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) + *(.dtors) + LONG(0) + __DTOR_END__ = .; + *(.lit) + *(.shdata) + _endtext = .; + } > ram + .shbss SIZEOF(.text) + ADDR(.text) : { + *(.shbss) + } + .talias : { } > ram + .data : { + sdata = .; + _sdata = .; + *(.data) + edata = .; + _edata = .; + } > ram + .bss SIZEOF(.data) + ADDR(.data) : + { + sbss = . ; + _sbss = . ; + __bss_start = ALIGN(0x8); + *(.bss) + *(COMMON) + end = ALIGN(0x8); + _end = ALIGN(0x8); + __end = ALIGN(0x8); + ebss = .; + _ebss = .; + } + .mstack : { } > ram + .rstack : { } > ram + .stab 0 (NOLOAD) : + { + [ .stab ] + } + .stabstr 0 (NOLOAD) : + { + [ .stabstr ] + } +} diff --git a/libgloss/sparc/ex930.ld b/libgloss/sparc/ex930.ld new file mode 100644 index 0000000..b501b2e --- /dev/null +++ b/libgloss/sparc/ex930.ld @@ -0,0 +1,160 @@ +/* + *uncomment this if you want the linker to output srecords. +OUTPUT_FORMAT(srec) + * + */ +ENTRY(_start) +STARTUP(crt0.o) +OUTPUT_ARCH(sparc) +SEARCH_DIR(.) +__DYNAMIC = 0; +GROUP (-lc -lslite930 -lgcc) + +/* + * The memory map looks like this: + * +--------------------+ <- low memory + * | .text | + * | _stext | + * | _etext | + * | ctor list | the ctor and dtor lists are for + * | dtor list | C++ support + * | _end_text | + * +--------------------+ + * | .data | initialized data goes here + * | _sdata | + * | _edata | + * +--------------------+ + * | .bss | + * | __bss_start | start of bss, cleared by crt0 + * | _end | start of heap, used by sbrk() + * +--------------------+ + * | heap space | + * | _ENDHEAP | + * | stack space | + * | __stack | top of stack + * +--------------------+ <- high memory + */ + +_STACK_SIZE = (16 * 1024); +_RAM_SIZE = 2M; +_RAM_START = 0x40000000; +_RAM_END = _RAM_START + _RAM_SIZE; + +/* + * Base address of the on-CPU peripherals. This is for compatability + * with the simulator. + */ + +_ERC32_MEC = 0x0; + +/* + * Setup the memory map of the MB86931-EB Board (ex931) + * stack grows down towards low memory. + */ +MEMORY +{ + ram (rwx) : ORIGIN = 0x40000000, LENGTH = 2M +} + +__stack = _RAM_START + _RAM_SIZE - 4 * 16; +__trap_stack = (_RAM_START + _RAM_SIZE - 4 * 16) - _STACK_SIZE; + +/* + * All the symbols that might be accessed from C code need to be + * listed twice, once with an additional underscore. aout format needs + * and extra underscore, whereas coff & elf doesn't. This is to work + * with both. + */ +/* + * Initalize some symbols to be zero so we can reference them in the + * crt0 without core dumping. These functions are all optional, but + * we do this so we can have our crt0 always use them if they exist. + * This is so BSPs work better when using the crt0 installed with gcc. + * We have to initalize them twice, so we cover a.out (which prepends + * an underscore) and coff object file formats. + */ +PROVIDE (hardware_init_hook = 0); +PROVIDE (_hardware_init_hook = 0); +PROVIDE (software_init_hook = 0); +PROVIDE (_software_init_hook = 0); +SECTIONS +{ + .text : { + stext = .; + _stext = .; + CREATE_OBJECT_SYMBOLS + *(.text) + __CTOR_LIST__ = .; + LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) + *(.ctors) + LONG(0) + __CTOR_END__ = .; + __DTOR_LIST__ = .; + LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) + *(.dtors) + LONG(0) + __DTOR_END__ = .; + _etext = .; + *(.lit) + *(.shdata) + } > ram + .shbss SIZEOF(.text) + ADDR(.text) : { + *(.shbss) + } + .talias : { } > ram + .data : { + sdata = .; + _sdata = .; + *(.data) + edata = .; + _edata = .; + } > ram + .bss SIZEOF(.data) + ADDR(.data) : { + sbss = . ; + _sbss = . ; + __bss_start = ALIGN(0x8); + __bss_start = ALIGN(0x8); + *(.bss) + *(COMMON) + end = ALIGN(0x8); + _end = ALIGN(0x8); + __end = ALIGN(0x8); + ebss = .; + _ebss = .; + } + .mstack : { } > ram + .rstack : { } > ram + .stab 0 (NOLOAD) : { + [ .stab ] + } + .stabstr 0 (NOLOAD) : + { + [ .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) } + .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) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + /* These must appear regardless of . */ +} diff --git a/libgloss/sparc/ex931.ld b/libgloss/sparc/ex931.ld new file mode 100644 index 0000000..26ffb4d --- /dev/null +++ b/libgloss/sparc/ex931.ld @@ -0,0 +1,160 @@ +/* + *uncomment this if you want the linker to output srecords. +OUTPUT_FORMAT(srec) + * + */ +ENTRY(_start) +STARTUP(crt0.o) +OUTPUT_ARCH(sparc) +SEARCH_DIR(.) +__DYNAMIC = 0; +GROUP (-lc -lslite931 -lgcc) + +/* + * The memory map looks like this: + * +--------------------+ <- low memory + * | .text | + * | _stext | + * | _etext | + * | ctor list | the ctor and dtor lists are for + * | dtor list | C++ support + * | _end_text | + * +--------------------+ + * | .data | initialized data goes here + * | _sdata | + * | _edata | + * +--------------------+ + * | .bss | + * | __bss_start | start of bss, cleared by crt0 + * | _end | start of heap, used by sbrk() + * +--------------------+ + * | heap space | + * | _ENDHEAP | + * | stack space | + * | __stack | top of stack + * +--------------------+ <- high memory + */ + +_STACK_SIZE = (16 * 1024); +_RAM_SIZE = 2M; +_RAM_START = 0x40000000; +_RAM_END = _RAM_START + _RAM_SIZE; + +/* + * Base address of the on-CPU peripherals. This is for compatability + * with the simulator. + */ + +_ERC32_MEC = 0x0; + +/* + * Setup the memory map of the MB86931-EB Board (ex931) + * stack grows down towards low memory. + */ +MEMORY +{ + ram (rwx) : ORIGIN = 0x40000000, LENGTH = 2M +} + +__stack = _RAM_START + _RAM_SIZE - 4 * 16; +__trap_stack = (_RAM_START + _RAM_SIZE - 4 * 16) - _STACK_SIZE; + +/* + * All the symbols that might be accessed from C code need to be + * listed twice, once with an additional underscore. aout format needs + * and extra underscore, whereas coff & elf doesn't. This is to work + * with both. + */ +/* + * Initalize some symbols to be zero so we can reference them in the + * crt0 without core dumping. These functions are all optional, but + * we do this so we can have our crt0 always use them if they exist. + * This is so BSPs work better when using the crt0 installed with gcc. + * We have to initalize them twice, so we cover a.out (which prepends + * an underscore) and coff object file formats. + */ +PROVIDE (hardware_init_hook = 0); +PROVIDE (_hardware_init_hook = 0); +PROVIDE (software_init_hook = 0); +PROVIDE (_software_init_hook = 0); +SECTIONS +{ + .text : { + stext = .; + _stext = .; + CREATE_OBJECT_SYMBOLS + *(.text) + __CTOR_LIST__ = .; + LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) + *(.ctors) + LONG(0) + __CTOR_END__ = .; + __DTOR_LIST__ = .; + LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) + *(.dtors) + LONG(0) + __DTOR_END__ = .; + _etext = .; + *(.lit) + *(.shdata) + } > ram + .shbss SIZEOF(.text) + ADDR(.text) : { + *(.shbss) + } + .talias : { } > ram + .data : { + sdata = .; + _sdata = .; + *(.data) + edata = .; + _edata = .; + } > ram + .bss SIZEOF(.data) + ADDR(.data) : { + sbss = . ; + _sbss = . ; + __bss_start = ALIGN(0x8); + __bss_start = ALIGN(0x8); + *(.bss) + *(COMMON) + end = ALIGN(0x8); + _end = ALIGN(0x8); + __end = ALIGN(0x8); + ebss = .; + _ebss = .; + } + .mstack : { } > ram + .rstack : { } > ram + .stab 0 (NOLOAD) : { + [ .stab ] + } + .stabstr 0 (NOLOAD) : + { + [ .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) } + .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) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + /* These must appear regardless of . */ +} diff --git a/libgloss/sparc/ex934.ld b/libgloss/sparc/ex934.ld new file mode 100644 index 0000000..7d1d5ed --- /dev/null +++ b/libgloss/sparc/ex934.ld @@ -0,0 +1,160 @@ +/* + *uncomment this if you want the linker to output srecords. +OUTPUT_FORMAT(srec) + * + */ +ENTRY(_start) +STARTUP(crt0.o) +OUTPUT_ARCH(sparc) +SEARCH_DIR(.) +__DYNAMIC = 0; +GROUP (-lc -lslite934 -lgcc) + +/* + * The memory map looks like this: + * +--------------------+ <- low memory + * | .text | + * | _stext | + * | _etext | + * | ctor list | the ctor and dtor lists are for + * | dtor list | C++ support + * | _end_text | + * +--------------------+ + * | .data | initialized data goes here + * | _sdata | + * | _edata | + * +--------------------+ + * | .bss | + * | __bss_start | start of bss, cleared by crt0 + * | _end | start of heap, used by sbrk() + * +--------------------+ + * | heap space | + * | _ENDHEAP | + * | stack space | + * | __stack | top of stack + * +--------------------+ <- high memory + */ + +_STACK_SIZE = (16 * 1024); +_RAM_SIZE = 2M; +_RAM_START = 0x40010000; +_RAM_END = _RAM_START + _RAM_SIZE; + +/* + * Base address of the on-CPU peripherals. This is for compatability + * with the simulator. + */ + +_ERC32_MEC = 0x0; + +/* + * Setup the memory map of the MB86931-EB Board (ex931) + * stack grows down towards low memory. + */ +MEMORY +{ + ram (rwx) : ORIGIN = 0x40010000, LENGTH = 2M +} + +__stack = _RAM_START + _RAM_SIZE - 4 * 16; +__trap_stack = (_RAM_START + _RAM_SIZE - 4 * 16) - _STACK_SIZE; + +/* + * All the symbols that might be accessed from C code need to be + * listed twice, once with an additional underscore. aout format needs + * and extra underscore, whereas coff & elf doesn't. This is to work + * with both. + */ +/* + * Initalize some symbols to be zero so we can reference them in the + * crt0 without core dumping. These functions are all optional, but + * we do this so we can have our crt0 always use them if they exist. + * This is so BSPs work better when using the crt0 installed with gcc. + * We have to initalize them twice, so we cover a.out (which prepends + * an underscore) and coff object file formats. + */ +PROVIDE (hardware_init_hook = 0); +PROVIDE (_hardware_init_hook = 0); +PROVIDE (software_init_hook = 0); +PROVIDE (_software_init_hook = 0); +SECTIONS +{ + .text : { + stext = .; + _stext = .; + CREATE_OBJECT_SYMBOLS + *(.text) + __CTOR_LIST__ = .; + LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) + *(.ctors) + LONG(0) + __CTOR_END__ = .; + __DTOR_LIST__ = .; + LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) + *(.dtors) + LONG(0) + __DTOR_END__ = .; + _etext = .; + *(.lit) + *(.shdata) + } > ram + .shbss SIZEOF(.text) + ADDR(.text) : { + *(.shbss) + } + .talias : { } > ram + .data : { + sdata = .; + _sdata = .; + *(.data) + edata = .; + _edata = .; + } > ram + .bss SIZEOF(.data) + ADDR(.data) : { + sbss = . ; + _sbss = . ; + __bss_start = ALIGN(0x8); + __bss_start = ALIGN(0x8); + *(.bss) + *(COMMON) + end = ALIGN(0x8); + _end = ALIGN(0x8); + __end = ALIGN(0x8); + ebss = .; + _ebss = .; + } + .mstack : { } > ram + .rstack : { } > ram + .stab 0 (NOLOAD) : { + [ .stab ] + } + .stabstr 0 (NOLOAD) : + { + [ .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) } + .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) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + /* These must appear regardless of . */ +} diff --git a/libgloss/sparc/fixctors.c b/libgloss/sparc/fixctors.c new file mode 100644 index 0000000..484023c --- /dev/null +++ b/libgloss/sparc/fixctors.c @@ -0,0 +1,54 @@ +/* Code to byte-swap static constructor/destructor tables on + broken a.out little-endian targets. The startup code should call + __fix_ctors just before calling main. It is safe to use on non-broken + or big-endian targets. */ + +extern long __CTOR_LIST__[]; +extern long __DTOR_LIST__[]; + +static void +byte_swap (long *entry) +{ + unsigned char *p = (unsigned char *)entry; + unsigned char tmp; + + tmp = p[0]; + p[0] = p[3]; + p[3] = tmp; + tmp = p[1]; + p[1] = p[2]; + p[2] = tmp; +} + +static void +fix_table (long *table) +{ + long len = table[0]; + + /* The heuristic for deciding if a table is broken is to examine + the word at the start of the table, which contains the number + of function pointers immediately following. If the low word + is zero, and the high word is non-zero, it's very likely that + it is byte-swapped. This test will fail if the program has + an exact multiple of 64K static constructors or destructors, a very + unlikely situation. */ + if ((len & 0xffff) == 0 && (len & 0xffff0000) != 0) + { + + /* The table looks broken. Byte-swap all the words in the table, up + to a NULL entry, which marks the end of the table. */ + do + { + byte_swap (table); + table++; + } + while (*table); + } +} + +void +__fix_ctors (void) +{ + fix_table (__CTOR_LIST__); + fix_table (__DTOR_LIST__); +} diff --git a/libgloss/sparc/libsys/Makefile.in b/libgloss/sparc/libsys/Makefile.in new file mode 100644 index 0000000..f3a036f --- /dev/null +++ b/libgloss/sparc/libsys/Makefile.in @@ -0,0 +1,167 @@ +# Makefile for libgloss/sparc/libsys +# Copyright (c) 1996 Cygnus Support. +# All rights reserved. +# +# Redistribution and use in source and binary forms are permitted +# provided that the above copyright notice and this paragraph are +# duplicated in all such forms and that any documentation, +# advertising materials, and other materials related to such +# distribution and use acknowledge that the software was developed +# at Cygnus Support, Inc. Cygnus Support, Inc. may not be used to +# endorse or promote products derived from this software without +# specific prior written permission. +# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + +VPATH = @srcdir@ +srcdir = @srcdir@ +objdir = . +srcroot = $(srcdir)/../.. +objroot = $(objdir)/../.. + +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +host_alias = @host_alias@ +target_alias = @target_alias@ + +bindir = @bindir@ +libdir = @libdir@ +tooldir = $(exec_prefix)/$(target_alias) + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ + +SHELL = /bin/sh + +CC = @CC@ + +AS = @AS@ +AR = @AR@ +LD = @LD@ +RANLIB = @RANLIB@ + +# _r.o is for the reentrant syscall stubs. +# The .S_r.o/.c_r.o rules are from host/any. + +.SUFFIXES: .c .S .o _r.o + +.S_r.o: + $(CC) $(CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) $(NEWLIB_CFLAGS) -DREENT $(INCLUDES) -c $< -o $@ +.c_r.o: + $(CC) $(CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) $(NEWLIB_CFLAGS) -DREENT $(INCLUDES) -c $< -o $@ + +# CFILES_R, SFILES_R, and TEMPLATE_SFILES_R define those system calls that are +# needed by the ANSI C part of newlib when REENTRANT_SYSCALLS_PROVIDED is +# defined. + +CFILES = isatty.c + +CFILES_R = + +SFILES = cerror.S _exit.S + +SFILES_R = sbrk.S + +# List of files built from template.S (with an '_' suffix). + +TEMPLATE_SFILES = chdir_ lstat_ + +TEMPLATE_SFILES_R = close_ fstat_ getpid_ kill_ \ + lseek_ open_ read_ stat_ unlink_ write_ + +# If newlib defines REENTRANT_SYSCALLS_PROVIDED, then these are used as well. +REENTRANT_OFILES = $(SFILES_R:.S=_r.o) $(TEMPLATE_SFILES_R:_=_r.o) \ + $(CFILES_R:.c=_r.o) + +OFILES = $(SFILES:.S=.o) $(SFILES_R:.S=.o) \ + $(TEMPLATE_SFILES:_=.o) $(TEMPLATE_SFILES_R:_=.o) \ + $(CFILES:.c=.o) $(CFILES_R:.c=.o) \ + $(REENTRANT_OFILES) + +#### Host specific Makefile fragment comes in here. +@host_makefile_frag@ + +all: libsys.a libsys-crt0.o + +libsys.a: $(OFILES) + rm -f $@ + $(AR) $(AR_FLAGS) $@ $(OFILES) + +install: + $(INSTALL_DATA) libsys-crt0.o $(tooldir)/lib/libsys-crt0.o + $(INSTALL_DATA) libsys.a $(tooldir)/lib/libsys.a + +doc: + +.PHONY: info install-info clean-info +info: +install-info: +clean-info: + +clean mostlyclean: + rm -f *.o *.a *.s stamp-srcs + +distclean maintainer-clean realclean: clean + rm -f Makefile config.status + +Makefile: Makefile.in config.status @host_makefile_frag_path@ + $(SHELL) config.status + +config.status: configure + $(SHELL) config.status --recheck + +stamp-srcs: Makefile template.S template_r.S + for f in $(TEMPLATE_SFILES:_=) ; \ + do \ + $(CC) -E -Dfunc=$$f \ + $(CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) $(NEWLIB_CFLAGS) $(INCLUDES) \ + $(srcdir)/template.S >$$f.S ; \ + done + for f in $(TEMPLATE_SFILES_R:_=) ; \ + do \ + $(CC) -E -Dfunc=$$f \ + $(CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) $(NEWLIB_CFLAGS) $(INCLUDES) \ + $(srcdir)/template_r.S | sed -e 's/^_/#/' >$$f.S ; \ + done + touch stamp-srcs + +# Make a dependency for each file built from a template. + +$(TEMPLATE_SFILES:_=.S) $(TEMPLATE_SFILES_R:_=.S): stamp-srcs + +# To support SunOS broken VPATH (sigh). + +_exit.o: _exit.S +cerror.o: cerror.S +chdir.o: chdir.S +close.o: close.S +fstat.o: fstat.S +getpid.o: getpid.S +isatty.o: isatty.c +kill.o: kill.S +libsys-crt0.o: libsys-crt0.S +lseek.o: lseek.S +lstat.o: lstat.S +open.o: open.S +read.o: read.S +sbrk.o: sbrk.S +stat.o: stat.S +write.o: write.S + +# Reentrant versions ... +# These are all needed to support the ANSI C library routines. + +close_r.o: close.S +fstat_r.o: fstat.S +getpid_r.o: getpid.S +kill_r.o: kill.S +lseek_r.o: lseek.S +open_r.o: open.S +read_r.o: read.S +sbrk_r.o: sbrk.S +stat_r.o: stat.S +unlink_r.o: unlink.S +write_r.o: write.S diff --git a/libgloss/sparc/libsys/_exit.S b/libgloss/sparc/libsys/_exit.S new file mode 100644 index 0000000..52c5c14 --- /dev/null +++ b/libgloss/sparc/libsys/_exit.S @@ -0,0 +1,14 @@ +! _exit() system call + +#include "syscallasm.h" + + TEXT_SECTION + ALIGN (4) + GLOBAL (ASM_SYMBOL (_exit)) +ASM_SYMBOL (_exit): + mov SYS_exit,%g1 + ta SYSCALL_TRAP + +! If that returns (yikes!), try an illegal insn ... + + WORD (0)
\ No newline at end of file diff --git a/libgloss/sparc/libsys/cerror.S b/libgloss/sparc/libsys/cerror.S new file mode 100644 index 0000000..8ad99c2 --- /dev/null +++ b/libgloss/sparc/libsys/cerror.S @@ -0,0 +1,47 @@ +! Set errno. +! This function is called by all the syscall stubs. +! +! FIXME: We assume errno is the first member of struct _reent. +! Not sure what to do about this. + +#include "syscallasm.h" + + DATA_SECTION + ALIGN (4) + GLOBAL (ASM_SYMBOL (errno)) ! FIXME: ASM_PRIVATE_SYMBOL ? +ASM_SYMBOL (errno): + WORD (0) + + TEXT_SECTION + ALIGN (4) + + GLOBAL (ASM_PRIVATE_SYMBOL (cerror)) +ASM_PRIVATE_SYMBOL (cerror): + sethi %hi (ASM_SYMBOL (errno)),%g1 + st %o0,[%g1+%lo (ASM_SYMBOL (errno))] + jmpl %o7+8,%g0 + mov -1,%o0 + + GLOBAL (ASM_PRIVATE_SYMBOL (cerror_r)) +ASM_PRIVATE_SYMBOL (cerror_r): + st %o0,[%o1] + jmpl %o7+8,%g0 + mov -1,%o0 + +! Since all system calls need this file, we put various state globals +! here as well. + + DATA_SECTION + +! CURBRK contains the current top of allocated space. +! END is a private symbol in svr4, but a public one in sunos4. +! FIXME: CURBRK is 4 bytes for now. + + ALIGN (4) + GLOBAL (ASM_PRIVATE_SYMBOL (curbrk)) +ASM_PRIVATE_SYMBOL (curbrk): +#ifdef SVR4 + WORD (ASM_PRIVATE_SYMBOL (end)) +#else + WORD (ASM_SYMBOL (end)) +#endif diff --git a/libgloss/sparc/libsys/configure b/libgloss/sparc/libsys/configure new file mode 100755 index 0000000..3702cce --- /dev/null +++ b/libgloss/sparc/libsys/configure @@ -0,0 +1,991 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.10 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.10" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set LANG and LC_ALL to C if already set. +# These must not be set unconditionally because not all systems understand +# e.g. LANG=C (notably SCO). +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LANG+set}" = set; then LANG=C; export LANG; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=libsys-crt0.S + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' + +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + +if test "$srcdir" = "." ; then + mdir=`echo "${with_multisubdir}/" \ + | sed -e 's,\([^/][^/]*\),..,g' -e 's,^/$,,'` + ac_aux_dir= +for ac_dir in ${mdir}../../../.. $srcdir/${mdir}../../../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in ${mdir}../../../.. $srcdir/${mdir}../../../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + +else + ac_aux_dir= +for ac_dir in ${srcdir}/../../.. $srcdir/${srcdir}/../../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in ${srcdir}/../../.. $srcdir/${srcdir}/../../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + +fi + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + for ac_prog in ginstall installbsd scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + # OSF/1 installbsd also uses dspmsg, but is usable. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_ifs" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + ac_prog_rejected=no + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +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 $# -gt 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 + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <<EOF +#ifdef __GNUC__ + yes; +#endif +EOF +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:707: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 +if test $ac_cv_prog_gcc = yes; then + GCC=yes + if test "${CFLAGS+set}" != set; then + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_gcc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_gcc_g=yes +else + ac_cv_prog_gcc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_gcc_g" 1>&6 + if test $ac_cv_prog_gcc_g = yes; then + CFLAGS="-g -O" + else + CFLAGS="-O" + fi + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi + +AS=${AS-as} + +AR=${AR-ar} + +LD=${LD-ld} + +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +host_makefile_frag=${srcdir}/../../config/default.mh + +host_makefile_frag_path=$host_makefile_frag + + + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1='\2'}/p" \ + >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs + + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS <<EOF +#! /bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.10" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS <<EOF + +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; + s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@CC@%$CC%g +s%@AS@%$AS%g +s%@AR@%$AR%g +s%@LD@%$LD%g +s%@RANLIB@%$RANLIB%g +s%@host_makefile_frag_path@%$host_makefile_frag_path%g +/@host_makefile_frag@/r $host_makefile_frag +s%@host_makefile_frag@%%g + +CEOF +EOF +cat >> $CONFIG_STATUS <<EOF + +CONFIG_FILES=\${CONFIG_FILES-"Makefile"} +EOF +cat >> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust relative srcdir, etc. for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" -f conftest.subs $ac_given_srcdir/$ac_file_in > $ac_file +fi; done +rm -f conftest.subs + + + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + diff --git a/libgloss/sparc/libsys/configure.in b/libgloss/sparc/libsys/configure.in new file mode 100644 index 0000000..cf3f496 --- /dev/null +++ b/libgloss/sparc/libsys/configure.in @@ -0,0 +1,50 @@ +# Configure.in for libgloss/sparc/libsys +# Copyright (c) 1996 Cygnus Support +# All rights reserved. +# +# Redistribution and use in source and binary forms are permitted +# provided that the above copyright notice and this paragraph are +# duplicated in all such forms and that any documentation, +# advertising materials, and other materials related to such +# distribution and use acknowledge that the software was developed +# at Cygnus Support, Inc. Cygnus Support, Inc. may not be used to +# endorse or promote products derived from this software without +# specific prior written permission. +# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + +dnl Process this file with autoconf to produce a configure script. +AC_PREREQ(2.5)dnl +AC_INIT(libsys-crt0.S) + +if test "$srcdir" = "." ; then + mdir=`echo "${with_multisubdir}/" \ + | sed -e 's,\([[^/]][[^/]]*\),..,g' -e 's,^/$,,'` + AC_CONFIG_AUX_DIR(${mdir}../../../..) +else + AC_CONFIG_AUX_DIR(${srcdir}/../../..) +fi + +AC_PROG_INSTALL + +AC_PROG_CC +AS=${AS-as} +AC_SUBST(AS) +AR=${AR-ar} +AC_SUBST(AR) +LD=${LD-ld} +AC_SUBST(LD) +AC_PROG_RANLIB + +host_makefile_frag=${srcdir}/../../config/default.mh + +dnl We have to assign the same value to other variables because autoconf +dnl doesn't provide a mechanism to substitute a replacement keyword with +dnl arbitrary data or pathnames. +dnl +host_makefile_frag_path=$host_makefile_frag +AC_SUBST(host_makefile_frag_path) +AC_SUBST_FILE(host_makefile_frag) + +AC_OUTPUT(Makefile) diff --git a/libgloss/sparc/libsys/isatty.c b/libgloss/sparc/libsys/isatty.c new file mode 100644 index 0000000..3c64647 --- /dev/null +++ b/libgloss/sparc/libsys/isatty.c @@ -0,0 +1,17 @@ +/* isatty.c */ + +/* Dumb implementation so programs will at least run. */ + +#include <sys/stat.h> + +int +isatty (int fd) +{ + struct stat buf; + + if (fstat (fd, &buf) < 0) + return 0; + if (S_ISCHR (buf.st_mode)) + return 1; + return 0; +} diff --git a/libgloss/sparc/libsys/libsys-crt0.S b/libgloss/sparc/libsys/libsys-crt0.S new file mode 100644 index 0000000..ef1b29d --- /dev/null +++ b/libgloss/sparc/libsys/libsys-crt0.S @@ -0,0 +1,127 @@ +! C run time start off + +! This file supports: +! +! - both 32bit pointer and 64bit pointer environments (at compile time) +! - an imposed stack bias (of 2047) (at run time) +! - medium/low and medium/anywhere code models (at run time) + +! Initial stack setup: +! +! bottom of stack (higher memory address) +! ... +! text of environment strings +! text of argument strings +! envp[envc] = 0 (4/8 bytes) +! ... +! env[0] (4/8 bytes) +! argv[argc] = 0 (4/8 bytes) +! ... +! argv[0] (4/8 bytes) +! argc (4/8 bytes) +! register save area (64 bits by 16 registers = 128 bytes) +! top of stack (%sp) + +! Stack Bias: +! +! It is the responsibility of the o/s to set this up. +! We handle both a 0 and 2047 value for the stack bias. + +! Medium/Anywhere code model support: +! +! In this model %g4 points to the start of the data segment. +! The text segment can go anywhere, but %g4 points to the *data* segment. +! It is up to the compiler/linker to get this right. +! +! Since this model is statically linked the start of the data segment +! is known at link time. Eg: +! +! sethi %hh(data_start), %g1 +! sethi %lm(data_start), %g4 +! or %g1, %hm(data_start), %g1 +! or %g4, %lo(data_start), %g4 +! sllx %g1, 32, %g1 +! or %g4, %g1, %g4 +! +! FIXME: For now we just assume 0. + +! FIXME: if %g1 contains a non-zero value, atexit() should be invoked +! with this value. + +#include "syscallasm.h" + +#ifndef TARGET_PTR_SIZE +#define TARGET_PTR_SIZE 32 +#endif + + TEXT_SECTION + ALIGN (4) + GLOBAL (ASM_PRIVATE_SYMBOL (start)) +ASM_PRIVATE_SYMBOL (start): + clr %fp + +! We use %g4 even if the code model is Medium/Low (simplifies the code). + + clr %g4 ! Medium/Anywhere base reg + +! If there is a stack bias in effect, account for it in %g5. Then always +! add %g5 to stack references below. This way the code can be used with +! or without an imposed bias. + + andcc %sp, 1, %g5 + bnz,a .LHaveBias + mov 2047, %g5 +.LHaveBias: + add %sp, %g5, %sp + +#if TARGET_PTR_SIZE == 32 + ! FIXME: We apparently assume here that there is no reserved word. + ! This is probably correct, but try to verify it. + ld [%sp + 0x80], %o0 ! argc + add %sp, 0x84, %o1 ! argv + add %o0, 1, %o2 + sll %o2, 2, %o2 +#else /* TARGET_PTR_SIZE == 64 */ + ld [%sp + 0x8c], %o0 ! argc.lo + add %sp, 0x90, %o1 ! argv + add %o0, 1, %o2 + sll %o2, 3, %o2 +#endif + add %o1, %o2, %o2 ! envp + sethi %hi (ASM_SYMBOL (environ)), %o3 + or %o3, %lo (ASM_SYMBOL (environ)), %o3 +#if TARGET_PTR_SIZE == 32 + st %o2, [%o3 + %g4] +#else /* TARGET_PTR_SIZE == 64 */ + stx %o2, [%o3 + %g4] +#endif + +! Restore any stack bias before we call main() ... + + sub %sp, %g5, %sp + + GLOBAL (ASM_SYMBOL (main)) + call ASM_SYMBOL (main) + +! FIXME: Not sure if this is needed anymore. +#if TARGET_PTR_SIZE == 32 + sub %sp, 0x20, %sp ! room to push args +#else /* TARGET_PTR_SIZE == 64 */ + sub %sp, 0x30, %sp ! room to push args +#endif + + GLOBAL (ASM_SYMBOL (exit)) + call ASM_SYMBOL (exit) + nop + + GLOBAL (ASM_SYMBOL (_exit)) + call ASM_SYMBOL (_exit) + nop + + set SYS_exit, %g1 + ta SYSCALL_TRAP ! in case user redefines __exit + +! If all the above methods fail to terminate the program, try an illegal insn. +! If that does not work, the o/s is hosed more than we are. + + WORD (0) diff --git a/libgloss/sparc/libsys/sbrk.S b/libgloss/sparc/libsys/sbrk.S new file mode 100644 index 0000000..b862621 --- /dev/null +++ b/libgloss/sparc/libsys/sbrk.S @@ -0,0 +1,66 @@ +! sbrk() system call + +#include "syscallasm.h" + + TEXT_SECTION + ALIGN (4) +#ifdef REENT + GLOBAL (ASM_SYMBOL (_sbrk_r)) +ASM_SYMBOL (_sbrk_r): + mov %o0,%o5 + mov %o1,%o0 +#else + GLOBAL (ASM_SYMBOL (sbrk)) +ASM_SYMBOL (sbrk): +#endif + add %o0,7,%o0 + andn %o0,7,%o0 + sethi %hi (ASM_PRIVATE_SYMBOL (curbrk)),%o2 +#ifdef __sparc_v9__ + lduw [%o2+%lo (ASM_PRIVATE_SYMBOL (curbrk))],%o3 +#else + ld [%o2+%lo (ASM_PRIVATE_SYMBOL (curbrk))],%o3 +#endif + add %o3,7,%o3 + andn %o3,7,%o3 + add %o3,%o0,%o0 + mov %o0,%o4 + mov SYS_brk,%g1 + ta SYSCALL_TRAP + bcs err + nop + st %o4,[%o2+%lo (ASM_PRIVATE_SYMBOL (curbrk))] + jmpl %o7+8,%g0 + mov %o3,%o0 + +#ifdef REENT + GLOBAL (ASM_SYMBOL (_brk_r)) +ASM_SYMBOL (_brk_r): + mov %o0,%o5 + mov %o1,%o0 +#else + GLOBAL (ASM_SYMBOL (brk)) +ASM_SYMBOL (brk): +#endif + add %o0,7,%o0 + andn %o0,7,%o0 + mov %o0,%o2 + mov SYS_brk,%g1 + ta SYSCALL_TRAP + bcs err + nop + sethi %hi (ASM_PRIVATE_SYMBOL (curbrk)),%o3 + st %o2,[%o3+%lo (ASM_PRIVATE_SYMBOL (curbrk))] + retl + mov %g0,%o0 + +err: +#ifdef REENT + sethi %hi (ASM_PRIVATE_SYMBOL (cerror_r)),%g1 + or %g1,%lo (ASM_PRIVATE_SYMBOL (cerror_r)),%g1 +#else + sethi %hi (ASM_PRIVATE_SYMBOL (cerror)),%g1 + or %g1,%lo (ASM_PRIVATE_SYMBOL (cerror)),%g1 +#endif + jmpl %g1,%g0 + mov %o5,%o1 diff --git a/libgloss/sparc/libsys/syscall.h b/libgloss/sparc/libsys/syscall.h new file mode 100644 index 0000000..457fe3a --- /dev/null +++ b/libgloss/sparc/libsys/syscall.h @@ -0,0 +1,39 @@ +#ifndef _SYSCALL_H_ +#define _SYSCALL_H_ + +/* + * This file defines the minimal set of system calls needed + * by newlib for both sunos4 and solaris2. + * + * WARNING: This file can be included by assembler files. + */ + +/* Process control. */ +#define SYS_exit 1 +#define SYS_getpid 20 +#define SYS_kill 37 + +/* File stuff. */ +#define SYS_read 3 +#define SYS_write 4 +#define SYS_open 5 +#define SYS_close 6 +#define SYS_lseek 19 + +/* Memory stuff. */ +#define SYS_brk 17 + +/* Directory stuff. */ +#define SYS_unlink 10 +#define SYS_chdir 12 +#ifdef SVR4 +#define SYS_stat 18 +#define SYS_fstat 28 +#define SYS_lstat 88 +#else +#define SYS_stat 38 +#define SYS_fstat 62 +#define SYS_lstat 40 +#endif + +#endif /* _SYSCALL_H_ */ diff --git a/libgloss/sparc/libsys/syscallasm.h b/libgloss/sparc/libsys/syscallasm.h new file mode 100644 index 0000000..55f25cd --- /dev/null +++ b/libgloss/sparc/libsys/syscallasm.h @@ -0,0 +1,93 @@ +#ifndef _SYSCALLASM_H_ +#define _SYSCALLASM_H_ + +/* + * This file defines the system calls for SPARC for the assembler. + * Anything C-ish is not allowed in this file. + * C files should include syscall.h. + */ + +#include "syscall.h" + +/* Some macros for writing assember syscall stubs. */ + +#ifdef SVR4 +#define TEXT_SECTION .section ".text" +#define DATA_SECTION .section ".data" +#define ALIGN(x) .align x +#define GLOBAL(sym) .global sym +#define WORD(x) .long x +#define ASM_SYMBOL(name) name +#define ASM_PRIVATE_SYMBOL(name) _##name +#define SYSCALL_TRAP 8 +#else +#define TEXT_SECTION .text +#define DATA_SECTION .data +#define ALIGN(x) .align x +#define GLOBAL(sym) .global sym +#define WORD(x) .word x +#define ASM_SYMBOL(name) _##name +#define ASM_PRIVATE_SYMBOL(name) name +#define SYSCALL_TRAP 0 +#endif + +#define defsyscall(name, n) \ + TEXT_SECTION ; \ + ALIGN (4) ; \ + GLOBAL (ASM_SYMBOL (name)) ; \ +ASM_SYMBOL (name): \ + mov n,%g1 ; \ + ta SYSCALL_TRAP ; \ + bcc noerr ; \ + sethi %hi (ASM_PRIVATE_SYMBOL (cerror)),%g1 ; \ + or %g1,%lo (ASM_PRIVATE_SYMBOL (cerror)),%g1 ; \ + jmpl %g1+%g0,%g0 ; \ + nop ; \ +noerr: \ + jmpl %o7+8,%g0 ; \ + nop + +/* Support for reentrant syscalls. The "struct _reent *" arg is always the + the first one. After that we allow up to four additional args. We could + allow more, but that's all we need for now. + + It may seem inefficient to have the reent arg be the first one as it means + copying all the other args into place (as opposed to making the reent arg + the last one in which case there wouldn't be any copying). I chose a clean + design over an extra four instructions in a system call. All other + reentrant functions use the first arg this way. + ??? Of course this scheme breaks down if we need to support 6 or more args. + + And of course the system calls aren't *really* reentrant. The intent + is to exercise the reentrancy framework rather than provide/claim + real reentrancy for this port. +*/ + +#define defsyscall_r(name, n) \ + TEXT_SECTION ; \ + ALIGN (4) ; \ + GLOBAL (ASM_SYMBOL (name)) ; \ +ASM_SYMBOL (name): \ + mov n,%g1 ; \ + mov %o0,%o5 ; \ + mov %o1,%o0 ; \ + mov %o2,%o1 ; \ + mov %o3,%o2 ; \ + mov %o4,%o3 ; \ + ta SYSCALL_TRAP ; \ + bcc noerr ; \ + sethi %hi (ASM_PRIVATE_SYMBOL (cerror_r)),%g1 ; \ + or %g1,%lo (ASM_PRIVATE_SYMBOL (cerror_r)),%g1 ; \ + jmpl %g1+%g0,%g0 ; \ + mov %o5,%o1 ; \ +noerr: \ + jmpl %o7+8,%g0 ; \ + nop + +#define seterrno() \ + sethi %hi (ASM_PRIVATE_SYMBOL (cerror)),%g1 ; \ + or %g1,%lo (ASM_PRIVATE_SYMBOL (cerror)),%g1 ; \ + jmpl %g1+%g0,%g0 ; \ + nop + +#endif /* _SYSCALLASM_H_ */ diff --git a/libgloss/sparc/libsys/template.S b/libgloss/sparc/libsys/template.S new file mode 100644 index 0000000..e1b437b --- /dev/null +++ b/libgloss/sparc/libsys/template.S @@ -0,0 +1,14 @@ +/* system call template */ + +/* Lots of system calls are trivial functions, so we build their source files + from a template. New syscalls can be added simply by editing the + Makefile! + + Usage: Compile this file with "func" set to the name of the syscall. */ + +#include "syscallasm.h" + +#define concat(a,b) a##b +#define makesys(a) concat (SYS_, a) + + defsyscall (func, makesys(func)) diff --git a/libgloss/sparc/libsys/template_r.S b/libgloss/sparc/libsys/template_r.S new file mode 100644 index 0000000..3a9b5f8 --- /dev/null +++ b/libgloss/sparc/libsys/template_r.S @@ -0,0 +1,26 @@ +/* reentrant system call template */ + +/* Lots of system calls are trivial functions, so we build their source files + from a template. New syscalls can be added simply by editing the + Makefile! + + The system calls aren't necessarily reentrant. If we were being used in + an embedded system they could be. Reentrant syscalls are also used, + however, to provide ANSI C namespace clean access to the host o/s. + + Usage: Compile this file with "func" set to the name of the syscall. */ + +#include "syscallasm.h" + +#define concat(a,b) a##b +#define concat3(a,b,c) a##b##c +#define makesys(a) concat (SYS_, a) +#define make_r_fn(a) concat3 (_, a, _r) + +/* The leading _'s get turned into #'s by the Makefile. */ + +_ifdef REENT + defsyscall_r (make_r_fn (func), makesys (func)) +_else + defsyscall (func, makesys (func)) +_endif diff --git a/libgloss/sparc/salib-701.c b/libgloss/sparc/salib-701.c new file mode 100644 index 0000000..404ad6c --- /dev/null +++ b/libgloss/sparc/salib-701.c @@ -0,0 +1,288 @@ +/* Stand-alone library for Sparclet 701 board + * + * Copyright (c) 1996 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#define RAM_BASE ((unsigned char *)0x12000000) /* Start of cacheable dram */ +#define DCACHE_LINES 128 /* Number of lines in data cache */ +#define DCACHE_LINE_SIZE 16 /* Bytes per data cache line */ +#define DCACHE_BANKS 4 /* 4-way associative */ +#define CACHE_INST_TAG_ADDR ((unsigned char *)0xc0020000) /* I-Cache tag base address */ +#define ALL_BANKS 0x0000f000 /* Selects all 4 cache banks */ +#define ICACHE_LINES 128 /* Number of lines in inst cache */ +#define ICACHE_LINE_SIZE 32 /* Bytes per inst cache line */ + +/* I/O Base addresses */ +#define CACHE_INST_BASE_ADD 0xc0000000 +#define CACHE_DATA_BASE_ADD 0xc8000000 +#define _InstrCacheCtlBase 0xc0000000 +#define _DataCacheCtlBase 0xc8000000 + +#define USART_BASE_ADD 0x92000000 +#define USART_BASE_ADRS(n) (USART_BASE_ADD + ((n)<<21)) /*0..3*/ + +/* Serial receiver definitions */ +#define USART_RX_CHAR(n) (*(unsigned char *) (USART_BASE_ADRS(n) +(2<<19))) +#define USART_RX_CTRL_BASE_ADRS(n) (USART_BASE_ADRS(n)+(3<<19)) +#define URSTR(n) (*(unsigned int *) (USART_RX_CTRL_BASE_ADRS(n)+(2<<15))) +#define URSTR_CHAR_NUM 0x1f00 /* Bits 8-12 */ + +/* Serial receiver definitions */ +#define USART_TX_CHAR(n) (*(unsigned char *) (USART_BASE_ADRS(n)+3)) +#define USART_TX_CTRL_BASE_ADRS(n) (USART_BASE_ADRS(n)+(1<<19)) +#define UTSTR(n) (*(unsigned int *) (USART_TX_CTRL_BASE_ADRS(n)+(2<<15))) +#define UTSTR_CHAR_FREE 0x1f0 /* Bits 4-8 */ + +/* Cache definitions */ +#define DCCA_NB_LINES 128 /* Nb of lines of the cache */ +/* Bank number, used for Cache Memory and Cache Tag */ +#define ICCA_B3 0x000008000 /* Bit 15 - 1:Bank3 selected */ +#define ICCA_B2 0x000004000 /* Bit 14 - 1:Bank2 selected */ +#define ICCA_B1 0x000002000 /* Bit 13 - 1:Bank1 selected */ +#define ICCA_B0 0x000001000 /* Bit 12 - 1:Bank0 selected */ +/* Register address, show which register is to be checked/updated */ +#define ICCACR 0x00000000 /* Bits 17 - 16 - Control register */ +#define ICCAMEM 0x00010000 /* Bits 17 - 16 - Cache memory */ +#define DCCACR 0x00000000 /* Bits 16 - 15 - Control register */ +/* Instruction Cache Controller Register */ +#define ICCR_DISABLE 0xfffffffe /* Reset enable bit */ + +/* Serial I/O routines */ + +#define STUB_PORT 1 /* 0 = serial port A; 1 = serial port B */ + +static volatile unsigned char *rx_fifo = &USART_RX_CHAR(STUB_PORT); +static volatile unsigned int *rx_status = &URSTR(STUB_PORT); + +static volatile unsigned char *tx_fifo = &USART_TX_CHAR(STUB_PORT); +static volatile unsigned int *tx_status = &UTSTR(STUB_PORT); + +/* library-free debug reoutines */ +#ifdef XDEBUG +#define XDBG_MSG(x) pmsg(x) +#define XDBG_HEX(x) phex(x) +#else +#define XDBG_MSG(x) +#define XDBG_HEX(x) +#endif + +static int +rx_rdy() +{ + return (*rx_status & URSTR_CHAR_NUM); +} + +static unsigned char +rx_char() +{ + return *rx_fifo; +} + +void +tx_char(char c) +{ + *tx_fifo = c; +} + +static int +tx_rdy() +{ + return (*tx_status & UTSTR_CHAR_FREE); +} + +int +getDebugChar() +{ + while (!rx_rdy()) + ; + return rx_char(); +} + +void +putDebugChar(int c) +{ + while (!tx_rdy()) + ; + tx_char(c); +} + +#ifdef XDEBUG +/* library-free debug reoutines */ +/* print a string */ +void pmsg(char *p) +{ + while (*p) + { + if (*p == '\n') + putDebugChar('\r'); + putDebugChar(*p++); + } +} + +/* print a hex number */ +void phex(long x) +{ + char buf[9]; + int i; + + buf[8] = '\0'; + for (i = 7; i >= 0; i--) + { + char c = x & 0x0f; + buf[i] = c < 10 ? c + '0' : c - 10 + 'A'; + x >>= 4; + } + pmsg(buf); +} +#endif + +/* rdtbr() - read the trap base register */ + +unsigned long rdtbr(); + +asm(" + .text + .align 4 + .globl _rdtbr +_rdtbr: + retl + mov %tbr, %o0 +"); + +/* wrtbr() - write the trap base register */ + +void wrtbr(unsigned long); + +asm(" + .text + .align 4 + .globl _wrtbr +_wrtbr: + retl + mov %o0, %tbr +"); + +/* Each entry in the trap vector occupies four words. */ + +struct trap_entry +{ + unsigned sethi_filler:10; + unsigned sethi_imm22:22; + unsigned jmpl_filler:19; + unsigned jmpl_simm13:13; + unsigned long filler[2]; +}; + +extern struct trap_entry fltr_proto; +asm (" + .data + .globl _fltr_proto + .align 4 +_fltr_proto: ! First level trap routine prototype + sethi 0, %l0 + jmpl 0+%l0, %g0 + nop + nop + + .text + .align 4 +"); + +/* copy_vectors - Copy the trap vectors from ROM to RAM, set the TBR register + to point to the RAM vectors, and return the address of the RAM vectors. */ + +extern struct trap_entry __trap_vectors[256]; /* defined in matra.ld */ + +struct trap_entry *copy_vectors() +{ + int i; + struct trap_entry *old = (struct trap_entry *) (rdtbr() & ~0xfff); + + XDBG_MSG("Copying vectors...\n"); + for (i = 0; i < 256; i++) + __trap_vectors[i] = old[i]; + wrtbr ((unsigned long)__trap_vectors); + XDBG_MSG("Done\n"); + return __trap_vectors; +} + + +void +disable_cache() +{ + unsigned long *ptr; + static unsigned long CACHE_shadow_iccr = 0; /* Because CR cannot be read */ + static unsigned long CACHE_shadow_dccr = 0; /* Because CR cannot be read */ + + XDBG_MSG("Disabling cache...\n"); + ptr = (unsigned long*)(CACHE_INST_BASE_ADD | ICCACR); + CACHE_shadow_iccr = CACHE_shadow_iccr & ICCR_DISABLE; + *ptr = CACHE_shadow_iccr; + + ptr = (unsigned long*)(CACHE_DATA_BASE_ADD | DCCACR); + CACHE_shadow_dccr = CACHE_shadow_dccr & ICCR_DISABLE; + *ptr = CACHE_shadow_dccr; + XDBG_MSG("Done\n"); +} + +/* Flush the instruction cache. We need to do this for the debugger stub so + that breakpoints, et. al. become visible to the instruction stream after + storing them in memory. FIXME!! + */ + +void +flush_i_cache () +{ + volatile unsigned char *addr; + + /* First, force all dirty items in the data cache to be moved out to real + memory. This is done by making read refs to alternate addresses that will + fill up all four banks for each line. Note that we actually have to + reference 8 locs per line just in case the region of memory we use is one + of the areas that needs to be flushed. */ + + for (addr = RAM_BASE; + addr < RAM_BASE + (DCACHE_LINES * DCACHE_LINE_SIZE * DCACHE_BANKS) * 2; + addr += DCACHE_LINE_SIZE) + *addr; /* Read the loc */ + + /* Now, flush the instruction cache. */ + + for (addr = CACHE_INST_TAG_ADDR + ALL_BANKS; + addr <= CACHE_INST_TAG_ADDR + ALL_BANKS + ICACHE_LINES * ICACHE_LINE_SIZE; + addr += ICACHE_LINE_SIZE) + *(unsigned long *)addr = 0; /* Clr tag entry for all banks on this line */ +} + +/* Setup trap TT to go to ROUTINE. */ + +void +exceptionHandler (int tt, unsigned long routine) +{ + static struct trap_entry *tb; /* Trap vector base address */ + + if (!tb) + { + tb = copy_vectors(); /* Copy trap vectors to RAM */ + disable_cache(); /* Disable cache FIXME!! */ + } + + XDBG_MSG("Setting exception handler for trap...\n"); + + tb[tt] = fltr_proto; + + tb[tt].sethi_imm22 = routine >> 10; + tb[tt].jmpl_simm13 = routine & 0x3ff; + + XDBG_MSG("Done\n"); +} diff --git a/libgloss/sparc/salib.c b/libgloss/sparc/salib.c new file mode 100644 index 0000000..8076a6b --- /dev/null +++ b/libgloss/sparc/salib.c @@ -0,0 +1,388 @@ +/* Stand-alone library for SPARClite + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#include "sparclite.h" +#include "asm.h" + +/* LED blinking pattern can be changed by modifying __led_algorithm. */ + +enum ledtype +{ + led_marching, /* marching pattern, only one led on at a time */ + led_random, /* pseudo-random pattern */ + led_blinking, /* all leds blink on and off */ + led_none /* leds off all the time */ +}; + +enum ledtype __led_algorithm = led_marching; + + +/* Pointer to hook for outbyte, set by stub's exception handler. */ +void (*__outbyte_hook) (int c); + +#ifdef SL931 +#define SDTR_BASE 0x200 +#define SDTR_ASI 1 +#define SDTR_SHIFT 0 +#else +#define SDTR_BASE 0x10000000 +#define SDTR_ASI 4 +#define SDTR_SHIFT 16 +#endif + +#define get_uart_status(PORT) \ + (read_asi (SDTR_ASI, SDTR_BASE + 0x24 + (PORT) * 0x10) >> SDTR_SHIFT) + +#define xmt_char(PORT, C) \ + write_asi (SDTR_ASI, SDTR_BASE + 0x20 + (PORT) * 0x10, (C) << SDTR_SHIFT) + +#define rcv_char(PORT) \ + (read_asi (SDTR_ASI, SDTR_BASE + 0x20 + (PORT) * 0x10) >> SDTR_SHIFT) + +void putDebugChar(); + +#if 0 +void +set_uart (cmd) + int cmd; +{ + write_asi (SDTR_ASI, SDTR_BASE + 0x24, cmd << SDTR_SHIFT); +} + +void +set_timer_3 (val) + int val; +{ + write_asi (SDTR_ASI, SDTR_BASE + 0x78, val << SDTR_SHIFT); +} +#endif + + +asm(" + .text + .align 4 + +! Register window overflow handler. Come here when save would move us +! into the invalid window. This routine runs with traps disabled, and +! must be careful not to touch the condition codes, as PSR is never +! restored. +! +! We are called with %l0 = wim, %l1 = pc, %l2 = npc + + .globl " STRINGSYM(win_ovf) " +" STRINGSYM(win_ovf) ": + mov %g1, %l3 ! Save g1, we use it to hold the wim + srl %l0, 1, %g1 ! Rotate wim right + sll %l0, __WINSIZE-1, %l0 + or %l0, %g1, %g1 + + save %g0, %g0, %g0 ! Slip into next window + mov %g1, %wim ! Install the new wim + + std %l0, [%sp + 0 * 4] ! save L & I registers + std %l2, [%sp + 2 * 4] + std %l4, [%sp + 4 * 4] + std %l6, [%sp + 6 * 4] + + std %i0, [%sp + 8 * 4] + std %i2, [%sp + 10 * 4] + std %i4, [%sp + 12 * 4] + std %i6, [%sp + 14 * 4] + + restore ! Go back to trap window. + mov %l3, %g1 ! Restore %g1 + + jmpl %l1, %g0 + rett %l2 + +! Register window underflow handler. Come here when restore would move us +! into the invalid window. This routine runs with traps disabled, and +! must be careful not to touch the condition codes, as PSR is never +! restored. +! +! We are called with %l0 = wim, %l1 = pc, %l2 = npc + + .globl " STRINGSYM(win_unf) " +" STRINGSYM(win_unf) ": + sll %l0, 1, %l3 ! Rotate wim left + srl %l0, __WINSIZE-1, %l0 + or %l0, %l3, %l0 + + mov %l0, %wim ! Install the new wim + + restore ! User's window + restore ! His caller's window + + ldd [%sp + 0 * 4], %l0 ! restore L & I registers + ldd [%sp + 2 * 4], %l2 + ldd [%sp + 4 * 4], %l4 + ldd [%sp + 6 * 4], %l6 + + ldd [%sp + 8 * 4], %i0 + ldd [%sp + 10 * 4], %i2 + ldd [%sp + 12 * 4], %i4 + ldd [%sp + 14 * 4], %i6 + + save %g0, %g0, %g0 ! Back to trap window + save %g0, %g0, %g0 + + jmpl %l1, %g0 + rett %l2 + +! Read the TBR. + + .globl " STRINGSYM(rdtbr) " +" STRINGSYM(rdtbr) ": + retl + mov %tbr, %o0 + +"); + +extern unsigned long rdtbr(); + +void +die(val) + int val; +{ + static unsigned char *leds = (unsigned char *)0x02000003; + + *leds = val; + + while (1) ; +} + +/* Each entry in the trap vector occupies four words. */ + +struct trap_entry +{ + unsigned sethi_filler:10; + unsigned sethi_imm22:22; + unsigned jmpl_filler:19; + unsigned jmpl_simm13:13; + unsigned long filler[2]; +}; + +extern struct trap_entry fltr_proto; +asm (" + .data + .globl " STRINGSYM(fltr_proto) " + .align 4 +" STRINGSYM(fltr_proto) ": ! First level trap routine prototype + sethi 0, %l0 + jmpl 0+%l0, %g0 + nop + nop + + .text + .align 4 +"); + +/* Setup trap TT to go to ROUTINE. If TT is between 0 and 255 inclusive, the + normal trap vector will be used. If TT is 256, then it's for the SPARClite + DSU, and that always vectors off to 255 unrelocated. +*/ + +void +exceptionHandler (tt, routine) + int tt; + unsigned long routine; +{ + struct trap_entry *tb; /* Trap vector base address */ + + if (tt != 256) + tb = (struct trap_entry *) (rdtbr() & ~0xfff); + else + { + tt = 255; + tb = (struct trap_entry *) 0; + } + + tb[tt] = fltr_proto; + + tb[tt].sethi_imm22 = routine >> 10; + tb[tt].jmpl_simm13 = routine & 0x3ff; +} + +void +update_leds() +{ + static unsigned char *leds = (unsigned char *)0x02000003; + static enum ledtype prev_algorithm = led_none; + + if (prev_algorithm != __led_algorithm) + { + *leds = 0xff; /* turn the LEDs off */ + prev_algorithm = __led_algorithm; + } + + switch (__led_algorithm) + { + case led_marching: + { + static unsigned char curled = 1; + static unsigned char dir = 0; + + *leds = ~curled; + + if (dir) + curled <<= 1; + else + curled >>= 1; + + if (curled == 0) + { + if (dir) + curled = 0x80; + else + curled = 1; + dir = ~dir; + } + break; + } + + case led_random: + { + static unsigned int next = 0; + *leds = next & 0xff; + next = (next * 1103515245 + 12345) & 0x7fff; + break; + } + + case led_blinking: + { + static unsigned char next = 0; + *leds = next; + next = ~next; + break; + } + + default: + break; + } +} + + /* 1/5th of a second? */ + +#define LEDTIME (20000000 / 500) + +unsigned long ledtime = LEDTIME; + +int +inbyte() +{ + return (getDebugChar()); +} + +int +getDebugChar() +{ + unsigned long countdown = ledtime; + + update_leds(); + + while (1) + { + if ((get_uart_status(0) & 2) != 0) break; + + if (countdown-- == 0) + { + countdown = ledtime; + update_leds(); + } + } + + return rcv_char(0); +} + +/* Output one character to the serial port */ +void +outbyte(c) + int c; +{ + if (__outbyte_hook) + __outbyte_hook (c); + else + putDebugChar(c); +} + +void +putDebugChar(c) + int c; +{ + update_leds(); + + while ((get_uart_status(0) & 1) == 0) ; + + xmt_char(0, c); +} + +#if 0 +int +write(fd, data, length) + int fd; + unsigned char *data; + int length; +{ + int olength = length; + + while (length--) + putDebugChar(*data++); + + return olength; +} + +int +read(fd, data, length) + int fd; + unsigned char *data; + int length; +{ + int olength = length; + int c; + + while (length--) + *data++ = getDebugChar(); + + return olength; +} +#endif + +/* Set the baud rate for the serial port, returns 0 for success, + -1 otherwise */ + +#if 0 +int +set_baud_rate(baudrate) + int baudrate; +{ + /* Convert baud rate to uart clock divider */ + switch (baudrate) + { + case 38400: + baudrate = 16; + break; + case 19200: + baudrate = 33; + break; + case 9600: + baudrate = 65; + break; + default: + return -1; + } + + set_timer_3(baudrate); /* Set it */ +} +#endif diff --git a/libgloss/sparc/slite.h b/libgloss/sparc/slite.h new file mode 100644 index 0000000..4762e3f --- /dev/null +++ b/libgloss/sparc/slite.h @@ -0,0 +1,127 @@ +/* + * Copyright (c) 1995, 1996 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#define STACK_SIZE 16 * 1024 +#define TRAP_STACK_SIZE 4 * 1024 +#define NUM_REGS 20 + +#ifdef SL933 +#define NUMBER_OF_REGISTER_WINDOWS 6 +#else +#define NUMBER_OF_REGISTER_WINDOWS 8 +#endif + +#if (NUMBER_OF_REGISTER_WINDOWS == 8) +#define SPARC_PSR_CWP_MASK 0x07 /* bits 0 - 4 */ +#elif (NUMBER_OF_REGISTER_WINDOWS == 16) +#define SPARC_PSR_CWP_MASK 0x0F /* bits 0 - 4 */ +#elif (NUMBER_OF_REGISTER_WINDOWS == 32) +#define SPARC_PSR_CWP_MASK 0x1F /* bits 0 - 4 */ +#else +#error "Unsupported number of register windows for this cpu" +#endif + +/* The traptable has to be the first code in a boot PROM. */ + +/* + * Entry for traps which jump to a programmer-specified trap handler. + */ + +#define TRAP(_handler) \ + sethi %hi(_handler), %l3 ; \ + jmpl %l3+%lo(_handler), %g0 ; \ + mov %wim, %l0 ; \ + nop + +/* Unexcpected trap will halt the processor by forcing it to error state */ +#if 1 +#define BAD_TRAP ta 0; nop; nop; nop; +#else +#define BAD_TRAP \ + mov %psr, l0 ; \ + mov 0x0, %o0 ; \ + sethi %hi(SYM(bad_trap)), l4 ; \ + jmp l4+%lo(SYM(bad_trap)); +#endif + +/* Software trap. Treat as BAD_TRAP for the time being... */ +#if 1 +#define SOFT_TRAP BAD_TRAP +#else +#define SOFT_TRAP \ + mov $psr, $l0 ; \ + mov 0x0, $o0 ; \ + sethi $hi(SYM(soft_trap)), l4 ; \ + jmp l4+$lo(SYM(soft_trap)); +#endif + +#define PSR_INIT 0x10c0 /* Disable traps, set s and ps */ +#define TBR_INIT 0 +#define WIM_INIT 2 +#define SP_INIT 0x023ffff0 + +/* Macros for reading and writing to arbitrary address spaces. Note that ASI + must be a constant (sorry, but the SPARC can only specify ASIs as part of an + instruction. */ + +#define read_asi(ASI, LOC) \ + ({ \ + unsigned int val; \ + __asm__ volatile ("lda [%r1]%2,%0" : "=r" (val) : "rJ" (LOC), "I" (ASI)); \ + val; \ + }) + +#define write_asi(ASI, LOC, VAL) \ + __asm__ volatile ("sta %0,[%r1]%2" : : "r" (VAL), "rJ" (LOC), "I" (ASI)); + +/* + * Use this when modifying registers that cause memory to be modified. This + * will cause GCC to reload all values after this point. + */ +#define write_asi_volatile(ASI, LOC, VAL) \ + __asm__ volatile ("sta %0,[%r1]%2" : : "r" (VAL), "rJ" (LOC), "I" (ASI) \ + : "memory"); + +#define WRITE_PC(x) registers[PC] = x; registers[NPC] = x + 4; + +/* + * Processor Status Register (psr) + * + * 31 28|27 24|23 20|19 12|11 9|7|6|5|4 0 + * +------+-------+-------+-------+------+-+-+-+--------+ + * | impl | ver | icc | res. | pil | | | | cwp | + * +------+-------+-------+-------+------+-+-+-+--------+ + * S P E + * S T + * if ET = 1, traps are enabled, 0 means disabled. + * if S = 1, you're in supervisor mode, 0 means user mode. + * cwp points to the current window. + * + * Trap Base Register (tbr) + * + * 31 12|11 4|3 0 + * +--------------+--------------+------+ + * | tba | tt | null | + * +--------------+--------------+------+ + * + * tba contains the most sig. 20 bits of the tbr base address + * tt is the trap number. + * + * Window Invalid Register (wim) + * 31 8| 7| 6| 5| 4| 3| 2| 1| 0 + * +-------------+--+--+--+--+--+--+--+--+ + * | res. |w7|w6|w5|w4|w3|w2|w1|w0| + * +-------------+--+--+--+--+--+--+--+--+ + */ + diff --git a/libgloss/sparc/sparc-stub.c b/libgloss/sparc/sparc-stub.c new file mode 100644 index 0000000..fa21d72 --- /dev/null +++ b/libgloss/sparc/sparc-stub.c @@ -0,0 +1,848 @@ +#include "sparclite.h" +/**************************************************************************** + + THIS SOFTWARE IS NOT COPYRIGHTED + + HP offers the following for use in the public domain. HP makes no + warranty with regard to the software or it's performance and the + user accepts the software "AS IS" with all faults. + + HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD + TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + +****************************************************************************/ + +/**************************************************************************** + * Header: remcom.c,v 1.34 91/03/09 12:29:49 glenne Exp $ + * + * Module name: remcom.c $ + * Revision: 1.34 $ + * Date: 91/03/09 12:29:49 $ + * Contributor: Lake Stevens Instrument Division$ + * + * Description: low level support for gdb debugger. $ + * + * Considerations: only works on target hardware $ + * + * Written by: Glenn Engel $ + * ModuleState: Experimental $ + * + * NOTES: See Below $ + * + * Modified for SPARC by Stu Grossman, Cygnus Support. + * + * This code has been extensively tested on the Fujitsu SPARClite demo board. + * + * To enable debugger support, two things need to happen. One, a + * call to set_debug_traps() is necessary in order to allow any breakpoints + * or error conditions to be properly intercepted and reported to gdb. + * Two, a breakpoint needs to be generated to begin communication. This + * is most easily accomplished by a call to breakpoint(). Breakpoint() + * simulates a breakpoint by executing a trap #1. + * + ************* + * + * The following gdb commands are supported: + * + * command function Return value + * + * g return the value of the CPU registers hex data or ENN + * G set the value of the CPU registers OK or ENN + * + * mAA..AA,LLLL Read LLLL bytes at address AA..AA hex data or ENN + * MAA..AA,LLLL: Write LLLL bytes at address AA.AA OK or ENN + * + * c Resume at current address SNN ( signal NN) + * cAA..AA Continue at address AA..AA SNN + * + * s Step one instruction SNN + * sAA..AA Step one instruction from AA..AA SNN + * + * k kill + * + * ? What was the last sigval ? SNN (signal NN) + * + * bBB..BB Set baud rate to BB..BB OK or BNN, then sets + * baud rate + * + * All commands and responses are sent with a packet which includes a + * checksum. A packet consists of + * + * $<packet info>#<checksum>. + * + * where + * <packet info> :: <characters representing the command or response> + * <checksum> :: < two hex digits computed as modulo 256 sum of <packetinfo>> + * + * When a packet is received, it is first acknowledged with either '+' or '-'. + * '+' indicates a successful transfer. '-' indicates a failed transfer. + * + * Example: + * + * Host: Reply: + * $m0,10#2a +$00010203040506070809101112131415#42 + * + ****************************************************************************/ + +#include <string.h> +#include <signal.h> + +/************************************************************************ + * + * external low-level support routines + */ + +extern putDebugChar(); /* write a single character */ +extern getDebugChar(); /* read and return a single char */ + +/************************************************************************/ +/* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/ +/* at least NUMREGBYTES*2 are needed for register packets */ +#define BUFMAX 2048 + +static int initialized = 0; /* !0 means we've been initialized */ + +static void set_mem_fault_trap(); + +static const char hexchars[]="0123456789abcdef"; + +#define NUMREGS 72 + +/* Number of bytes of registers. */ +#define NUMREGBYTES (NUMREGS * 4) +enum regnames {G0, G1, G2, G3, G4, G5, G6, G7, + O0, O1, O2, O3, O4, O5, SP, O7, + L0, L1, L2, L3, L4, L5, L6, L7, + I0, I1, I2, I3, I4, I5, FP, I7, + + F0, F1, F2, F3, F4, F5, F6, F7, + F8, F9, F10, F11, F12, F13, F14, F15, + F16, F17, F18, F19, F20, F21, F22, F23, + F24, F25, F26, F27, F28, F29, F30, F31, + Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR }; + +/*************************** ASSEMBLY CODE MACROS *************************/ +/* */ + +extern void trap_low(); + +asm(" + .reserve trapstack, 1000 * 4, \"bss\", 8 + + .data + .align 4 + +in_trap_handler: + .word 0 + + .text + .align 4 + +! This function is called when any SPARC trap (except window overflow or +! underflow) occurs. It makes sure that the invalid register window is still +! available before jumping into C code. It will also restore the world if you +! return from handle_exception. + + .globl _trap_low +_trap_low: + mov %psr, %l0 + mov %wim, %l3 + + srl %l3, %l0, %l4 ! wim >> cwp + cmp %l4, 1 + bne window_fine ! Branch if not in the invalid window + nop + +! Handle window overflow + + mov %g1, %l4 ! Save g1, we use it to hold the wim + srl %l3, 1, %g1 ! Rotate wim right + tst %g1 + bg good_wim ! Branch if new wim is non-zero + nop + +! At this point, we need to bring a 1 into the high order bit of the wim. +! Since we don't want to make any assumptions about the number of register +! windows, we figure it out dynamically so as to setup the wim correctly. + + not %g1 ! Fill g1 with ones + mov %g1, %wim ! Fill the wim with ones + nop + nop + nop + mov %wim, %g1 ! Read back the wim + inc %g1 ! Now g1 has 1 just to left of wim + srl %g1, 1, %g1 ! Now put 1 at top of wim + mov %g0, %wim ! Clear wim so that subsequent save + nop ! won't trap + nop + nop + +good_wim: + save %g0, %g0, %g0 ! Slip into next window + mov %g1, %wim ! Install the new wim + + std %l0, [%sp + 0 * 4] ! save L & I registers + std %l2, [%sp + 2 * 4] + std %l4, [%sp + 4 * 4] + std %l6, [%sp + 6 * 4] + + std %i0, [%sp + 8 * 4] + std %i2, [%sp + 10 * 4] + std %i4, [%sp + 12 * 4] + std %i6, [%sp + 14 * 4] + + restore ! Go back to trap window. + mov %l4, %g1 ! Restore %g1 + +window_fine: + sethi %hi(in_trap_handler), %l4 + ld [%lo(in_trap_handler) + %l4], %l5 + tst %l5 + bg recursive_trap + inc %l5 + + set trapstack+1000*4, %sp ! Switch to trap stack + +recursive_trap: + st %l5, [%lo(in_trap_handler) + %l4] + sub %sp,(16+1+6+1+72)*4,%sp ! Make room for input & locals + ! + hidden arg + arg spill + ! + doubleword alignment + ! + registers[72] local var + + std %g0, [%sp + (24 + 0) * 4] ! registers[Gx] + std %g2, [%sp + (24 + 2) * 4] + std %g4, [%sp + (24 + 4) * 4] + std %g6, [%sp + (24 + 6) * 4] + + std %i0, [%sp + (24 + 8) * 4] ! registers[Ox] + std %i2, [%sp + (24 + 10) * 4] + std %i4, [%sp + (24 + 12) * 4] + std %i6, [%sp + (24 + 14) * 4] + ! F0->F31 not implemented + mov %y, %l4 + mov %tbr, %l5 + st %l4, [%sp + (24 + 64) * 4] ! Y + st %l0, [%sp + (24 + 65) * 4] ! PSR + st %l3, [%sp + (24 + 66) * 4] ! WIM + st %l5, [%sp + (24 + 67) * 4] ! TBR + st %l1, [%sp + (24 + 68) * 4] ! PC + st %l2, [%sp + (24 + 69) * 4] ! NPC + + ! CPSR and FPSR not impl + + or %l0, 0xf20, %l4 + mov %l4, %psr ! Turn on traps, disable interrupts + + call _handle_exception + add %sp, 24 * 4, %o0 ! Pass address of registers + +! Reload all of the registers that aren't on the stack + + ld [%sp + (24 + 1) * 4], %g1 ! registers[Gx] + ldd [%sp + (24 + 2) * 4], %g2 + ldd [%sp + (24 + 4) * 4], %g4 + ldd [%sp + (24 + 6) * 4], %g6 + + ldd [%sp + (24 + 8) * 4], %i0 ! registers[Ox] + ldd [%sp + (24 + 10) * 4], %i2 + ldd [%sp + (24 + 12) * 4], %i4 + ldd [%sp + (24 + 14) * 4], %i6 + + ldd [%sp + (24 + 64) * 4], %l0 ! Y & PSR + ldd [%sp + (24 + 68) * 4], %l2 ! PC & NPC + + restore ! Ensure that previous window is valid + save %g0, %g0, %g0 ! by causing a window_underflow trap + + mov %l0, %y + mov %l1, %psr ! Make sure that traps are disabled + ! for rett + + sethi %hi(in_trap_handler), %l4 + ld [%lo(in_trap_handler) + %l4], %l5 + dec %l5 + st %l5, [%lo(in_trap_handler) + %l4] + + jmpl %l2, %g0 ! Restore old PC + rett %l3 ! Restore old nPC +"); + +/* Convert ch from a hex digit to an int */ + +static int +hex(ch) + unsigned char ch; +{ + if (ch >= 'a' && ch <= 'f') + return ch-'a'+10; + if (ch >= '0' && ch <= '9') + return ch-'0'; + if (ch >= 'A' && ch <= 'F') + return ch-'A'+10; + return -1; +} + +/* scan for the sequence $<data>#<checksum> */ + +static void +getpacket(buffer) + char *buffer; +{ + unsigned char checksum; + unsigned char xmitcsum; + int i; + int count; + unsigned char ch; + + do + { + /* wait around for the start character, ignore all other characters */ + while ((ch = (getDebugChar() & 0x7f)) != '$') ; + + checksum = 0; + xmitcsum = -1; + + count = 0; + + /* now, read until a # or end of buffer is found */ + while (count < BUFMAX) + { + ch = getDebugChar() & 0x7f; + if (ch == '#') + break; + checksum = checksum + ch; + buffer[count] = ch; + count = count + 1; + } + + if (count >= BUFMAX) + continue; + + buffer[count] = 0; + + if (ch == '#') + { + xmitcsum = hex(getDebugChar() & 0x7f) << 4; + xmitcsum |= hex(getDebugChar() & 0x7f); +#if 0 + /* Humans shouldn't have to figure out checksums to type to it. */ + putDebugChar ('+'); + return; +#endif + if (checksum != xmitcsum) + putDebugChar('-'); /* failed checksum */ + else + { + putDebugChar('+'); /* successful transfer */ + /* if a sequence char is present, reply the sequence ID */ + if (buffer[2] == ':') + { + putDebugChar(buffer[0]); + putDebugChar(buffer[1]); + /* remove sequence chars from buffer */ + count = strlen(buffer); + for (i=3; i <= count; i++) + buffer[i-3] = buffer[i]; + } + } + } + } + while (checksum != xmitcsum); +} + +/* send the packet in buffer. */ + +static void +putpacket(buffer) + unsigned char *buffer; +{ + unsigned char checksum; + int count; + unsigned char ch; + + /* $<packet info>#<checksum>. */ + do + { + putDebugChar('$'); + checksum = 0; + count = 0; + + while (ch = buffer[count]) + { + if (! putDebugChar(ch)) + return; + checksum += ch; + count += 1; + } + + putDebugChar('#'); + putDebugChar(hexchars[checksum >> 4]); + putDebugChar(hexchars[checksum & 0xf]); + + } + while ((getDebugChar() & 0x7f) != '+'); +} + +static char remcomInBuffer[BUFMAX]; +static char remcomOutBuffer[BUFMAX]; + +/* Indicate to caller of mem2hex or hex2mem that there has been an + error. */ +static volatile int mem_err = 0; + +/* Convert the memory pointed to by mem into hex, placing result in buf. + * Return a pointer to the last char put in buf (null), in case of mem fault, + * return 0. + * If MAY_FAULT is non-zero, then we will handle memory faults by returning + * a 0, else treat a fault like any other fault in the stub. + */ + +static unsigned char * +mem2hex(mem, buf, count, may_fault) + unsigned char *mem; + unsigned char *buf; + int count; + int may_fault; +{ + unsigned char ch; + + set_mem_fault_trap(may_fault); + + while (count-- > 0) + { + ch = *mem++; + if (mem_err) + return 0; + *buf++ = hexchars[ch >> 4]; + *buf++ = hexchars[ch & 0xf]; + } + + *buf = 0; + + set_mem_fault_trap(0); + + return buf; +} + +/* convert the hex array pointed to by buf into binary to be placed in mem + * return a pointer to the character AFTER the last byte written */ + +static char * +hex2mem(buf, mem, count, may_fault) + unsigned char *buf; + unsigned char *mem; + int count; + int may_fault; +{ + int i; + unsigned char ch; + + set_mem_fault_trap(may_fault); + + for (i=0; i<count; i++) + { + ch = hex(*buf++) << 4; + ch |= hex(*buf++); + *mem++ = ch; + if (mem_err) + return 0; + } + + set_mem_fault_trap(0); + + return mem; +} + +/* This table contains the mapping between SPARC hardware trap types, and + signals, which are primarily what GDB understands. It also indicates + which hardware traps we need to commandeer when initializing the stub. */ + +static struct hard_trap_info +{ + unsigned char tt; /* Trap type code for SPARClite */ + unsigned char signo; /* Signal that we map this trap into */ +} hard_trap_info[] = { + {1, SIGSEGV}, /* instruction access error */ + {2, SIGILL}, /* privileged instruction */ + {3, SIGILL}, /* illegal instruction */ + {4, SIGEMT}, /* fp disabled */ + {36, SIGEMT}, /* cp disabled */ + {7, SIGBUS}, /* mem address not aligned */ + {9, SIGSEGV}, /* data access exception */ + {10, SIGEMT}, /* tag overflow */ + {128+1, SIGTRAP}, /* ta 1 - normal breakpoint instruction */ + {0, 0} /* Must be last */ +}; + +/* Set up exception handlers for tracing and breakpoints */ + +void +set_debug_traps() +{ + struct hard_trap_info *ht; + + for (ht = hard_trap_info; ht->tt && ht->signo; ht++) + exceptionHandler(ht->tt, trap_low); + + /* In case GDB is started before us, ack any packets (presumably + "$?#xx") sitting there. */ + + putDebugChar ('+'); + + initialized = 1; +} + +asm (" +! Trap handler for memory errors. This just sets mem_err to be non-zero. It +! assumes that %l1 is non-zero. This should be safe, as it is doubtful that +! 0 would ever contain code that could mem fault. This routine will skip +! past the faulting instruction after setting mem_err. + + .text + .align 4 + +_fltr_set_mem_err: + sethi %hi(_mem_err), %l0 + st %l1, [%l0 + %lo(_mem_err)] + jmpl %l2, %g0 + rett %l2+4 +"); + +static void +set_mem_fault_trap(enable) + int enable; +{ + extern void fltr_set_mem_err(); + mem_err = 0; + + if (enable) + exceptionHandler(9, fltr_set_mem_err); + else + exceptionHandler(9, trap_low); +} + +/* Convert the SPARC hardware trap type code to a unix signal number. */ + +static int +computeSignal(tt) + int tt; +{ + struct hard_trap_info *ht; + + for (ht = hard_trap_info; ht->tt && ht->signo; ht++) + if (ht->tt == tt) + return ht->signo; + + return SIGHUP; /* default for things we don't know about */ +} + +/* + * While we find nice hex chars, build an int. + * Return number of chars processed. + */ + +static unsigned int +hexToInt(char **ptr, int *intValue) +{ + int numChars = 0; + int hexValue; + + *intValue = 0; + + while (**ptr) + { + hexValue = hex(**ptr); + if (hexValue < 0) + break; + + *intValue = (*intValue << 4) | hexValue; + numChars ++; + + (*ptr)++; + } + + return (numChars); +} + +/* + * This function does all command procesing for interfacing to gdb. It + * returns 1 if you should skip the instruction at the trap address, 0 + * otherwise. + */ + +extern void breakinst(); + +static void +handle_exception (registers) + unsigned long *registers; +{ + int tt; /* Trap type */ + int sigval; + unsigned int addr; + int length; + char *ptr; + unsigned long *sp; + +/* First, we must force all of the windows to be spilled out */ + + asm(" save %sp, -64, %sp + save %sp, -64, %sp + save %sp, -64, %sp + save %sp, -64, %sp + save %sp, -64, %sp + save %sp, -64, %sp + save %sp, -64, %sp + save %sp, -64, %sp + restore + restore + restore + restore + restore + restore + restore + restore +"); + + if (registers[PC] == (unsigned long)breakinst) + { + registers[PC] = registers[NPC]; + registers[NPC] += 4; + } + + sp = (unsigned long *)registers[SP]; + + tt = (registers[TBR] >> 4) & 0xff; + + /* reply to host that an exception has occurred */ + sigval = computeSignal(tt); + ptr = remcomOutBuffer; + + *ptr++ = 'T'; + *ptr++ = hexchars[sigval >> 4]; + *ptr++ = hexchars[sigval & 0xf]; + + *ptr++ = hexchars[PC >> 4]; + *ptr++ = hexchars[PC & 0xf]; + *ptr++ = ':'; + ptr = mem2hex((char *)®isters[PC], ptr, 4, 0); + *ptr++ = ';'; + + *ptr++ = hexchars[FP >> 4]; + *ptr++ = hexchars[FP & 0xf]; + *ptr++ = ':'; + ptr = mem2hex(sp + 8 + 6, ptr, 4, 0); /* FP */ + *ptr++ = ';'; + + *ptr++ = hexchars[SP >> 4]; + *ptr++ = hexchars[SP & 0xf]; + *ptr++ = ':'; + ptr = mem2hex((char *)&sp, ptr, 4, 0); + *ptr++ = ';'; + + *ptr++ = hexchars[NPC >> 4]; + *ptr++ = hexchars[NPC & 0xf]; + *ptr++ = ':'; + ptr = mem2hex((char *)®isters[NPC], ptr, 4, 0); + *ptr++ = ';'; + + *ptr++ = hexchars[O7 >> 4]; + *ptr++ = hexchars[O7 & 0xf]; + *ptr++ = ':'; + ptr = mem2hex((char *)®isters[O7], ptr, 4, 0); + *ptr++ = ';'; + + *ptr++ = 0; + + putpacket(remcomOutBuffer); + + while (1) + { + remcomOutBuffer[0] = 0; + + getpacket(remcomInBuffer); + switch (remcomInBuffer[0]) + { + case '?': + remcomOutBuffer[0] = 'S'; + remcomOutBuffer[1] = hexchars[sigval >> 4]; + remcomOutBuffer[2] = hexchars[sigval & 0xf]; + remcomOutBuffer[3] = 0; + break; + + case 'd': + /* toggle debug flag */ + break; + + case 'g': /* return the value of the CPU registers */ + { + ptr = remcomOutBuffer; + ptr = mem2hex((char *)registers, ptr, 16 * 4, 0); /* G & O regs */ + ptr = mem2hex(sp + 0, ptr, 16 * 4, 0); /* L & I regs */ + memset(ptr, '0', 32 * 8); /* Floating point */ + mem2hex((char *)®isters[Y], + ptr + 32 * 4 * 2, + 8 * 4, + 0); /* Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR */ + } + break; + + case 'G': /* set the value of the CPU registers - return OK */ + { + unsigned long *newsp, psr; + + psr = registers[PSR]; + + ptr = &remcomInBuffer[1]; + hex2mem(ptr, (char *)registers, 16 * 4, 0); /* G & O regs */ + hex2mem(ptr + 16 * 4 * 2, sp + 0, 16 * 4, 0); /* L & I regs */ + hex2mem(ptr + 64 * 4 * 2, (char *)®isters[Y], + 8 * 4, 0); /* Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR */ + + /* See if the stack pointer has moved. If so, then copy the saved + locals and ins to the new location. This keeps the window + overflow and underflow routines happy. */ + + newsp = (unsigned long *)registers[SP]; + if (sp != newsp) + sp = memcpy(newsp, sp, 16 * 4); + + /* Don't allow CWP to be modified. */ + + if (psr != registers[PSR]) + registers[PSR] = (psr & 0x1f) | (registers[PSR] & ~0x1f); + + strcpy(remcomOutBuffer,"OK"); + } + break; + + case 'm': /* mAA..AA,LLLL Read LLLL bytes at address AA..AA */ + /* Try to read %x,%x. */ + + ptr = &remcomInBuffer[1]; + + if (hexToInt(&ptr, &addr) + && *ptr++ == ',' + && hexToInt(&ptr, &length)) + { + if (mem2hex((char *)addr, remcomOutBuffer, length, 1)) + break; + + strcpy (remcomOutBuffer, "E03"); + } + else + strcpy(remcomOutBuffer,"E01"); + break; + + case 'M': /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */ + /* Try to read '%x,%x:'. */ + + ptr = &remcomInBuffer[1]; + + if (hexToInt(&ptr, &addr) + && *ptr++ == ',' + && hexToInt(&ptr, &length) + && *ptr++ == ':') + { + if (hex2mem(ptr, (char *)addr, length, 1)) + strcpy(remcomOutBuffer, "OK"); + else + strcpy(remcomOutBuffer, "E03"); + } + else + strcpy(remcomOutBuffer, "E02"); + break; + + case 'c': /* cAA..AA Continue at address AA..AA(optional) */ + /* try to read optional parameter, pc unchanged if no parm */ + + ptr = &remcomInBuffer[1]; + if (hexToInt(&ptr, &addr)) + { + registers[PC] = addr; + registers[NPC] = addr + 4; + } + +/* Need to flush the instruction cache here, as we may have deposited a + breakpoint, and the icache probably has no way of knowing that a data ref to + some location may have changed something that is in the instruction cache. + */ + + flush_i_cache(); + return; + + /* kill the program */ + case 'k' : /* do nothing */ + break; +#if 0 + case 't': /* Test feature */ + asm (" std %f30,[%sp]"); + break; +#endif + case 'r': /* Reset */ + asm ("call 0 + nop "); + break; + +#if 0 +Disabled until we can unscrew this properly + + case 'b': /* bBB... Set baud rate to BB... */ + { + int baudrate; + extern void set_timer_3(); + + ptr = &remcomInBuffer[1]; + if (!hexToInt(&ptr, &baudrate)) + { + strcpy(remcomOutBuffer,"B01"); + break; + } + + /* Convert baud rate to uart clock divider */ + switch (baudrate) + { + case 38400: + baudrate = 16; + break; + case 19200: + baudrate = 33; + break; + case 9600: + baudrate = 65; + break; + default: + strcpy(remcomOutBuffer,"B02"); + goto x1; + } + + putpacket("OK"); /* Ack before changing speed */ + set_timer_3(baudrate); /* Set it */ + } +x1: break; +#endif + } /* switch */ + + /* reply to the request */ + putpacket(remcomOutBuffer); + } +} + +/* This function will generate a breakpoint exception. It is used at the + beginning of a program to sync up with a debugger and can be used + otherwise as a quick means to stop program execution and "break" into + the debugger. */ + +void +breakpoint() +{ + if (!initialized) + return; + + asm(" .globl _breakinst + + _breakinst: ta 1 + "); +} diff --git a/libgloss/sparc/sparc86x.ld b/libgloss/sparc/sparc86x.ld new file mode 100644 index 0000000..e7cf27e --- /dev/null +++ b/libgloss/sparc/sparc86x.ld @@ -0,0 +1,177 @@ +/* + *uncomment this if you want the linker to output srecords. +OUTPUT_FORMAT(srec) + * + */ +ENTRY(_start) +STARTUP(crt0.o) +OUTPUT_ARCH(sparc) +SEARCH_DIR(.) +__DYNAMIC = 0; +GROUP (-lc -lslite86x -lgcc) + +/* + * The memory map looks like this: + * +--------------------+ <- low memory + * | .text | + * | _stext | + * | _etext | + * | ctor list | the ctor and dtor lists are for + * | dtor list | C++ support + * | _end_text | + * +--------------------+ + * | .data | initialized data goes here + * | _sdata | + * | _edata | + * +--------------------+ + * | .bss | + * | __bss_start | start of bss, cleared by crt0 + * | _end | start of heap, used by sbrk() + * +--------------------+ + * | heap space | + * | _ENDHEAP | + * | stack space | + * | __stack | top of stack + * +--------------------+ <- high memory + */ + +_STACK_SIZE = (16 * 1024); +_RAM_SIZE = 2M; +_RAM_START = 0x40010000; +_RAM_END = _RAM_START + _RAM_SIZE; + +/* + * Base address of the on-CPU peripherals. This is for compatability + * with the simulator. + */ + +_ERC32_MEC = 0x0; + +/* + * Setup the memory map of the MB86931-EB Board (ex931) + * stack grows down towards low memory. + */ +MEMORY +{ + ram (rwx) : ORIGIN = 0x40010000, LENGTH = 2M +} + +__stack = _RAM_START + _RAM_SIZE - 4 * 16; +__trap_stack = (_RAM_START + _RAM_SIZE - 4 * 16) - _STACK_SIZE; + +/* + * All the symbols that might be accessed from C code need to be + * listed twice, once with an additional underscore. aout format needs + * and extra underscore, whereas coff & elf doesn't. This is to work + * with both. + */ +/* + * Initalize some symbols to be zero so we can reference them in the + * crt0 without core dumping. These functions are all optional, but + * we do this so we can have our crt0 always use them if they exist. + * This is so BSPs work better when using the crt0 installed with gcc. + * We have to initalize them twice, so we cover a.out (which prepends + * an underscore) and coff object file formats. + */ +PROVIDE (hardware_init_hook = 0); +PROVIDE (_hardware_init_hook = 0); +PROVIDE (software_init_hook = 0); +PROVIDE (_software_init_hook = 0); +SECTIONS +{ + .text : { + stext = .; + _stext = .; + __EH_FRAME_BEGIN__ = .; + + CREATE_OBJECT_SYMBOLS + *(.text) + + __CTOR_LIST__ = .; + LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) + KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*crtend.o(.ctors)) + LONG(0) + __CTOR_END__ = .; + __DTOR_LIST__ = .; + LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) + KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*crtend.o(.dtors)) + LONG(0) + __DTOR_END__ = .; + + _etext = .; + + *(.init) + *(.lit) + *(.rodata) + *(.shdata) + *(.eh_frame) + *(.gnu.linkonce.t*) + *(.gnu.linkonce.r*) + *(.gcc_except_table) + *(.fini) + + } > ram + .shbss SIZEOF(.text) + ADDR(.text) : { + *(.shbss) + } + .talias : { } > ram + .data ALIGN(0x2000) : { + sdata = .; + _sdata = .; + *(.data) + edata = .; + _edata = .; + } > ram + .bss SIZEOF(.data) + ADDR(.data) : { + sbss = . ; + _sbss = . ; + __bss_start = ALIGN(0x8); + __bss_start = ALIGN(0x8); + *(.bss) + *(COMMON) + end = ALIGN(0x8); + _end = ALIGN(0x8); + __end = ALIGN(0x8); + ebss = .; + _ebss = .; + } + .mstack : { } > ram + .rstack : { } > ram + .stab 0 (NOLOAD) : { + [ .stab ] + } + .stabstr 0 (NOLOAD) : + { + [ .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) } + .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) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + /* These must appear regardless of . */ +} diff --git a/libgloss/sparc/sparcl-stub.c b/libgloss/sparc/sparcl-stub.c new file mode 100644 index 0000000..634878b --- /dev/null +++ b/libgloss/sparc/sparcl-stub.c @@ -0,0 +1,1005 @@ +/**************************************************************************** + + THIS SOFTWARE IS NOT COPYRIGHTED + + HP offers the following for use in the public domain. HP makes no + warranty with regard to the software or it's performance and the + user accepts the software "AS IS" with all faults. + + HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD + TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + +****************************************************************************/ + +/**************************************************************************** + * Header: remcom.c,v 1.34 91/03/09 12:29:49 glenne Exp $ + * + * Module name: remcom.c $ + * Revision: 1.34 $ + * Date: 91/03/09 12:29:49 $ + * Contributor: Lake Stevens Instrument Division$ + * + * Description: low level support for gdb debugger. $ + * + * Considerations: only works on target hardware $ + * + * Written by: Glenn Engel $ + * ModuleState: Experimental $ + * + * NOTES: See Below $ + * + * Modified for SPARC by Stu Grossman, Cygnus Support. + * Based on sparc-stub.c, it's modified for SPARClite Debug Unit hardware + * breakpoint support to create sparclite-stub.c, by Kung Hsu, Cygnus Support. + * + * This code has been extensively tested on the Fujitsu SPARClite demo board. + * + * To enable debugger support, two things need to happen. One, a + * call to set_debug_traps() is necessary in order to allow any breakpoints + * or error conditions to be properly intercepted and reported to gdb. + * Two, a breakpoint needs to be generated to begin communication. This + * is most easily accomplished by a call to breakpoint(). Breakpoint() + * simulates a breakpoint by executing a trap #1. + * + ************* + * + * The following gdb commands are supported: + * + * command function Return value + * + * g return the value of the CPU registers hex data or ENN + * G set the value of the CPU registers OK or ENN + * + * mAA..AA,LLLL Read LLLL bytes at address AA..AA hex data or ENN + * MAA..AA,LLLL: Write LLLL bytes at address AA.AA OK or ENN + * + * c Resume at current address SNN ( signal NN) + * cAA..AA Continue at address AA..AA SNN + * + * s Step one instruction SNN + * sAA..AA Step one instruction from AA..AA SNN + * + * k kill + * + * ? What was the last sigval ? SNN (signal NN) + * + * bBB..BB Set baud rate to BB..BB OK or BNN, then sets + * baud rate + * + * All commands and responses are sent with a packet which includes a + * checksum. A packet consists of + * + * $<packet info>#<checksum>. + * + * where + * <packet info> :: <characters representing the command or response> + * <checksum> :: < two hex digits computed as modulo 256 sum of <packetinfo>> + * + * When a packet is received, it is first acknowledged with either '+' or '-'. + * '+' indicates a successful transfer. '-' indicates a failed transfer. + * + * Example: + * + * Host: Reply: + * $m0,10#2a +$00010203040506070809101112131415#42 + * + ****************************************************************************/ + +#include <string.h> +#include <signal.h> +#include "asm.h" + +/************************************************************************ + * + * external low-level support routines + */ +extern putDebugChar(); /* write a single character */ +extern getDebugChar(); /* read and return a single char */ + +/* Pointer to hook for outbyte, set by stub's exception handler. */ +extern void (*__outbyte_hook)(); + +/************************************************************************/ +/* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/ +/* at least NUMREGBYTES*2 are needed for register packets */ +#define BUFMAX 2048 + +static int initialized = 0; /* !0 means we've been initialized */ + +extern void breakinst(); +static void hw_breakpoint(); +static void set_mem_fault_trap(); +static void get_in_break_mode(); + +static const char hexchars[]="0123456789abcdef"; + +#define NUMREGS 80 + +/* Number of bytes of registers. */ +#define NUMREGBYTES (NUMREGS * 4) +enum regnames {G0, G1, G2, G3, G4, G5, G6, G7, + O0, O1, O2, O3, O4, O5, SP, O7, + L0, L1, L2, L3, L4, L5, L6, L7, + I0, I1, I2, I3, I4, I5, FP, I7, + + F0, F1, F2, F3, F4, F5, F6, F7, + F8, F9, F10, F11, F12, F13, F14, F15, + F16, F17, F18, F19, F20, F21, F22, F23, + F24, F25, F26, F27, F28, F29, F30, F31, + Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR, + DIA1, DIA2, DDA1, DDA2, DDV1, DDV2, DCR, DSR }; + +/*************************** ASSEMBLY CODE MACROS *************************/ +/* */ + +extern void trap_low(); + +asm(" + .reserve trapstack, 1000 * 4, \"bss\", 8 + + .data + .align 4 + +in_trap_handler: + .word 0 + + .text + .align 4 + +! This function is called when any SPARC trap (except window overflow or +! underflow) occurs. It makes sure that the invalid register window is still +! available before jumping into C code. It will also restore the world if you +! return from handle_exception. + + .globl " STRINGSYM(trap_low) " +" STRINGSYM(trap_low) ": + mov %psr, %l0 + mov %wim, %l3 + + srl %l3, %l0, %l4 ! wim >> cwp + cmp %l4, 1 + bne window_fine ! Branch if not in the invalid window + nop + +! Handle window overflow + + mov %g1, %l4 ! Save g1, we use it to hold the wim + srl %l3, 1, %g1 ! Rotate wim right + tst %g1 + bg good_wim ! Branch if new wim is non-zero + nop + +! At this point, we need to bring a 1 into the high order bit of the wim. +! Since we don't want to make any assumptions about the number of register +! windows, we figure it out dynamically so as to setup the wim correctly. + + not %g1 ! Fill g1 with ones + mov %g1, %wim ! Fill the wim with ones + nop + nop + nop + mov %wim, %g1 ! Read back the wim + inc %g1 ! Now g1 has 1 just to left of wim + srl %g1, 1, %g1 ! Now put 1 at top of wim + mov %g0, %wim ! Clear wim so that subsequent save + nop ! won't trap + nop + nop + +good_wim: + save %g0, %g0, %g0 ! Slip into next window + mov %g1, %wim ! Install the new wim + + std %l0, [%sp + 0 * 4] ! save L & I registers + std %l2, [%sp + 2 * 4] + std %l4, [%sp + 4 * 4] + std %l6, [%sp + 6 * 4] + + std %i0, [%sp + 8 * 4] + std %i2, [%sp + 10 * 4] + std %i4, [%sp + 12 * 4] + std %i6, [%sp + 14 * 4] + + restore ! Go back to trap window. + mov %l4, %g1 ! Restore %g1 + +window_fine: + sethi %hi(in_trap_handler), %l4 + ld [%lo(in_trap_handler) + %l4], %l5 + tst %l5 + bg recursive_trap + inc %l5 + + set trapstack+1000*4, %sp ! Switch to trap stack + +recursive_trap: + st %l5, [%lo(in_trap_handler) + %l4] + sub %sp,(16+1+6+1+80)*4,%sp ! Make room for input & locals + ! + hidden arg + arg spill + ! + doubleword alignment + ! + registers[72] local var + + std %g0, [%sp + (24 + 0) * 4] ! registers[Gx] + std %g2, [%sp + (24 + 2) * 4] + std %g4, [%sp + (24 + 4) * 4] + std %g6, [%sp + (24 + 6) * 4] + + std %i0, [%sp + (24 + 8) * 4] ! registers[Ox] + std %i2, [%sp + (24 + 10) * 4] + std %i4, [%sp + (24 + 12) * 4] + std %i6, [%sp + (24 + 14) * 4] + ! F0->F31 not implemented + mov %y, %l4 + mov %tbr, %l5 + st %l4, [%sp + (24 + 64) * 4] ! Y + st %l0, [%sp + (24 + 65) * 4] ! PSR + st %l3, [%sp + (24 + 66) * 4] ! WIM + st %l5, [%sp + (24 + 67) * 4] ! TBR + st %l1, [%sp + (24 + 68) * 4] ! PC + st %l2, [%sp + (24 + 69) * 4] ! NPC + ! CPSR and FPSR not impl + or %l0, 0xf20, %l4 + mov %l4, %psr ! Turn on traps, disable interrupts + nop + nop + nop + call " STRINGSYM(get_in_break_mode) " + nop + nop + nop + + sethi %hi(0xff00), %l5 + or %l5, %lo(0xff00), %l5 + + lda [%l5]0x1, %l4 + st %l4, [%sp + (24 + 72) * 4] ! DIA1, debug instr addr 1 + add %l5, 4, %l5 + lda [%l5]0x1, %l4 + st %l4, [%sp + (24 + 73) * 4] ! DIA2, debug instr addr 2 + add %l5, 4, %l5 + lda [%l5]0x1, %l4 + st %l4, [%sp + (24 + 74) * 4] ! DDA1, debug data addr 1 + add %l5, 4, %l5 + lda [%l5]0x1, %l4 + st %l4, [%sp + (24 + 75) * 4] ! DDA2, debug data addr 2 + add %l5, 4, %l5 + lda [%l5]0x1, %l4 + st %l4, [%sp + (24 + 76) * 4] ! DDV1, debug data val 1 + add %l5, 4, %l5 + lda [%l5]0x1, %l4 + st %l4, [%sp + (24 + 77) * 4] ! DDV2, debug data val 2 + add %l5, 4, %l5 + lda [%l5]0x1, %l4 + st %l4, [%sp + (24 + 78) * 4] ! DCR, debug control reg + add %l5, 4, %l5 + lda [%l5]0x1, %l4 + st %l4, [%sp + (24 + 79) * 4] ! DSR, debug status reg + nop + nop + or %l0, 0xf20, %l4 + mov %l4, %psr ! Turn on traps, disable interrupts + nop + nop + nop + call " STRINGSYM(handle_exception) " + add %sp, 24 * 4, %o0 ! Pass address of registers + +! Reload all of the registers that aren't on the stack + + ld [%sp + (24 + 1) * 4], %g1 ! registers[Gx] + ldd [%sp + (24 + 2) * 4], %g2 + ldd [%sp + (24 + 4) * 4], %g4 + ldd [%sp + (24 + 6) * 4], %g6 + + ldd [%sp + (24 + 8) * 4], %i0 ! registers[Ox] + ldd [%sp + (24 + 10) * 4], %i2 + ldd [%sp + (24 + 12) * 4], %i4 + ldd [%sp + (24 + 14) * 4], %i6 + + sethi %hi(0xff00), %l2 + or %l2, %lo(0xff00), %l2 + ldd [%sp + (24 + 72) * 4], %l4 ! DIA1, debug instr addr 1 + stda %l4, [%l2]0x1 + nop + nop + nop + nop + ldd [%sp + (24 + 74) * 4], %l4 ! DDA1, debug data addr 1 + add %l2, 8, %l2 + stda %l4, [%l2]0x1 + nop + nop + nop + nop + ldd [%sp + (24 + 76) * 4], %l4 ! DDV1, debug data value 1 + add %l2, 8, %l2 + stda %l4, [%l2]0x1 + nop + nop + nop + nop + ld [%sp + (24 + 78) * 4], %l4 ! DCR, debug control reg + ld [%sp + (24 + 79) * 4], %l5 ! DSR, debug control reg + add %l2, 8, %l2 + or %l4, 0x200, %l4 + sta %l4, [%l2]0x1 + add %l2, 4, %l2 + sta %l5, [%l2]0x1 + nop + nop + nop + nop + + ldd [%sp + (24 + 64) * 4], %l0 ! Y & PSR + ldd [%sp + (24 + 68) * 4], %l2 ! PC & NPC + + restore ! Ensure that previous window is valid + save %g0, %g0, %g0 ! by causing a window_underflow trap + + mov %l0, %y + mov %l1, %psr ! Make sure that traps are disabled + ! for rett + sethi %hi(in_trap_handler), %l4 + ld [%lo(in_trap_handler) + %l4], %l5 + dec %l5 + st %l5, [%lo(in_trap_handler) + %l4] + + jmpl %l2, %g0 ! Restore old PC + rett %l3 ! Restore old nPC +"); + +/* Convert ch from a hex digit to an int */ + +static int +hex(ch) + unsigned char ch; +{ + if (ch >= 'a' && ch <= 'f') + return ch-'a'+10; + if (ch >= '0' && ch <= '9') + return ch-'0'; + if (ch >= 'A' && ch <= 'F') + return ch-'A'+10; + return -1; +} + +/* scan for the sequence $<data>#<checksum> */ + +static void +getpacket(buffer) + char *buffer; +{ + unsigned char checksum; + unsigned char xmitcsum; + int i; + int count; + unsigned char ch; + + do + { + /* wait around for the start character, ignore all other characters */ + while ((ch = (getDebugChar() & 0x7f)) != '$') ; + + checksum = 0; + xmitcsum = -1; + + count = 0; + + /* now, read until a # or end of buffer is found */ + while (count < BUFMAX) + { + ch = getDebugChar() & 0x7f; + if (ch == '#') + break; + checksum = checksum + ch; + buffer[count] = ch; + count = count + 1; + } + + if (count >= BUFMAX) + continue; + + buffer[count] = 0; + + if (ch == '#') + { + xmitcsum = hex(getDebugChar() & 0x7f) << 4; + xmitcsum |= hex(getDebugChar() & 0x7f); +#if 0 + /* Humans shouldn't have to figure out checksums to type to it. */ + putDebugChar ('+'); + return; +#endif + if (checksum != xmitcsum) + putDebugChar('-'); /* failed checksum */ + else + { + putDebugChar('+'); /* successful transfer */ + /* if a sequence char is present, reply the sequence ID */ + if (buffer[2] == ':') + { + putDebugChar(buffer[0]); + putDebugChar(buffer[1]); + /* remove sequence chars from buffer */ + count = strlen(buffer); + for (i=3; i <= count; i++) + buffer[i-3] = buffer[i]; + } + } + } + } + while (checksum != xmitcsum); +} + +/* send the packet in buffer. */ + +static void +putpacket(buffer) + unsigned char *buffer; +{ + unsigned char checksum; + int count; + unsigned char ch; + + /* $<packet info>#<checksum>. */ + do + { + putDebugChar('$'); + checksum = 0; + count = 0; + + while (ch = buffer[count]) + { + if (! putDebugChar(ch)) + return; + checksum += ch; + count += 1; + } + + putDebugChar('#'); + putDebugChar(hexchars[checksum >> 4]); + putDebugChar(hexchars[checksum & 0xf]); + + } + while ((getDebugChar() & 0x7f) != '+'); +} + +static char remcomInBuffer[BUFMAX]; +static char remcomOutBuffer[BUFMAX]; + +/* Indicate to caller of mem2hex or hex2mem that there has been an + error. */ +static volatile int mem_err = 0; + +/* Convert the memory pointed to by mem into hex, placing result in buf. + * Return a pointer to the last char put in buf (null), in case of mem fault, + * return 0. + * If MAY_FAULT is non-zero, then we will handle memory faults by returning + * a 0, else treat a fault like any other fault in the stub. + */ + +static unsigned char * +mem2hex(mem, buf, count, may_fault) + unsigned char *mem; + unsigned char *buf; + int count; + int may_fault; +{ + unsigned char ch; + + set_mem_fault_trap(may_fault); + + while (count-- > 0) + { + ch = *mem++; + if (mem_err) + return 0; + *buf++ = hexchars[ch >> 4]; + *buf++ = hexchars[ch & 0xf]; + } + + *buf = 0; + + set_mem_fault_trap(0); + + return buf; +} + +/* convert the hex array pointed to by buf into binary to be placed in mem + * return a pointer to the character AFTER the last byte written */ + +static char * +hex2mem(buf, mem, count, may_fault) + unsigned char *buf; + unsigned char *mem; + int count; + int may_fault; +{ + int i; + unsigned char ch; + + set_mem_fault_trap(may_fault); + + for (i=0; i<count; i++) + { + ch = hex(*buf++) << 4; + ch |= hex(*buf++); + *mem++ = ch; + if (mem_err) + return 0; + } + + set_mem_fault_trap(0); + + return mem; +} + +/* This table contains the mapping between SPARC hardware trap types, and + signals, which are primarily what GDB understands. It also indicates + which hardware traps we need to commandeer when initializing the stub. */ + +static struct hard_trap_info +{ + unsigned char tt; /* Trap type code for SPARClite */ + unsigned char signo; /* Signal that we map this trap into */ +} hard_trap_info[] = { + {1, SIGSEGV}, /* instruction access error */ + {2, SIGILL}, /* privileged instruction */ + {3, SIGILL}, /* illegal instruction */ + {4, SIGEMT}, /* fp disabled */ + {36, SIGEMT}, /* cp disabled */ + {7, SIGBUS}, /* mem address not aligned */ + {9, SIGSEGV}, /* data access exception */ + {10, SIGEMT}, /* tag overflow */ + {128+1, SIGTRAP}, /* ta 1 - normal breakpoint instruction */ + {255, SIGTRAP}, /* hardware breakpoint */ + {0, 0} /* Must be last */ +}; + +/* Set up exception handlers for tracing and breakpoints */ + +void +set_debug_traps() +{ + struct hard_trap_info *ht; + + for (ht = hard_trap_info; ht->tt && ht->signo; ht++) + exceptionHandler(ht->tt, trap_low); + + /* In case GDB is started before us, ack any packets (presumably + "$?#xx") sitting there. */ + + putDebugChar ('+'); + + initialized = 1; +} + +asm (" +! Trap handler for memory errors. This just sets mem_err to be non-zero. It +! assumes that %l1 is non-zero. This should be safe, as it is doubtful that +! 0 would ever contain code that could mem fault. This routine will skip +! past the faulting instruction after setting mem_err. + + .text + .align 4 + +" STRINGSYM(fltr_set_mem_err) ": + sethi %hi(" STRINGSYM(mem_err) "), %l0 + st %l1, [%l0 + %lo(" STRINGSYM(mem_err) ")] + jmpl %l2, %g0 + rett %l2+4 +"); + +static void +set_mem_fault_trap(enable) + int enable; +{ + extern void fltr_set_mem_err(); + mem_err = 0; + + if (enable) + exceptionHandler(9, fltr_set_mem_err); + else + exceptionHandler(9, trap_low); +} + +asm (" + .text + .align 4 + +" STRINGSYM(dummy_hw_breakpoint) ": + jmpl %l2, %g0 + rett %l2+4 + nop + nop +"); + +static void +set_hw_breakpoint_trap(enable) + int enable; +{ + extern void dummy_hw_breakpoint(); + + if (enable) + exceptionHandler(255, dummy_hw_breakpoint); + else + exceptionHandler(255, trap_low); +} + +static void +get_in_break_mode() +{ + set_hw_breakpoint_trap(1); + + asm(" + sethi %hi(0xff10), %l4 + or %l4, %lo(0xff10), %l4 + sta %g0, [%l4]0x1 + nop + nop + nop + "); + + set_hw_breakpoint_trap(0); +} + +/* Convert the SPARC hardware trap type code to a unix signal number. */ + +static int +computeSignal(tt) + int tt; +{ + struct hard_trap_info *ht; + + for (ht = hard_trap_info; ht->tt && ht->signo; ht++) + if (ht->tt == tt) + return ht->signo; + + return SIGHUP; /* default for things we don't know about */ +} + +/* + * While we find nice hex chars, build an int. + * Return number of chars processed. + */ + +static int +hexToInt(char **ptr, int *intValue) +{ + int numChars = 0; + int hexValue; + + *intValue = 0; + + while (**ptr) + { + hexValue = hex(**ptr); + if (hexValue < 0) + break; + + *intValue = (*intValue << 4) | hexValue; + numChars ++; + + (*ptr)++; + } + + return (numChars); +} + +/* Replacement for outbyte that sends a packet to GDB containing + the character to be output. */ + +static void +outbyte_stub (int c) +{ + static char buf[4]; + + buf[0] = 'O'; + buf[1] = hexchars[(c >> 4) & 0xf]; + buf[2] = hexchars[c % 16]; + buf[3] = 0; + putpacket (buf); +} + + +/* + * This function does all command procesing for interfacing to gdb. It + * returns 1 if you should skip the instruction at the trap address, 0 + * otherwise. + */ + + +static void +handle_exception (registers) + unsigned long *registers; +{ + int tt; /* Trap type */ + int sigval; + int addr; + int length; + char *ptr; + unsigned long *sp; + unsigned long dsr; + +/* First, we must force all of the windows to be spilled out */ + + asm(" save %sp, -64, %sp + save %sp, -64, %sp + save %sp, -64, %sp + save %sp, -64, %sp + save %sp, -64, %sp + save %sp, -64, %sp + save %sp, -64, %sp + save %sp, -64, %sp + restore + restore + restore + restore + restore + restore + restore + restore +"); + + if (registers[PC] == (unsigned long)breakinst) + { + registers[PC] = registers[NPC]; + registers[NPC] += 4; + } + sp = (unsigned long *)registers[SP]; + + dsr = (unsigned long)registers[DSR]; + if (dsr & 0x3c) + { + tt = 255; + } + else + { + tt = (registers[TBR] >> 4) & 0xff; + } + + /* reply to host that an exception has occurred */ + sigval = computeSignal(tt); + ptr = remcomOutBuffer; + + *ptr++ = 'T'; + *ptr++ = hexchars[sigval >> 4]; + *ptr++ = hexchars[sigval & 0xf]; + + *ptr++ = hexchars[PC >> 4]; + *ptr++ = hexchars[PC & 0xf]; + *ptr++ = ':'; + ptr = mem2hex((char *)®isters[PC], ptr, 4, 0); + *ptr++ = ';'; + + *ptr++ = hexchars[FP >> 4]; + *ptr++ = hexchars[FP & 0xf]; + *ptr++ = ':'; + ptr = mem2hex(sp + 8 + 6, ptr, 4, 0); /* FP */ + *ptr++ = ';'; + + *ptr++ = hexchars[SP >> 4]; + *ptr++ = hexchars[SP & 0xf]; + *ptr++ = ':'; + ptr = mem2hex((char *)&sp, ptr, 4, 0); + *ptr++ = ';'; + + *ptr++ = hexchars[NPC >> 4]; + *ptr++ = hexchars[NPC & 0xf]; + *ptr++ = ':'; + ptr = mem2hex((char *)®isters[NPC], ptr, 4, 0); + *ptr++ = ';'; + + *ptr++ = hexchars[O7 >> 4]; + *ptr++ = hexchars[O7 & 0xf]; + *ptr++ = ':'; + ptr = mem2hex((char *)®isters[O7], ptr, 4, 0); + *ptr++ = ';'; + + *ptr++ = 0; + + putpacket(remcomOutBuffer); + + __outbyte_hook = outbyte_stub; + + while (1) + { + remcomOutBuffer[0] = 0; + + getpacket(remcomInBuffer); + switch (remcomInBuffer[0]) + { + case '?': + remcomOutBuffer[0] = 'S'; + remcomOutBuffer[1] = hexchars[sigval >> 4]; + remcomOutBuffer[2] = hexchars[sigval & 0xf]; + remcomOutBuffer[3] = 0; + break; + + case 'd': + /* toggle debug flag */ + break; + + case 'g': /* return the value of the CPU registers */ + { + ptr = remcomOutBuffer; + ptr = mem2hex((char *)registers, ptr, 16 * 4, 0); /* G & O regs */ + ptr = mem2hex(sp + 0, ptr, 16 * 4, 0); /* L & I regs */ + memset(ptr, '0', 32 * 8); /* Floating point */ + ptr = mem2hex((char *)®isters[Y], + ptr + 32 * 4 * 2, + 8 * 4, + 0); /* Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR */ + mem2hex((char *)®isters[DIA1], ptr, + 8 * 4, 0); /* DIA1, DIA2, DDA1, DDA2, DDV1, DDV2, DCR, DSR */ + } + break; + + case 'G': /* set the value of the CPU registers - return OK */ + { + unsigned long *newsp, psr; + + psr = registers[PSR]; + + ptr = &remcomInBuffer[1]; + hex2mem(ptr, (char *)registers, 16 * 4, 0); /* G & O regs */ + hex2mem(ptr + 16 * 4 * 2, sp + 0, 16 * 4, 0); /* L & I regs */ + hex2mem(ptr + 64 * 4 * 2, (char *)®isters[Y], + 8 * 4, 0); /* Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR */ + hex2mem(ptr + 72 * 4 * 2, (char *)®isters[DIA1], + 8 * 4, 0); /* DIA1, DIA2, DDA1, DDA2, DDV1, DDV2, DCR, DSR */ + + /* See if the stack pointer has moved. If so, then copy the saved + locals and ins to the new location. This keeps the window + overflow and underflow routines happy. */ + + newsp = (unsigned long *)registers[SP]; + if (sp != newsp) + sp = memcpy(newsp, sp, 16 * 4); + + /* Don't allow CWP to be modified. */ + + if (psr != registers[PSR]) + registers[PSR] = (psr & 0x1f) | (registers[PSR] & ~0x1f); + + strcpy(remcomOutBuffer,"OK"); + } + break; + + case 'm': /* mAA..AA,LLLL Read LLLL bytes at address AA..AA */ + /* Try to read %x,%x. */ + + ptr = &remcomInBuffer[1]; + + if (hexToInt(&ptr, &addr) + && *ptr++ == ',' + && hexToInt(&ptr, &length)) + { + if (mem2hex((char *)addr, remcomOutBuffer, length, 1)) + break; + + strcpy (remcomOutBuffer, "E03"); + } + else + strcpy(remcomOutBuffer,"E01"); + break; + + case 'M': /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */ + /* Try to read '%x,%x:'. */ + + ptr = &remcomInBuffer[1]; + + if (hexToInt(&ptr, &addr) + && *ptr++ == ',' + && hexToInt(&ptr, &length) + && *ptr++ == ':') + { + if (hex2mem(ptr, (char *)addr, length, 1)) + strcpy(remcomOutBuffer, "OK"); + else + strcpy(remcomOutBuffer, "E03"); + } + else + strcpy(remcomOutBuffer, "E02"); + break; + + case 'c': /* cAA..AA Continue at address AA..AA(optional) */ + /* try to read optional parameter, pc unchanged if no parm */ + + ptr = &remcomInBuffer[1]; + if (hexToInt(&ptr, &addr)) + { + registers[PC] = addr; + registers[NPC] = addr + 4; + } + +/* Need to flush the instruction cache here, as we may have deposited a + breakpoint, and the icache probably has no way of knowing that a data ref to + some location may have changed something that is in the instruction cache. + */ + + flush_i_cache(); + return; + + /* kill the program */ + case 'k' : /* do nothing */ + break; +#if 0 + case 't': /* Test feature */ + asm (" std %f30,[%sp]"); + break; +#endif + case 'r': /* Reset */ + asm ("call 0 + nop "); + break; + +#if 0 +Disabled until we can unscrew this properly + + case 'b': /* bBB... Set baud rate to BB... */ + { + int baudrate; + extern void set_timer_3(); + + ptr = &remcomInBuffer[1]; + if (!hexToInt(&ptr, &baudrate)) + { + strcpy(remcomOutBuffer,"B01"); + break; + } + + /* Convert baud rate to uart clock divider */ + switch (baudrate) + { + case 38400: + baudrate = 16; + break; + case 19200: + baudrate = 33; + break; + case 9600: + baudrate = 65; + break; + default: + strcpy(remcomOutBuffer,"B02"); + goto x1; + } + + putpacket("OK"); /* Ack before changing speed */ + set_timer_3(baudrate); /* Set it */ + } +x1: break; +#endif + } /* switch */ + + /* reply to the request */ + putpacket(remcomOutBuffer); + } +} + +/* This function will generate a breakpoint exception. It is used at the + beginning of a program to sync up with a debugger and can be used + otherwise as a quick means to stop program execution and "break" into + the debugger. */ + +void +breakpoint() +{ + if (!initialized) + return; + + asm(" .globl " STRINGSYM(breakinst) " + + " STRINGSYM(breakinst) ": ta 1 + "); +} + +static void +hw_breakpoint() +{ + asm(" + ta 127 + "); +} diff --git a/libgloss/sparc/sparclet-stub.c b/libgloss/sparc/sparclet-stub.c new file mode 100644 index 0000000..a462128 --- /dev/null +++ b/libgloss/sparc/sparclet-stub.c @@ -0,0 +1,1233 @@ +/**************************************************************************** + + THIS SOFTWARE IS NOT COPYRIGHTED + + HP offers the following for use in the public domain. HP makes no + warranty with regard to the software or it's performance and the + user accepts the software "AS IS" with all faults. + + HP DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD + TO THIS SOFTWARE INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + +****************************************************************************/ + +/**************************************************************************** + * Header: remcom.c,v 1.34 91/03/09 12:29:49 glenne Exp $ + * + * Module name: remcom.c $ + * Revision: 1.34 $ + * Date: 91/03/09 12:29:49 $ + * Contributor: Lake Stevens Instrument Division$ + * + * Description: low level support for gdb debugger. $ + * + * Considerations: only works on target hardware $ + * + * Written by: Glenn Engel $ + * ModuleState: Experimental $ + * + * NOTES: See Below $ + * + * Modified for SPARC by Stu Grossman, Cygnus Support. + * Based on sparc-stub.c, it's modified for SPARClite Debug Unit hardware + * breakpoint support to create sparclite-stub.c, by Kung Hsu, Cygnus Support. + * + * This code has been extensively tested on the Fujitsu SPARClite demo board. + * + * To enable debugger support, two things need to happen. One, a + * call to set_debug_traps() is necessary in order to allow any breakpoints + * or error conditions to be properly intercepted and reported to gdb. + * Two, a breakpoint needs to be generated to begin communication. This + * is most easily accomplished by a call to breakpoint(). Breakpoint() + * simulates a breakpoint by executing a trap #1. + * + ************* + * + * The following gdb commands are supported: + * + * command function Return value + * + * g return the value of the CPU registers hex data or ENN + * G set the value of the CPU registers OK or ENN + * P set the value of a single CPU register OK or P01 (???) + * + * mAA..AA,LLLL Read LLLL bytes at address AA..AA hex data or ENN + * MAA..AA,LLLL: Write LLLL bytes at address AA.AA OK or ENN + * + * c Resume at current address SNN ( signal NN) + * cAA..AA Continue at address AA..AA SNN + * + * s Step one instruction SNN + * sAA..AA Step one instruction from AA..AA SNN + * + * k kill + * + * ? What was the last sigval ? SNN (signal NN) + * + * bBB..BB Set baud rate to BB..BB OK or BNN, then sets + * baud rate + * + * All commands and responses are sent with a packet which includes a + * checksum. A packet consists of + * + * $<packet info>#<checksum>. + * + * where + * <packet info> :: <characters representing the command or response> + * <checksum> :: <two hex digits computed as modulo 256 sum of <packetinfo>> + * + * When a packet is received, it is first acknowledged with either '+' or '-'. + * '+' indicates a successful transfer. '-' indicates a failed transfer. + * + * Example: + * + * Host: Reply: + * $m0,10#2a +$00010203040506070809101112131415#42 + * + ****************************************************************************/ + +#include <string.h> +#include <signal.h> + +/************************************************************************ + * + * external low-level support routines + */ + +extern putDebugChar(); /* write a single character */ +extern getDebugChar(); /* read and return a single char */ + +/************************************************************************/ +/* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/ +/* at least NUMREGBYTES*2 are needed for register packets */ +#define BUFMAX 2048 + +static int initialized = 0; /* !0 means we've been initialized */ +static int remote_debug = 0; /* turn on verbose debugging */ + +extern void breakinst(); +void _cprint(); +static void hw_breakpoint(); +static void set_mem_fault_trap(); +static void get_in_break_mode(); +static unsigned char *mem2hex(); + +static const char hexchars[]="0123456789abcdef"; + +#define NUMREGS 121 + +static unsigned long saved_stack_pointer; + +/* Number of bytes of registers. */ +#define NUMREGBYTES (NUMREGS * 4) +enum regnames { G0, G1, G2, G3, G4, G5, G6, G7, + O0, O1, O2, O3, O4, O5, SP, O7, + L0, L1, L2, L3, L4, L5, L6, L7, + I0, I1, I2, I3, I4, I5, FP, I7, + + F0, F1, F2, F3, F4, F5, F6, F7, + F8, F9, F10, F11, F12, F13, F14, F15, + F16, F17, F18, F19, F20, F21, F22, F23, + F24, F25, F26, F27, F28, F29, F30, F31, + + Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR, + CCSR, CCPR, CCCRCR, CCOR, CCOBR, CCIBR, CCIR, UNUSED1, + + ASR1, ASR15, ASR17, ASR18, ASR19, ASR20, ASR21, ASR22, + /* the following not actually implemented */ + AWR0, AWR1, AWR2, AWR3, AWR4, AWR5, AWR6, AWR7, + AWR8, AWR9, AWR10, AWR11, AWR12, AWR13, AWR14, AWR15, + AWR16, AWR17, AWR18, AWR19, AWR20, AWR21, AWR22, AWR23, + AWR24, AWR25, AWR26, AWR27, AWR28, AWR29, AWR30, AWR31, + APSR +}; + +/*************************** ASSEMBLY CODE MACROS *************************/ +/* */ + +extern void trap_low(); + +asm(" + .reserve trapstack, 1000 * 4, \"bss\", 8 + + .data + .align 4 + +in_trap_handler: + .word 0 + + .text + .align 4 + +! This function is called when any SPARC trap (except window overflow or +! underflow) occurs. It makes sure that the invalid register window is still +! available before jumping into C code. It will also restore the world if you +! return from handle_exception. +! +! On entry, trap_low expects l1 and l2 to contain pc and npc respectivly. + + .globl _trap_low +_trap_low: + mov %psr, %l0 + mov %wim, %l3 + + srl %l3, %l0, %l4 ! wim >> cwp + and %l4, 0xff, %l4 ! Mask off windows 28, 29 + cmp %l4, 1 + bne window_fine ! Branch if not in the invalid window + nop + +! Handle window overflow + + mov %g1, %l4 ! Save g1, we use it to hold the wim + srl %l3, 1, %g1 ! Rotate wim right + and %g1, 0xff, %g1 ! Mask off windows 28, 29 + tst %g1 + bg good_wim ! Branch if new wim is non-zero + nop + +! At this point, we need to bring a 1 into the high order bit of the wim. +! Since we don't want to make any assumptions about the number of register +! windows, we figure it out dynamically so as to setup the wim correctly. + + ! The normal way doesn't work on the sparclet as register windows + ! 28 and 29 are special purpose windows. + !not %g1 ! Fill g1 with ones + !mov %g1, %wim ! Fill the wim with ones + !nop + !nop + !nop + !mov %wim, %g1 ! Read back the wim + !inc %g1 ! Now g1 has 1 just to left of wim + !srl %g1, 1, %g1 ! Now put 1 at top of wim + + mov 0x80, %g1 ! Hack for sparclet + + ! This doesn't work on the sparclet. + !mov %g0, %wim ! Clear wim so that subsequent save + ! won't trap + andn %l3, 0xff, %l5 ! Clear wim but not windows 28, 29 + mov %l5, %wim + nop + nop + nop + +good_wim: + save %g0, %g0, %g0 ! Slip into next window + mov %g1, %wim ! Install the new wim + + std %l0, [%sp + 0 * 4] ! save L & I registers + std %l2, [%sp + 2 * 4] + std %l4, [%sp + 4 * 4] + std %l6, [%sp + 6 * 4] + + std %i0, [%sp + 8 * 4] + std %i2, [%sp + 10 * 4] + std %i4, [%sp + 12 * 4] + std %i6, [%sp + 14 * 4] + + restore ! Go back to trap window. + mov %l4, %g1 ! Restore %g1 + +window_fine: + sethi %hi(in_trap_handler), %l4 + ld [%lo(in_trap_handler) + %l4], %l5 + tst %l5 + bg recursive_trap + inc %l5 + + set trapstack+1000*4, %sp ! Switch to trap stack + +recursive_trap: + st %l5, [%lo(in_trap_handler) + %l4] + sub %sp,(16+1+6+1+88)*4,%sp ! Make room for input & locals + ! + hidden arg + arg spill + ! + doubleword alignment + ! + registers[121] + + std %g0, [%sp + (24 + 0) * 4] ! registers[Gx] + std %g2, [%sp + (24 + 2) * 4] + std %g4, [%sp + (24 + 4) * 4] + std %g6, [%sp + (24 + 6) * 4] + + std %i0, [%sp + (24 + 8) * 4] ! registers[Ox] + std %i2, [%sp + (24 + 10) * 4] + std %i4, [%sp + (24 + 12) * 4] + std %i6, [%sp + (24 + 14) * 4] + + ! FP regs (sparclet doesn't have fpu) + + mov %y, %l4 + mov %tbr, %l5 + st %l4, [%sp + (24 + 64) * 4] ! Y + st %l0, [%sp + (24 + 65) * 4] ! PSR + st %l3, [%sp + (24 + 66) * 4] ! WIM + st %l5, [%sp + (24 + 67) * 4] ! TBR + st %l1, [%sp + (24 + 68) * 4] ! PC + st %l2, [%sp + (24 + 69) * 4] ! NPC + ! CPSR and FPSR not impl + or %l0, 0xf20, %l4 + mov %l4, %psr ! Turn on traps, disable interrupts + nop + nop + nop + +! Save coprocessor state. +! See SK/demo/hdlc_demo/ldc_swap_context.S. + + mov %psr, %l0 + sethi %hi(0x2000), %l5 ! EC bit in PSR + or %l5, %l0, %l5 + mov %l5, %psr ! enable coprocessor + nop ! 3 nops after write to %psr (needed?) + nop + nop + crdcxt %ccsr, %l1 ! capture CCSR + mov 0x6, %l2 + cwrcxt %l2, %ccsr ! set CCP state machine for CCFR + crdcxt %ccfr, %l2 ! capture CCOR + cwrcxt %l2, %ccfr ! tickle CCFR + crdcxt %ccfr, %l3 ! capture CCOBR + cwrcxt %l3, %ccfr ! tickle CCFR + crdcxt %ccfr, %l4 ! capture CCIBR + cwrcxt %l4, %ccfr ! tickle CCFR + crdcxt %ccfr, %l5 ! capture CCIR + cwrcxt %l5, %ccfr ! tickle CCFR + crdcxt %ccpr, %l6 ! capture CCPR + crdcxt %cccrcr, %l7 ! capture CCCRCR + st %l1, [%sp + (24 + 72) * 4] ! save CCSR + st %l2, [%sp + (24 + 75) * 4] ! save CCOR + st %l3, [%sp + (24 + 76) * 4] ! save CCOBR + st %l4, [%sp + (24 + 77) * 4] ! save CCIBR + st %l5, [%sp + (24 + 78) * 4] ! save CCIR + st %l6, [%sp + (24 + 73) * 4] ! save CCPR + st %l7, [%sp + (24 + 74) * 4] ! save CCCRCR + mov %l0, %psr ! restore original PSR + nop ! 3 nops after write to %psr (needed?) + nop + nop + +! End of saving coprocessor state. +! Save asr regs + +! Part of this is silly -- we should not display ASR15 or ASR19 at all. + + sethi %hi(0x01000000), %l6 + st %l6, [%sp + (24 + 81) * 4] ! ASR15 == NOP + sethi %hi(0xdeadc0de), %l6 + or %l6, %lo(0xdeadc0de), %l6 + st %l6, [%sp + (24 + 84) * 4] ! ASR19 == DEADC0DE + + rd %asr1, %l4 + st %l4, [%sp + (24 + 80) * 4] +! rd %asr15, %l4 ! must not read ASR15 +! st %l4, [%sp + (24 + 81) * 4] ! (illegal instr trap) + rd %asr17, %l4 + st %l4, [%sp + (24 + 82) * 4] + rd %asr18, %l4 + st %l4, [%sp + (24 + 83) * 4] +! rd %asr19, %l4 ! must not read asr19 +! st %l4, [%sp + (24 + 84) * 4] ! (halts the CPU) + rd %asr20, %l4 + st %l4, [%sp + (24 + 85) * 4] + rd %asr21, %l4 + st %l4, [%sp + (24 + 86) * 4] + rd %asr22, %l4 + st %l4, [%sp + (24 + 87) * 4] + +! End of saving asr regs + + call _handle_exception + add %sp, 24 * 4, %o0 ! Pass address of registers + +! Reload all of the registers that aren't on the stack + + ld [%sp + (24 + 1) * 4], %g1 ! registers[Gx] + ldd [%sp + (24 + 2) * 4], %g2 + ldd [%sp + (24 + 4) * 4], %g4 + ldd [%sp + (24 + 6) * 4], %g6 + + ldd [%sp + (24 + 8) * 4], %i0 ! registers[Ox] + ldd [%sp + (24 + 10) * 4], %i2 + ldd [%sp + (24 + 12) * 4], %i4 + ldd [%sp + (24 + 14) * 4], %i6 + + ! FP regs (sparclet doesn't have fpu) + +! Update the coprocessor registers. +! See SK/demo/hdlc_demo/ldc_swap_context.S. + + mov %psr, %l0 + sethi %hi(0x2000), %l5 ! EC bit in PSR + or %l5, %l0, %l5 + mov %l5, %psr ! enable coprocessor + nop ! 3 nops after write to %psr (needed?) + nop + nop + + mov 0x6, %l2 + cwrcxt %l2, %ccsr ! set CCP state machine for CCFR + + ld [%sp + (24 + 72) * 4], %l1 ! saved CCSR + ld [%sp + (24 + 75) * 4], %l2 ! saved CCOR + ld [%sp + (24 + 76) * 4], %l3 ! saved CCOBR + ld [%sp + (24 + 77) * 4], %l4 ! saved CCIBR + ld [%sp + (24 + 78) * 4], %l5 ! saved CCIR + ld [%sp + (24 + 73) * 4], %l6 ! saved CCPR + ld [%sp + (24 + 74) * 4], %l7 ! saved CCCRCR + + cwrcxt %l2, %ccfr ! restore CCOR + cwrcxt %l3, %ccfr ! restore CCOBR + cwrcxt %l4, %ccfr ! restore CCIBR + cwrcxt %l5, %ccfr ! restore CCIR + cwrcxt %l6, %ccpr ! restore CCPR + cwrcxt %l7, %cccrcr ! restore CCCRCR + cwrcxt %l1, %ccsr ! restore CCSR + + mov %l0, %psr ! restore PSR + nop ! 3 nops after write to %psr (needed?) + nop + nop + +! End of coprocessor handling stuff. +! Update asr regs + + ld [%sp + (24 + 80) * 4], %l4 + wr %l4, %asr1 +! ld [%sp + (24 + 81) * 4], %l4 ! can't write asr15 +! wr %l4, %asr15 + ld [%sp + (24 + 82) * 4], %l4 + wr %l4, %asr17 + ld [%sp + (24 + 83) * 4], %l4 + wr %l4, %asr18 +! ld [%sp + (24 + 84) * 4], %l4 ! can't write asr19 +! wr %l4, %asr19 +! ld [%sp + (24 + 85) * 4], %l4 ! can't write asr20 +! wr %l4, %asr20 +! ld [%sp + (24 + 86) * 4], %l4 ! can't write asr21 +! wr %l4, %asr21 + ld [%sp + (24 + 87) * 4], %l4 + wr %l4, %asr22 + +! End of restoring asr regs + + + ldd [%sp + (24 + 64) * 4], %l0 ! Y & PSR + ldd [%sp + (24 + 68) * 4], %l2 ! PC & NPC + + restore ! Ensure that previous window is valid + save %g0, %g0, %g0 ! by causing a window_underflow trap + + mov %l0, %y + mov %l1, %psr ! Make sure that traps are disabled + ! for rett + nop ! 3 nops after write to %psr (needed?) + nop + nop + + sethi %hi(in_trap_handler), %l4 + ld [%lo(in_trap_handler) + %l4], %l5 + dec %l5 + st %l5, [%lo(in_trap_handler) + %l4] + + jmpl %l2, %g0 ! Restore old PC + rett %l3 ! Restore old nPC +"); + +/* Convert ch from a hex digit to an int */ + +static int +hex(ch) + unsigned char ch; +{ + if (ch >= 'a' && ch <= 'f') + return ch-'a'+10; + if (ch >= '0' && ch <= '9') + return ch-'0'; + if (ch >= 'A' && ch <= 'F') + return ch-'A'+10; + return -1; +} + +/* scan for the sequence $<data>#<checksum> */ + +static void +getpacket(buffer) + char *buffer; +{ + unsigned char checksum; + unsigned char xmitcsum; + int i; + int count; + unsigned char ch; + + do + { + /* wait around for the start character, ignore all other characters */ + while ((ch = (getDebugChar() & 0x7f)) != '$') + ; + + checksum = 0; + xmitcsum = -1; + + count = 0; + + /* now, read until a # or end of buffer is found */ + while (count < BUFMAX) + { + ch = getDebugChar() & 0x7f; + if (ch == '#') + break; + checksum = checksum + ch; + buffer[count] = ch; + count = count + 1; + } + + if (count >= BUFMAX) + continue; + + buffer[count] = 0; + + if (ch == '#') + { + xmitcsum = hex(ch = getDebugChar() & 0x7f) << 4; + xmitcsum |= hex(ch = getDebugChar() & 0x7f); + + if (checksum != xmitcsum) + putDebugChar('-'); /* failed checksum */ + else + { + putDebugChar('+'); /* successful transfer */ + /* if a sequence char is present, reply the sequence ID */ + if (buffer[2] == ':') + { + putDebugChar(buffer[0]); + putDebugChar(buffer[1]); + /* remove sequence chars from buffer */ + count = strlen(buffer); + for (i=3; i <= count; i++) + buffer[i-3] = buffer[i]; + } + } + } + } + while (checksum != xmitcsum); +} + +/* send the packet in buffer. */ + +static void +putpacket(buffer) + unsigned char *buffer; +{ + unsigned char checksum; + int count; + unsigned char ch; + + /* $<packet info>#<checksum>. */ + do + { + putDebugChar('$'); + checksum = 0; + count = 0; + + while (ch = buffer[count]) + { + if (! putDebugChar(ch)) + return; + checksum += ch; + count += 1; + } + + putDebugChar('#'); + putDebugChar(hexchars[checksum >> 4]); + putDebugChar(hexchars[checksum & 0xf]); + + } + while ((getDebugChar() & 0x7f) != '+'); +} + +static char remcomInBuffer[BUFMAX]; +static char remcomOutBuffer[BUFMAX]; + +/* Indicate to caller of mem2hex or hex2mem that there has been an + error. */ +static volatile int mem_err = 0; + +/* Convert the memory pointed to by mem into hex, placing result in buf. + * Return a pointer to the last char put in buf (null), in case of mem fault, + * return 0. + * If MAY_FAULT is non-zero, then we will handle memory faults by returning + * a 0, else treat a fault like any other fault in the stub. + */ + +static unsigned char * +mem2hex(mem, buf, count, may_fault) + unsigned char *mem; + unsigned char *buf; + int count; + int may_fault; +{ + unsigned char ch; + + set_mem_fault_trap(may_fault); + + while (count-- > 0) + { + ch = *mem++; + if (mem_err) + return 0; + *buf++ = hexchars[ch >> 4]; + *buf++ = hexchars[ch & 0xf]; + } + + *buf = 0; + + set_mem_fault_trap(0); + + return buf; +} + +/* convert the hex array pointed to by buf into binary to be placed in mem + * return a pointer to the character AFTER the last byte written */ + +static char * +hex2mem(buf, mem, count, may_fault) + unsigned char *buf; + unsigned char *mem; + int count; + int may_fault; +{ + int i; + unsigned char ch; + + set_mem_fault_trap(may_fault); + + for (i=0; i<count; i++) + { + ch = hex(*buf++) << 4; + ch |= hex(*buf++); + *mem++ = ch; + if (mem_err) + return 0; + } + + set_mem_fault_trap(0); + + return mem; +} + +/* This table contains the mapping between SPARC hardware trap types, and + signals, which are primarily what GDB understands. It also indicates + which hardware traps we need to commandeer when initializing the stub. */ + +static struct hard_trap_info +{ + unsigned char tt; /* Trap type code for SPARClite */ + unsigned char signo; /* Signal that we map this trap into */ +} hard_trap_info[] = { + {1, SIGSEGV}, /* instruction access exception */ + {0x3b, SIGSEGV}, /* instruction access error */ + {2, SIGILL}, /* illegal instruction */ + {3, SIGILL}, /* privileged instruction */ + {4, SIGEMT}, /* fp disabled */ + {0x24, SIGEMT}, /* cp disabled */ + {7, SIGBUS}, /* mem address not aligned */ + {0x29, SIGSEGV}, /* data access exception */ + {10, SIGEMT}, /* tag overflow */ + {128+1, SIGTRAP}, /* ta 1 - normal breakpoint instruction */ + {0, 0} /* Must be last */ +}; + +/* Set up exception handlers for tracing and breakpoints */ + +void +set_debug_traps() +{ + struct hard_trap_info *ht; + + for (ht = hard_trap_info; ht->tt && ht->signo; ht++) + exceptionHandler(ht->tt, trap_low); + + /* In case GDB is started before us, ack any packets (presumably + "$?#xx") sitting there. */ + putDebugChar ('+'); + + initialized = 1; +} + +asm (" +! Trap handler for memory errors. This just sets mem_err to be non-zero. It +! assumes that %l1 is non-zero. This should be safe, as it is doubtful that +! 0 would ever contain code that could mem fault. This routine will skip +! past the faulting instruction after setting mem_err. + + .text + .align 4 + +_fltr_set_mem_err: + sethi %hi(_mem_err), %l0 + st %l1, [%l0 + %lo(_mem_err)] + jmpl %l2, %g0 + rett %l2+4 +"); + +static void +set_mem_fault_trap(enable) + int enable; +{ + extern void fltr_set_mem_err(); + mem_err = 0; + + if (enable) + exceptionHandler(0x29, fltr_set_mem_err); + else + exceptionHandler(0x29, trap_low); +} + +asm (" + .text + .align 4 + +_dummy_hw_breakpoint: + jmpl %l2, %g0 + rett %l2+4 + nop + nop +"); + +static void +set_hw_breakpoint_trap(enable) + int enable; +{ + extern void dummy_hw_breakpoint(); + + if (enable) + exceptionHandler(255, dummy_hw_breakpoint); + else + exceptionHandler(255, trap_low); +} + +static void +get_in_break_mode() +{ +#if 0 + int x; + mesg("get_in_break_mode, sp = "); + phex(&x); +#endif + set_hw_breakpoint_trap(1); + + asm(" + sethi %hi(0xff10), %l4 + or %l4, %lo(0xff10), %l4 + sta %g0, [%l4]0x1 + nop + nop + nop + "); + + set_hw_breakpoint_trap(0); +} + +/* Convert the SPARC hardware trap type code to a unix signal number. */ + +static int +computeSignal(tt) + int tt; +{ + struct hard_trap_info *ht; + + for (ht = hard_trap_info; ht->tt && ht->signo; ht++) + if (ht->tt == tt) + return ht->signo; + + return SIGHUP; /* default for things we don't know about */ +} + +/* + * While we find nice hex chars, build an int. + * Return number of chars processed. + */ + +static int +hexToInt(char **ptr, int *intValue) +{ + int numChars = 0; + int hexValue; + + *intValue = 0; + + while (**ptr) + { + hexValue = hex(**ptr); + if (hexValue < 0) + break; + + *intValue = (*intValue << 4) | hexValue; + numChars ++; + + (*ptr)++; + } + + return (numChars); +} + +/* + * This function does all command procesing for interfacing to gdb. It + * returns 1 if you should skip the instruction at the trap address, 0 + * otherwise. + */ + +static void +handle_exception (registers) + unsigned long *registers; +{ + int tt; /* Trap type */ + int sigval; + int addr; + int length; + char *ptr; + unsigned long *sp; + unsigned long dsr; + +/* First, we must force all of the windows to be spilled out */ + + asm(" + ! Ugh. sparclet has broken save + !save %sp, -64, %sp + save + add %fp,-64,%sp + !save %sp, -64, %sp + save + add %fp,-64,%sp + !save %sp, -64, %sp + save + add %fp,-64,%sp + !save %sp, -64, %sp + save + add %fp,-64,%sp + !save %sp, -64, %sp + save + add %fp,-64,%sp + !save %sp, -64, %sp + save + add %fp,-64,%sp + !save %sp, -64, %sp + save + add %fp,-64,%sp + !save %sp, -64, %sp + save + add %fp,-64,%sp + restore + restore + restore + restore + restore + restore + restore + restore +"); + + if (registers[PC] == (unsigned long)breakinst) + { + registers[PC] = registers[NPC]; + registers[NPC] += 4; + } + sp = (unsigned long *)registers[SP]; + + tt = (registers[TBR] >> 4) & 0xff; + + /* reply to host that an exception has occurred */ + sigval = computeSignal(tt); + ptr = remcomOutBuffer; + + *ptr++ = 'T'; + *ptr++ = hexchars[sigval >> 4]; + *ptr++ = hexchars[sigval & 0xf]; + + *ptr++ = hexchars[PC >> 4]; + *ptr++ = hexchars[PC & 0xf]; + *ptr++ = ':'; + ptr = mem2hex((char *)®isters[PC], ptr, 4, 0); + *ptr++ = ';'; + + *ptr++ = hexchars[FP >> 4]; + *ptr++ = hexchars[FP & 0xf]; + *ptr++ = ':'; + ptr = mem2hex(sp + 8 + 6, ptr, 4, 0); /* FP */ + *ptr++ = ';'; + + *ptr++ = hexchars[SP >> 4]; + *ptr++ = hexchars[SP & 0xf]; + *ptr++ = ':'; + ptr = mem2hex((char *)&sp, ptr, 4, 0); + *ptr++ = ';'; + + *ptr++ = hexchars[NPC >> 4]; + *ptr++ = hexchars[NPC & 0xf]; + *ptr++ = ':'; + ptr = mem2hex((char *)®isters[NPC], ptr, 4, 0); + *ptr++ = ';'; + + *ptr++ = hexchars[O7 >> 4]; + *ptr++ = hexchars[O7 & 0xf]; + *ptr++ = ':'; + ptr = mem2hex((char *)®isters[O7], ptr, 4, 0); + *ptr++ = ';'; + + *ptr++ = 0; + + putpacket(remcomOutBuffer); + + while (1) + { + remcomOutBuffer[0] = 0; + + getpacket(remcomInBuffer); + switch (remcomInBuffer[0]) + { + case '?': + remcomOutBuffer[0] = 'S'; + remcomOutBuffer[1] = hexchars[sigval >> 4]; + remcomOutBuffer[2] = hexchars[sigval & 0xf]; + remcomOutBuffer[3] = 0; + break; + + case 'd': + remote_debug = !(remote_debug); /* toggle debug flag */ + break; + + case 'g': /* return the value of the CPU registers */ + { + ptr = remcomOutBuffer; + ptr = mem2hex((char *)registers, ptr, 16 * 4, 0); /* G & O regs */ + ptr = mem2hex(sp + 0, ptr, 16 * 4, 0); /* L & I regs */ + memset(ptr, '0', 32 * 8); /* Floating point */ + ptr = mem2hex((char *)®isters[Y], + ptr + 32 * 4 * 2, + 8 * 4, + 0); /* Y, PSR, WIM, TBR, PC, NPC, FPSR, CPSR */ + ptr = mem2hex((char *)®isters[CCSR], + ptr, + 8 * 4, + 0); /* CCSR, CCPR, CCCRCR, CCOR, CCOBR, CCIBR, CCIR */ + ptr = mem2hex((char *)®isters[ASR1], + ptr, + 8 * 4, + 0); /* ASR1,ASR15,ASR17,ASR18,ASR19,ASR20,ASR21,ASR22 */ +#if 0 /* not implemented */ + ptr = mem2hex((char *) ®isters[AWR0], + ptr, + 32 * 4, + 0); /* Alternate Window Registers */ +#endif + } + break; + + case 'G': /* set value of all the CPU registers - return OK */ + case 'P': /* set value of one CPU register - return OK */ + { + unsigned long *newsp, psr; + + psr = registers[PSR]; + + ptr = &remcomInBuffer[1]; + + if (remcomInBuffer[0] == 'P') /* do a single register */ + { + int regno; + + if (hexToInt (&ptr, ®no) + && *ptr++ == '=') + if (regno >= L0 && regno <= I7) + hex2mem (ptr, sp + regno - L0, 4, 0); + else + hex2mem (ptr, (char *)®isters[regno], 4, 0); + else + { + strcpy (remcomOutBuffer, "P01"); + break; + } + } + else + { + hex2mem(ptr, (char *)registers, 16 * 4, 0); /* G & O regs */ + hex2mem(ptr + 16 * 4 * 2, sp + 0, 16 * 4, 0); /* L & I regs */ + hex2mem(ptr + 64 * 4 * 2, (char *)®isters[Y], + 8 * 4, 0); /* Y,PSR,WIM,TBR,PC,NPC,FPSR,CPSR */ + hex2mem(ptr + 72 * 4 * 2, (char *)®isters[CCSR], + 8 * 4, 0); /* CCSR,CCPR,CCCRCR,CCOR,CCOBR,CCIBR,CCIR */ + hex2mem(ptr + 80 * 4 * 2, (char *)®isters[ASR1], + 8 * 4, 0); /* ASR1 ... ASR22 */ +#if 0 /* not implemented */ + hex2mem(ptr + 88 * 4 * 2, (char *)®isters[AWR0], + 8 * 4, 0); /* Alternate Window Registers */ +#endif + } + /* See if the stack pointer has moved. If so, then copy the saved + locals and ins to the new location. This keeps the window + overflow and underflow routines happy. */ + + newsp = (unsigned long *)registers[SP]; + if (sp != newsp) + sp = memcpy(newsp, sp, 16 * 4); + + /* Don't allow CWP to be modified. */ + + if (psr != registers[PSR]) + registers[PSR] = (psr & 0x1f) | (registers[PSR] & ~0x1f); + + strcpy(remcomOutBuffer,"OK"); + } + break; + + case 'm': /* mAA..AA,LLLL Read LLLL bytes at address AA..AA */ + /* Try to read %x,%x. */ + + ptr = &remcomInBuffer[1]; + + if (hexToInt(&ptr, &addr) + && *ptr++ == ',' + && hexToInt(&ptr, &length)) + { + if (mem2hex((char *)addr, remcomOutBuffer, length, 1)) + break; + + strcpy (remcomOutBuffer, "E03"); + } + else + strcpy(remcomOutBuffer,"E01"); + break; + + case 'M': /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */ + /* Try to read '%x,%x:'. */ + + ptr = &remcomInBuffer[1]; + + if (hexToInt(&ptr, &addr) + && *ptr++ == ',' + && hexToInt(&ptr, &length) + && *ptr++ == ':') + { + if (hex2mem(ptr, (char *)addr, length, 1)) + strcpy(remcomOutBuffer, "OK"); + else + strcpy(remcomOutBuffer, "E03"); + } + else + strcpy(remcomOutBuffer, "E02"); + break; + + case 'c': /* cAA..AA Continue at address AA..AA(optional) */ + /* try to read optional parameter, pc unchanged if no parm */ + + ptr = &remcomInBuffer[1]; + if (hexToInt(&ptr, &addr)) + { + registers[PC] = addr; + registers[NPC] = addr + 4; + } + +/* Need to flush the instruction cache here, as we may have deposited a + breakpoint, and the icache probably has no way of knowing that a data ref to + some location may have changed something that is in the instruction cache. + */ + + flush_i_cache(); + return; + + /* kill the program */ + case 'k' : /* do nothing */ + break; +#if 0 + case 't': /* Test feature */ + asm (" std %f30,[%sp]"); + break; +#endif + case 'r': /* Reset */ + asm ("call 0 + nop "); + break; + +#if 0 +Disabled until we can unscrew this properly + + case 'b': /* bBB... Set baud rate to BB... */ + { + int baudrate; + extern void set_timer_3(); + + ptr = &remcomInBuffer[1]; + if (!hexToInt(&ptr, &baudrate)) + { + strcpy(remcomOutBuffer,"B01"); + break; + } + + /* Convert baud rate to uart clock divider */ + switch (baudrate) + { + case 38400: + baudrate = 16; + break; + case 19200: + baudrate = 33; + break; + case 9600: + baudrate = 65; + break; + default: + strcpy(remcomOutBuffer,"B02"); + goto x1; + } + + putpacket("OK"); /* Ack before changing speed */ + set_timer_3(baudrate); /* Set it */ + } +x1: break; +#endif + } /* switch */ + + /* reply to the request */ + putpacket(remcomOutBuffer); + } +} + +/* This function will generate a breakpoint exception. It is used at the + beginning of a program to sync up with a debugger and can be used + otherwise as a quick means to stop program execution and "break" into + the debugger. */ + +void +breakpoint() +{ + if (!initialized) + return; + + asm(" .globl _breakinst + + _breakinst: ta 1 + "); +} + +static void +hw_breakpoint() +{ + asm(" + ta 127 + "); +} + +#if 0 /* experimental and never finished, left here for reference */ +static void +splet_temp(void) +{ + asm(" sub %sp,(16+1+6+1+121)*4,%sp ! Make room for input & locals + ! + hidden arg + arg spill + ! + doubleword alignment + ! + registers[121] + +! Leave a trail of breadcrumbs! (save register save area for debugging) + mov %sp, %l0 + add %l0, 24*4, %l0 + sethi %hi(_debug_registers), %l1 + st %l0, [%lo(_debug_registers) + %l1] + +! Save the Alternate Register Set: (not implemented yet) +! To save the Alternate Register set, we must: +! 1) Save the current SP in some global location. +! 2) Swap the register sets. +! 3) Save the Alternate SP in the Y register +! 4) Fetch the SP that we saved in step 1. +! 5) Use that to save the rest of the regs (not forgetting ASP in Y) +! 6) Restore the Alternate SP from Y +! 7) Swap the registers back. + +! 1) Copy the current stack pointer to global _SAVED_STACK_POINTER: + sethi %hi(_saved_stack_pointer), %l0 + st %sp, [%lo(_saved_stack_pointer) + %l0] + +! 2) Swap the register sets: + mov %psr, %l1 + sethi %hi(0x10000), %l2 + xor %l1, %l2, %l1 + mov %l1, %psr + nop ! 3 nops after write to %psr (needed?) + nop + nop + +! 3) Save Alternate L0 in Y + wr %l0, 0, %y + +! 4) Load former SP into alternate SP, using L0 + sethi %hi(_saved_stack_pointer), %l0 + or %lo(_saved_stack_pointer), %l0, %l0 + swap [%l0], %sp + +! 4.5) Restore alternate L0 + rd %y, %l0 + +! 5) Save the Alternate Window Registers + st %r0, [%sp + (24 + 88) * 4] ! AWR0 + st %r1, [%sp + (24 + 89) * 4] ! AWR1 + st %r2, [%sp + (24 + 90) * 4] ! AWR2 + st %r3, [%sp + (24 + 91) * 4] ! AWR3 + st %r4, [%sp + (24 + 92) * 4] ! AWR4 + st %r5, [%sp + (24 + 93) * 4] ! AWR5 + st %r6, [%sp + (24 + 94) * 4] ! AWR6 + st %r7, [%sp + (24 + 95) * 4] ! AWR7 + st %r8, [%sp + (24 + 96) * 4] ! AWR8 + st %r9, [%sp + (24 + 97) * 4] ! AWR9 + st %r10, [%sp + (24 + 98) * 4] ! AWR10 + st %r11, [%sp + (24 + 99) * 4] ! AWR11 + st %r12, [%sp + (24 + 100) * 4] ! AWR12 + st %r13, [%sp + (24 + 101) * 4] ! AWR13 +! st %r14, [%sp + (24 + 102) * 4] ! AWR14 (SP) + st %r15, [%sp + (24 + 103) * 4] ! AWR15 + st %r16, [%sp + (24 + 104) * 4] ! AWR16 + st %r17, [%sp + (24 + 105) * 4] ! AWR17 + st %r18, [%sp + (24 + 106) * 4] ! AWR18 + st %r19, [%sp + (24 + 107) * 4] ! AWR19 + st %r20, [%sp + (24 + 108) * 4] ! AWR20 + st %r21, [%sp + (24 + 109) * 4] ! AWR21 + st %r22, [%sp + (24 + 110) * 4] ! AWR22 + st %r23, [%sp + (24 + 111) * 4] ! AWR23 + st %r24, [%sp + (24 + 112) * 4] ! AWR24 + st %r25, [%sp + (24 + 113) * 4] ! AWR25 + st %r26, [%sp + (24 + 114) * 4] ! AWR26 + st %r27, [%sp + (24 + 115) * 4] ! AWR27 + st %r28, [%sp + (24 + 116) * 4] ! AWR28 + st %r29, [%sp + (24 + 117) * 4] ! AWR29 + st %r30, [%sp + (24 + 118) * 4] ! AWR30 + st %r31, [%sp + (24 + 119) * 4] ! AWR21 + +! Get the Alternate PSR (I hope...) + + rd %psr, %l2 + st %l2, [%sp + (24 + 120) * 4] ! APSR + +! Don't forget the alternate stack pointer + + rd %y, %l3 + st %l3, [%sp + (24 + 102) * 4] ! AWR14 (SP) + +! 6) Restore the Alternate SP (saved in Y) + + rd %y, %o6 + + +! 7) Swap the registers back: + + mov %psr, %l1 + sethi %hi(0x10000), %l2 + xor %l1, %l2, %l1 + mov %l1, %psr + nop ! 3 nops after write to %psr (needed?) + nop + nop +"); +} + +#endif diff --git a/libgloss/sparc/sparclite.h b/libgloss/sparc/sparclite.h new file mode 100644 index 0000000..0f14d51 --- /dev/null +++ b/libgloss/sparc/sparclite.h @@ -0,0 +1,81 @@ +/* SPARClite defs + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +/* Macros for reading and writing to arbitrary address spaces. Note that ASI + must be a constant (sorry, but the SPARC can only specify ASIs as part of an + instruction. */ + +#define read_asi(ASI, LOC) \ + ({ \ + unsigned int val; \ + __asm__ volatile ("lda [%r1]%2,%0" : "=r" (val) : "rJ" (LOC), "I" (ASI)); \ + val; \ + }) + +#define write_asi(ASI, LOC, VAL) \ + __asm__ volatile ("sta %0,[%r1]%2" : : "r" (VAL), "rJ" (LOC), "I" (ASI)) + +/* Use this when modifying registers that cause memory to be modified. This + will cause GCC to reload all values after this point. */ + +#define write_asi_volatile(ASI, LOC, VAL) \ + __asm__ volatile ("sta %0,[%r1]%2" : : "r" (VAL), "rJ" (LOC), "I" (ASI) \ + : "memory") + +/* Read the PSR (processor state register). */ + +#define read_psr() \ + ({ \ + unsigned int psr; \ + __asm__ ("mov %%psr, %0" : "=r" (psr)); \ + psr; \ + }) + +/* Write the PSR. */ + +#define write_psr(VAL) \ + __asm__ ("mov %0, %%psr \n nop \n nop \n nop" : : "r" (VAL)) + +/* Read the specified Ancillary State Register. */ + +#define read_asr(REG) read_asr1(REG) +#define read_asr1(REG) \ + ({ \ + unsigned int val; \ + __asm__ ("rd %%asr" #REG ",%0" : "=r" (val)); \ + val; \ + }) + +/* Write the specified Ancillary State Register. */ + +#define write_asr(REG, VAL) write_asr1(REG, VAL) +#define write_asr1(REG, VAL) \ + __asm__ ("wr %0, 0, %%asr" #REG : : "r" (VAL)) + +/* Set window size for window overflow and underflow trap handlers. Better to + do this at at compile time than to calculate them at compile time each time + we get a window overflow/underflow trap. */ + +#ifdef SL933 + asm ("__WINSIZE=6"); +#else + asm ("__WINSIZE=8"); +#endif + +#define PSR_INIT 0x10c0 /* Disable traps, set s and ps */ +#define TBR_INIT 0 +#define WIM_INIT 2 +#define STACK_SIZE 16 * 1024 + diff --git a/libgloss/sparc/sysc-701.c b/libgloss/sparc/sysc-701.c new file mode 100644 index 0000000..191a08a --- /dev/null +++ b/libgloss/sparc/sysc-701.c @@ -0,0 +1,55 @@ +/* more sparclet syscall support (the rest is in crt0-701.S). */ + +#include <sys/types.h> +#include <sys/stat.h> +#include <errno.h> + +int +fstat(int _fd, struct stat* _sbuf) +{ + errno = ENOSYS; + return -1; +} + +int +isatty(int fd) +{ + if (fd < 0) + { + errno = EBADF; + return -1; + } + return fd <= 2; +} + +int +getpid() +{ + return 1; +} + +int +kill(int pid) +{ + /* if we knew how to nuke the board, we would... */ + return 0; +} + +int +lseek(int _fd, off_t offset, int whence) +{ + errno = ENOSYS; + return -1; +} + +extern char end; +char* +sbrk (int incr) +{ + static char* base; + char *b; + if(!base) base = &end; + b = base; + base += incr; + return b; +} diff --git a/libgloss/sparc/syscalls.c b/libgloss/sparc/syscalls.c new file mode 100644 index 0000000..01ba501 --- /dev/null +++ b/libgloss/sparc/syscalls.c @@ -0,0 +1,85 @@ +/* Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + * + * fake unix routines for sparclite and remote debugger + * Many of these routines just substitute an appropriate error status, + * if you want some kind of file system access, you'll have to fill them in... + * sbrk on the other hand is functional (malloc uses it) but it doesn't do + * any checking for lack of memory. + * kill and _exit could get more real implementations, as well. + */ + +#include <sys/stat.h> + +int +fstat(int _fd, struct stat* _sbuf) +{ + /* this is used in a few places in stdio... */ + /* just error, so they assume a pipe */ + return -1; +} + +int +isatty(int _fd) +{ + return 1; +} + +int +close(int _fd) +{ + /* return value usually ignored anyhow */ + return 0; +} + +int +open(char *filename) +{ + /* always fail */ + return -1; +} + +int +getpid() { + return 1; +} + +int +kill(int pid) { + /* if we knew how to nuke the board, we would... */ + return 0; +} + +void +_exit(int status) { + /* likewise... */ + return; +} + +int +lseek(int _fd, off_t offset, int whence) +{ + /* nothing is ever seekable */ + return -1; +} + +extern char end; +char* +sbrk(int incr) +{ + static char* base; + char *b; + if(!base) base = &end; + b = base; + base += incr; + return b; +} diff --git a/libgloss/sparc/test.c b/libgloss/sparc/test.c new file mode 100644 index 0000000..fc443a8 --- /dev/null +++ b/libgloss/sparc/test.c @@ -0,0 +1,69 @@ +#include "debug.h" + +char hextab[] = "0123456789abcdef"; + +int +foo(arg) + int arg; +{ + return arg+1; +} + +int +fact (i) + int i; +{ + if (i == 1) + return 1; + else + return i * fact ( i - 1); +} + +main() +{ + unsigned char c; + int num; + char foo[100]; + +#if 0 + set_debug_level(2); + + cache_on(); +#endif + + set_debug_traps(); + breakpoint(); + + print("Got to here\r\n"); + + while (1) { + c = inbyte(); + if (c == 'c') + break; + + if (c == 'd') { + set_debug_traps(); + breakpoint(); + break; + } + + print("echo "); + outbyte(c); + print("\r\n"); + } + + print("Hello world\r\n"); + + while (1) { + c = inbyte(); + + if ((c & 0x7f) == 4) + break; + + print("Char is "); + outbyte (c); + print("\r\n"); + } + + print("I escaped!\r\n"); +} diff --git a/libgloss/sparc/traps.S b/libgloss/sparc/traps.S new file mode 100644 index 0000000..b3cc966 --- /dev/null +++ b/libgloss/sparc/traps.S @@ -0,0 +1,651 @@ +/* + * Copyright (c) 1995, 1996, 1998 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ + +#include "asm.h" +#include "slite.h" + + .text + .align 4 + +/* + * The trap table has to be the first code in a boot PROM. But because + * the Memory Configuration comes up thinking we only have 4K of PROM, we + * cannot have a full trap table and still have room left over to + * reprogram the Memory Configuration register correctly. This file + * uses an abbreviated trap which has every entry which might be used + * before RTEMS installs its own trap table. + */ + .globl _trap_table +_trap_table: + TRAP(SYM(ercinit)); ! 00 reset trap + BAD_TRAP; ! 01 instruction access exception + TRAP(SYM(no_fpu)); ! 02 illegal instruction + BAD_TRAP; ! 03 privileged instruction + BAD_TRAP; ! 04 fp disabled + TRAP(SYM(win_overflow)); ! 05 window overflow + TRAP(SYM(win_underflow)); ! 06 window underflow + BAD_TRAP; ! 07 memory address not aligned + BAD_TRAP; ! 08 fp exception + BAD_TRAP; ! 09 data access exception + BAD_TRAP; ! 0A tag overflow + + /* Trap levels from 0B to 0x10 are not defined (used for MEC init) */ + +SYM(ercinit): + sethi %hi(_ERC32_MEC), %g1 ! 0B + sethi %hi(0x001C1000), %g2 + or %g1,%lo(0x001C1000),%g1 + st %g2, [%g1 + 0x10] + st %g0, [%g1 + 0x18] ! 0C + nop + nop + nop + + TRAP(SYM(hard_reset)); ! 0D undefined + BAD_TRAP; ! 0E undefined + BAD_TRAP; ! 0F undefined + BAD_TRAP; ! 10 undefined + + /* + * ERC32 defined traps + */ + + BAD_TRAP; ! 11 masked errors + BAD_TRAP; ! 12 external 1 + BAD_TRAP; ! 13 external 2 + BAD_TRAP; ! 14 UART A RX/TX + BAD_TRAP; ! 15 UART B RX/TX + BAD_TRAP; ! 16 correctable memory error + BAD_TRAP; ! 17 UART error + BAD_TRAP; ! 18 DMA access error + BAD_TRAP; ! 19 DMA timeout + BAD_TRAP; ! 1A external 3 + BAD_TRAP; ! 1B external 4 + BAD_TRAP; ! 1C general purpose timer + BAD_TRAP; ! 1D real time clock + BAD_TRAP; ! 1E external 5 + BAD_TRAP; ! 1F watchdog timeout + + + BAD_TRAP; BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 20 - 23 undefined + BAD_TRAP; ! 24 cp_disabled + BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 25 - 27 undefined + BAD_TRAP; ! 28 cp_exception + BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 29 - 2B undefined + BAD_TRAP; BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 2C - 2F undefined + BAD_TRAP; BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 30 - 33 undefined + BAD_TRAP; BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 34 - 37 undefined + BAD_TRAP; BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 38 - 3B undefined + BAD_TRAP; BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 3C - 3F undefined + BAD_TRAP; BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 40 - 43 undefined + BAD_TRAP; BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 44 - 47 undefined + BAD_TRAP; BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 48 - 4B undefined + BAD_TRAP; BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 4C - 4F undefined + BAD_TRAP; BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 50 - 53 undefined + BAD_TRAP; BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 54 - 57 undefined + BAD_TRAP; BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 58 - 5B undefined + BAD_TRAP; BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 5C - 5F undefined + BAD_TRAP; BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 60 - 63 undefined + BAD_TRAP; BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 64 - 67 undefined + BAD_TRAP; BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 68 - 6B undefined + BAD_TRAP; BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 6C - 6F undefined + BAD_TRAP; BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 70 - 73 undefined + BAD_TRAP; BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 74 - 77 undefined + BAD_TRAP; BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 78 - 7B undefined + BAD_TRAP; BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 7C - 7F undefined + + /* + * Software traps + * + * NOTE: At the risk of being redundant... this is not a full + * table. The setjmp on the SPARC requires a window flush trap + * handler and RTEMS will preserve the entries that were + * installed before. + */ + + SOFT_TRAP; ! 80 +#if 0 + SOFT_TRAP; ! 81 +#else + TRAP(SYM(trap_low)) ! 81 +#endif + SOFT_TRAP; ! 82 + TRAP(SYM(win_flush)); ! 83 flush windows SW trap + SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! 84 - 87 + SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! 88 - 8B + SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! 8C - 8F + SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! 90 - 93 + SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! 94 - 97 + SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! 98 - 9B + SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! 9C - 9F + SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! A0 - A3 + SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! A4 - A7 + SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! A8 - AB + SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! AC - AF + SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! B0 - B3 + SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! B4 - B7 + SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! B8 - BB + SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! BC - BF + SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! C0 - C3 + SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! C4 - C7 + SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! C8 - CB + SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! CC - CF + SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! D0 - D3 + SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! D4 - D7 + SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! D8 - DB + SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! DC - DF + SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! E0 - E3 + SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! E4 - E7 + SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! E8 - EB + SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! EC - EF + SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! F0 - F3 + SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! F4 - F7 + SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! F8 - FB + SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! FC - FF + +/* + * Startup code for standalone system. Wash IU and FPU (if present) + * registers. The registers have to be written to initiate the parity + * bits. + */ + .globl SYM(hard_reset) +SYM(hard_reset): + + sethi %hi(0x01FE0),%o0 + or %o0,%lo(0x01FE0),%o0 + mov %o0, %psr ! Set valid PSR + nop + + mov %g0, %wim ! Set window invalid mask register + mov %g0, %y ! Init Y-register + nop + sethi %hi(SYM(hard_reset)), %g1 + + mov %g1, %tbr ! Set TBR + sethi %hi(SP_INIT),%sp + or %g0, 1, %o0 + ld [%g0], %f0 ! Check if FPU is present + + tst %o0 + bz fixiu + nop + ba fixfpu + +! FPU disabled trap address + + clr %i0 + jmpl %l2, %g0 + rett %l2 + 4 + nop + + +! Wash register files (fix for 90C601E & 90C602E) + +fixfpu: + + ld [%g0], %f0 + ld [%g0], %f1 + ld [%g0], %f2 + ld [%g0], %f3 + ld [%g0], %f4 + ld [%g0], %f5 + ld [%g0], %f6 + ld [%g0], %f7 + ld [%g0], %f8 + ld [%g0], %f9 + ld [%g0], %f10 + ld [%g0], %f11 + ld [%g0], %f12 + ld [%g0], %f13 + ld [%g0], %f14 + ld [%g0], %f15 + ld [%g0], %f16 + ld [%g0], %f17 + ld [%g0], %f18 + ld [%g0], %f19 + ld [%g0], %f20 + ld [%g0], %f21 + ld [%g0], %f22 + ld [%g0], %f23 + ld [%g0], %f24 + ld [%g0], %f25 + ld [%g0], %f26 + ld [%g0], %f27 + ld [%g0], %f28 + ld [%g0], %f29 + ld [%g0], %f30 + ld [%g0], %f31 + +fixiu: + clr %g1 + clr %g2 + clr %g3 + clr %g4 + clr %g5 + clr %g6 + clr %g7 + set 8,%g1 +wl0: + clr %i0 + clr %i1 + clr %i2 + clr %i3 + clr %i4 + clr %i5 + clr %i6 + clr %i7 + clr %l0 + clr %l1 + clr %l2 + clr %l3 + clr %l4 + clr %l5 + clr %l6 + clr %l7 + save + subcc %g1, 1, %g1 + bne wl0 + nop + +! +! Start the real-time clock with a tick of 150 clocks +! + +rtc: + + set 0x1f80000, %l0 ! MEC register base + set 149, %l1 + st %l1, [%l0 + 0x84] ! RTC scaler = 149 + set 0x0d00, %l1 + st %l1, [%l0 + 0x98] ! Start RTC + + st %g0, [%l0 + 0x64] ! Disable watchdog for now + ld [%l0], %g1 + or %g1, 1, %g1 + st %g1, [%l0] ! Enable power-down mode + +_init: + set PSR_INIT, %g1 ! Initialize psr + mov %g1, %psr + set WIM_INIT, %g1 ! Initialize WIM + mov %g1, %wim + set _trap_table, %g1 ! Initialize TBR + mov %g1, %tbr + nop;nop;nop + + set PSR_INIT, %g1 + wr %g1, 0x20, %psr ! enable traps + nop; nop; nop; + + call SYM(start) + nop + +/* + * Register window overflow handler. Come here when save would move us + * into the invalid window. This routine runs with traps disabled, and + * must be careful not to touch the condition codes, as PSR is never + * restored. + * + * We are called with %l0 = wim, %l1 = pc, %l2 = npc + */ + .globl SYM(win_overflow) +SYM(win_overflow): + mov %g1, %l3 ! Save g1, we use it to hold the wim + srl %l0, 1, %g1 ! Rotate wim right + sll %l0, NUMBER_OF_REGISTER_WINDOWS - 1, %l0 + or %l0, %g1, %g1 + + save %g0, %g0, %g0 ! Slip into next window + mov %g1, %wim ! Install the new wim + nop + nop + nop + + std %l0, [%sp + 0 * 4] ! save L & I registers + std %l2, [%sp + 2 * 4] + std %l4, [%sp + 4 * 4] + std %l6, [%sp + 6 * 4] + + std %i0, [%sp + 8 * 4] + std %i2, [%sp + 10 * 4] + std %i4, [%sp + 12 * 4] + std %i6, [%sp + 14 * 4] + + restore ! Go back to trap window. + mov %l3, %g1 ! Restore %g1 + + jmpl %l1, %g0 + rett %l2 + +/* + * Register window underflow handler. Come here when restore would move us + * into the invalid window. This routine runs with traps disabled, and + * must be careful not to touch the condition codes, as PSR is never + * restored. + * + * We are called with %l0 = wim, %l1 = pc, %l2 = npc + */ + .globl SYM(win_underflow) +SYM(win_underflow): + sll %l0, 1, %l3 ! Rotate wim left + srl %l0, NUMBER_OF_REGISTER_WINDOWS - 1, %l0 + or %l0, %l3, %l0 + + mov %l0, %wim ! Install the new wim + + restore ! Users window + restore ! His callers window + + ldd [%sp + 0 * 4], %l0 ! restore L & I registers + ldd [%sp + 2 * 4], %l2 + ldd [%sp + 4 * 4], %l4 + ldd [%sp + 6 * 4], %l6 + + ldd [%sp + 8 * 4], %i0 + ldd [%sp + 10 * 4], %i2 + ldd [%sp + 12 * 4], %i4 + ldd [%sp + 14 * 4], %i6 + + save %g0, %g0, %g0 ! Back to trap window + save %g0, %g0, %g0 + + jmpl %l1, %g0 + rett %l2 + +/* + * Register window flush handler, triggered by a "ta 3" instruction. + * We are called with %l0 = wim, %l1 = pc, %l2 = npc + */ + .globl SYM(win_flush) +SYM(win_flush): + mov %psr, %l0 + or %l0,0xf00,%l3 ! Disable interrupts + mov %l3,%psr + nop + nop + nop + mov %wim, %l3 + + srl %l3, %l0, %l4 ! wim >> cwp + cmp %l4, 1 + bne flush_window_fine ! Branch if not in the invalid window + nop + +/* Handle window overflow. We can't trap here. */ + + mov %g1, %l4 ! Save g1, we use it to hold the wim + srl %l3, 1, %g1 ! Rotate wim right + sll %l3, NUMBER_OF_REGISTER_WINDOWS - 1, %l3 + or %l3, %g1, %g1 + mov %g0, %wim ! Clear wim so that subsequent save + nop ! wont trap + nop + nop + save %g0, %g0, %g0 ! Slip into next window + mov %g1, %wim ! Install the new wim + + std %l0, [%sp + 0 * 4] ! save L & I registers + std %l2, [%sp + 2 * 4] + std %l4, [%sp + 4 * 4] + std %l6, [%sp + 6 * 4] + + std %i0, [%sp + 8 * 4] + std %i2, [%sp + 10 * 4] + std %i4, [%sp + 12 * 4] + std %i6, [%sp + 14 * 4] + + restore ! Go back to trap window. + mov %l4, %g1 ! Restore %g1 + +flush_window_fine: + mov %psr,%l5 ! enable traps + or %l5,0x20,%l5 + mov %l5, %psr + nop + nop + nop + + set save_buf,%l5 + st %l2,[%l5] + + ! The stack pointer currently contains a bogus value [when a trap + ! occurs CWP is decremented and points to an unused window]. + ! Give it something useful before we flush every window. + ! This does what a "save %sp,-64,$sp" would, except that CWP has + ! already been decremented. + add %fp, -64, %sp + + save %sp, -64, %sp ! Flush user register window to stack + save %sp, -64, %sp + save %sp, -64, %sp + save %sp, -64, %sp + save %sp, -64, %sp + save %sp, -64, %sp + save %sp, -64, %sp + save %sp, -64, %sp + restore + restore + restore + restore + restore + restore + restore + restore + + restore ! Make sure we have a valid window + save %g0, %g0, %g0 + + set save_buf, %l2 ! Get our return address back + ld [%l2],%l2 + + mov %psr,%l5 ! disable traps for rett + andn %l5,0x20,%l5 + mov %l5,%psr + nop + nop + nop + + jmpl %l2, %g0 + rett %l2+4 + +/* + * Read the TBR. + */ + .globl SYM(rdtbr) +SYM(rdtbr): + mov %tbr, %o0 + nop + retl + nop + +/* + * Read the psr + */ + .globl SYM(read_psr) +SYM(read_psr): + mov %psr, %o0 + nop + retl + nop + +/* + * Write the PSR. + */ + + .globl SYM(write_psr) +SYM(write_psr): + mov %i0, %psr + nop + nop + nop + retl + nop +/* + * Come here when no fpu exists. This just skips the offending + * instruction. + */ + .globl SYM(no_fpu) +SYM(no_fpu): + jmpl %l2, %g0 + rett %l2+4 + + .globl SYM(fltr_proto) + .align 4 +SYM(fltr_proto): ! First level trap routine prototype + sethi 0, %l0 + jmpl 0+%l0, %g0 + nop + nop + +/* + * Trap handler for memory errors. This just sets mem_err to be + * non-zero. It assumes that l1 is non-zero. This should be safe, + * as it is doubtful that 0 would ever contain code that could mem + * fault. This routine will skip past the faulting instruction after + * setting mem_err. + */ + .globl SYM(fltr_set_mem_err) +SYM(fltr_set_mem_err): + sethi %hi(SYM(mem_err)), %l0 + st %l1, [%l0 + %lo(SYM(mem_err))] + jmpl %l2, %g0 + rett %l2+4 + + .data + .align 4 + .ascii "DaTa" + .long SYM(sdata) +in_trap_handler: + .word 0 +save_buf: + .word 0 /* place to save %g1 */ + .word 0 /* place to save %g2 */ + + .text + .align 4 + +/* + * This function is called when any SPARC trap (except window overflow + * or underflow) occurs. It makes sure that the invalid register + * window is still available before jumping into C code. It will also + * restore the world if you return from handle_exception. + */ + .globl SYM(trap_low) +SYM(trap_low): + mov %psr, %l0 + mov %wim, %l3 + + srl %l3, %l0, %l4 ! wim >> cwp + cmp %l4, 1 + bne window_fine ! Branch if not in the invalid window + nop + + mov %g1, %l4 ! Save g1, we use it to hold the wim + srl %l3, 1, %g1 ! Rotate wim right + sll %l3, 8-1, %l5 + or %l5, %g1, %g1 + + save %g0, %g0, %g0 ! Slip into next window + mov %g1, %wim ! Install the new wim + + std %l0, [%sp + 0 * 4] ! save L & I registers + std %l2, [%sp + 2 * 4] + std %l4, [%sp + 4 * 4] + std %l6, [%sp + 6 * 4] + + std %i0, [%sp + 8 * 4] + std %i2, [%sp + 10 * 4] + std %i4, [%sp + 12 * 4] + std %i6, [%sp + 14 * 4] + + restore ! Go back to trap window. + mov %l4, %g1 ! Restore g1 + +window_fine: + sethi %hi(in_trap_handler), %l4 + ld [%lo(in_trap_handler) + %l4], %l5 + tst %l5 + bg recursive_trap + inc %l5 + + /* use the stack we set in the linker script */ + sethi %hi(__trap_stack), %l6 + or %l6,%lo(__trap_stack),%l6 + mov %l6, %sp ! set the stack pointer + +recursive_trap: + st %l5, [%lo(in_trap_handler) + %l4] + + sub %sp,(16+1+6+1+72)*4,%sp ! Make room for input & locals + ! + hidden arg + arg spill + ! + doubleword alignment + ! + registers[72] local var + + std %g0, [%sp + (24 + 0) * 4] ! registers[Gx] + std %g2, [%sp + (24 + 2) * 4] + std %g4, [%sp + (24 + 4) * 4] + std %g6, [%sp + (24 + 6) * 4] + + std %i0, [%sp + (24 + 8) * 4] ! registers[Ox] + std %i2, [%sp + (24 + 10) * 4] + std %i4, [%sp + (24 + 12) * 4] + std %i6, [%sp + (24 + 14) * 4] + ! F0->F31 not implemented + mov %y, %l4 + mov %tbr, %l5 + st %l4, [%sp + (24 + 64) * 4] ! Y + st %l0, [%sp + (24 + 65) * 4] ! PSR + st %l3, [%sp + (24 + 66) * 4] ! WIM + st %l5, [%sp + (24 + 67) * 4] ! TBR + st %l1, [%sp + (24 + 68) * 4] ! PC + st %l2, [%sp + (24 + 69) * 4] ! NPC + ! CPSR and FPSR not implemented + + or %l0, 0xf20, %l4 + mov %l4, %psr ! Turn on traps, disable interrupts + + call SYM(handle_exception) + add %sp, 24 * 4, %o0 ! Pass address of registers + +/* Reload all of the registers that aren't on the stack */ + + ld [%sp + (24 + 1) * 4], %g1 ! registers[Gx] + ldd [%sp + (24 + 2) * 4], %g2 + ldd [%sp + (24 + 4) * 4], %g4 + ldd [%sp + (24 + 6) * 4], %g6 + + ldd [%sp + (24 + 8) * 4], %i0 ! registers[Ox] + ldd [%sp + (24 + 10) * 4], %i2 + ldd [%sp + (24 + 12) * 4], %i4 + ldd [%sp + (24 + 14) * 4], %i6 + + ldd [%sp + (24 + 64) * 4], %l0 ! Y & PSR + ldd [%sp + (24 + 68) * 4], %l2 ! PC & NPC + + restore ! Ensure that previous window is valid + save %g0, %g0, %g0 ! by causing a window_underflow trap + + mov %l0, %y + mov %l1, %psr ! Make sure that traps are disabled + ! for rett + + sethi %hi(in_trap_handler), %l4 + ld [%lo(in_trap_handler) + %l4], %l5 + dec %l5 + st %l5, [%lo(in_trap_handler) + %l4] + + jmpl %l2, %g0 ! Restore old PC + rett %l3 ! Restore old nPC + + diff --git a/libgloss/sparc/tsc701.ld b/libgloss/sparc/tsc701.ld new file mode 100644 index 0000000..bc6cd73 --- /dev/null +++ b/libgloss/sparc/tsc701.ld @@ -0,0 +1,55 @@ +/* must compile with -nostdlib option */ +OUTPUT_FORMAT("a.out-sunos-big", "a.out-sunos-big", + "a.out-sparc-little") +OUTPUT_ARCH(sparc) +SEARCH_DIR(/usr/local/sparclet-aout/lib) +PROVIDE (__stack = 0); +ENTRY (start) +STARTUP (crt0-701.o) +GROUP (libsplet701.a libc.a libgcc.a) +SECTIONS +{ + /* Sparcmon likes to load programs starting at this address. */ + . = 0x12010000; + .text : + { + CREATE_OBJECT_SYMBOLS + *(.text) + /* The next six sections are for SunOS dynamic linking. The order + is important. */ + *(.dynrel) + *(.hash) + *(.dynsym) + *(.dynstr) + *(.rules) + *(.need) + _etext = .; + __etext = .; + } + .data : + { + /* The first three sections are for SunOS dynamic linking. */ + *(.dynamic) + *(.got) + *(.plt) + *(.data) + *(.linux-dynamic) /* For Linux dynamic linking. */ + CONSTRUCTORS + _edata = .; + __edata = .; + } + .bss : + { + __bss_start = .; + *(.bss) + *(COMMON) + _end = ALIGN(4) ; + __end = ALIGN(4) ; + } + /* This is the value that Sparcmon assigns to the SP at reset, minus 4K. */ + PROVIDE(___stack = 0x123ef000); + PROVIDE(__stack = 0x123ef000); + /* Provide 4K area for copying the trap vectors from ROM to RAM. */ + PROVIDE(___trap_vectors = 0x123f0000); + PROVIDE(__trap_vectors = 0x123f0000); +} diff --git a/libgloss/stat.c b/libgloss/stat.c new file mode 100644 index 0000000..ebb7de3 --- /dev/null +++ b/libgloss/stat.c @@ -0,0 +1,30 @@ +/* stat.c -- Get the status of a file. + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include <sys/stat.h> +#include <errno.h> +#include "glue.h" + +/* + * stat -- Since we have no file system, we just return an error. + */ +int +_DEFUN (stat, (path, buf), + const char *path _AND + struct stat *buf) +{ + errno = EIO; + return (-1); +} + diff --git a/libgloss/syscall.h b/libgloss/syscall.h new file mode 100644 index 0000000..da78562 --- /dev/null +++ b/libgloss/syscall.h @@ -0,0 +1,47 @@ +/* General use syscall.h file. + The more ports that use this file, the simpler sim/common/nltvals.def + remains. */ + +#ifndef LIBGLOSS_SYSCALL_H +#define LIBGLOSS_SYSCALL_H + +/* Note: This file may be included by assembler source. */ + +/* These should be as small as possible to allow a port to use a trap type + instruction, which the system call # as the trap (the d10v for instance + supports traps 0..31). An alternative would be to define one trap for doing + system calls, and put the system call number in a register that is not used + for the normal calling sequence (so that you don't have to shift down the + arguments to add the system call number). Obviously, if these system call + numbers are ever changed, all of the simulators and potentially user code + will need to be updated. */ + +/* There is no current need for the following: SYS_execv, SYS_creat, SYS_wait, + etc. etc. Don't add them. */ + +/* These are required by the ANSI C part of newlib (excluding system() of + course). */ +#define SYS_exit 1 +#define SYS_open 2 +#define SYS_close 3 +#define SYS_read 4 +#define SYS_write 5 +#define SYS_lseek 6 +#define SYS_unlink 7 +#define SYS_getpid 8 +#define SYS_kill 9 +#define SYS_fstat 10 +/*#define SYS_sbrk 11 - not currently a system call, but reserved. */ + +/* ARGV support. */ +#define SYS_argvlen 12 +#define SYS_argv 13 + +/* These are extras added for one reason or another. */ +#define SYS_chdir 14 +#define SYS_stat 15 +#define SYS_chmod 16 +#define SYS_utime 17 +#define SYS_time 18 + +#endif diff --git a/libgloss/testsuite/Makefile.in b/libgloss/testsuite/Makefile.in new file mode 100644 index 0000000..28fd914 --- /dev/null +++ b/libgloss/testsuite/Makefile.in @@ -0,0 +1,109 @@ +# +# Makefile +# Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995 Free Software Foundation +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +# + +srcdir = . + +prefix = /usr/local + +exec_prefix = $(prefix) +bindir = $(exec_prefix)/bin +libdir = $(exec_prefix)/lib +tooldir = $(exec_prefix) + +SHELL = /bin/sh + +INSTALL = `cd $(srcdir); pwd`/../../install-sh -c +INSTALL_PROGRAM = $(INSTALL) +INSTALL_DATA = $(INSTALL) + +AR_FLAGS = qv +BISON = bison +MAKEINFO = makeinfo + +SUBDIRS = +OBJROOT = +SRCROOT = + +.NOEXPORT: +MAKEOVERRIDES= + +#### Host, target, and site specific Makefile fragments come in here. +### + +# These are roughly topologically sorted in order to make porting more +# streamlined. +FLAGS_TO_PASS = \ + "prefix=$(prefix)" \ + "exec_prefix=$(exec_prefix)" \ + "CC=$(CC)" \ + "CFLAGS=$(CFLAGS)" \ + "AR=$(AR)" \ + "RANLIB=$(RANLIB)" \ + "AR_FLAGS=$(AR_FLAGS)" \ + "AS=$(AS)" \ + "CROSS_CFLAGS=$(CROSS_CFLAGS)" \ + "TARGET_CFLAGS=$(TARGET_CFLAGS)" \ + "OBJROOT=$(OBJROOT)" + +all: + @for dir in ${SUBDIRS}; do \ + if [ -d $$dir ]; then \ + (cd $$dir; $(MAKE) $(FLAGS_TO_PASS)); \ + else true; fi; \ + done + +install: + -rm -f *~ core *.o a.out xgdb *.x + for dir in ${SUBDIRS}; do \ + echo "$$dir:"; \ + if [ -d $$dir ]; then \ + (cd $$dir; $(MAKE) $(FLAGS_TO_PASS) install); \ + else true; fi; \ + done + +clean-here: + -rm -f *~ core *.o a.out xgdb *.x + +clean mostlyclean: clean-here + for dir in ${SUBDIRS}; do \ + echo "$$dir:"; \ + if [ -d $$dir ]; then \ + (cd $$dir; $(MAKE) $(FLAGS_TO_PASS) $@); \ + else true; fi; \ + done + +distclean maintainer-clean realclean: clean-here + for dir in ${SUBDIRS}; do \ + echo "$$dir:"; \ + if [ -d $$dir ]; then \ + (cd $$dir; $(MAKE) $(FLAGS_TO_PASS) $@); \ + else true; fi; \ + done + -rm -f Makefile config.status *-init.exp site.* + -rm -fr *.log summary detail *.sum blockit + +.PHONY: info install-info clean-info +info: +install-info: +clean-info: + +force: + +Makefile: Makefile.in configure.in $(host_makefile_frag) $(target_makefile_frag) + $(SHELL) config.status diff --git a/libgloss/testsuite/config/hppa.mt b/libgloss/testsuite/config/hppa.mt new file mode 100644 index 0000000..0a01c32 --- /dev/null +++ b/libgloss/testsuite/config/hppa.mt @@ -0,0 +1,4 @@ +MULTILIB=-msoft-float +GLOSSDIR=pa +SCRIPTS=w89k op50n + diff --git a/libgloss/testsuite/config/m68k.mt b/libgloss/testsuite/config/m68k.mt new file mode 100644 index 0000000..c8415ac --- /dev/null +++ b/libgloss/testsuite/config/m68k.mt @@ -0,0 +1,3 @@ +MULTILIB= +GLOSSDIR=m68k +SCRIPTS=mvme135 idp diff --git a/libgloss/testsuite/config/mips.mt b/libgloss/testsuite/config/mips.mt new file mode 100644 index 0000000..c8979f3 --- /dev/null +++ b/libgloss/testsuite/config/mips.mt @@ -0,0 +1,3 @@ +MULTILIB= +GLOSSDIR=mips +SCRIPTS=array diff --git a/libgloss/testsuite/config/support.c b/libgloss/testsuite/config/support.c new file mode 100644 index 0000000..2fc7bcc --- /dev/null +++ b/libgloss/testsuite/config/support.c @@ -0,0 +1,24 @@ +/* + * support.c -- minimal support functions. This is to keep the exit code + * generic enough that pattern matching from expect should be easier. + */ + +#if defined (unix) +#define PRINT printf /* so we can test on a native system */ +#else +#define PRINT iprintf /* this is only in newlib */ +#endif + +int +fail (str) +char *str; +{ + PRINT ("FAIL: %s\n", str); +} + +int +pass (str) +char *str; +{ + PRINT ("PASS: %s\n", str); +} diff --git a/libgloss/testsuite/configure.in b/libgloss/testsuite/configure.in new file mode 100644 index 0000000..07b8fee --- /dev/null +++ b/libgloss/testsuite/configure.in @@ -0,0 +1,29 @@ +# This file is a shell script fragment that supplies the information +# necessary to tailor a template configure script into the configure +# script appropriate for this directory. For more information, check +# any existing configure script. + +srctrigger=Makefile.in +srcname="testing support" +target_dependent=true + +# per-host: + +# This is basically a hack so that we don't have to replicate the same +# defines in all the Makefiles. We put a standard set of definitions +# in host/any, and use them everywhere. + +host_makefile_frag=../config/default.mh + +# per-target: + +configdirs="libgloss.all" + +# post-target: + +objroot=`pwd | sed -e 's@/[^/]*$@@' -e 's@/[^/]*$@@'` +srcroot=`echo $srcdir | sed -e 's@/[^/]*$@@' -e 's@/[^/]*$@@'` +sed -e "s:^OBJROOT[ ]*=.*$:OBJROOT = ${objroot}:" -e "s:^SRCROOT[ ]*=.*$:SRCROOT = ${srcroot}:" \ + ${Makefile} > Makefile.tem +rm -f ${Makefile} +mv Makefile.tem ${Makefile} diff --git a/libgloss/testsuite/lib/libgloss.exp b/libgloss/testsuite/lib/libgloss.exp new file mode 100644 index 0000000..4335f3e --- /dev/null +++ b/libgloss/testsuite/lib/libgloss.exp @@ -0,0 +1,77 @@ +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +# This file was written by Rob Savoye. (rob@cygnus.com) + +# The default option list can be overridden by +# TORTURE_OPTIONS="{ { list1 } ... { listN } }" + +if ![info exists TORTURE_OPTIONS] { + # FIXME: We should test -g at least once. + set TORTURE_OPTIONS [list \ + { -O0 } { -O1 } { -O2 } \ + { -O2 -fomit-frame-pointer -finline-functions } \ + { -O2 -fomit-frame-pointer -finline-functions -funroll-all-loops }] +} + +# These globals are used if no compiler arguments are provided. +# They are also used by the various testsuites to define the environment: +# where to find stdio.h, libc.a, etc. + +global CC +if ![info exists CC] then { + set CC [findfile $base_dir/xgcc "$base_dir/xgcc -B$base_dir/" [transform gcc +]] +} +if { [which $CC] == 0 } then { + perror "$CC does not exist" + exit 1 +} + +global CFLAGS +if ![info exists CFLAGS] then { + set CFLAGS "" +} + +global LIBS +if ![info exists LIBS] then { + set LIBS "" +} + +# It is difficult to come up with a situation where one has to use LDFLAGS +# and not LIBS (why two?). Both are useful in makefiles, so maybe it's better +# to just continue existing practice. However, there is still a lot of +# confusion about when to use one or the other. +global LDFLAGS +if ![info exists LDFLAGS] then { + set LDFLAGS "" +} + +proc just_compile { file } { + global CFLAGS + set output "$tmpdir/[file tail [file rootname $src]].o" + + append CFLAGS " -w -c -o $output $option" +} + +proc just_link { file } { +} + +proc just_execute { file } { +} + +proc run_test { file } { +} diff --git a/libgloss/testsuite/libgloss.all/.gdbinit b/libgloss/testsuite/libgloss.all/.gdbinit new file mode 100644 index 0000000..65fbccd --- /dev/null +++ b/libgloss/testsuite/libgloss.all/.gdbinit @@ -0,0 +1,82 @@ +define wec-test +set height 0 +set remotedebug 0 +echo Running array test... +load array-w89k.x +run +echo Running double test... +load double-w89k.x +run +echo Running float test... +load float-w89k.x +run +echo Running func test... +load func-w89k.x +run +echo Running io test... +load io-w89k.x +run +echo Running math test... +load math-w89k.x +run +echo Running memory test... +load memory-w89k.x +run +echo Running div test... +load div-w89k.x +run +echo Running struct test... +load struct-w89k.x +run +echo Running printf test... +load printf-w89k.x +run +echo Running varargs test... +load varargs-w89k.x +run +echo Running varargs2 test... +load varargs2-w89k.x +run +end + +define oki-test +set height 0 +set remotedebug 0 +echo Running array test... +load array-op50n.x +run +echo Running double test... +load double-op50n.x +run +echo Running float test... +load float-op50n.x +run +echo Running func test... +load func-op50n.x +run +echo Running io test... +load io-op50n.x +run +echo Running math test... +load math-op50n.x +run +echo Running memory test... +load memory-op50n.x +run +echo Running div test... +load div-op50n.x +run +echo Running struct test... +load struct-op50n.x +run +echo Running printf test... +load printf-op50n.x +run +echo Running varargs test... +load varargs-op50n.x +run +echo Running varargs2 test... +load varargs2-op50n.x +run +end + diff --git a/libgloss/testsuite/libgloss.all/Makefile.in b/libgloss/testsuite/libgloss.all/Makefile.in new file mode 100644 index 0000000..fcade79 --- /dev/null +++ b/libgloss/testsuite/libgloss.all/Makefile.in @@ -0,0 +1,221 @@ +srcdir = . +OBJROOT = +SRCROOT = + +SHELL = /bin/sh + +# +# this is for code to support embedded testing +# +SUPPORT=support.o + +# +# to add a new test, put it's name here, and list the objects +# required too. +TESTS= misc.x float.x io.x memory.x double.x math.x func.x div.x \ + printf.x varargs.x varargs2.x array.x struct.x misc.x + +CFLAGS= -g +LDFLAGS_FOR_TARGET= -g +LIBS_FOR_TARGET = ${SUPPORT} ${LIBC_FOR_TARGET} ${LIBGCC_FOR_TARGET} \ + ${LIBC_FOR_TARGET} + +#### Host, target, and site specific Makefile fragments come in here. +### + +# +# This attempts to build the binaries. Ideally these are getting built +# under control of DejaGnu, but it's nice to build these for times +# when testing needs to be done by hand. +# +all: support.o ${TESTS} + +# +# we create a false implicit rule to make a binary ".x" file from +# an object file. this also makes us an srecord and a dissasmbly +# cause if something goes wrong, we'll need them. +# +.SUFFIXES: .x +.o.x: + for script in ${SCRIPTS}; do \ + echo Building $@ for $${script}... ; \ + echo Link Line is ${LD_FOR_TARGET} \ + ${LDFLAGS_FOR_TARGET} $< -L${OBJROOT}/libgloss/${GLOSSDIR} \ + -T${srcdir}/../../${GLOSSDIR}/$${script}.ld \ + ${SUPPORT} -o $*-$${script} $(LIBS_FOR_TARGET); \ + ${LD_FOR_TARGET} ${LDFLAGS_FOR_TARGET} $< -L${OBJROOT}/libgloss/${GLOSSDIR} \ + -T${srcdir}/../../${GLOSSDIR}/$${script}.ld \ + ${SUPPORT} -o $*-$${script}.x $(LIBS_FOR_TARGET); \ + if [ -s $*-$${script}.x ] ; then \ + echo "Making an srecord for $@..." ; \ + ${OBJCOPY_FOR_TARGET} -O srec $*-$${script}.x $*-$${script}.srec ; \ + echo "Making an disassembly file for $@..." ; \ + rm -f $*-$${script}.dis ; \ + ${OBJDUMP_FOR_TARGET} -d $*-$${script}.x > $*-$${script}.dis ; \ + else \ + rm $*-$${script}.x ; \ + echo "WARNING: $*-$${script} didn't build." ; \ + fi ; \ + touch $@ ; \ + done + +# +# here's all the dependancies. This is a little messy cause we want +# dependancies to work for the rule we just defined. this isn't +# tottally ideal cause if one of the architectures doesn't build. it +# relinks for all of the scrip0t files. +# +array.o: ${srcdir}/array.c +array.x: array-w89k.x array-op50n.x +array-w89k.x: array.o +array-op50n.x: array.o +float.o: ${srcdir}/float.c +float.x: float-w89k.x float-op50n.x +float-w89k.x: float.o +float-op50n.x: float.o +io.o: ${srcdir}/io.c +io.x: io-w89k.x io-op50n.x +io-w89k.x: io.o +io-op50n.x: io.o +memory.o: ${srcdir}/memory.c +memory.x: memory-w89k.x memory-op50n.x +memory-w89k.x: memory.o +memory-op50n.x: memory.o +double.o: ${srcdir}/double.c +double.x: double-w89k.x double-op50n.x +double-w89k.x: double.o +double-op50n.x: double.o +math.o: ${srcdir}/math.c +math.x: math-w89k.x math-op50n.x +math-w89k.x: math.o +math-op50n.x: math.o +misc.o: ${srcdir}/misc.c +misc.x: misc-w89k.x misc-op50n.x +misc-w89k.x: misc.o +misc-op50n.x: misc.o +func.o: ${srcdir}/func.c +func.x: func-w89k.x func-op50n.x +func-w89k.x: func.o +func-op50n.x: func.o +div.o: ${srcdir}/div.c +div.x: div-w89k.x div-op50n.x +div-w89k.x: div.o +div-op50n.x: div.o +struct.o: ${srcdir}/struct.c +struct.x: struct-w89k.x struct-op50n.x +struct-w89k.x: struct.o +struct-op50n.x: struct.o +printf.o: ${srcdir}/printf.c +printf.x: printf-w89k.x printf-op50n.x +printf-w89k.x: printf.o +printf-op50n.x: printf.o +varargs.o: ${srcdir}/varargs.c +varargs.x: varargs-w89k.x varargs-op50n.x +varargs-w89k.x: varargs.o +varargs-op50n.x: varargs.o +varargs2.o: ${srcdir}/varargs2.c +varargs2.x: varargs2-w89k.x varargs2-op50n.x +varargs2-w89k.x: varargs2.o +varargs2-op50n.x: varargs.o +misc.o: ${srcdir}/misc.c +misc.x: misc-w89k.x misc-op50n.x +misc-w89k.x: misc.o +misc-op50n.x: misc.o + +# +# this attempts to build these test cases on a DOS box +# +DOSLIBS= ../lib/soft-flo/libc.a ../lib/soft-flo/libgcc.a ../lib/soft-flo/libc.a +LIBDIR= -L../lib +dos: + gcc -msoft-float -c support.c + gcc -msoft-float -c io.c + gcc -msoft-float -c float.c + gcc -msoft-float -c memory.c + gcc -msoft-float -c double.c + gcc -msoft-float -c func.c + gcc -msoft-float -c array.c + gcc -msoft-float -c math.c + gcc -msoft-float -c div.c + gcc -msoft-float -c struct.c + gcc -msoft-float -c printf.c + gcc -msoft-float -c varargs.c + gcc -msoft-float -c varargs2.c + gcc -msoft-float -c misc.c + ld ${LIBDIR} io.o -Tw89k.ld -o io-wec.x support.o ${DOSLIBS} + objcopy -O srec io-wec.x io-wec.sre + ld ${LIBDIR} io.o -Top50n.ld -o io-oki.x support.o ${DOSLIBS} + objcopy -O srec io-oki.x io-oki.sre + ld ${LIBDIR} func.o -Tw89k.ld -o func-wec.x support.o ${DOSLIBS} + objcopy -O srec func-wec.x func-wec.sre + ld ${LIBDIR} func.o -Top50n.ld -o func-oki.x support.o ${DOSLIBS} + objcopy -O srec func-oki.x func-oki.sre + ld ${LIBDIR} math.o -Tw89k.ld -o math-wec.x support.o ${DOSLIBS} + objcopy -O srec math-wec.x math-wec.sre + gcc ${LIBDIR} math.o -Top50n.ld -o math-oki.x support.o ${DOSLIBS} + objcopy -O srec math-oki.x math-oki.sre + gcc ${LIBDIR} float.o -Tw89k.ld -o flot-wec.x support.o ${DOSLIBS} + objcopy -O srec flot-wec.x flot-wec.sre + gcc ${LIBDIR} float.o -Top50n.ld -o flot-oki.x support.o ${DOSLIBS} + objcopy -O srec flot-oki.x flot-oki.sre + gcc ${LIBDIR} memory.o -Tw89k.ld -o mem-wec.x support.o ${DOSLIBS} + objcopy -O srec mem-wec.x mem-wec.sre + gcc ${LIBDIR} memory.c -Top50n.ld -o mem-oki.x support.o ${DOSLIBS} + objcopy -O srec mem-oki.x mem-oki.sre + gcc ${LIBDIR} double.o -Tw89k.ld -o doub-wec.x support.o ${DOSLIBS} + objcopy -O srec mem-wec.x doub-wec.sre + gcc ${LIBDIR} double.o -Top50n.ld -o doub-oki.x support.o ${DOSLIBS} + objcopy -O srec doub-oki.x doub-oki.sre + gcc ${LIBDIR} array.o -Tw89k.ld -o arry-wec.x support.o ${DOSLIBS} + objcopy -O srec arry-wec.x arry-wec.sre + gcc ${LIBDIR} array.o -Top50n.ld -o arry-oki.x support.o ${DOSLIBS} + objcopy -O srec arry-oki.x arry-oki.sre + gcc ${LIBDIR} div.o -Tw89k.ld -o div-wec.x support.o ${DOSLIBS} + objcopy -O srec div-wec.x div-wec.sre + gcc ${LIBDIR} div.o -Top50n.ld -o div-oki.x support.o ${DOSLIBS} + objcopy -O srec div-oki.x div-oki.sre + gcc ${LIBDIR} printf.o -Tw89k.ld -o printf-wec.x support.o ${DOSLIBS} + objcopy -O srec printf-wec.x printf-wec.sre + gcc ${LIBDIR} printf.o -Top50n.ld -o printf-oki.x support.o ${DOSLIBS} + objcopy -O srec printf-oki.x printf-oki.sre + gcc ${LIBDIR} struct.o -Tw89k.ld -o struct-wec.x support.o ${DOSLIBS} + objcopy -O srec struct-wec.x struct-wec.sre + gcc ${LIBDIR} struct.o -Top50n.ld -o struct-oki.x support.o ${DOSLIBS} + objcopy -O srec struct-oki.x struct-oki.sre + gcc ${LIBDIR} varargs.o -Tw89k.ld -o args-wec.x support.o ${DOSLIBS} + objcopy -O srec args-wec.x args-wec.sre + gcc ${LIBDIR} varargs.o -Top50n.ld -o args-oki.x support.o ${DOSLIBS} + objcopy -O srec args-oki.x args-oki.sre + gcc ${LIBDIR} varargs2.o -Tw89k.ld -o arg2-wec.x support.o ${DOSLIBS} + objcopy -O srec arg2-wec.x arg2-wec.sre + gcc ${LIBDIR} varargs2.o -Top50n.ld -o arg2-oki.x support.o ${DOSLIBS} + objcopy -O srec arg2-oki.x arg2-oki.sre + gcc ${LIBDIR} misc.o -Tw89k.ld -o misc-wec.x support.o ${DOSLIBS} + objcopy -O srec misc-wec.x misc-wec.sre + gcc ${LIBDIR} misc.o -Top50n.ld -o misc-oki.x support.o ${DOSLIBS} + objcopy -O srec misc-oki.x misc-oki.sre + +# this is a minimalist testing API for these test cases to keep the +# outout standardized enough to help with automated testing. +support.o: ${srcdir}/../config/support.c + rootme=`pwd | sed -e 's@/[^/]*$$@@'`; \ + $(CC_FOR_TARGET) $(CFLAGS_FOR_TARGET) -O2 $(INCLUDES) -c $< + +doc: + +clean mostlyclean: + rm -f a.out core *.i *~ *.o *-test *.srec *.dis *.map *.x + +distclean maintainer-clean realclean: clean + rm -f Makefile config.status a.out + +.PHONY: install info install-info clean-info +install: +info: +install-info: +clean-info: + +Makefile: Makefile.in $(host_makefile_frag) $(target_makefile_frag) + $(SHELL) config.status + + diff --git a/libgloss/testsuite/libgloss.all/array.c b/libgloss/testsuite/libgloss.all/array.c new file mode 100644 index 0000000..14b6fdb --- /dev/null +++ b/libgloss/testsuite/libgloss.all/array.c @@ -0,0 +1,18 @@ +/* WinBond bug report + + this is a compile test. At one time static arrays over 500 elements + didn't work. We'll test both global and local array. If it compiles at + all, it it passes. + */ + +#include <stdio.h> +static short aa[64][64]; +static int bb[500]; + +main() +{ + static short cc[64][64]; + static int dd[500]; + pass ("large arrays"); + fflush(stdout); +} diff --git a/libgloss/testsuite/libgloss.all/configure.in b/libgloss/testsuite/libgloss.all/configure.in new file mode 100644 index 0000000..d51e602 --- /dev/null +++ b/libgloss/testsuite/libgloss.all/configure.in @@ -0,0 +1,54 @@ +# This file is a shell script fragment that supplies the information +# necessary to tailor a template configure script into the configure +# script appropriate for this directory. For more information, check +# any existing configure script. + +srctrigger=io.c +srcname="libgloss testsuite" +target_dependent=true + +# per-host: + +# This is basically a hack so that we don't have to replicate the same +# defines in all the Makefiles. We put a standard set of definitions +# in host/any, and use them everywhere except DOS, which is braindead. + +host_makefile_frag=../../config/default.mh +case "${host}" in + i[3456]86-*-go32) + host_makefile_frag=../../config/dos.mh + ;; +esac + +# per-target: +case "${target}" in + m68*-unknown-*) + target_makefile_frag=../config/m68k.mt + ;; + hppa*-*-pro*) + target_makefile_frag=../config/hppa.mt + ;; + sparclite-*-*) + target_makefile_frag=../config/sparcl.mt + ;; + mips*-*-*) + target_makefile_frag=../config/mips.mt + ;; +esac + +# post-target: + +case ${srcdir} in + .) + ;; + *) + grep "source ${srcdir}/.gdbinit" .gdbinit >/dev/null 2>/dev/null || \ + echo "source ${srcdir}/.gdbinit" >> .gdbinit +esac + +objroot=`pwd | sed -e 's@/[^/]*$@@' -e 's@/[^/]*$@@' -e 's@/[^/]*$@@'` +srcroot=`echo $srcdir | sed -e 's@/[^/]*$@@' -e 's@/[^/]*$@@' -e 's@/[^/]*$@@'` +sed -e "s:^OBJROOT[ ]*=.*$:OBJROOT = ${objroot}:" -e "s:^SRCROOT[ ]*=.*$:SRCROOT = ${srcroot}:" \ + ${Makefile} > Makefile.tem +rm -f ${Makefile} +mv Makefile.tem ${Makefile} diff --git a/libgloss/testsuite/libgloss.all/div.c b/libgloss/testsuite/libgloss.all/div.c new file mode 100644 index 0000000..32eff9d --- /dev/null +++ b/libgloss/testsuite/libgloss.all/div.c @@ -0,0 +1,35 @@ +/* WinBond bug report + + Please don't use "gcc -O3 -S hello.c" command, because it + will optimize "i/5" to be "2" in compile time. + + */ + +#include <stdio.h> +#define TESTSEED 10 + +main () +{ + int a1,b1,c1; + long a2,b2,c2; + double a3,b3,c3; + float a4,b4,c4; + char buf[20]; + + /* integer tests */ + for (a1 = 1; a1 < 16; a1++) { + b1 = TESTSEED/a1; + c1 = TESTSEED%a1; + printf ("%d/%d = %d, ^ = %d\n", TESTSEED, a1, b1, c1); + if ((c1 + (a1 * b1)) == TESTSEED) { + sprintf (buf, "div %d by %d", TESTSEED, a1); + pass (buf); + } else { + sprintf (buf, "div %d by %d", TESTSEED, a1); + fail (buf); + } + fflush (stdout); + } +} + + diff --git a/libgloss/testsuite/libgloss.all/double.c b/libgloss/testsuite/libgloss.all/double.c new file mode 100644 index 0000000..e648191 --- /dev/null +++ b/libgloss/testsuite/libgloss.all/double.c @@ -0,0 +1,33 @@ +/* Oki bug report [OKI001](gcc008_1) + + The following program is not executed. + error messages are as follow. + + illegal trap: 0x12 pc=d000d954 + d000d954 08000240 NOP + */ + +#include <stdio.h> +extern double dcall (); + +main () +{ + double d1, d2, d3; + int i; + + d1 = dcall (1.); + printf ("d1 = %e\n", d1); + + pass ("double [OKI001]"); + fflush(stdout); +} + +double +dcall (d) + double d; +{ + int Zero = 0; + return d + Zero; +} + + diff --git a/libgloss/testsuite/libgloss.all/float.c b/libgloss/testsuite/libgloss.all/float.c new file mode 100644 index 0000000..bbe41ca --- /dev/null +++ b/libgloss/testsuite/libgloss.all/float.c @@ -0,0 +1,20 @@ +#include <stdio.h> + +main() +{ + float a,b,c; + + a = 0.11; + b = 3.12; + c = a+b; + + printf ("Print float, result with 'f' = %f\n", c); + printf ("Print float, result with 'e' = %e\n", c); + printf ("Print float, result with 'E' = %E\n", c); + printf ("Print float, result with 'g' = %g\n", c); + printf ("Print float, result with 'G' = %G\n", c); + + pass ("float"); + fflush (stdout); +} + diff --git a/libgloss/testsuite/libgloss.all/func.c b/libgloss/testsuite/libgloss.all/func.c new file mode 100644 index 0000000..50ca207 --- /dev/null +++ b/libgloss/testsuite/libgloss.all/func.c @@ -0,0 +1,26 @@ +/* Oki bug report [OKI002](gcc008_2) + + The following program is not executed. + Error message is as follow. + + illegal trap: 0x12 pc=d000d954 + d000d954 08000240 NOP + + */ + +#include <stdio.h> +#include <stdarg.h> + +int func (int, ...); + +void main () +{ + func (2, 1., 2., 3.); + pass ("func [OKI002]"); + fflush (stdout); +} + +int func (int i, ...) +{ + return (i); +} diff --git a/libgloss/testsuite/libgloss.all/io.c b/libgloss/testsuite/libgloss.all/io.c new file mode 100644 index 0000000..5ad93ef --- /dev/null +++ b/libgloss/testsuite/libgloss.all/io.c @@ -0,0 +1,71 @@ +/* + io.c -- Test the serial I/O. + */ + +#define BUFSIZE 80 +#include <stdio.h> + +main() +{ + char buf[100]; + char *tmp; + int result; + + /* test the lowest level output function */ + result = outbyte ('&'); + if (result != 0x0) { + pass ("outbyte"); + } else { + fail ("outbyte"); + } + + /* try writing a string */ + result = write ("Write Test:\n", 12); + print ("result was "); + putnum (result); + outbyte ('\n'); + if (result == 12) { + pass ("write"); + } else { + fail ("write"); + } + + /* try the print() function too */ + result = print ("Print Test:\n"); + print ("result was "); + putnum (result); + outbyte ('\n'); + if (result == 12) { + pass ("print"); + } else { + fail ("print"); + } + + /* try the iprintf() function too */ + result = print ("Iprintf Test:\n"); + print ("result was "); + putnum (result); + outbyte ('\n'); + if (result == 14) { + pass ("iprintf"); + } else { + fail ("iprintf"); + } + + /* try to read a string */ + print ("Type 5 characters"); + + result = 0; + result = read (0, buf, 5); + print (buf); + if (result == 5) { + pass ("read"); + } else { + fail ("read"); + } + + /* clear everything out */ + fflush (stdout); +} + + diff --git a/libgloss/testsuite/libgloss.all/math.c b/libgloss/testsuite/libgloss.all/math.c new file mode 100644 index 0000000..fe137da --- /dev/null +++ b/libgloss/testsuite/libgloss.all/math.c @@ -0,0 +1,88 @@ +/* Oki bug report [OKI004](gcc005) + + The following computation is no work. + -1 / 1 => 1 (correct -1) + -1 % 2 => 1 (correct -1) + */ + +#include <stdio.h> + +main () +{ + long l1, l2, l6; + auto long l3; + long oza1, oza2, oza; + + l1 = 1; + l2 = 2; + l3 = -1; + l6 = 6; + + /*** test 1 ***/ + oza = ((l3 / ((l1)--)) | (l6 <= (l3 % l2))); + printf ("test 1 has a result of %d.\n", oza); + if (oza != -1) + fail ("divide test [OKI004]"); + else + pass ("divide test [OKI004]"); + + l1 = 1; + /*** test 2 ***/ + oza1 = (l3 / ((l1)--)); + oza2 = (l6 <= (l3 % l2)); + oza = oza1 | oza2; + + printf ("test 2 has a result of %d.\n", oza); + if (oza != -1) + fail ("modulos test [OKI004]"); + else + pass ("modulos test [OKI004]"); + fflush (stdout); + + test_1(); +} + +/* + 32760 / (1) = 32760 + 32760 / (-1) = 32760 -------> ERROR, same as you said. + 32760 / (2) = 16380 + 32760 / (-2) = -2147467268 ----> ERROR + 32760 / (3) = 10920 + 32760 / (-3) = -1431644845 ----> ERROR + 32760 / (4) = 8190 + 32760 / (-4) = -8190 + */ +test_1() +{ + int value, i, j; + + i = 32760; + j = 1; + value = i / (j); + printf ("%d / (%d) = %d\n", i, j, value); + j = -1; + value = i / (j); + printf ("%d / (%d) = %d\n", i, j, value); + + j = 2; + value = i / (j); + printf ("%d / (%d) = %d\n", i, j, value); + j = -2; + value = i / (j); + printf ("%d / (%d) = %d\n", i, j, value); + + j = 3; + value = i / (j); + printf ("%d / (%d) = %d\n", i, j, value); + j = -3; + value = i / (j); + printf ("%d / (%d) = %d\n", i, j, value); + + j = 4; + value = i / (j); + printf ("%d / (%d) = %d\n", i, j, value); + j = -4; + value = i / (j); + printf ("%d / (%d) = %d\n", i, j, value); +} + diff --git a/libgloss/testsuite/libgloss.all/memory.c b/libgloss/testsuite/libgloss.all/memory.c new file mode 100644 index 0000000..6e0422d --- /dev/null +++ b/libgloss/testsuite/libgloss.all/memory.c @@ -0,0 +1,38 @@ +/* WinBond bug report + + malloc() returns 0x0. + + test the memory calls. These test sbrk(), which is part of glue.c + for most architectures. + */ + +#include <stdio.h> +#define BUFSIZE 80 + +main() +{ + char *buf; + char *tmp; + char *result; + + /* see if we can get some memory */ + buf = (char *)malloc(BUFSIZE); + if (buf != 0x0) { + pass ("malloc"); + } else { + fail ("malloc"); + } + + /* see if we can realloc it */ + tmp = buf; + result = (char *)realloc (buf, BUFSIZE+100); + if ((buf != 0x0) && (result != 0x0)) { + pass ("realloc"); + } else { + fail ("realloc"); + } + + /* see if we can free it up. FIXME: how to test free ?*/ + free (buf); + fflush (stdout); +} diff --git a/libgloss/testsuite/libgloss.all/misc.c b/libgloss/testsuite/libgloss.all/misc.c new file mode 100644 index 0000000..5d082bc --- /dev/null +++ b/libgloss/testsuite/libgloss.all/misc.c @@ -0,0 +1,167 @@ +/* + * this file contains misc bug reports from WinBond. + */ +#include <stdio.h> +#include <math.h> + +#if unix +#define pass(x) printf("PASS: %s\n", x); +#define fail(x) printf("FAIL: %s\n", x); +#endif + +/* + The compare operation is error. Because the constant value 1.0 is + not correct. It seems compare with 0 in this statement. + +HP-UX native: + dist is 0.301 + PASS: float compare + *cp = be9a1cac, *cp1 = be9a1cac + PASS: float multiple 1 + PASS: float multiple 2 + 32760 / (-2) = -16380 + PASS: float divide 1 + 32760 / (-1) = -32760 + PASS: float divide 1 + These test only pass if the output matches: + Correct output is + 1.0 = 1.000000E+00, 0.3010 = 3.000000E-01, -1.0 = -1.000000E+0 + 1.0 = 1.000000E+00, 0.3010 = 3.010000E-01, -1.0 = -1.000000E+00 + These test only pass if the outut matches: + Correct output is + ans = 1.000000E+00, ans1 = 3.010000E-01, ans2 = -1.000000E+00 + ans = 1.000000E+00, ans1 = 3.010000E-01, ans2 = -1.000000E+00 + + +Test run on Oki: + + dist is 0 + PASS: float compare + *cp = be9a1cac, *cp1 = be9a1cac + PASS: float multiple 1 + PASS: float multiple 2 + 32760 / (-2) = -2147467268 + PASS: float divide 1 + 32760 / (-1) = 32760 + PASS: float divide 1 + These test only pass if the output matches: + Correct output is + 1.0 = 1.000000E+00, 0.3010 = 3.000000E-01, -1.0 = -1.000000E+0 + 1.0 = 1.586860E-318, 0.3010 = -1.009091E-303, -1.0 = 5.290504E-315 + These test only pass if the outut matches: + Correct output is + ans = 1.000000E+00, ans1 = 3.010000E-01, ans2 = -1.000000E+00 + ans = 4.940656E-324, ans1 = -5.299809E-315, ans2 = 5.290504E-315 + + */ + +main() +{ + float dist = 0.3010; + + printf ("dist is %G\n", dist); + if ( dist < 1.0 ) { + pass ("float compare"); + } else { + fail ("float compare"); + } + + test_1(); + test_2(); + test_3(); + test_4(); + + fflush (stdout); +} + +/* + * *cp = be9a1cac, *cp1 = 00000000 + */ +test_1() +{ + float i, ans, ans1; + unsigned int *cp=&ans, *cp1=&ans1; + + i = 0.3010; + ans = (-1.0) * 0.3010 * 1.0; /* OK */ + ans1 = (-1.0) * i * 1.0; /* Disaster */ + printf ("*cp = %08x, *cp1 = %08x\n", *cp, *cp1); + + if (*cp != 0xbe9a1cac) { + fail ("float multiple 1"); + } else { + pass ("float multiple 1"); + } + + if (*cp1 != 0xbe9a1cac) { + fail ("float multiple 2"); + } else { + pass ("float multiple 2"); + } +} + +/* + Positive integer divide Negative integer may get interesting result. + For examples: + EX1: 32760 / (-2) = -2147467268 + */ +test_2() +{ + int value, i, j; + + i = 32760; + j = -2; + value = i / (j); + printf ("%d / (%d) = %d\n", i, j, value); + + if (value != -16380) { + fail ("float divide 1"); + } else { + pass ("float divide 1"); + } +} + +/* + EX2: 32760 / (-1) = 32760 + */ +test_3() +{ + int value, i, j; + + i = 32760; + j = -1; + value = i / (j); + printf ("%d / (%d) = %d\n", i, j, value); + + if (value != -32760) { + fail ("float divide 1"); + } else { + pass ("float divide 1"); + } +} + +/* + The data output format %e, %E, %g, %G in printf() can not work. + Please test the following example: + + 1.0 = 1.000000E+00, 0.3010 = 3.009999E-01, -1.0 = -1.000000E+00 + ans = 4.940656E-324, ans1 = -5.299809E-315, ans2 = 5.290504E-315 + */ +test_4() +{ + float ans, ans1, ans2; + + ans = 1.0; + ans1 = 0.3010; + ans2 = -1.0; + + printf ("These test only pass if the output matches:\nCorrect output is\n1.0 = 1.000000E+00, 0.3010 = 3.000000E-01, -1.0 = -1.000000E+0\n"); + printf ("1.0 = %E, 0.3010 = %E, -1.0 = %E\n", 1.0, 0.3010, -1.0); + printf ("These test only pass if the outut matches:\nCorrect output is\nans = 1.000000E+00, ans1 = 3.010000E-01, ans2 = -1.000000E+00\n"); + printf ("ans = %E, ans1 = %E, ans2 = %E\n", ans, ans1, ans2); +} + + + + + diff --git a/libgloss/testsuite/libgloss.all/printf.c b/libgloss/testsuite/libgloss.all/printf.c new file mode 100644 index 0000000..4aff104 --- /dev/null +++ b/libgloss/testsuite/libgloss.all/printf.c @@ -0,0 +1,31 @@ +/* Oki bug report [OKI006] + + The following program is no work. + + illegal trap: 0x12 pc=d000d954 + d000d954 08000240 NOP + */ + +#include <stdio.h> + +main () +{ + int i, j, k; + + print ("\r\nDemo Program Start\r\n"); + printf ("Value = %d, %d\r\n", 2, 1); + pass ("printf [OKI006]"); + +/* Oki bug report [OKI007] + + iprintf is no work. + "Value = 2, 1" string is not displayed. + + break instruction trap (9) pc=4003c + 0004003c 00000000 BREAK 0x0,0x0 + */ + print ("\r\nDemo Program Start\r\n"); + iprintf ("Value = %d, %d\r\n", 2, 1); + pass ("iprintf [OKI007]"); + fflush (stdout); +} diff --git a/libgloss/testsuite/libgloss.all/struct.c b/libgloss/testsuite/libgloss.all/struct.c new file mode 100644 index 0000000..799f9a5 --- /dev/null +++ b/libgloss/testsuite/libgloss.all/struct.c @@ -0,0 +1,65 @@ +/* Oki bug report, no number. Here's the output the error generates. + + gcc -c -g -ansi oki008.c -o oki008.o -msoft-float + oki008.c: In function `Proc0': + oki008.c:50: internal error--insn does not satisfy its constraints: + (insn 37 35 24 (set (mem:DF (post_inc:DF (reg:SI 1 %r1))) + (reg:DF 48 %fr12)) 94 {reload_outdf+2} (nil) + (nil)) + gcc: Internal compiler error: program cc1 got fatal signal 6 + */ + +#include <stdio.h> + +typedef int Enumeration; +typedef int OneToFifty; +typedef char String30[31]; +struct Record +{ + struct Record *PtrComp; + Enumeration Discr; + Enumeration EnumComp; + OneToFifty IntComp; + String30 StringComp; +}; + +typedef struct Record RecordType; +typedef RecordType * RecordPtr; +typedef int boolean; + +#include <stdio.h> + +char buf[0x10000]; +char *pbuf = buf; + +char *_malloc(size) +{ + char *p; + + p = pbuf; + pbuf += size; + if (pbuf >= &buf[sizeof (buf)]) { + printf("_malloc error\n"); + return (0); + } + return (p); +} + +main() +{ + Proc0(); + pass ("struct"); + fflush (stdout); + return (0); +} + +RecordPtr PtrGlbNext; + +Proc0() +{ + extern char *_malloc(); + + register unsigned int i; + + PtrGlbNext = (RecordPtr) _malloc(sizeof(RecordType)); +} diff --git a/libgloss/testsuite/libgloss.all/varargs.c b/libgloss/testsuite/libgloss.all/varargs.c new file mode 100644 index 0000000..c055574 --- /dev/null +++ b/libgloss/testsuite/libgloss.all/varargs.c @@ -0,0 +1,46 @@ +/* Oki bug report [OKI013] + + Variable argments test failed. + + Execution result. + val1, val2 = 1, 0 + val1, val2 = 2, 0 + val1, val2 = 3, 0 + + Note, this tests for ANSI style varargs. + + */ + +#include <stdio.h> +#include <stdarg.h> +int func(int, ...); + +main() +{ + func(2, 1., 2., 3.); +} + +func(int i, ...) +{ + va_list p; + int j; + + va_start(p, i); + for (j = 1; j <= 3; ++j){ + dequals(__LINE__, (double)j, va_arg(p, double)); + } + va_end(p); + return (i); +} + +dequals(int line, double val1, double val2) +{ + iprintf ("val1, val2 = %d, %d\n", (int)val1, (int)val2); + if(val1 == val2) + pass ("varargs [OKI013]"); + else + fail ("varargs [OKI013]"); + + fflush (stdout); + return; +} diff --git a/libgloss/testsuite/libgloss.all/varargs2.c b/libgloss/testsuite/libgloss.all/varargs2.c new file mode 100644 index 0000000..9e590fc --- /dev/null +++ b/libgloss/testsuite/libgloss.all/varargs2.c @@ -0,0 +1,48 @@ +/* Oki bug report [OKI013] + + Variable argments test failed. + + Execution result. + val1, val2 = 1, 0 + val1, val2 = 2, 0 + val1, val2 = 3, 0 + + Note, this test case for for traditional style C code. + + */ + +#include <stdio.h> +#include <varargs.h> +int func(); + +main() +{ + func(1., 2., 3.); +} + +func(va_alist) + va_dcl +{ + va_list p; + double val1, val2; + int j; + + va_start(p); + for (j = 1; j <= 3; ++j){ + dequals((double)j, va_arg(p, double)); + } + va_end(p); + return (p); +} + +dequals(double val1, double val2) +{ + iprintf ("val1 is %d, val2 is %d\n", (int)val1, (int)val2); + if (val1 == val2) + pass ("varargs2 [OKI013]"); + else + fail ("varargs2 [OKI013]"); + + fflush (stdout); + return; +} diff --git a/libgloss/unlink.c b/libgloss/unlink.c new file mode 100644 index 0000000..15ea7e8 --- /dev/null +++ b/libgloss/unlink.c @@ -0,0 +1,28 @@ +/* unlink.c -- remove a file. + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include <errno.h> +#include "glue.h" + +/* + * unlink -- since we have no file system, + * we just return an error. + */ +int +_DEFUN (unlink, (path), + char * path) +{ + errno = EIO; + return (-1); +} diff --git a/libgloss/v850/sys/syscall.h b/libgloss/v850/sys/syscall.h new file mode 100644 index 0000000..4187226 --- /dev/null +++ b/libgloss/v850/sys/syscall.h @@ -0,0 +1,41 @@ +#ifndef _SYS_SYSCALL_H_ +#define _SYS_SYSCALL_H_ + +/* Note: This file may be included by assembler source. */ + +#define SYS_exit 1 +#define SYS_fork 2 + +#define SYS_read 3 +#define SYS_write 4 +#define SYS_open 5 +#define SYS_close 6 +#define SYS_wait4 7 +#define SYS_creat 8 +#define SYS_link 9 +#define SYS_unlink 10 +#define SYS_execv 11 +#define SYS_chdir 12 +#define SYS_mknod 14 +#define SYS_chmod 15 +#define SYS_chown 16 +#define SYS_lseek 19 +#define SYS_getpid 20 +#define SYS_isatty 21 +#define SYS_fstat 22 +#define SYS_time 23 + + +#define SYS_ARG 24 +#define SYS_stat 38 + + +#define SYS_pipe 42 +#define SYS_execve 59 +#define SYS_times 43 +#define SYS_gettimeofday 116 + +#define SYS_utime 201 /* not really a system call */ +#define SYS_wait 202 /* nor is this */ + +#endif diff --git a/libgloss/wince/Makefile.am b/libgloss/wince/Makefile.am new file mode 100644 index 0000000..acb72b8 --- /dev/null +++ b/libgloss/wince/Makefile.am @@ -0,0 +1,12 @@ +## Process this file with automake to produce Makefile.in. + +AUTOMAKE_OPTIONS = cygnus + +gdbdir = ${dir ${patsubst %/,%,${dir @srcdir@}}}gdb +VPATH = $(gdbdir) +bin_PROGRAMS = stub.exe +stub_exe_SOURCES = wince-stub.c + +tooldir = $(exec_prefix)/$(host_alias) +INCLUDES = -I$(gdbdir) +LDADD = @LDADD@ diff --git a/libgloss/wince/Makefile.in b/libgloss/wince/Makefile.in new file mode 100644 index 0000000..e0d428a --- /dev/null +++ b/libgloss/wince/Makefile.in @@ -0,0 +1,332 @@ +# Makefile.in generated automatically by automake 1.4 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = . + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_alias = @build_alias@ +build_triplet = @build@ +host_alias = @host_alias@ +host_triplet = @host@ +target_alias = @target_alias@ +target_triplet = @target@ +CC = @CC@ +EXEEXT = @EXEEXT@ +LD = @LD@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +PACKAGE = @PACKAGE@ +VERSION = @VERSION@ + +AUTOMAKE_OPTIONS = cygnus + +gdbdir = ${dir ${patsubst %/,%,${dir @srcdir@}}}gdb +VPATH = $(gdbdir) +bin_PROGRAMS = stub.exe +stub_exe_SOURCES = wince-stub.c + +tooldir = $(exec_prefix)/$(host_alias) +INCLUDES = -I$(gdbdir) +LDADD = @LDADD@ +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/../../mkinstalldirs +CONFIG_CLEAN_FILES = +bin_PROGRAMS = stub.exe +PROGRAMS = $(bin_PROGRAMS) + + +DEFS = @DEFS@ -I. -I$(srcdir) +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +stub_exe_OBJECTS = wince-stub.o +stub_exe_LDADD = $(LDADD) +stub_exe_DEPENDENCIES = +stub_exe_LDFLAGS = +CFLAGS = @CFLAGS@ +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +DIST_COMMON = Makefile.am Makefile.in aclocal.m4 configure configure.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = gtar +GZIP_ENV = --best +SOURCES = $(stub_exe_SOURCES) +OBJECTS = $(stub_exe_OBJECTS) + +all: all-redirect +.SUFFIXES: +.SUFFIXES: .S .c .o .s +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --cygnus Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status + +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in + cd $(srcdir) && $(ACLOCAL) + +config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck +$(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) + cd $(srcdir) && $(AUTOCONF) + +mostlyclean-binPROGRAMS: + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + +distclean-binPROGRAMS: + +maintainer-clean-binPROGRAMS: + +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(bindir) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \ + $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + list='$(bin_PROGRAMS)'; for p in $$list; do \ + rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + done + +.c.o: + $(COMPILE) -c $< + +.s.o: + $(COMPILE) -c $< + +.S.o: + $(COMPILE) -c $< + +mostlyclean-compile: + -rm -f *.o core *.core + +clean-compile: + +distclean-compile: + -rm -f *.tab.c + +maintainer-clean-compile: + +stub.exe: $(stub_exe_OBJECTS) $(stub_exe_DEPENDENCIES) + @rm -f stub.exe + $(LINK) $(stub_exe_LDFLAGS) $(stub_exe_OBJECTS) $(stub_exe_LDADD) $(LIBS) + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $$unique $(LISP) + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + -rm -rf $(distdir) + GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz + mkdir $(distdir)/=build + mkdir $(distdir)/=inst + dc_install_base=`cd $(distdir)/=inst && pwd`; \ + cd $(distdir)/=build \ + && ../configure --srcdir=.. --prefix=$$dc_install_base \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) dist + -rm -rf $(distdir) + @banner="$(distdir).tar.gz is ready for distribution"; \ + dashes=`echo "$$banner" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + echo "$$dashes" +dist: distdir + -chmod -R a+r $(distdir) + GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) + -rm -rf $(distdir) +dist-all: distdir + -chmod -R a+r $(distdir) + GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) + -rm -rf $(distdir) +distdir: $(DISTFILES) + -rm -rf $(distdir) + mkdir $(distdir) + -chmod 777 $(distdir) + @for file in $(DISTFILES); do \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + cp -pr $$/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: +check: check-am +installcheck-am: +installcheck: installcheck-am +install-info-am: +install-info: install-info-am +install-exec-am: install-binPROGRAMS +install-exec: install-exec-am + +install-data-am: +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: uninstall-binPROGRAMS +uninstall: uninstall-am +all-am: Makefile $(PROGRAMS) +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + $(mkinstalldirs) $(DESTDIR)$(bindir) + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-binPROGRAMS mostlyclean-compile \ + mostlyclean-tags mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-binPROGRAMS clean-compile clean-tags clean-generic \ + mostlyclean-am + +clean: clean-am + +distclean-am: distclean-binPROGRAMS distclean-compile distclean-tags \ + distclean-generic clean-am + +distclean: distclean-am + -rm -f config.status + +maintainer-clean-am: maintainer-clean-binPROGRAMS \ + maintainer-clean-compile maintainer-clean-tags \ + maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-am + -rm -f config.status + +.PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \ +maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \ +mostlyclean-compile distclean-compile clean-compile \ +maintainer-clean-compile tags mostlyclean-tags distclean-tags \ +clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \ +check-am installcheck-am installcheck install-info-am install-info \ +install-exec-am install-exec install-data-am install-data install-am \ +install uninstall-am uninstall all-redirect all-am all installdirs \ +mostlyclean-generic distclean-generic clean-generic \ +maintainer-clean-generic clean mostlyclean distclean maintainer-clean + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libgloss/wince/aclocal.m4 b/libgloss/wince/aclocal.m4 new file mode 100644 index 0000000..f5379a5 --- /dev/null +++ b/libgloss/wince/aclocal.m4 @@ -0,0 +1,137 @@ +dnl aclocal.m4 generated automatically by aclocal 1.4 + +dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without +dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A +dnl PARTICULAR PURPOSE. + +# Do all the work for Automake. This macro actually does too much -- +# some checks are only needed if your package does certain things. +# But this isn't really a big deal. + +# serial 1 + +dnl Usage: +dnl AM_INIT_AUTOMAKE(package,version, [no-define]) + +AC_DEFUN(AM_INIT_AUTOMAKE, +[AC_REQUIRE([AC_PROG_INSTALL]) +PACKAGE=[$1] +AC_SUBST(PACKAGE) +VERSION=[$2] +AC_SUBST(VERSION) +dnl test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +fi +ifelse([$3],, +AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) +AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) +AC_REQUIRE([AM_SANITY_CHECK]) +AC_REQUIRE([AC_ARG_PROGRAM]) +dnl FIXME This is truly gross. +missing_dir=`cd $ac_aux_dir && pwd` +AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) +AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) +AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) +AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) +AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) +AC_REQUIRE([AC_PROG_MAKE_SET])]) + +# +# Check to make sure that the build environment is sane. +# + +AC_DEFUN(AM_SANITY_CHECK, +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftestfile +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "[$]*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "[$]*" != "X $srcdir/configure conftestfile" \ + && test "[$]*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "[$]2" = conftestfile + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +rm -f conftest* +AC_MSG_RESULT(yes)]) + +dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) +dnl The program must properly implement --version. +AC_DEFUN(AM_MISSING_PROG, +[AC_MSG_CHECKING(for working $2) +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if ($2 --version) < /dev/null > /dev/null 2>&1; then + $1=$2 + AC_MSG_RESULT(found) +else + $1="$3/missing $2" + AC_MSG_RESULT(missing) +fi +AC_SUBST($1)]) + +# Add --enable-maintainer-mode option to configure. +# From Jim Meyering + +# serial 1 + +AC_DEFUN(AM_MAINTAINER_MODE, +[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) + dnl maintainer-mode is disabled by default + AC_ARG_ENABLE(maintainer-mode, +[ --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer], + USE_MAINTAINER_MODE=$enableval, + USE_MAINTAINER_MODE=no) + AC_MSG_RESULT($USE_MAINTAINER_MODE) + AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes) + MAINT=$MAINTAINER_MODE_TRUE + AC_SUBST(MAINT)dnl +] +) + +# Define a conditional. + +AC_DEFUN(AM_CONDITIONAL, +[AC_SUBST($1_TRUE) +AC_SUBST($1_FALSE) +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi]) + diff --git a/libgloss/wince/configure b/libgloss/wince/configure new file mode 100755 index 0000000..efc00cc --- /dev/null +++ b/libgloss/wince/configure @@ -0,0 +1,1489 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.13 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: +ac_help="$ac_help + --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer" + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +sitefile= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --site-file=FILE use FILE as the site file + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -site-file | --site-file | --site-fil | --site-fi | --site-f) + ac_prev=sitefile ;; + -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*) + sitefile="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.13" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=Makefile.in + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$sitefile"; then + if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi + fi +else + CONFIG_SITE="$sitefile" +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +ac_exeext= +ac_objext=o +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + + +# Do some error checking and defaulting for the host and target type. +# The inputs are: +# configure --host=HOST --target=TARGET --build=BUILD NONOPT +# +# The rules are: +# 1. You are not allowed to specify --host, --target, and nonopt at the +# same time. +# 2. Host defaults to nonopt. +# 3. If nonopt is not specified, then host defaults to the current host, +# as determined by config.guess. +# 4. Target and build default to nonopt. +# 5. If nonopt is not specified, then target and build default to host. + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +case $host---$target---$nonopt in +NONE---*---* | *---NONE---* | *---*---NONE) ;; +*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;; +esac + + +# Make sure we can run config.sub. +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi + +echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:586: checking host system type" >&5 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + +echo $ac_n "checking target system type""... $ac_c" 1>&6 +echo "configure:607: checking target system type" >&5 + +target_alias=$target +case "$target_alias" in +NONE) + case $nonopt in + NONE) target_alias=$host_alias ;; + *) target_alias=$nonopt ;; + esac ;; +esac + +target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias` +target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$target" 1>&6 + +echo $ac_n "checking build system type""... $ac_c" 1>&6 +echo "configure:625: checking build system type" >&5 + +build_alias=$build +case "$build_alias" in +NONE) + case $nonopt in + NONE) build_alias=$host_alias ;; + *) build_alias=$nonopt ;; + esac ;; +esac + +build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` +build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$build" 1>&6 + +test "$host_alias" != "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + +if test "$program_transform_name" = s,x,x,; then + program_transform_name= +else + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed +s,\\,\\\\,g; s,\$,$$,g +EOF_SED + program_transform_name="`echo $program_transform_name|sed -f conftestsed`" + rm -f conftestsed +fi +test "$program_prefix" != NONE && + program_transform_name="s,^,${program_prefix},; $program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" + +# sed with no file args requires a program. +test "$program_transform_name" = "" && program_transform_name="s,x,x," + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:678: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 +echo "configure:731: checking whether build environment is sane" >&5 +# Just in case +sleep 1 +echo timestamp > conftestfile +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "$*" != "X $srcdir/configure conftestfile" \ + && test "$*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { echo "configure: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" 1>&2; exit 1; } + fi + + test "$2" = conftestfile + ) +then + # Ok. + : +else + { echo "configure: error: newly created file is older than distributed files! +Check your system clock" 1>&2; exit 1; } +fi +rm -f conftest* +echo "$ac_t""yes" 1>&6 +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +echo "configure:769: checking whether ${MAKE-make} sets \${MAKE}" >&5 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftestmake <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftestmake +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SET_MAKE= +else + echo "$ac_t""no" 1>&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + + +PACKAGE=wince-stub + +VERSION=1.0 + +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } +fi +cat >> confdefs.h <<EOF +#define PACKAGE "$PACKAGE" +EOF + +cat >> confdefs.h <<EOF +#define VERSION "$VERSION" +EOF + + + +missing_dir=`cd $ac_aux_dir && pwd` +echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 +echo "configure:815: checking for working aclocal" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (aclocal --version) < /dev/null > /dev/null 2>&1; then + ACLOCAL=aclocal + echo "$ac_t""found" 1>&6 +else + ACLOCAL="$missing_dir/missing aclocal" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 +echo "configure:828: checking for working autoconf" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoconf --version) < /dev/null > /dev/null 2>&1; then + AUTOCONF=autoconf + echo "$ac_t""found" 1>&6 +else + AUTOCONF="$missing_dir/missing autoconf" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working automake""... $ac_c" 1>&6 +echo "configure:841: checking for working automake" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (automake --version) < /dev/null > /dev/null 2>&1; then + AUTOMAKE=automake + echo "$ac_t""found" 1>&6 +else + AUTOMAKE="$missing_dir/missing automake" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 +echo "configure:854: checking for working autoheader" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoheader --version) < /dev/null > /dev/null 2>&1; then + AUTOHEADER=autoheader + echo "$ac_t""found" 1>&6 +else + AUTOHEADER="$missing_dir/missing autoheader" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 +echo "configure:867: checking for working makeinfo" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (makeinfo --version) < /dev/null > /dev/null 2>&1; then + MAKEINFO=makeinfo + echo "$ac_t""found" 1>&6 +else + MAKEINFO="$missing_dir/missing makeinfo" + echo "$ac_t""missing" 1>&6 +fi + + +echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 +echo "configure:881: checking whether to enable maintainer-specific portions of Makefiles" >&5 + # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then + enableval="$enable_maintainer_mode" + USE_MAINTAINER_MODE=$enableval +else + USE_MAINTAINER_MODE=no +fi + + echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6 + + +if test $USE_MAINTAINER_MODE = yes; then + MAINTAINER_MODE_TRUE= + MAINTAINER_MODE_FALSE='#' +else + MAINTAINER_MODE_TRUE='#' + MAINTAINER_MODE_FALSE= +fi + MAINT=$MAINTAINER_MODE_TRUE + + + +cross_compiling=yes +program_transform_name=s,^,@target_alias@-,; + +: ${CFLAGS='-O2'} +# Extract the first word of ""${host_alias}-gcc"", so it can be a program name with args. +set dummy "${host_alias}-gcc"; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:911: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC=""${host_alias}-gcc"" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +# CFLAGS="$CFLAGS -Xlinker --defsym -Xlinker _main=_WinMain" +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:939: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <<EOF +#ifdef __GNUC__ + yes; +#endif +EOF +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:948: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 +if test $host != $build; then + ac_tool_prefix=${host_alias}- +else + ac_tool_prefix= +fi + +# Extract the first word of "${ac_tool_prefix}ld", so it can be a program name with args. +set dummy ${ac_tool_prefix}ld; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:965: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$LD"; then + ac_cv_prog_LD="$LD" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_LD="${ac_tool_prefix}ld" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +LD="$ac_cv_prog_LD" +if test -n "$LD"; then + echo "$ac_t""$LD" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +if test -z "$ac_cv_prog_LD"; then +if test -n "$ac_tool_prefix"; then + # Extract the first word of "ld", so it can be a program name with args. +set dummy ld; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:997: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$LD"; then + ac_cv_prog_LD="$LD" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_LD="ld" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_LD" && ac_cv_prog_LD="ld" +fi +fi +LD="$ac_cv_prog_LD" +if test -n "$LD"; then + echo "$ac_t""$LD" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +else + LD="ld" +fi +fi + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:1042: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +case "${target}" in + *arm*-*-*) LDADD='-lwinsock -lsslsock' ;; + *) LDADD='-lwinsock' +esac + +# +# The following is sort of a kludge but we *know* that we need +# an executable extension and, currently, the sh-pe-gcc compiler +# doesn't play well with configure, so, set a "cache" entry. +# +: ${ac_cv_exeext='.exe'} +echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 +echo "configure:1106: checking for Cygwin environment" >&5 +if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1111 "configure" +#include "confdefs.h" + +int main() { + +#ifndef __CYGWIN__ +#define __CYGWIN__ __CYGWIN32__ +#endif +return __CYGWIN__; +; return 0; } +EOF +if { (eval echo configure:1122: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_cygwin=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_cygwin=no +fi +rm -f conftest* +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_cygwin" 1>&6 +CYGWIN= +test "$ac_cv_cygwin" = yes && CYGWIN=yes +echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 +echo "configure:1139: checking for mingw32 environment" >&5 +if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1144 "configure" +#include "confdefs.h" + +int main() { +return __MINGW32__; +; return 0; } +EOF +if { (eval echo configure:1151: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_mingw32=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_mingw32=no +fi +rm -f conftest* +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_mingw32" 1>&6 +MINGW32= +test "$ac_cv_mingw32" = yes && MINGW32=yes + + +echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 +echo "configure:1170: checking for executable suffix" >&5 +if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$CYGWIN" = yes || test "$MINGW32" = yes; then + ac_cv_exeext=.exe +else + rm -f conftest* + echo 'int main () { return 0; }' > conftest.$ac_ext + ac_cv_exeext= + if { (eval echo configure:1180: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + for file in conftest.*; do + case $file in + *.c | *.o | *.obj | *.ilk | *.pdb) ;; + *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; + esac + done + else + { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; } + fi + rm -f conftest* + test x"${ac_cv_exeext}" = x && ac_cv_exeext=no +fi +fi + +EXEEXT="" +test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext} +echo "$ac_t""${ac_cv_exeext}" 1>&6 +ac_exeext=$EXEEXT + + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs + + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS <<EOF +#! /bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.13" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS <<EOF + +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; + s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@FFLAGS@%$FFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@host@%$host%g +s%@host_alias@%$host_alias%g +s%@host_cpu@%$host_cpu%g +s%@host_vendor@%$host_vendor%g +s%@host_os@%$host_os%g +s%@target@%$target%g +s%@target_alias@%$target_alias%g +s%@target_cpu@%$target_cpu%g +s%@target_vendor@%$target_vendor%g +s%@target_os@%$target_os%g +s%@build@%$build%g +s%@build_alias@%$build_alias%g +s%@build_cpu@%$build_cpu%g +s%@build_vendor@%$build_vendor%g +s%@build_os@%$build_os%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@PACKAGE@%$PACKAGE%g +s%@VERSION@%$VERSION%g +s%@ACLOCAL@%$ACLOCAL%g +s%@AUTOCONF@%$AUTOCONF%g +s%@AUTOMAKE@%$AUTOMAKE%g +s%@AUTOHEADER@%$AUTOHEADER%g +s%@MAKEINFO@%$MAKEINFO%g +s%@SET_MAKE@%$SET_MAKE%g +s%@MAINTAINER_MODE_TRUE@%$MAINTAINER_MODE_TRUE%g +s%@MAINTAINER_MODE_FALSE@%$MAINTAINER_MODE_FALSE%g +s%@MAINT@%$MAINT%g +s%@CC@%$CC%g +s%@LD@%$LD%g +s%@LDADD@%$LDADD%g +s%@EXEEXT@%$EXEEXT%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <<EOF + +CONFIG_FILES=\${CONFIG_FILES-"Makefile"} +EOF +cat >> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +EOF +cat >> $CONFIG_STATUS <<EOF + +EOF +cat >> $CONFIG_STATUS <<\EOF + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + diff --git a/libgloss/wince/configure.in b/libgloss/wince/configure.in new file mode 100644 index 0000000..1211804 --- /dev/null +++ b/libgloss/wince/configure.in @@ -0,0 +1,34 @@ +dnl Process this file with autoconf to produce a configure script. + +AC_PREREQ(2.13) + +AC_INIT(Makefile.in) +AC_CANONICAL_SYSTEM +AC_ARG_PROGRAM +AM_INIT_AUTOMAKE(wince-stub, 1.0) +AM_MAINTAINER_MODE + +cross_compiling=yes +program_transform_name=s,^,@target_alias@-,; + +: ${CFLAGS='-O2'} +AC_CHECK_PROG(CC, "${host_alias}-gcc", "${host_alias}-gcc") +# CFLAGS="$CFLAGS -Xlinker --defsym -Xlinker _main=_WinMain" +AC_PROG_CC_GNU +AC_CHECK_TOOL(LD, ld, ld) +AC_SUBST(LD) +AC_PROG_INSTALL +case "${target}" in + *arm*-*-*) LDADD='-lwinsock -lsslsock' ;; + *) LDADD='-lwinsock' +esac +AC_SUBST(LDADD) +# +# The following is sort of a kludge but we *know* that we need +# an executable extension and, currently, the sh-pe-gcc compiler +# doesn't play well with configure, so, set a "cache" entry. +# +: ${ac_cv_exeext='.exe'} +AC_EXEEXT + +AC_OUTPUT([Makefile]) diff --git a/libgloss/write.c b/libgloss/write.c new file mode 100644 index 0000000..292a68e --- /dev/null +++ b/libgloss/write.c @@ -0,0 +1,39 @@ +/* write.c -- write bytes to an output device. + * + * Copyright (c) 1995 Cygnus Support + * + * The authors hereby grant permission to use, copy, modify, distribute, + * and license this software and its documentation for any purpose, provided + * that existing copyright notices are retained in all copies and that this + * notice is included verbatim in any distributions. No written agreement, + * license, or royalty fee is required for any of the authorized uses. + * Modifications to this software may be copyrighted by their authors + * and need not follow the licensing terms described here, provided that + * the new terms are clearly indicated on the first page of each file where + * they apply. + */ +#include "glue.h" + +extern int _EXFUN (outbyte, (char x)); + +/* + * write -- write bytes to the serial port. Ignore fd, since + * stdout and stderr are the same. Since we have no filesystem, + * open will only return an error. + */ +int +_DEFUN (write, (fd, buf, nbytes), + int fd _AND + char *buf _AND + int nbytes) +{ + int i; + + for (i = 0; i < nbytes; i++) { + if (*(buf + i) == '\n') { + outbyte ('\r'); + } + outbyte (*(buf + i)); + } + return (nbytes); +} |