gcc 2.95.2 for sparc
Seems that between the 2.95.2-pre2(?) and 2.95.2-1 release, the changes
that were applied for MULTILIBS in debian/rules2 were lost, along with
some other sparc related things. The 2.95.2-1.2 I uploaded today uses
those, and attached are the patches and updated files. The 32/64 support
is now working, so hopefully egcs64 will be gone soon (maybe by potato
release), since I have a 29 uptime on a heavily used system using a kernel
built with this for sun4u.
Thanks,
Ben
#! /bin/sh -e
# DP: This enables sparc-linux building with 64bit multilibs. We have
# DP: to massage configure.in to allow us to build a sparc-linux with
# DP: sparc64 support (-m64) and modify a few defaults. For one, m64
# DP: defaults to -mhard-quad-float. Also, we modify the default /lib64
# DP: and /usr/lib64 directories where gcc expects libc and other libs
# DP: to be installed, and move it to /lib/64 and /usr/lib/64 since it
# DP: matches gcc's multilib support. This way we only have 2 directories
# DP: to worry about with 64bit libs. Debian's glibc will be modified to
# DP: match this.
if [ $# -eq 3 -a "$2" = '-d' ]; then
pdir="-d $3"
adir="$3/"
elif [ $# -ne 1 ]; then
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
exit 1
fi
case "$1" in
-patch) patch $pdir -f --no-backup-if-mismatch -p0 < $0;;
-unpatch) patch $pdir -f --no-backup-if-mismatch -R -p0 < $0;;
*)
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
exit 1
esac
# We need to regenerate configure after patching and unpatching
cd ${adir}gcc && autoconf
exit 0
####PATCH####
--- gcc/configure.in Fri Sep 3 06:05:42 1999
+++ gcc/configure.in~ Fri Sep 3 05:56:29 1999
@@ -3055,10 +3055,10 @@
gnu_ld=yes
;;
sparc-*-linux-gnu*) # Sparc's running GNU/Linux, libc6
+ tmake_file="t-linux sparc/t-linux64"
+ tm_file=sparc/linux64.h
xm_file="${xm_file} sparc/xm-linux.h"
xmake_file=x-linux
- tm_file=sparc/linux.h
- tmake_file="t-linux"
extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
gnu_ld=yes
if test x$enable_threads = xyes; then
--- config-ml.in~ Mon Sep 13 23:14:55 1999
+++ config-ml.in Mon Sep 13 23:15:12 1999
@@ -151,7 +151,7 @@
done
# Only do this if --enable-multilib.
-if [ "${enable_multilib}" = yes ]; then
+if false; then
# Compute whether this is the library's top level directory
# (ie: not a multilib subdirectory, and not a subdirectory like libg++/src).
--- gcc/config/sparc/linux64.h Wed Dec 16 16:13:13 1998
+++ gcc/config/sparc/linux64.h Sun Oct 31 19:51:40 1999
@@ -40,7 +40,7 @@
#undef TARGET_DEFAULT
#define TARGET_DEFAULT \
- (MASK_V9 + MASK_PTR64 + MASK_64BIT /* + MASK_HARD_QUAD */ \
+ (MASK_V9 + MASK_PTR64 + MASK_64BIT + MASK_HARD_QUAD \
+ MASK_STACK_BIAS + MASK_APP_REGS + MASK_EPILOGUE + MASK_FPU)
#endif
@@ -70,8 +70,8 @@
#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}"
+ %{pg:/usr/lib/64/gcrt1.o%s} %{!pg:%{p:/usr/lib/64/gcrt1.o%s} %{!p:/usr/lib/64/crt1.o%s}}}\
+ /usr/lib/64/crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
#ifdef SPARC_BI_ARCH
@@ -105,7 +105,7 @@
"%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
#define ENDFILE_SPEC64 \
- "%{!shared:crtend.o%s} %{shared:crtendS.o%s} /usr/lib64/crtn.o%s"
+ "%{!shared:crtend.o%s} %{shared:crtendS.o%s} /usr/lib/64/crtn.o%s"
#ifdef SPARC_BI_ARCH
@@ -128,7 +128,7 @@
#endif
#undef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (sparc64 GNU/Linux with ELF)");
+#define TARGET_VERSION fprintf (stderr, " (sparc 32/64 GNU/Linux with ELF)");
/* The default code model. */
#undef SPARC_DEFAULT_CMODEL
@@ -194,12 +194,12 @@
%{static:-static}}} \
"
-#define LINK_ARCH64_SPEC "-m elf64_sparc -Y P,/usr/lib64 %{shared:-shared} \
+#define LINK_ARCH64_SPEC "-m elf64_sparc -Y P,/usr/lib/64 %{shared:-shared} \
%{!shared: \
%{!ibcs: \
%{!static: \
%{rdynamic:-export-dynamic} \
- %{!dynamic-linker:-dynamic-linker /lib64/ld-linux.so.2}} \
+ %{!dynamic-linker:-dynamic-linker /lib/64/ld-linux.so.2}} \
%{static:-static}}} \
"
@@ -246,12 +246,12 @@
#else /* !SPARC_BI_ARCH */
#undef LINK_SPEC
-#define LINK_ARCH_SPEC "-m elf64_sparc -Y P,/usr/lib64 %{shared:-shared} \
+#define LINK_ARCH_SPEC "-m elf64_sparc -Y P,/usr/lib/64 %{shared:-shared} \
%{!shared: \
%{!ibcs: \
%{!static: \
%{rdynamic:-export-dynamic} \
- %{!dynamic-linker:-dynamic-linker /lib64/ld-linux.so.2}} \
+ %{!dynamic-linker:-dynamic-linker /lib/64/ld-linux.so.2}} \
%{static:-static}}} \
%{mlittle-endian:-EL} \
"
@@ -271,7 +271,8 @@
%{Wa,*:%*} \
-s %{fpic:-K PIC} %{fPIC:-K PIC} \
%{mlittle-endian:-EL} \
-%(asm_cpu) %(asm_arch) \
+%{m32:-32 -Av7} \
+%{m64:-64 -Av9a} \
"
/* Same as sparc.h */
--- gcc/config/sparc/sparc.c Wed Aug 18 04:20:11 1999
+++ gcc/config/sparc/sparc.c Sun Oct 31 19:51:40 1999
@@ -366,7 +366,7 @@
/* Do various machine dependent initializations. */
sparc_init_modes ();
- if ((profile_flag || profile_block_flag)
+ if ((profile_flag || profile_block_flag) && TARGET_ARCH64
&& sparc_cmodel != CM_MEDLOW)
{
error ("profiling does not support code models other than medlow");
--- gcc/config/sparc/sparc.h Mon Jun 21 13:48:49 1999
+++ gcc/config/sparc/sparc.h Sun Oct 31 19:51:40 1999
@@ -48,6 +48,13 @@
#endif /* SPARC_BI_ARCH */
#define TARGET_ARCH64 (! TARGET_ARCH32)
+/* do this here, so we get proper thunks for -m32 in libgcc */
+#if !defined(USE_GNULIBC_1) && !defined(__sparcv9) && !defined(__sparcv_v9) && \
+ !defined(__arch64__)
+#undef DEFAULT_VTABLE_THUNKS
+#define DEFAULT_VTABLE_THUNKS 1
+#endif /* ! sparc64 or libc1 */
+
/* Code model selection.
-mcmodel is used to select the v9 code model.
Different code models aren't supported for v8 code.
@@ -143,8 +151,8 @@
#else
-#define CPP_CPU64_DEFAULT_SPEC ""
-#define ASM_CPU64_DEFAULT_SPEC ""
+#define CPP_CPU64_DEFAULT_SPEC "-D__sparc_v9__"
+#define ASM_CPU64_DEFAULT_SPEC "-Av9a"
#if TARGET_CPU_DEFAULT == TARGET_CPU_sparc \
|| TARGET_CPU_DEFAULT == TARGET_CPU_v8
@@ -611,7 +619,7 @@
/* MASK_APP_REGS must always be the default because that's what
FIXED_REGISTERS is set to and -ffixed- is processed before
CONDITIONAL_REGISTER_USAGE is called (where we process -mno-app-regs). */
-#define TARGET_DEFAULT (MASK_APP_REGS + MASK_EPILOGUE + MASK_FPU)
+#define TARGET_DEFAULT (MASK_APP_REGS + MASK_EPILOGUE + MASK_FPU + MASK_HARD_QUAD)
/* This is meant to be redefined in target specific files. */
#define SUBTARGET_SWITCHES
/* sparc64-linux-gcc-wrapper.c: a wrapper to set -m64 options for gcc
*
* Copyright (c) 1999 by Ben Collins <bcollins@debian.org>
*
* Licensed under the GNU GPL version 2 or later
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#define GCC_SPARC_LINUX "/usr/bin/gcc"
int main (int argc, char *argv[], char *envp[])
{
int i;
char **newargs;
newargs = (char **) calloc ((size_t) (argc + 3), sizeof(char *));
if (newargs == NULL) {
fprintf (stderr, "%s: error mallocing space for args\n", argv[0]);
fprintf (stderr, "(note, this is not a gcc bug)\n");
exit(1);
}
newargs[0] = argv[0];
newargs[1] = "-m64";
for ( i = 1 ; i < argc ; i++ ) {
if (strcmp(argv[i], "-mmedlow") == 0)
newargs[i+1] = "-mcmodel=medlow";
else
newargs[i+1] = argv[i];
}
newargs[i+1] = NULL;
execve (GCC_SPARC_LINUX, newargs, envp);
fprintf (stderr, "%s: error executing %s\n", argv[0], GCC_SPARC_LINUX);
fprintf (stderr, "(note, this is not a gcc bug)\n");
exit(1);
}
diff -urN debian.old/gcc.postinst debian/gcc.postinst
--- debian.old/gcc.postinst Mon Nov 1 12:06:20 1999
+++ debian/gcc.postinst Sun Oct 31 13:43:51 1999
@@ -5,8 +5,11 @@
--slave /usr/share/man/man1/cc.1.gz cc.1.gz /usr/share/man/man1/gcc.1.gz
if [ "`uname -m`" = sparc ]; then
+ # Remove the old incorrect alternative
+ update-alternatives --remove sparc64-linux-gcc /usr/bin/gcc || true
update-alternatives \
- --install /usr/bin/sparc64-linux-gcc sparc64-linux-gcc /usr/bin/gcc 30
+ --install /usr/bin/sparc64-linux-gcc sparc64-linux-gcc \
+ /usr/bin/sparc64-linux-gcc-wrapper 30
fi
#DEBHELPER#
diff -urN debian.old/gcc.prerm debian/gcc.prerm
--- debian.old/gcc.prerm Mon Nov 1 12:06:20 1999
+++ debian/gcc.prerm Sat Oct 30 14:50:53 1999
@@ -4,7 +4,7 @@
update-alternatives --remove cc /usr/bin/gcc
if [ "`uname -m`" = sparc ]; then
update-alternatives \
- --remove sparc64-linux-gcc /usr/bin/sparc64-linux-gcc
+ --remove sparc64-linux-gcc /usr/bin/sparc64-linux-gcc-wrapper
fi
fi
diff -urN debian.old/rules2 debian/rules2
--- debian.old/rules2 Mon Nov 1 12:06:22 1999
+++ debian/rules2 Sat Oct 30 17:24:27 1999
@@ -86,6 +86,18 @@
ifeq ($(with_objc_gc),yes)
CONFARGS += --enable-objc-gc
endif
+# MULTILIBS is one or more of "gcc g++ stdc++ chill objc g77"
+# MULTIDIRS is in the format "32" or "{m68000,m68020,m68040}"
+ifeq ($(DEB_HOST_GNU_TYPE),sparc64-linux)
+ CONFARGS += --with-cpu=ultrasparc
+ MULTIDIRS := 32
+ MULTILIBS := gcc g++ stdc++ chill objc g77
+endif
+ifeq ($(DEB_HOST_GNU_TYPE),sparc-linux)
+ CONFARGS += --with-cpu=v7
+ MULTIDIRS := 64
+ MULTILIBS := gcc
+endif
CONFARGS += $(DEB_HOST_GNU_TYPE)
ifneq ($(SNAPSHOT),yes)
@@ -347,6 +359,13 @@
endif
#files_gcc += \
# $(PF)/lib/gcc-lib/$(DEB_HOST_GNU_TYPE)/$(VER)/SYSCALLS.c.X
+ifneq (,$(findstring gcc,$(MULTILIBS)))
+ dirs_gcc += $(PF)/lib/gcc-lib/$(DEB_HOST_GNU_TYPE)/$(VER)/$(MULTIDIRS)
+ files_gcc += $(PF)/lib/gcc-lib/$(DEB_HOST_GNU_TYPE)/$(VER)/$(MULTIDIRS)/{libgcc.a,*.o}
+endif
+ifeq ($(DEB_HOST_GNU_TYPE),sparc-linux)
+ files_gcc += $(PF)/bin/sparc64-linux-gcc-wrapper
+endif
ifeq ($(DEB_HOST_ARCH),powerpc)
dirs_nof = \
@@ -391,6 +410,10 @@
files_objc = \
$(PF)/lib/gcc-lib/$(DEB_HOST_GNU_TYPE)/$(VER)/include/objc \
$(PF)/lib/gcc-lib/$(DEB_HOST_GNU_TYPE)/$(VER)/{cc1obj,libobjc*.a}
+ifneq (,$(findstring objc,$(MULTILIBS)))
+ dirs_objc += $(PF)/lib/gcc-lib/$(DEB_HOST_GNU_TYPE)/$(VER)/$(MULTIDIRS)
+ files_objc += $(PF)/lib/gcc-lib/$(DEB_HOST_GNU_TYPE)/$(VER)/$(MULTIDIRS)/libobjc*.a
+endif
dirs_gpp = \
$(docdir)/$(p_gpp) \
@@ -416,6 +439,10 @@
$(PF)/lib/gcc-lib/$(DEB_HOST_GNU_TYPE)/$(VER)/{f771,libg2c.a} \
$(PF)/lib/gcc-lib/$(DEB_HOST_GNU_TYPE)/$(VER)/include/g2c.h \
$(PF)/share/man/man1/g77.1
+ifneq (,$(findstring g77,$(MULTILIBS)))
+ dirs_g77 += $(PF)/lib/gcc-lib/$(DEB_HOST_GNU_TYPE)/$(VER)/$(MULTIDIRS)
+ files_g77 += $(PF)/lib/gcc-lib/$(DEB_HOST_GNU_TYPE)/$(VER)/$(MULTIDIRS)/libg2c.a
+endif
dirs_g77d = \
$(docdir)/$(p_g77d) \
@@ -434,6 +461,10 @@
$(PF)/bin/chill \
$(PF)/lib/gcc-lib/$(DEB_HOST_GNU_TYPE)/$(VER)/*chill* \
$(PF)/share/info/chill*
+ifneq (,$(findstring chill,$(MULTILIBS)))
+ dirs_chill += $(PF)/lib/gcc-lib/$(DEB_HOST_GNU_TYPE)/$(VER)/$(MULTIDIRS)
+ files_chill += $(PF)/lib/gcc-lib/$(DEB_HOST_GNU_TYPE)/$(VER)/$(MULTIDIRS)/*chill*.{a,o}
+endif
dirs_java = \
$(docdir)/$(p_java) \
@@ -454,6 +485,10 @@
$(PF)/bin/{bpc,epc,gpc,pc} \
$(PF)/share/man/man1/{bpc,epc,gpc,pc}.1 \
$(PF)/lib/gcc-lib/$(DEB_HOST_GNU_TYPE)/$(VER)/{gpc-cpp,gpc1,libgpc.a,units}
+ifneq (,$(findstring gpc,$(MULTILIBS)))
+ dirs_gpc += $(PF)/lib/gcc-lib/$(DEB_HOST_GNU_TYPE)/$(VER)/$(MULTIDIRS)
+ files_gpc += $(PF)/lib/gcc-lib/$(DEB_HOST_GNU_TYPE)/$(VER)/$(MULTIDIRS)/libgpc.a
+endif
dirs_gpcd = \
$(docdir)/$(p_gpcd) \
@@ -467,6 +502,10 @@
$(PF)/lib
files_lgp = \
$(addprefix $(PF)/lib/, $(lgp_shlib) $(lgp_mshlink))
+ifneq (,$(findstring g++,$(MULTILIBS)))
+ dirs_lgp += $(PF)/lib/$(MULTIDIRS)
+ files_lgp += $(addprefix $(PF)/lib/$(MULTIDIRS)/, $(lgp_shlib) $(lgp_mshlink))
+endif
dirs_lgd = \
$(docdir)/$(p_lgp) \
@@ -484,6 +523,12 @@
$(PF)/include/$(cxx_inc_dir)/gen/ \
$(PF)/include/$(cxx_inc_dir)/{$(shell cd $(srcdir)/libg++/src; \
echo *.h | tr ' ' ,)}
+ifneq (,$(findstring g++,$(MULTILIBS)))
+ dirs_lgd += $(PF)/lib/gcc-lib/$(DEB_HOST_GNU_TYPE)/$(VER)/$(MULTIDIRS)
+ files_lgd += $(addprefix $(PF)/lib/$(MULTILIB)/, $(lgp_arlib) $(lgp_marlink)) \
+ $(PF)/lib/gcc-lib/$(DEB_HOST_GNU_TYPE)/$(VER)/$(MULTIDIRS)/libg++.{a,so}
+endif
+
dirs_lgdbg = \
$(docdir) \
$(PF)/lib/libg++_debug
@@ -494,7 +539,10 @@
$(PF)/lib
files_lib = \
$(addprefix $(PF)/lib/, $(lib_shlib) $(lib_mshlink))
-
+ifneq (,$(findstring stdc++,$(MULTILIBS)))
+ dirs_lib += $(PF)/lib/$(MULTIDIRS)
+ files_lib += $(addprefix $(PF)/lib/$(MULTIDIRS)/, $(lib_shlib) $(lib_mshlink))
+endif
dirs_dev = \
$(docdir)/$(p_lib) \
@@ -509,6 +557,10 @@
$(PF)/include/$(cxx_inc_dir)/ \
$(PF)/share/info/iostream* \
$(PF)/$(lib_linkdir)/libstdc++.{a,so}
+ifneq (,$(findstring stdc++,$(MULTILIBS)))
+ files_dev += $(PF)/$(lib_linkdir)/$(MULTIDIRS)/libstdc++.{a,so} \
+ $(addprefix $(PF)/lib/$(MULTIDIRS)/, $(lib_arlib) $(lib_marlink))
+endif
dirs_dbg = \
$(docdir) \
@@ -698,6 +750,10 @@
endif
dh_movefiles -p$(p_gpp) $(files_gpp)
# gcc must be moved after g77 and g++
+ifeq ($(DEB_HOST_GNU_TYPE),sparc-linux)
+ # Compile the wrapper
+ $(CC) debian/sparc64-linux-gcc-wrapper.c -o debian/tmp/usr/bin/sparc64-linux-gcc-wrapper
+endif
dh_movefiles -p$(p_gcc) $(files_gcc)
touch first-move-stamp
Reply to: