From 664252b754b47fc328bfeaf77dc8c2a82b2e2a99 Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Fri, 25 Oct 2002 19:18:46 +0000 Subject: 2002-10-25 Bernd Schmidt * i386/cygmon.ld: Add entry for .gcc_except_table. 2000-10-25 Mark Salter * i386/cygmon-crt0.S: Use __USER_LABEL_PREFIX__ for symbols. Always use __start for start symbol. * i386/cygmon-salib.c: Don't build __do_global_[cd]tors for AOUT. Disable file I/O extensions to make Plum Hall happy. * i386/cygmon.ld: Set __start as entry point. * i386/Makefile.in: Support IS_AOUT. * i386/configure.in: Support IS_AOUT. * i386/configure: Regenerated. * i386/cygmon-salib.c: * i386/cygmon-gmon.c (_mcount): It's _etext. --- libgloss/i386/Makefile.in | 6 ++-- libgloss/i386/configure | 59 ++++++++++++++++++++++------------- libgloss/i386/configure.in | 4 +++ libgloss/i386/cygmon-crt0.S | 73 +++++++++++++++++++++----------------------- libgloss/i386/cygmon-gmon.c | 6 ++-- libgloss/i386/cygmon-salib.c | 17 +++++++++-- libgloss/i386/cygmon.ld | 20 ++++++------ 7 files changed, 107 insertions(+), 78 deletions(-) (limited to 'libgloss/i386') diff --git a/libgloss/i386/Makefile.in b/libgloss/i386/Makefile.in index d68657a78..158ba81a3 100644 --- a/libgloss/i386/Makefile.in +++ b/libgloss/i386/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (c) 1997 Cygnus Support +# Copyright (c) 1997, 2000 Cygnus Support # # The authors hereby grant permission to use, copy, modify, distribute, # and license this software and its documentation for any purpose, provided @@ -87,10 +87,10 @@ libcygmon.a: $(CYGMON_OBJS) ${RANLIB} $@ cygmon-salib.o: ${srcdir}/cygmon-salib.c - $(CC) -c $(CFLAGS) @NEED_UNDERSCORE@ @IS_COFF@ $(<) -o $@ + $(CC) -c $(CFLAGS) @NEED_UNDERSCORE@ @IS_COFF@ @IS_AOUT@ $(<) -o $@ cygmon-crt0.o: ${srcdir}/cygmon-crt0.S - $(CC) -c $(CFLAGS) @NEED_UNDERSCORE@ @IS_COFF@ $(<) -o $@ + $(CC) -c $(CFLAGS) @NEED_UNDERSCORE@ @IS_COFF@ @IS_AOUT@ $(<) -o $@ doc: diff --git a/libgloss/i386/configure b/libgloss/i386/configure index d0e35b2cf..534c8b47b 100755 --- a/libgloss/i386/configure +++ b/libgloss/i386/configure @@ -1,7 +1,7 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.12.1 +# 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 @@ -333,7 +333,7 @@ EOF verbose=yes ;; -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.12.1" + echo "configure generated by autoconf version 2.13" exit 0 ;; -with-* | --with-*) @@ -503,9 +503,11 @@ 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' +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 @@ -581,7 +583,7 @@ 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 +echo "configure:587: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -602,7 +604,7 @@ 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 +echo "configure:608: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -620,7 +622,7 @@ 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 +echo "configure:626: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -674,12 +676,12 @@ test "$program_transform_name" = "" && program_transform_name="s,x,x," # 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 +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="${IFS}:" + 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 @@ -722,6 +724,8 @@ echo "$ac_t""$INSTALL" 1>&6 # 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' @@ -732,24 +736,29 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' # autoconf should provide a way to do this. + case "$target" in *coff) IS_COFF="-DCOFF" ;; + *aout) + IS_AOUT="-DAOUT" + ;; 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 +echo "configure:753: 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 + 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" @@ -770,16 +779,17 @@ 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 +echo "configure:783: 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}:" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_prog_rejected=no - for ac_dir in $PATH; do + 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 @@ -818,7 +828,7 @@ fi 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 +echo "configure:832: 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 @@ -827,7 +837,7 @@ else 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 +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:841: \"$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 @@ -842,7 +852,7 @@ if test $ac_cv_prog_gcc = yes; then 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 +echo "configure:856: 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 @@ -877,18 +887,20 @@ 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 +echo "configure:895: 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 + 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" @@ -936,7 +948,7 @@ 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 | - case `(ac_space=' '; set) 2>&1` in + 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 \). @@ -1015,7 +1027,7 @@ do 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" + echo "$CONFIG_STATUS generated by autoconf version 2.13" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; @@ -1039,6 +1051,7 @@ 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 @@ -1073,12 +1086,14 @@ 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%@IS_COFF@%$IS_COFF%g +s%@IS_AOUT@%$IS_AOUT%g s%@NEED_UNDERSCORE@%$NEED_UNDERSCORE%g s%@RANLIB@%$RANLIB%g s%@host_makefile_frag_path@%$host_makefile_frag_path%g diff --git a/libgloss/i386/configure.in b/libgloss/i386/configure.in index fe9224c03..722241ca0 100644 --- a/libgloss/i386/configure.in +++ b/libgloss/i386/configure.in @@ -77,6 +77,9 @@ case "$target" in *coff) IS_COFF="-DCOFF" ;; + *aout) + IS_AOUT="-DAOUT" + ;; esac LIB_AC_PROG_CC @@ -87,6 +90,7 @@ AC_SUBST(AR) LD=${LD-ld} AC_SUBST(LD) AC_SUBST(IS_COFF) +AC_SUBST(IS_AOUT) AC_SUBST(NEED_UNDERSCORE) AC_PROG_RANLIB diff --git a/libgloss/i386/cygmon-crt0.S b/libgloss/i386/cygmon-crt0.S index 9be020917..1c4535e07 100644 --- a/libgloss/i386/cygmon-crt0.S +++ b/libgloss/i386/cygmon-crt0.S @@ -1,7 +1,7 @@ /* * crt0 startup code for user programs running under Cygmon * - * Copyright (c) 1998 Cygnus Support + * Copyright (c) 1998, 2000 Cygnus Support * * The authors hereby grant permission to use, copy, modify, distribute, * and license this software and its documentation for any purpose, provided @@ -14,11 +14,9 @@ * they apply. */ -#ifndef NEED_UNDERSCORE -#define SYM(X) X -#else -#define SYM(X) _ ## X -#endif +#define _S2(P,X) P ## X +#define _S1(P,X) _S2(P,X) +#define SYM(X) _S1(__USER_LABEL_PREFIX__,X) .data .align 8 @@ -31,52 +29,51 @@ SYM(argc): .text .align 4 - .globl SYM(_start) -SYM(_start): + .globl __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 */ - lea __stack,%eax - cmpl $0,%eax - jz 1f - mov %eax, %esp + movl $__stack, %eax + testl %eax, %eax + jz 1f + movl %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 + movl $__bss_start, %edi + movl $__bss_end, %ecx + subl %edi, %ecx + xorl %eax, %eax + rep; stosb - pushl $SYM(__do_global_dtors) - call SYM(atexit) - add $4, %esp + pushl $SYM(__sigtramp) + pushl $0 + call SYM(__install_signal_handler) + popl %eax - call SYM(__do_global_ctors) + pushl $SYM(__do_global_dtors) + call SYM(atexit) + popl %eax - pushl $SYM(argc) - call SYM(__get_program_arguments) - add $4, %esp + call SYM(__do_global_ctors) - pushl %eax - lea SYM(argc), %ebx - pushl (%ebx) - call SYM(main) - add $8, %esp + pushl $SYM(argc) + call SYM(__get_program_arguments) + popl %ecx + + movl SYM(argc), %ecx + pushl %eax + pushl %ecx + call SYM(main) + popl %ecx + popl %edx /* 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 + pushl %eax call SYM(exit) 3: - jmp 3b + jmp 3b diff --git a/libgloss/i386/cygmon-gmon.c b/libgloss/i386/cygmon-gmon.c index 30b114720..480b2ec99 100644 --- a/libgloss/i386/cygmon-gmon.c +++ b/libgloss/i386/cygmon-gmon.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 1991 The Regents of the University of California. + * Copyright (c) 1991, 2000 The Regents of the University of California. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -221,10 +221,10 @@ _mcount() if (! already_setup) { - extern etext(); + extern _etext(); extern _ftext(); already_setup = 1; - monstartup(_ftext, etext); + monstartup(_ftext, _etext); atexit(_mcleanup); } /* diff --git a/libgloss/i386/cygmon-salib.c b/libgloss/i386/cygmon-salib.c index e0d5e72f7..1fd29cacf 100644 --- a/libgloss/i386/cygmon-salib.c +++ b/libgloss/i386/cygmon-salib.c @@ -1,7 +1,7 @@ /* * Standard x86 syscalls for user programs running under Cygmon * - * Copyright (c) 1998 Cygnus Support + * Copyright (c) 1998, 2000 Cygnus Support * * The authors hereby grant permission to use, copy, modify, distribute, * and license this software and its documentation for any purpose, provided @@ -22,8 +22,15 @@ extern int errno; _syscall3(int,write,int,i,char *,c,int,len); - +#if 0 _syscall3(int,read,int,i,char *,c,int,len); +#else +int +read (int des, char *dest, int len) +{ + return -1; +} +#endif _syscall2(int,kill,int,pid,int,signal); @@ -43,7 +50,11 @@ _syscall1(int, close, int, fd); int open (const char *filename, int mode, ...) { +#if 0 return __open (filename, mode, 0644); +#else + return -1; +#endif } /* Ultra-super cheezy. */ @@ -108,7 +119,7 @@ clock () return t.tv_sec * 1000 + (t.tv_usec / 1000); } -#ifndef COFF +#if ! defined(COFF) && ! defined(AOUT) typedef void (*ctp)(); void __do_global_ctors () diff --git a/libgloss/i386/cygmon.ld b/libgloss/i386/cygmon.ld index 03bbb60da..f5c506967 100644 --- a/libgloss/i386/cygmon.ld +++ b/libgloss/i386/cygmon.ld @@ -1,5 +1,5 @@ STARTUP(cygmon-crt0.o) -ENTRY(_start) +ENTRY(__start) GROUP(-lcygmon -lc -lcygmon -lgcc) SEARCH_DIR(.) __DYNAMIC = 0; @@ -45,8 +45,8 @@ SECTIONS *(.dtors) LONG(0) __DTOR_END__ = .; - etext = .; - _etext = .; + PROVIDE(_etext = .); + PROVIDE(__etext = .); } . = .; .rdata : { @@ -55,6 +55,8 @@ SECTIONS _fdata = ALIGN(16); .data : { *(.data) + *(.gcc_except_table) + *(.gcc_exc) } . = ALIGN(8); _gp = . + 0x8000; @@ -69,20 +71,20 @@ SECTIONS *(.sdata) } . = ALIGN(4); - edata = .; - _edata = .; + PROVIDE(_edata = .); + PROVIDE(__edata = .); fbss = .; _fbss = .; .sbss : { + PROVIDE(__bss_start = .); *(.sbss) *(.scommon) } .bss : { - __bss_start = . ; *(.bss) *(COMMON) - __bss_end = . ; + PROVIDE(__bss_end = .); } - end = .; - _end = .; + PROVIDE(_end = .); + PROVIDE(__end = .); } -- cgit v1.2.3