--- egcs64-19980921.orig/gcc/ChangeLog +++ egcs64-19980921/gcc/ChangeLog @@ -1,3 +1,63 @@ +Thu Sep 24 15:08:08 1998 Jakub Jelinek + + * config/sparc/sparc.c (function_value): Perform the equivalent of + PROMOTE_MODE for ARCH64. + (eligible_for_epilogue_delay): Allow DImode operations in delay + slot of a return for ARCH64. + +Thu Sep 24 01:35:34 1998 David S. Miller + + * config/sparc/sol2-sld-64.h (TRANSFER_FROM_TRAMPOLINE): Define. + * config/sparc/sparc.c (sparc64_initialize_trampoline): If that is + defined, emit libcall to __enable_execute_stack. Also fix opcodes + and offsets in actual stack trampoline code so they match the + commentary and actually work. + +Thu Sep 24 01:19:02 1998 Jakub Jelinek + + * configure.in (sparcv9-*-solaris): Use t-sol2 and t-sol2-64 for + tmake_file. + (sparc64-*-linux): Use t-linux and sparc/t-linux64 for + tmake_file. Set extra_parts to needed crt objects. + * configure: Rebuilt. + * config/sparc/linux64.h (SPARC_BI_ARCH): Define. + (TARGET_DEFAULT): Set if default is v9 or ultra. + (STARTFILE_SPEC32, STARTFILE_SPEC64): New macros. + (STARTFILE_SPEC): Set to those upon SPARC_BI_ARCH. + (ENDFILE_SPEC32, ENDFILE_SPEC64, ENDFILE_SPEC): Likewise. + (SUBTARGET_EXTRA_SPECS, LINK_ARCH32_SPEC, LINK_ARCH64_SPEC, + LINK_SPEC, LINK_ARCH_SPEC): Likewise. + (TARGET_VERSION): Define. + (MULTILIB_DEFAULT): Define. + * config/sparc/sparc.h (CPP_CPU_DEFAULT_SPEC): Rearrange so that + mixed 32/64 bit compilers based upon SPARC_BI_ARCH work. + (CPP_CPU64_DEFAULT_SPEC, CPP_CPU32_DEFAULT_SEC): Define + appropriately. + (TARGET_SWITCHES): Allow ptr32/ptr64 options once more. + * config/sparc/sparc.c (sparc_override_options): If arch and + pointer size disagree, emit diagnostic and fix it up. If + SPARC_BI_ARCH and TARGET_ARCH32, set cmodel to CM_32. Turn off + V8PLUS in 64-bit mode. + * config/sparc/t-linux64: New file. + * config/sparc/t-sol2-64: New file. + * config/sparc/t-sol2: Adjust build rules to use MULTILIB_CFLAGS. + * config/sparc/sol2-sld-64.h (SPARC_BI_ARCH): Define. + (ASM_CPU32_DEFAULT_SPEC, ASM_CPU64_DEFAULT_SPEC, + CPP_CPU32_DEFAULT_SPEC, CPP_CPU64_DEFAULT_SPEC): Define. + (ASM_SPEC, CPP_CPU_SPEC): Set appropriately based upon those. + (STARTFILE_SPEC32, STARTFILE_SPEC32, STARTFILE_ARCH_SPEC): + Define. + (STARTFILE_SPEC): Set approriately based upon those. + (CPP_CPU_DEFAULT_SPEC, ASM_CPU_DEFAULT_SPEC): Set based upon + disposition of DEFAULT_ARCH32_P. + (LINK_ARCH32_SPEC, LINK_ARCH64_SPEC): Define. + (LINK_ARCH_SPEC, LINK_ARCH_DEFAULT_SPEC): Set based upon those. + (CC1_SPEC, MULTILIB_DEFAULTS): Set based upon DEFAULT_ARCH32_P. + (MD_STARTFILE_PREFIX): Set correctly based upon SPARC_BI_ARCH. + * config/sparc/xm-sysv4-64.h (HOST_BITS_PER_LONG): Only set on + arch64/v9. + * config/sparc/xm-sp64.h (HOST_BITS_PER_LONG): Likewise. + Mon Sep 21 23:40:38 PDT 1998 Jeff Law (law@cygnus.com) * version.c: Bump for snapshot. --- egcs64-19980921.orig/gcc/configure +++ egcs64-19980921/gcc/configure @@ -4739,7 +4739,7 @@ tm_file=sparc/sol2-sld-64.h xm_file="sparc/xm-sysv4-64.h sparc/xm-sol2.h" xm_defines="USG POSIX" - tmake_file=sparc/t-sol2 + tmake_file="sparc/t-sol2 sparc/t-sol2-64" xmake_file=sparc/x-sysv4 extra_parts="crt1.o crti.o crtn.o gcrt1.o crtbegin.o crtend.o" fixincludes=fixinc.wrap @@ -4845,11 +4845,12 @@ extra_parts="crtbegin.o crtend.o" ;; sparc64-*-linux*) # 64-bit Sparc's running GNU/Linux - tmake_file=sparc/t-sp64 + tmake_file="t-linux sparc/t-linux64" xm_file="sparc/xm-sp64.h sparc/xm-linux.h" tm_file=sparc/linux64.h xmake_file=x-linux fixincludes=Makefile.in # The headers are ok already. + extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" gnu_ld=yes ;; # This hasn't been upgraded to GCC 2. --- egcs64-19980921.orig/gcc/configure.in +++ egcs64-19980921/gcc/configure.in @@ -2878,7 +2878,7 @@ tm_file=sparc/sol2-sld-64.h xm_file="sparc/xm-sysv4-64.h sparc/xm-sol2.h" xm_defines="USG POSIX" - tmake_file=sparc/t-sol2 + tmake_file="sparc/t-sol2 sparc/t-sol2-64" xmake_file=sparc/x-sysv4 extra_parts="crt1.o crti.o crtn.o gcrt1.o crtbegin.o crtend.o" fixincludes=fixinc.wrap @@ -2986,11 +2986,12 @@ extra_parts="crtbegin.o crtend.o" ;; sparc64-*-linux*) # 64-bit Sparc's running GNU/Linux - tmake_file=sparc/t-sp64 + tmake_file="t-linux sparc/t-linux64" xm_file="sparc/xm-sp64.h sparc/xm-linux.h" tm_file=sparc/linux64.h xmake_file=x-linux fixincludes=Makefile.in # The headers are ok already. + extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" gnu_ld=yes ;; # This hasn't been upgraded to GCC 2. --- egcs64-19980921.orig/gcc/flow.c +++ egcs64-19980921/gcc/flow.c @@ -3321,15 +3321,28 @@ int *num_preds; int *num_succs; { + int_list_ptr tmp; if (succ_bb != EXIT_BLOCK) { - add_int_list_node (&pred_int_list_blocks, &s_preds[succ_bb], pred_bb); - num_preds[succ_bb]++; + for (tmp = s_preds[succ_bb]; tmp; tmp = tmp->next) + if (tmp->val == pred_bb) + break; + if (tmp == NULL) + { + add_int_list_node (&pred_int_list_blocks, &s_preds[succ_bb], pred_bb); + num_preds[succ_bb]++; + } } if (pred_bb != ENTRY_BLOCK) { - add_int_list_node (&pred_int_list_blocks, &s_succs[pred_bb], succ_bb); - num_succs[pred_bb]++; + for (tmp = s_succs[pred_bb]; tmp; tmp = tmp->next) + if (tmp->val == succ_bb) + break; + if (tmp == NULL) + { + add_int_list_node (&pred_int_list_blocks, &s_succs[pred_bb], succ_bb); + num_succs[pred_bb]++; + } } } --- egcs64-19980921.orig/gcc/frame.c +++ egcs64-19980921/gcc/frame.c @@ -27,6 +27,9 @@ This exception does not however invalidate any other reasons why the executable file might be covered by the GNU General Public License. */ +/* Gross, but makes it build with glibc-2.1 -DaveM */ +#define __restrict + /* It is incorrect to include config.h here, because this file is being compiled for the target, and hence definitions concerning only the host do not apply. */ --- egcs64-19980921.orig/gcc/gcse.c +++ egcs64-19980921/gcc/gcse.c @@ -4146,12 +4146,18 @@ int bb, i, changed, size, passes; sbitmap_vector_ones (pre_ppin, n_basic_blocks); - /* ??? Inefficient as we set pre_ppin[0] twice, but simple. */ sbitmap_zero (pre_ppin[0]); + /* Placement Possible out is initially set on all except exit blocks. + That is, either blocks whose sole successor is exit, or who have no + successors at all, such as would be created by a function that does + not return. */ sbitmap_vector_ones (pre_ppout, n_basic_blocks); - /* ??? Inefficient as we set pre_ppout[n_basic_blocks-1] twice, but simple. */ - sbitmap_zero (pre_ppout[n_basic_blocks - 1]); + for (bb = 0; bb < n_basic_blocks; bb++) + if (s_succs[bb] == NULL + || (s_succs[bb]->next == NULL + && s_succs[bb]->val == EXIT_BLOCK)) + sbitmap_zero (pre_ppout[bb]); size = pre_ppin[0]->size; passes = 0; @@ -4171,8 +4177,9 @@ for (i = 0; i < size; i++) { int_list_ptr pred; - SBITMAP_ELT_TYPE tmp = *antin & *pavin & (*antloc | (*transp & *ppout)); - SBITMAP_ELT_TYPE pred_val = -1L; + SBITMAP_ELT_TYPE tmp, pred_val = -1L; + + tmp = *antin & *pavin & (*antloc | (*transp & *ppout)); for (pred = s_preds[bb]; pred != NULL; pred = pred->next) { @@ -4206,13 +4213,18 @@ } } - for (bb = 0; bb < n_basic_blocks - 1; bb++) + for (bb = 0; bb < n_basic_blocks; bb++) { sbitmap_ptr ppout = pre_ppout[bb]->elms; - for (i = 0; i < size; i++) + if (s_succs[bb] == NULL + || (s_succs[bb]->next == NULL + && s_succs[bb]->val == EXIT_BLOCK)) + continue; + + for (i = 0; i < size; i++, ppout++) { - int_list_ptr succ; + int_list_ptr succ = s_succs[bb]; SBITMAP_ELT_TYPE tmp = -1L; for (succ = s_succs[bb]; succ != NULL; succ = succ->next) @@ -4229,10 +4241,8 @@ if (*ppout != tmp) { changed = 1; - *ppout++ = tmp; + *ppout = tmp; } - else - ppout++; } } --- egcs64-19980921.orig/gcc/libgcc2.c +++ egcs64-19980921/gcc/libgcc2.c @@ -26,6 +26,9 @@ This exception does not however invalidate any other reasons why the executable file might be covered by the GNU General Public License. */ +/* Gross, but makes it build with glibc-2.1 -DaveM */ +#define __restrict + /* It is incorrect to include config.h here, because this file is being compiled for the target, and hence definitions concerning only the host do not apply. */ --- egcs64-19980921.orig/gcc/f/intdoc.texi +++ egcs64-19980921/gcc/f/intdoc.texi @@ -2231,7 +2231,7 @@ @emph{Caution:} Using this routine during I/O to a unit connected with a non-absolute file name can cause subsequent I/O on such a unit to fail -because the I/O library may reopen files by name. +because the I/O library might reopen files by name. Some non-GNU implementations of Fortran provide this intrinsic as only a function, not as a subroutine, or do not support the @@ -2270,7 +2270,7 @@ @emph{Caution:} Using this routine during I/O to a unit connected with a non-absolute file name can cause subsequent I/O on such a unit to fail -because the I/O library may reopen files by name. +because the I/O library might reopen files by name. Due to the side effects performed by this intrinsic, the function form is not recommended. @@ -2319,7 +2319,7 @@ Note that this currently works by actually invoking @code{/bin/chmod} (or the @code{chmod} found when -the library was configured) and so may fail in some circumstances and +the library was configured) and so might fail in some circumstances and will, anyway, be slow. Some non-GNU implementations of Fortran provide this intrinsic as @@ -2369,7 +2369,7 @@ Note that this currently works by actually invoking @code{/bin/chmod} (or the @code{chmod} found when -the library was configured) and so may fail in some circumstances and +the library was configured) and so might fail in some circumstances and will, anyway, be slow. Due to the side effects performed by this intrinsic, the function @@ -4237,7 +4237,7 @@ Description: Returns the complementary error function of @var{X}: -@samp{ERFC(R) = 1 - ERF(R)} (except that the result may be more +@samp{ERFC(R) = 1 - ERF(R)} (except that the result might be more accurate than explicitly evaluating that formulae would give). See @code{erfc(3m)}, which provides the implementation. @@ -4896,10 +4896,10 @@ Description: Attempts to move Fortran unit @var{Unit} to the specified -@var{Offset}: absolute offset if @var{Offset}=0; relative to the -current offset if @var{Offset}=1; relative to the end of the file if -@var{Offset}=2. -It branches to label @var{Whence} if @var{Unit} is +@var{Offset}: absolute offset if @var{Whence}=0; relative to the +current offset if @var{Whence}=1; relative to the end of the file if +@var{Whence}=2. +It branches to label @var{ErrLab} if @var{Unit} is not open or if the call otherwise fails. @node FStat Intrinsic (subroutine) @@ -5455,8 +5455,9 @@ (optional) @var{Status} argument. On some systems (specifically SCO) it might be necessary to link the -``socket'' library if you call this routine, i.e.@: append -@samp{-lg2c -lsocket -lm} to the @code{g77} arguments. +``socket'' library if you call this routine. +Typically this means adding @samp{-lg2c -lsocket -lm} +to the @code{g77} command line when linking the program. For information on other intrinsics with the same name: @xref{HostNm Intrinsic (function)}. @@ -5488,8 +5489,9 @@ (@code{ENOSYS} if the system does not provide @code{gethostname(2)}). On some systems (specifically SCO) it might be necessary to link the -``socket'' library if you call this routine, i.e.@: append -@samp{-lg2c -lsocket -lm} to the @code{g77} arguments. +``socket'' library if you call this routine. +Typically this means adding @samp{-lg2c -lsocket -lm} +to the @code{g77} command line when linking the program. For information on other intrinsics with the same name: @xref{HostNm Intrinsic (subroutine)}. @@ -6598,8 +6600,7 @@ indicates no shift and @samp{@var{Shift}.LT.0} indicates a right shift. If the absolute value of the shift count is greater than @samp{BIT_SIZE(@var{I})}, the result is undefined. -Bits shifted out from the left end or the right end, as the case may be, -are lost. +Bits shifted out from the left end or the right end are lost. Zeros are shifted in from the opposite end. @xref{IShftC Intrinsic} for the circular-shift equivalent. --- egcs64-19980921.orig/gcc/config/sparc/linux64.h +++ egcs64-19980921/gcc/config/sparc/linux64.h @@ -19,9 +19,7 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* ??? bi-architecture support will require changes to the linker - related specs, among perhaps other things (multilibs). */ -/* #define SPARC_BI_ARCH */ +#define SPARC_BI_ARCH #define LINUX_DEFAULT_ELF @@ -36,6 +34,16 @@ #undef MD_EXEC_PREFIX #undef MD_STARTFILE_PREFIX +#if TARGET_CPU_DEFAULT == TARGET_CPU_v9 || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc +/* A 64 bit v9 compiler with stack-bias, + in a Medium/Low code model environment. */ + +#undef TARGET_DEFAULT +#define TARGET_DEFAULT \ + (MASK_V9 + MASK_PTR64 + MASK_64BIT /* + MASK_HARD_QUAD */ \ + + MASK_STACK_BIAS + MASK_APP_REGS + MASK_EPILOGUE + MASK_FPU) +#endif + /* Output at beginning of assembler file. */ /* The .file command should always begin the output. */ #undef ASM_FILE_START @@ -54,11 +62,37 @@ object constructed before entering `main'. */ #undef STARTFILE_SPEC -#define STARTFILE_SPEC \ + +#define STARTFILE_SPEC32 \ "%{!shared: \ %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}\ crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}" +#define STARTFILE_SPEC64 \ + "%{!shared: \ + %{pg:/usr/lib64/gcrt1.o%s} %{!pg:%{p:/usr/lib64/gcrt1.o%s} %{!p:/usr/lib64/crt1.o%s}}}\ + /usr/lib64/crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}" + +#ifdef SPARC_BI_ARCH + +#if DEFAULT_ARCH32_P +#define STARTFILE_SPEC "\ +%{m32:" STARTFILE_SPEC32 "} \ +%{m64:" STARTFILE_SPEC64 "} \ +%{!m32:%{!m64:" STARTFILE_SPEC32 "}}" +#else +#define STARTFILE_SPEC "\ +%{m32:" STARTFILE_SPEC32 "} \ +%{m64:" STARTFILE_SPEC64 "} \ +%{!m32:%{!m64:" STARTFILE_SPEC64 "}}" +#endif + +#else + +#define STARTFILE_SPEC STARTFILE_SPEC64 + +#endif + /* Provide a ENDFILE_SPEC appropriate for GNU/Linux. Here we tack on the GNU/Linux magical crtend.o file (see crtstuff.c) which provides part of the support for getting C++ file-scope static @@ -66,19 +100,35 @@ GNU/Linux "finalizer" file, `crtn.o'. */ #undef ENDFILE_SPEC -#define ENDFILE_SPEC \ + +#define ENDFILE_SPEC32 \ "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s" -#undef TARGET_VERSION -#define TARGET_VERSION fprintf (stderr, " (sparc64 GNU/Linux with ELF)"); +#define ENDFILE_SPEC64 \ + "%{!shared:crtend.o%s} %{shared:crtendS.o%s} /usr/lib64/crtn.o%s" + +#ifdef SPARC_BI_ARCH -/* A 64 bit v9 compiler with stack-bias, - in a Medium/Anywhere code model environment. */ +#if DEFAULT_ARCH32_P +#define ENDFILE_SPEC "\ +%{m32:" ENDFILE_SPEC32 "} \ +%{m64:" ENDFILE_SPEC64 "} \ +%{!m32:%{!m64:" ENDFILE_SPEC32 "}}" +#else +#define ENDFILE_SPEC "\ +%{m32:" ENDFILE_SPEC32 "} \ +%{m64:" ENDFILE_SPEC64 "} \ +%{!m32:%{!m64:" ENDFILE_SPEC64 "}}" +#endif -#undef TARGET_DEFAULT -#define TARGET_DEFAULT \ - (MASK_V9 + MASK_PTR64 + MASK_64BIT /* + MASK_HARD_QUAD */ \ - + MASK_STACK_BIAS + MASK_APP_REGS + MASK_EPILOGUE + MASK_FPU) +#else + +#define ENDFILE_SPEC ENDFILE_SPEC64 + +#endif + +#undef TARGET_VERSION +#define TARGET_VERSION fprintf (stderr, " (sparc64 GNU/Linux with ELF)"); /* The default code model. */ #undef SPARC_DEFAULT_CMODEL @@ -92,7 +142,7 @@ #undef LONG_DOUBLE_TYPE_SIZE #define LONG_DOUBLE_TYPE_SIZE 128 - + #undef CPP_PREDEFINES #define CPP_PREDEFINES "-D__ELF__ -Dunix -Dsparc -Dlinux -Asystem(unix) -Asystem(posix)" @@ -126,16 +176,87 @@ /* If ELF is the default format, we should not use /lib/elf. */ +#ifdef SPARC_BI_ARCH + +#undef SUBTARGET_EXTRA_SPECS +#define SUBTARGET_EXTRA_SPECS \ + { "link_arch32", LINK_ARCH32_SPEC }, \ + { "link_arch64", LINK_ARCH64_SPEC }, \ + { "link_arch_default", LINK_ARCH_DEFAULT_SPEC }, \ + { "link_arch", LINK_ARCH_SPEC }, + +#define LINK_ARCH32_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \ + %{!shared: \ + %{!ibcs: \ + %{!static: \ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \ + %{static:-static}}} \ +" + +#define LINK_ARCH64_SPEC "-m elf64_sparc -Y P,/usr/lib64 %{shared:-shared} \ + %{!shared: \ + %{!ibcs: \ + %{!static: \ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker:-dynamic-linker /lib64/ld-linux.so.2}} \ + %{static:-static}}} \ +" + +#define LINK_ARCH_SPEC "\ +%{m32:%(link_arch32)} \ +%{m64:%(link_arch64)} \ +%{!m32:%{!m64:%(link_arch_default)}} \ +" + +#define LINK_ARCH_DEFAULT_SPEC \ +(DEFAULT_ARCH32_P ? LINK_ARCH32_SPEC : LINK_ARCH64_SPEC) + #undef LINK_SPEC -#define LINK_SPEC "-m elf64_sparc -Y P,/usr/lib %{shared:-shared} \ +#define LINK_SPEC "\ +%(link_arch) \ +%{mlittle-endian:-EL} \ +" + +#undef CC1_SPEC +#if DEFAULT_ARCH32_P +#define CC1_SPEC "\ +%{sun4:} %{target:} \ +%{mcypress:-mcpu=cypress} \ +%{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \ +%{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \ +%{m64:-mptr64 -mcpu=ultrasparc -mstack-bias} \ +" +#else +#define CC1_SPEC "\ +%{sun4:} %{target:} \ +%{mcypress:-mcpu=cypress} \ +%{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \ +%{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \ +%{m32:-mptr32 -mcpu=cypress -mno-stack-bias} \ +" +#endif + +#if DEFAULT_ARCH32_P +#define MULTILIB_DEFAULTS { "m32" } +#else +#define MULTILIB_DEFAULTS { "m64" } +#endif + +#else /* !SPARC_BI_ARCH */ + +#undef LINK_SPEC +#define LINK_ARCH_SPEC "-m elf64_sparc -Y P,/usr/lib64 %{shared:-shared} \ %{!shared: \ %{!ibcs: \ %{!static: \ %{rdynamic:-export-dynamic} \ - %{!dynamic-linker:-dynamic-linker /lib/ld-linux64.so.2}} \ + %{!dynamic-linker:-dynamic-linker /lib64/ld-linux.so.2}} \ %{static:-static}}} \ %{mlittle-endian:-EL} \ " + +#endif /* !SPARC_BI_ARCH */ /* The sun bundled assembler doesn't accept -Yd, (and neither does gas). It's safe to pass -s always, even if -g is not used. */ --- egcs64-19980921.orig/gcc/config/sparc/sparc.c +++ egcs64-19980921/gcc/config/sparc/sparc.c @@ -210,7 +210,7 @@ struct cpu_table *cpu; struct sparc_cpu_select *sel; int fpu; - + #ifndef SPARC_BI_ARCH /* Check for unsupported architecture size. */ if (! TARGET_64BIT != DEFAULT_ARCH32_P) @@ -220,8 +220,25 @@ } #endif + /* At the moment we don't allow different pointer size and architecture */ + if (! TARGET_64BIT != ! TARGET_PTR64) + { + error ("-mptr%d not allowed on -m%d", + TARGET_PTR64 ? 64 : 32, TARGET_64BIT ? 64 : 32); + if (TARGET_64BIT) + target_flags |= MASK_PTR64; + else + target_flags &= ~MASK_PTR64; + } + /* Code model selection. */ sparc_cmodel = SPARC_DEFAULT_CMODEL; + +#ifdef SPARC_BI_ARCH + if (TARGET_ARCH32) + sparc_cmodel = CM_32; +#endif + if (sparc_cmodel_string != NULL) { if (TARGET_ARCH64) @@ -280,8 +297,8 @@ if (TARGET_V9 && TARGET_ARCH32) target_flags |= MASK_DEPRECATED_V8_INSNS; - /* V8PLUS requires V9 */ - if (! TARGET_V9) + /* V8PLUS requires V9, makes no sense in 64 bit mode. */ + if (! TARGET_V9 || TARGET_ARCH64) target_flags &= ~MASK_V8PLUS; /* Don't use stack biasing in 32 bit mode. */ @@ -1018,7 +1035,7 @@ return ((GET_CODE (op) == CONST_INT && ((INTVAL (op) >= 0 && INTVAL (op) < 0x1000) || (INTVAL (op) >= 0xFFFFF000 - && INTVAL (op) < 0x100000000))) + && INTVAL (op) < ((unsigned HOST_WIDE_INT)0xFFFFFFFF) + 1))) || GET_CODE (op) == CONSTANT_P_RTX); #else return (((GET_CODE (op) == CONST_INT && (unsigned) INTVAL (op) < 0x1000) @@ -2242,9 +2259,14 @@ src = SET_SRC (pat); - /* This matches "*return_[qhs]i". */ + /* This matches "*return_[qhs]i" or even "*return_di" on TARGET_ARCH64. */ if (arith_operand (src, GET_MODE (src))) - return GET_MODE_SIZE (GET_MODE (src)) <= GET_MODE_SIZE (SImode); + { + if (TARGET_ARCH64) + return GET_MODE_SIZE (GET_MODE (src)) <= GET_MODE_SIZE (DImode); + else + return GET_MODE_SIZE (GET_MODE (src)) <= GET_MODE_SIZE (SImode); + } /* This matches "*return_di". */ else if (arith_double_operand (src, GET_MODE (src))) @@ -4215,6 +4237,12 @@ mode = mode_for_size (bytes * BITS_PER_UNIT, MODE_INT, 0); } } + + if (TARGET_ARCH64 + && GET_MODE_CLASS (mode) == MODE_INT + && GET_MODE_SIZE (mode) < UNITS_PER_WORD + && type && TREE_CODE (type) != UNION_TYPE) + mode = DImode; if (incoming_p) regno = BASE_RETURN_VALUE_REG (mode); @@ -5453,6 +5481,11 @@ sparc64_initialize_trampoline (tramp, fnaddr, cxt) rtx tramp, fnaddr, cxt; { +#ifdef TRANSFER_FROM_TRAMPOLINE + emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "__enable_execute_stack"), + 0, VOIDmode, 1, tramp, Pmode); +#endif + /* rd %pc, %g1 ldx [%g1+24], %g5 @@ -5466,12 +5499,13 @@ emit_move_insn (gen_rtx_MEM (SImode, plus_constant (tramp, 4)), GEN_INT (0xca586018)); emit_move_insn (gen_rtx_MEM (SImode, plus_constant (tramp, 8)), - GEN_INT (0x81c04000)); + GEN_INT (0x81c14000)); emit_move_insn (gen_rtx_MEM (SImode, plus_constant (tramp, 12)), GEN_INT (0xca586010)); emit_move_insn (gen_rtx_MEM (DImode, plus_constant (tramp, 16)), cxt); - emit_move_insn (gen_rtx_MEM (DImode, plus_constant (tramp, 20)), fnaddr); + emit_move_insn (gen_rtx_MEM (DImode, plus_constant (tramp, 24)), fnaddr); emit_insn (gen_flush (validize_mem (gen_rtx_MEM (DImode, tramp)))); + if (sparc_cpu != PROCESSOR_ULTRASPARC) emit_insn (gen_flush (validize_mem (gen_rtx_MEM (DImode, plus_constant (tramp, 8))))); } --- egcs64-19980921.orig/gcc/config/sparc/sparc.h +++ egcs64-19980921/gcc/config/sparc/sparc.h @@ -109,34 +109,74 @@ #define TARGET_CPU_sparc64 5 /* alias */ #define TARGET_CPU_ultrasparc 6 -#if TARGET_CPU_DEFAULT == TARGET_CPU_sparc || TARGET_CPU_DEFAULT == TARGET_CPU_v8 || TARGET_CPU_DEFAULT == TARGET_CPU_supersparc -#define CPP_CPU_DEFAULT_SPEC "" -#define ASM_CPU_DEFAULT_SPEC "" -#endif -#if TARGET_CPU_DEFAULT == TARGET_CPU_sparclet -#define CPP_CPU_DEFAULT_SPEC "-D__sparclet__" -#define ASM_CPU_DEFAULT_SPEC "-Asparclet" -#endif -#if TARGET_CPU_DEFAULT == TARGET_CPU_sparclite -#define CPP_CPU_DEFAULT_SPEC "-D__sparclite__" -#define ASM_CPU_DEFAULT_SPEC "-Asparclite" -#endif +#if TARGET_CPU_DEFAULT == TARGET_CPU_v9 || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc + +#define CPP_CPU32_DEFAULT_SPEC "" +#define ASM_CPU32_DEFAULT_SPEC "" + #if TARGET_CPU_DEFAULT == TARGET_CPU_v9 /* ??? What does Sun's CC pass? */ -#define CPP_CPU_DEFAULT_SPEC "-D__sparc_v9__" +#define CPP_CPU64_DEFAULT_SPEC "-D__sparc_v9__" /* ??? It's not clear how other assemblers will handle this, so by default use GAS. Sun's Solaris assembler recognizes -xarch=v8plus, but this case is handled in sol2.h. */ -#define ASM_CPU_DEFAULT_SPEC "-Av9" +#define ASM_CPU64_DEFAULT_SPEC "-Av9" #endif #if TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc -#define CPP_CPU_DEFAULT_SPEC "-D__sparc_v9__" -#define ASM_CPU_DEFAULT_SPEC "-Av9a" +#define CPP_CPU64_DEFAULT_SPEC "-D__sparc_v9__" +#define ASM_CPU64_DEFAULT_SPEC "-Av9a" +#endif + +#else + +#define CPP_CPU64_DEFAULT_SPEC "" +#define ASM_CPU64_DEFAULT_SPEC "" + +#if TARGET_CPU_DEFAULT == TARGET_CPU_sparc || TARGET_CPU_DEFAULT == TARGET_CPU_v8 || TARGET_CPU_DEFAULT == TARGET_CPU_supersparc +#define CPP_CPU32_DEFAULT_SPEC "" +#define ASM_CPU32_DEFAULT_SPEC "" +#endif +#if TARGET_CPU_DEFAULT == TARGET_CPU_sparclet +#define CPP_CPU32_DEFAULT_SPEC "-D__sparclet__" +#define ASM_CPU32_DEFAULT_SPEC "-Asparclet" +#endif +#if TARGET_CPU_DEFAULT == TARGET_CPU_sparclite +#define CPP_CPU32_DEFAULT_SPEC "-D__sparclite__" +#define ASM_CPU32_DEFAULT_SPEC "-Asparclite" #endif -#ifndef CPP_CPU_DEFAULT_SPEC + +#endif + +#if !defined(CPP_CPU32_DEFAULT_SPEC) || !defined(CPP_CPU64_DEFAULT_SPEC) Unrecognized value in TARGET_CPU_DEFAULT. #endif +#ifdef SPARC_BI_ARCH + +#define CPP_CPU_DEFAULT_SPEC \ +(DEFAULT_ARCH32_P ? "\ +%{m64:" CPP_CPU64_DEFAULT_SPEC "} \ +%{!m64:" CPP_CPU32_DEFAULT_SPEC "} \ +" : "\ +%{m32:" CPP_CPU32_DEFAULT_SPEC "} \ +%{!m32:" CPP_CPU64_DEFAULT_SPEC "} \ +") +#define ASM_CPU_DEFAULT_SPEC \ +(DEFAULT_ARCH32_P ? "\ +%{m64:" ASM_CPU64_DEFAULT_SPEC "} \ +%{!m64:" ASM_CPU32_DEFAULT_SPEC "} \ +" : "\ +%{m32:" ASM_CPU32_DEFAULT_SPEC "} \ +%{!m32:" ASM_CPU64_DEFAULT_SPEC "} \ +") + +#else /* !SPARC_BI_ARCH */ + +#define CPP_CPU_DEFAULT_SPEC (DEFAULT_ARCH32_P ? CPP_CPU32_DEFAULT_SPEC : CPP_CPU64_DEFAULT_SPEC) +#define ASM_CPU_DEFAULT_SPEC (DEFAULT_ARCH32_P ? ASM_CPU32_DEFAULT_SPEC : ASM_CPU64_DEFAULT_SPEC) + +#endif /* !SPARC_BI_ARCH */ + /* Names to predefine in the preprocessor for this target machine. ??? It would be nice to not include any subtarget specific values here, however there's no way to portably provide subtarget values to @@ -171,8 +211,20 @@ sparc64 in 32 bit environments, so for now we only use `sparc64' in 64 bit environments. */ +#ifdef SPARC_BI_ARCH + +#define CPP_ARCH32_SPEC "-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int \ +-D__GCC_NEW_VARARGS__ -Acpu(sparc) -Amachine(sparc)" +#define CPP_ARCH64_SPEC "-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int \ +-D__arch64__ -Acpu(sparc64) -Amachine(sparc64)" + +#else + #define CPP_ARCH32_SPEC "-D__GCC_NEW_VARARGS__ -Acpu(sparc) -Amachine(sparc)" #define CPP_ARCH64_SPEC "-D__arch64__ -Acpu(sparc64) -Amachine(sparc64)" + +#endif + #define CPP_ARCH_DEFAULT_SPEC \ (DEFAULT_ARCH32_P ? CPP_ARCH32_SPEC : CPP_ARCH64_SPEC) @@ -413,8 +465,7 @@ /* 0x2000, 0x4000 are unused */ /* Nonzero if pointers are 64 bits. - This is not a user selectable option, though it may be one day - - so it is used to determine pointer size instead of an architecture flag. */ + At the moment it must follow architecture size flag. */ #define MASK_PTR64 0x8000 #define TARGET_PTR64 (target_flags & MASK_PTR64) @@ -512,9 +563,8 @@ {"v8", 0}, \ {"supersparc", 0}, \ /* End of deprecated options. */ \ - /* -mptrNN exists for *experimental* purposes. */ \ -/* {"ptr64", MASK_PTR64}, */ \ -/* {"ptr32", -MASK_PTR64}, */ \ + {"ptr64", MASK_PTR64}, \ + {"ptr32", -MASK_PTR64}, \ {"32", -MASK_64BIT}, \ {"64", MASK_64BIT}, \ {"stack-bias", MASK_STACK_BIAS}, \ --- egcs64-19980921.orig/gcc/config/sparc/t-sol2 +++ egcs64-19980921/gcc/config/sparc/t-sol2 @@ -6,19 +6,19 @@ LIBGCC1_TEST = # gmon build rule: -gmon.o: $(srcdir)/config/sparc/gmon-sol2.c $(GCC_PASSES) $(CONFIG_H) stmp-int-hdrs - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \ - -c $(srcdir)/config/sparc/gmon-sol2.c -o gmon.o +$(T)gmon.o: $(srcdir)/config/sparc/gmon-sol2.c $(GCC_PASSES) $(CONFIG_H) stmp-int-hdrs + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) \ + -c $(srcdir)/config/sparc/gmon-sol2.c -o $(T)gmon.o # Assemble startup files. -crt1.o: $(srcdir)/config/sparc/sol2-c1.asm $(GCC_PASSES) - $(GCC_FOR_TARGET) -c -o crt1.o -x assembler-with-cpp $(srcdir)/config/sparc/sol2-c1.asm -crti.o: $(srcdir)/config/sparc/sol2-ci.asm $(GCC_PASSES) - $(GCC_FOR_TARGET) -c -o crti.o -x assembler-with-cpp $(srcdir)/config/sparc/sol2-ci.asm -crtn.o: $(srcdir)/config/sparc/sol2-cn.asm $(GCC_PASSES) - $(GCC_FOR_TARGET) -c -o crtn.o -x assembler-with-cpp $(srcdir)/config/sparc/sol2-cn.asm -gcrt1.o: $(srcdir)/config/sparc/sol2-c1.asm $(GCC_PASSES) - $(GCC_FOR_TARGET) -c -DGCRT1 -o gcrt1.o -x assembler-with-cpp $(srcdir)/config/sparc/sol2-c1.asm +$(T)crt1.o: $(srcdir)/config/sparc/sol2-c1.asm $(GCC_PASSES) + $(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -c -o $(T)crt1.o -x assembler-with-cpp $(srcdir)/config/sparc/sol2-c1.asm +$(T)crti.o: $(srcdir)/config/sparc/sol2-ci.asm $(GCC_PASSES) + $(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -c -o $(T)crti.o -x assembler-with-cpp $(srcdir)/config/sparc/sol2-ci.asm +$(T)crtn.o: $(srcdir)/config/sparc/sol2-cn.asm $(GCC_PASSES) + $(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -c -o $(T)crtn.o -x assembler-with-cpp $(srcdir)/config/sparc/sol2-cn.asm +$(T)gcrt1.o: $(srcdir)/config/sparc/sol2-c1.asm $(GCC_PASSES) + $(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) -c -DGCRT1 -o $(T)gcrt1.o -x assembler-with-cpp $(srcdir)/config/sparc/sol2-c1.asm # We need to use -fPIC when we are using gcc to compile the routines in # crtstuff.c. This is only really needed when we are going to use gcc/g++ --- egcs64-19980921.orig/gcc/config/sparc/xm-sp64.h +++ egcs64-19980921/gcc/config/sparc/xm-sp64.h @@ -21,5 +21,7 @@ #include /* This describes the machine the compiler is hosted on. */ +#if defined(__arch64__) || defined(__sparc_v9__) || defined(__sparcv9) #undef HOST_BITS_PER_LONG #define HOST_BITS_PER_LONG 64 +#endif --- egcs64-19980921.orig/gcc/config/sparc/sol2-sld-64.h +++ egcs64-19980921/gcc/config/sparc/sol2-sld-64.h @@ -1,6 +1,8 @@ /* Definitions of target machine for GNU compiler, for 64-bit SPARC running Solaris 2 using the system linker. */ +#define SPARC_BI_ARCH + #include "sparc/sol2.h" /* At least up through Solaris 2.6, @@ -12,14 +14,12 @@ /* A 64 bit v9 compiler with stack-bias */ +#if TARGET_CPU_DEFAULT == TARGET_CPU_v9 || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc #undef TARGET_DEFAULT #define TARGET_DEFAULT \ (MASK_V9 + MASK_PTR64 + MASK_64BIT /* + MASK_HARD_QUAD */ + \ MASK_STACK_BIAS + MASK_APP_REGS + MASK_EPILOGUE + MASK_FPU) - -/* ??? bi-architecture support will require changes to the linker - related specs, among perhaps other things (multilibs). */ -/* #define SPARC_BI_ARCH */ +#endif /* The default code model. */ #undef SPARC_DEFAULT_CMODEL @@ -28,58 +28,243 @@ #undef LONG_DOUBLE_TYPE_SIZE #define LONG_DOUBLE_TYPE_SIZE 128 +#undef ASM_CPU32_DEFAULT_SPEC +#define ASM_CPU32_DEFAULT_SPEC "" +#undef ASM_CPU64_DEFAULT_SPEC +#define ASM_CPU64_DEFAULT_SPEC "-xarch=v9" + #if TARGET_CPU_DEFAULT == TARGET_CPU_v9 -#undef CPP_CPU_DEFAULT_SPEC -#define CPP_CPU_DEFAULT_SPEC "-D__sparcv9" -#undef ASM_CPU_DEFAULT_SPEC -#define ASM_CPU_DEFAULT_SPEC "-xarch=v9" -#undef CPP_CPU_SPEC -#define CPP_CPU_SPEC "\ -%{mcypress:} \ -%{msparclite:-D__sparclite__} \ -%{mf930:-D__sparclite__} %{mf934:-D__sparclite__} \ -%{mv8:-D__sparcv8} \ -%{msupersparc:-D__supersparc__ -D__sparcv8} \ -%{mcpu=sparclet:-D__sparclet__} %{mcpu=tsc701:-D__sparclet__} \ -%{mcpu=sparclite:-D__sparclite__} \ -%{mcpu=f930:-D__sparclite__} %{mcpu=f934:-D__sparclite__} \ -%{mcpu=v8:-D__sparc_v8__} \ -%{mcpu=supersparc:-D__supersparc__ -D__sparcv8} \ -%{mcpu=v9:-D__sparcv9} \ -%{mcpu=ultrasparc:-D__sparcv9} \ -%{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8:%{!msupersparc:%(cpp_cpu_default)}}}}}}} \ -" +#undef CPP_CPU64_DEFAULT_SPEC +#define CPP_CPU64_DEFAULT_SPEC "" +#undef ASM_CPU32_DEFAULT_SPEC +#define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plus" #endif #if TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc -#undef CPP_CPU_DEFAULT_SPEC -#define CPP_CPU_DEFAULT_SPEC "-D__sparcv9" -#undef ASM_CPU_DEFAULT_SPEC -#define ASM_CPU_DEFAULT_SPEC "-xarch=v9a" +#undef CPP_CPU64_DEFAULT_SPEC +#define CPP_CPU64_DEFAULT_SPEC "" +#undef ASM_CPU32_DEFAULT_SPEC +#define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plusa" +#undef ASM_CPU64_DEFAULT_SPEC +#define ASM_CPU64_DEFAULT_SPEC "-xarch=v9a" +#endif + +/* The sun bundled assembler doesn't accept -Yd, (and neither does gas). + It's safe to pass -s always, even if -g is not used. */ +#undef ASM_SPEC +#define ASM_SPEC "\ +%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s \ +%{fpic:-K PIC} %{fPIC:-K PIC} \ +%(asm_cpu)\ +" + +#if DEFAULT_ARCH32_P +#define DEF_ARCH32_SPEC(__str) "%{!m64:" __str "}" +#define DEF_ARCH64_SPEC(__str) "%{m64:" __str "}" +#else +#define DEF_ARCH32_SPEC(__str) "%{m32:" __str "}" +#define DEF_ARCH64_SPEC(__str) "%{!m32:" __str "}" +#endif + #undef CPP_CPU_SPEC #define CPP_CPU_SPEC "\ %{mcypress:} \ %{msparclite:-D__sparclite__} \ %{mf930:-D__sparclite__} %{mf934:-D__sparclite__} \ -%{mv8:-D__sparcv8} \ -%{msupersparc:-D__supersparc__ -D__sparcv8} \ +%{mv8:" DEF_ARCH32_SPEC("-D__sparcv8") "} \ +%{msupersparc:-D__supersparc__ " DEF_ARCH32_SPEC("-D__sparcv8") "} \ %{mcpu=sparclet:-D__sparclet__} %{mcpu=tsc701:-D__sparclet__} \ %{mcpu=sparclite:-D__sparclite__} \ %{mcpu=f930:-D__sparclite__} %{mcpu=f934:-D__sparclite__} \ -%{mcpu=v8:-D__sparc_v8__} \ -%{mcpu=supersparc:-D__supersparc__ -D__sparcv8} \ -%{mcpu=v9:-D__sparcv9} \ -%{mcpu=ultrasparc:-D__sparcv9} \ +%{mcpu=v8:" DEF_ARCH32_SPEC("-D__sparcv8") "} \ +%{mcpu=supersparc:-D__supersparc__ " DEF_ARCH32_SPEC("-D__sparcv8") "} \ +%{mcpu=v9:" DEF_ARCH32_SPEC("-D__sparcv8") "} \ +%{mcpu=ultrasparc:" DEF_ARCH32_SPEC("-D__sparcv8") "} \ %{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8:%{!msupersparc:%(cpp_cpu_default)}}}}}}} \ " -#endif #undef ASM_CPU_SPEC -#define ASM_CPU_SPEC "\ -%{mcpu=v8plus:-xarch=v8plus} \ -%{mcpu=ultrasparc:-xarch=v9a} \ +#define ASM_CPU_SPEC " +%{mcpu=ultrasparc:" DEF_ARCH32_SPEC("-xarch=v8plusa") DEF_ARCH64_SPEC("-xarch=v9a") "} \ +%{mcpu=v9:" DEF_ARCH32_SPEC("-xarch=v8plus") DEF_ARCH64_SPEC("-xarch=v9") "} \ +%{!mcpu=ultrasparc:%{!mcpu=v9:%{mcpu*:" DEF_ARCH32_SPEC("-xarch=v8") DEF_ARCH64_SPEC("-xarch=v9") "}}} \ %{!mcpu*:%(asm_cpu_default)} \ " +#define STARTFILE_SPEC32 "\ +%{ansi:values-Xc.o%s} \ +%{!ansi: \ + %{traditional:values-Xt.o%s} \ + %{!traditional:values-Xa.o%s}}" + +#define STARTFILE_SPEC64 "\ +%{ansi:/usr/lib/sparcv9/values-Xc.o%s} \ +%{!ansi: \ + %{traditional:/usr/lib/sparcv9/values-Xt.o%s} \ + %{!traditional:/usr/lib/sparcv9/values-Xa.o%s}}" + +#ifdef SPARC_BI_ARCH + +#if DEFAULT_ARCH32_P +#define STARTFILE_ARCH_SPEC "\ +%{m32:" STARTFILE_SPEC32 "} \ +%{m64:" STARTFILE_SPEC64 "} \ +%{!m32:%{!m64:" STARTFILE_SPEC32 "}}" +#else +#define STARTFILE_ARCH_SPEC "\ +%{m32:" STARTFILE_SPEC32 "} \ +%{m64:" STARTFILE_SPEC64 "} \ +%{!m32:%{!m64:" STARTFILE_SPEC64 "}}" +#endif + +#else /* !SPARC_BI_ARCH */ + +/* In this case we define MD_STARTFILE_PREFIX to /usr/lib/sparcv9/ */ +#define STARTFILE_ARCH_SPEC STARTFILE_SPEC32 + +#endif /* !SPARC_BI_ARCH */ + +#undef STARTFILE_SPEC +#define STARTFILE_SPEC "%{!shared: \ + %{!symbolic: \ + %{p:mcrt1.o%s} \ + %{!p: \ + %{pg:gcrt1.o%s gmon.o%s} \ + %{!pg:crt1.o%s}}}} \ + crti.o%s" STARTFILE_ARCH_SPEC " \ + crtbegin.o%s" + +#ifdef SPARC_BI_ARCH + +#undef CPP_CPU_DEFAULT_SPEC +#define CPP_CPU_DEFAULT_SPEC \ +(DEFAULT_ARCH32_P ? "\ +%{m64:" CPP_CPU64_DEFAULT_SPEC "} \ +%{!m64:" CPP_CPU32_DEFAULT_SPEC "} \ +" : "\ +%{m32:" CPP_CPU32_DEFAULT_SPEC "} \ +%{!m32:" CPP_CPU64_DEFAULT_SPEC "} \ +") + +#undef ASM_CPU_DEFAULT_SPEC +#define ASM_CPU_DEFAULT_SPEC \ +(DEFAULT_ARCH32_P ? "\ +%{m64:" ASM_CPU64_DEFAULT_SPEC "} \ +%{!m64:" ASM_CPU32_DEFAULT_SPEC "} \ +" : "\ +%{m32:" ASM_CPU32_DEFAULT_SPEC "} \ +%{!m32:" ASM_CPU64_DEFAULT_SPEC "} \ +") + +#undef CPP_ARCH32_SPEC +#define CPP_ARCH32_SPEC "-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int \ +-D__GCC_NEW_VARARGS__ -Acpu(sparc) -Amachine(sparc)" +#undef CPP_ARCH64_SPEC +#define CPP_ARCH64_SPEC "-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int \ +-D__arch64__ -Acpu(sparc64) -Amachine(sparcv9) -D__sparcv9" + +#undef CPP_ARCH_SPEC +#define CPP_ARCH_SPEC "\ +%{m32:%(cpp_arch32)} \ +%{m64:%(cpp_arch64)} \ +%{!m32:%{!m64:%(cpp_arch_default)}} \ +" + +#undef ASM_ARCH_SPEC +#define ASM_ARCH_SPEC "" + +#undef ASM_ARCH32_SPEC +#define ASM_ARCH32_SPEC "" + +#undef ASM_ARCH64_SPEC +#define ASM_ARCH64_SPEC "" + +#undef ASM_ARCH_DEFAULT_SPEC +#define ASM_ARCH_DEFAULT_SPEC "" + +#undef SUBTARGET_EXTRA_SPECS +#define SUBTARGET_EXTRA_SPECS \ + { "link_arch32", LINK_ARCH32_SPEC }, \ + { "link_arch64", LINK_ARCH64_SPEC }, \ + { "link_arch_default", LINK_ARCH_DEFAULT_SPEC }, \ + { "link_arch", LINK_ARCH_SPEC }, + +/* This should be the same as in svr4.h, except with -R added. */ +#define LINK_ARCH32_SPEC \ + "%{G:-G} \ + %{YP,*} \ + %{R*} \ + %{compat-bsd: \ + %{!YP,*:%{p:-Y P,/usr/ucblib:/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \ + %{pg:-Y P,/usr/ucblib:/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \ + %{!p:%{!pg:-Y P,/usr/ucblib:/usr/ccs/lib:/usr/lib}}} \ + -R /usr/ucblib} \ + %{!compat-bsd: \ + %{!YP,*:%{p:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \ + %{pg:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \ + %{!p:%{!pg:-Y P,/usr/ccs/lib:/usr/lib}}}}" + +#define LINK_ARCH64_SPEC \ + "%{mcmodel=medlow:-M /usr/lib/ld/sparcv9/map.below4G} \ + %{G:-G} \ + %{YP,*} \ + %{R*} \ + %{compat-bsd: \ + %{!YP,*:%{p:-Y P,/usr/ucblib/sparcv9:/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \ + %{pg:-Y P,/usr/ucblib/sparcv9:/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \ + %{!p:%{!pg:-Y P,/usr/ucblib/sparcv9:/usr/lib/sparcv9}}} \ + -R /usr/ucblib} \ + %{!compat-bsd: \ + %{!YP,*:%{p:-Y P,/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \ + %{pg:-Y P,/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \ + %{!p:%{!pg:-Y P,/usr/lib/sparcv9}}}}" + +#define LINK_ARCH_SPEC "\ +%{m32:%(link_arch32)} \ +%{m64:%(link_arch64)} \ +%{!m32:%{!m64:%(link_arch_default)}} \ +" + +#define LINK_ARCH_DEFAULT_SPEC \ +(DEFAULT_ARCH32_P ? LINK_ARCH32_SPEC : LINK_ARCH64_SPEC) + +#undef LINK_SPEC +#define LINK_SPEC \ + "%{h*} %{v:-V} \ + %{b} %{Wl,*:%*} \ + %{static:-dn -Bstatic} \ + %{shared:-G -dy %{!mimpure-text:-z text}} \ + %{symbolic:-Bsymbolic -G -dy -z text} \ + %(link_arch) \ + %{Qy:} %{!Qn:-Qy}" + +#undef CC1_SPEC +#if DEFAULT_ARCH32_P +#define CC1_SPEC "\ +%{sun4:} %{target:} \ +%{mcypress:-mcpu=cypress} \ +%{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \ +%{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \ +%{m64:-mptr64 -mcpu=v9 -mstack-bias -mno-v8plus} \ +" +#else +#define CC1_SPEC "\ +%{sun4:} %{target:} \ +%{mcypress:-mcpu=cypress} \ +%{msparclite:-mcpu=sparclite} %{mf930:-mcpu=f930} %{mf934:-mcpu=f934} \ +%{mv8:-mcpu=v8} %{msupersparc:-mcpu=supersparc} \ +%{m32:-mptr32 -mcpu=cypress -mno-stack-bias} \ +%{mv8plus:-m32 -mptr32 -mcpu=cypress -mno-stack-bias} \ +" +#endif + +#if DEFAULT_ARCH32_P +#define MULTILIB_DEFAULTS { "m32" } +#else +#define MULTILIB_DEFAULTS { "m64" } +#endif + +#else /* !SPARC_BI_ARCH */ + /* * This should be the same as in sol2-sld.h, except with "/sparcv9" * appended to the paths and /usr/ccs/lib is no longer necessary @@ -105,6 +290,25 @@ %{pg:-Y P,/usr/lib/libp/sparcv9:/usr/lib/sparcv9} \ %{!p:%{!pg:-Y P,/usr/lib/sparcv9}}}} \ %{Qy:} %{!Qn:-Qy}" - + #undef MD_STARTFILE_PREFIX -#define MD_STARTFILE_PREFIX "/usr/ccs/lib/sparcv9/" +#define MD_STARTFILE_PREFIX "/usr/lib/sparcv9/" + +/* Attempt to turn on access permissions for the stack. */ + +#define TRANSFER_FROM_TRAMPOLINE \ +void \ +__enable_execute_stack (addr) \ + void *addr; \ +{ \ + long size = getpagesize (); \ + long mask = ~(size-1); \ + char *page = (char *) (((long) addr) & mask); \ + char *end = (char *) ((((long) (addr + TRAMPOLINE_SIZE)) & mask) + size); \ + \ + /* 7 is PROT_READ | PROT_WRITE | PROT_EXEC */ \ + if (mprotect (page, end - page, 7) < 0) \ + perror ("mprotect of trampoline code"); \ +} + +#endif /* ! SPARC_BI_ARCH */ --- egcs64-19980921.orig/gcc/config/sparc/xm-sysv4-64.h +++ egcs64-19980921/gcc/config/sparc/xm-sysv4-64.h @@ -21,5 +21,7 @@ #include /* This describes the machine the compiler is hosted on. */ +#if defined(__arch64__) || defined(__sparc_v9__) || defined(__sparcv9) #undef HOST_BITS_PER_LONG #define HOST_BITS_PER_LONG 64 +#endif --- egcs64-19980921.orig/gcc/config/sparc/t-linux64 +++ egcs64-19980921/gcc/config/sparc/t-linux64 @@ -0,0 +1,21 @@ +MULTILIB_OPTIONS = m64/m32 +MULTILIB_DIRNAMES = 64 32 +MULTILIB_MATCHES = + +LIBGCC = stmp-multilib +INSTALL_LIBGCC = install-multilib + +EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o crtbeginS.o crtendS.o + +tcrtbeginS.o: crtstuff.c $(GCC_PASSES) $(CONFIG_H) \ + defaults.h frame.h gbl-ctors.h + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \ + -finhibit-size-directive -fno-inline-functions -fno-exceptions $(CRTSTUFF_T_CFLAGS_S) \ + -c $(srcdir)/crtstuff.c -DCRT_BEGIN -o tcrtbeginS$(objext) + +tcrtendS.o: crtstuff.c $(GCC_PASSES) $(CONFIG_H) \ + defaults.h frame.h gbl-ctors.h + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \ + -finhibit-size-directive -fno-inline-functions -fno-exceptions $(CRTSTUFF_T_CFLAGS_S) \ + -c $(srcdir)/crtstuff.c -DCRT_END -o tcrtendS$(objext) + --- egcs64-19980921.orig/gcc/config/sparc/t-sol2-64 +++ egcs64-19980921/gcc/config/sparc/t-sol2-64 @@ -0,0 +1,8 @@ +MULTILIB_OPTIONS = m32/m64 +MULTILIB_DIRNAMES = sparcv7 sparcv9 +MULTILIB_MATCHES = + +LIBGCC = stmp-multilib +INSTALL_LIBGCC = install-multilib + +EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o gmon.o crt1.o crti.o crtn.o gcrt1.o --- egcs64-19980921.orig/debian/README.debian +++ egcs64-19980921/debian/README.debian @@ -0,0 +1,13 @@ +egcs64 for DEBIAN +---------------------- + +This program is compromised of the egcs64 package from RedHat including +their patches. It was based on the UltraPenguin egcs64 compiler using an +egcs snapshot from Sept, 21 1998. It is only useful for compiling kernels. +When a sparc64 capable compiler is ready for compiling binaries, it will +be packaged as gcc-64. + +Ben Collins + +(originally packaged by) +Steve Dunham , Mon, 14 Dec 1998 22:09:05 -0500 --- egcs64-19980921.orig/debian/changelog +++ egcs64-19980921/debian/changelog @@ -0,0 +1,61 @@ +egcs64 (1:19980921-4) frozen unstable; urgency=low + + * Up the priority of our alternative for sparc64-linux-gcc so we are + made default above gcc. This makes sure sparc64 kernels get built + with this by default, which is what we want to avoid problems. + + -- Ben Collins Tue, 28 Mar 2000 10:34:46 -0500 + +egcs64 (1:19980921-3) unstable; urgency=low + + * sparc64-linux-gcc is now provided via an alternative since the next + gcc will also have -m64 support and provide this. + + -- Ben Collins Sun, 29 Aug 1999 11:40:23 -0400 + +egcs64 (1:19980921-2) unstable; urgency=low + + * Added patch for gsce.c and flow.c to fix X and kaffe problems. + + -- Ben Collins Fri, 20 Aug 1999 20:46:00 -0400 + +egcs64 (1:19980921-1) unstable; urgency=low + + * Back ported to RedHat version including their patches + + -- Ben Collins Thu, 29 Jul 1999 11:46:37 -0400 + +egcs64 (19990402-2) unstable; urgency=low + + * Get rid of collect2 or we have compile problems (not kernel ones + though). + + -- Ben Collins Mon, 5 Apr 1999 15:47:39 -0400 + +egcs64 (19990402-1) unstable; urgency=low + + * NMU + * Upgraded to the latest egcs CVS, did not use UltraPenguin patches, + this is purely egcs. + * Disable haifa scheduler and patch gcc/sched.c to allow glibc to + compile (still needs work for a usable compile) + * Added /usr/sparc-linux to satisfy certain binutils problems when + looking for elf_sparc64 + * Updated control file information as well as copyright and + README.Debian + * Changed build setup to be a cross-compile instead of a sparc64-linux + compile + + -- Ben Collins Fri, 2 Apr 1999 18:11:58 -0500 + +egcs64 (19980921-1) unstable; urgency=low + + * Original code and patches taken from Ultrapenguin egcs64 package + * Initial Release. + + -- Steve Dunham Mon, 14 Dec 1998 22:09:05 -0500 + +Local variables: +mode: debian-changelog +add-log-mailing-address: "dunham@debian.org" +End: --- egcs64-19980921.orig/debian/copyright +++ egcs64-19980921/debian/copyright @@ -0,0 +1,39 @@ +This package was debianized by Steve Dunham dunham@debian.org on +Mon, 14 Dec 1998 22:09:05 -0500. + +This source was obtained from the egcs cvs repository. Information is +available at http://egcs.cygnus.com + +Copyright: GPL + +EGCS is derived from gcc, and retains the same ownership and copyright. + +GCC is Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, +1994, 1995, 1996, 1997, 1998 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, 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, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. + +On Debian GNU/Linux systems, the complete text of the GNU General +Public License can be found in `/usr/doc/copyright/GPL'. + +libg++ is copyright Free Software Foundation, and is licensed under +the GNU Library General Public License which on Debian GNU/Linux +systems can be found as `/usr/doc/copyright/LGPL'. + +gpc is copyright Free Software Foundation, and is licensed under the +GNU General Public License which on Debian GNU/Linux systems can be +found as `/usr/doc/copyright/GPL'. + --- egcs64-19980921.orig/debian/dirs +++ egcs64-19980921/debian/dirs @@ -0,0 +1,3 @@ +usr/bin +usr/lib +usr/sparc-linux --- egcs64-19980921.orig/debian/docs +++ egcs64-19980921/debian/docs @@ -0,0 +1 @@ +README --- egcs64-19980921.orig/debian/control +++ egcs64-19980921/debian/control @@ -0,0 +1,12 @@ +Source: egcs64 +Section: devel +Priority: standard +Maintainer: Steve Dunham +Standards-Version: 2.5.0.0 + +Package: egcs64 +Architecture: sparc +Depends: ${shlibs:Depends} +Description: C Cross-Compiler for 64 bit UltraSPARC kernels + This package contains a cross-compiler for compiling 64 bit binaries on sparc + systems (mainly 64 bit UltraSPARC kernels). --- egcs64-19980921.orig/debian/rules +++ egcs64-19980921/debian/rules @@ -0,0 +1,82 @@ +#!/usr/bin/make -f +# MAde with the aid of dh_make, by Craig Small +# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess. +# Some lines taken from debmake, by Cristoph Lameter. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +build: build-stamp +build-stamp: configure-stamp + dh_testdir + -cd obj-sparc64-linux && make CFLAGS='-O2' LANGUAGES=c cross + touch build-stamp + +configure-stamp: + rm -rf obj-sparc64-linux + mkdir obj-sparc64-linux + cd obj-sparc64-linux && MAKEINFO="makeinfo --no-split" \ + AR_FOR_TARGET=ar LIBGCC2_INCLUDES=-I/usr/include CC=gcc \ + ../configure --prefix=/usr \ + --enable-shared --enable-threads --enable-languages="" \ + --enable-version-specific-runtime-libs sparc64-linux + # Do this to trick the cross compile + touch obj-sparc64-linux/gcc/{g,c}++ + touch obj-sparc64-linux/gcc/{gcc,cpp}.info + + touch configure-stamp + +clean: + dh_testdir + dh_testroot + rm -f build-stamp install-stamp configure-stamp + rm -rf obj-sparc64-linux + dh_clean + +install: install-stamp +install-stamp: build-stamp + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # Add here commands to install the package into debian/tmp. + cd obj-sparc64-linux && make install prefix=`pwd`/../debian/tmp/usr \ + CFLAGS='-O2 -DHOST_WIDE_INT=long\ long -DHOST_BITS_PER_WIDE_INT=64' \ + LANGUAGES=c + + # Remove extraneous stuff + cd debian/tmp/usr && rm -rf man info include + rm -f debian/tmp/usr/bin/{*++,g}* debian/tmp/usr/bin/sparc64-linux-*protoize + rm -f `find debian/tmp/usr -name libiberty.a -o -name collect2` + rm -f debian/tmp/usr/lib/gcc-lib/sparc64-linux/*/cc1plus + rm -rf debian/tmp/usr/sparc64-linux + ln -s ../lib debian/tmp/usr/sparc-linux/lib + # We now provide sparc64-linux-gcc through an alternative since + # the default compiler now has -m64 support + mv debian/tmp/usr/bin/sparc64-linux-gcc debian/tmp/usr/bin/sparc64-linux-gcc.egcs64 + + touch install-stamp + +binary-indep: build install + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installdocs + dh_installchangelogs ChangeLog + dh_strip + dh_compress + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +source diff: + @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary --- egcs64-19980921.orig/debian/postinst +++ egcs64-19980921/debian/postinst @@ -0,0 +1,4 @@ +#!/bin/sh -e + +update-alternatives --install /usr/bin/sparc64-linux-gcc sparc64-linux-gcc \ + /usr/bin/sparc64-linux-gcc.egcs64 40 --- egcs64-19980921.orig/debian/prerm +++ egcs64-19980921/debian/prerm @@ -0,0 +1,6 @@ +#!/bin/sh -e + +if [ "$1" != "upgrade" ] +then + update-alternatives --remove sparc64-linux-gcc /usr/bin/sparc64-linux-gcc.egcs64 +fi