Ryan Murray writes: > gcc 2.95 fails to build on mips: ok, debian/patches/gcc-mips-linux.dpatch didn't call autoconf. Please could you retry with the appended updated patch and autoconf2.13 (currently in incoming) installed?
#! /bin/sh -e src=gcc if [ $# -eq 3 -a "$2" = '-d' ]; then pdir="-d $3" src=$3/gcc 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 -p1 < $0 cd $src && autoconf ;; -unpatch) patch $pdir -f --no-backup-if-mismatch -R -p1 < $0 cd $src && autoconf ;; *) echo >&2 "`basename $0`: script expects -patch|-unpatch as argument" exit 1 esac exit 0 diff -up --recursive --new-file gcc-2.95.2.macro/gcc/config/mips/linux.h gcc-2.95.2/gcc/config/mips/linux.h --- gcc-2.95.2.macro/gcc/config/mips/linux.h Wed Apr 14 10:46:45 1999 +++ gcc-2.95.2/gcc/config/mips/linux.h Thu Nov 16 07:25:03 2000 @@ -1,5 +1,5 @@ /* Definitions for MIPS running Linux-based GNU systems with ELF format. - Copyright (C) 1998 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. This file is part of GNU CC. @@ -18,16 +18,106 @@ along with GNU CC; see the file COPYING. the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* Required to keep collect2.c happy */ -#undef OBJECT_FORMAT_COFF +#undef TARGET_VERSION +#if TARGET_ENDIAN_DEFAULT == 0 +#define TARGET_VERSION fprintf (stderr, " (MIPSel GNU/Linux with ELF)"); +#else +#define TARGET_VERSION fprintf (stderr, " (MIPS GNU/Linux with ELF)"); +#endif + +#undef MD_EXEC_PREFIX +#undef MD_STARTFILE_PREFIX + +/* Output at beginning of assembler file. */ +/* The .file command should always begin the output. */ +#undef ASM_FILE_START +#define ASM_FILE_START(FILE) \ + do { \ + mips_asm_file_start (FILE); \ + fprintf (FILE, "\t.version\t\"01.01\"\n"); \ + } while (0) + -#define HAVE_ATEXIT +/* Required to keep collect2.c happy */ +#undef OBJECT_FORMAT_COFF /* If we don't set MASK_ABICALLS, we can't default to PIC. */ #undef TARGET_DEFAULT #define TARGET_DEFAULT (MASK_ABICALLS|MASK_GAS) +/* Handle #pragma weak and #pragma pack. */ +#define HANDLE_SYSV_PRAGMA 1 + +/* Use more efficient ``thunks'' to implement C++ vtables. */ +#undef DEFAULT_VTABLE_THUNKS +#define DEFAULT_VTABLE_THUNKS 1 + +/* Don't assume anything about the header files. */ +#define NO_IMPLICIT_EXTERN_C + +/* Generate calls to memcpy, etc., not bcopy, etc. */ +#define TARGET_MEM_FUNCTIONS + +/* Specify predefined symbols in preprocessor. */ +#undef CPP_PREDEFINES +#if TARGET_ENDIAN_DEFAULT == 0 +#define CPP_PREDEFINES "-DMIPSEL -D_MIPSEL -Dunix -Dmips -D_mips \ +-DR3000 -D_R3000 -Dlinux -Asystem(posix) -Acpu(mips) \ +-Amachine(mips) -D__ELF__ -D__PIC__ -D__pic__" +#else +#define CPP_PREDEFINES "-DMIPSEB -D_MIPSEB -Dunix -Dmips -D_mips \ +-DR3000 -D_R3000 -Dlinux -Asystem(posix) -Acpu(mips) \ +-Amachine(mips) -D__ELF__ -D__PIC__ -D__pic__" +#endif + +#undef SUBTARGET_CPP_SIZE_SPEC +#define SUBTARGET_CPP_SIZE_SPEC "\ +%{mabi=32: -D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int} \ +%{mabi=n32: -D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int} \ +%{mabi=64: -D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int} \ +%{!mabi*: -D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int}" + +/* We must make -mips3 do what -mlong64 used to do. */ +/* ??? If no mipsX option given, but a mabi=X option is, then should set + _MIPS_ISA based on the mabi=X option. */ +/* ??? If no mabi=X option give, but a mipsX option is, then should set + _MIPS_SIM based on the mipsX option. */ +/* ??? Same for _MIPS_SZINT. */ +/* ??? Same for _MIPS_SZPTR. */ +/* ??? Same for __SIZE_TYPE and __PTRDIFF_TYPE. */ +#undef SUBTARGET_CPP_SPEC +#define SUBTARGET_CPP_SPEC "\ +%{mfp32: -D_MIPS_FPSET=16} \ +%{mfp64: -D_MIPS_FPSET=32} \ +%{!mfp*: -D_MIPS_FPSET=32} \ +%{mips1: -D_MIPS_ISA=_MIPS_ISA_MIPS1} \ +%{mips2: -D_MIPS_ISA=_MIPS_ISA_MIPS2} \ +%{mips3: -D_MIPS_ISA=_MIPS_ISA_MIPS3} \ +%{mips4: -D_MIPS_ISA=_MIPS_ISA_MIPS4} \ +%{!mips*: -D_MIPS_ISA=_MIPS_ISA_MIPS1} \ +%{mabi=32: -D_MIPS_SIM=_MIPS_SIM_ABI32} \ +%{mabi=n32: -D_ABIN32=2 -D_MIPS_SIM=_ABIN32} \ +%{mabi=64: -D_ABI64=3 -D_MIPS_SIM=_ABI64} \ +%{!mabi*: -D_ABIN32=2 -D_MIPS_SIM=_ABIN32} \ +%{!mint64: -D_MIPS_SZINT=32}%{mint64: -D_MIPS_SZINT=64} \ +%{mabi=32: -D_MIPS_SZLONG=32} \ +%{mabi=n32: -D_MIPS_SZLONG=32} \ +%{mabi=64: -D_MIPS_SZLONG=64} \ +%{!mabi*: -D_MIPS_SZLONG=32} \ +%{mabi=32: -D_MIPS_SZPTR=32} \ +%{mabi=n32: -D_MIPS_SZPTR=32} \ +%{mabi=64: -D_MIPS_SZPTR=64} \ +%{!mabi*: -D_MIPS_SZPTR=32} \ +%{!mips*: -U__mips -D__mips} \ +%{mabi=32: -U__mips64} \ +%{mabi=n32: -D__mips64} \ +%{mabi=64: -U__mips64} \ +%{!mabi*: -U__mips64} \ +%{fno-PIC:-U__PIC__ -U__pic__} %{fno-pic:-U__PIC__ -U__pic__} \ +%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} \ +%{pthread:-D_REENTRANT}" + /* Provide a STARTFILE_SPEC appropriate for GNU/Linux. Here we add the GNU/Linux magical crtbegin.o file (see crtstuff.c) which provides part of the support for getting C++ file-scope static @@ -55,9 +145,18 @@ Boston, MA 02111-1307, USA. */ #undef MIPS_DEFAULT_GVALUE #define MIPS_DEFAULT_GVALUE 0 +#undef LIB_SPEC +/* Taken from sparc/linux.h. */ +#define LIB_SPEC \ + "%{shared: -lc} \ + %{!shared: %{mieee-fp:-lieee} %{pthread:-lpthread} \ + %{profile:-lc_p} %{!profile: -lc}}" + /* Borrowed from sparc/linux.h */ #undef LINK_SPEC -#define LINK_SPEC "-Y P,/usr/lib %{shared:-shared} \ +#define LINK_SPEC \ + "%(endian_spec) \ + %{shared:-shared} \ %{!shared: \ %{!ibcs: \ %{!static: \ @@ -67,33 +166,7 @@ Boston, MA 02111-1307, USA. */ #undef SUBTARGET_ASM_SPEC -#define SUBTARGET_ASM_SPEC "-KPIC" - -/* Undefine the following which were defined in elf.h. This will cause the linux - port to continue to use collect2 for constructors/destructors. These may be removed - when .ctor/.dtor section support is desired. */ - -#undef CTORS_SECTION_ASM_OP -#undef DTORS_SECTION_ASM_OP - -#undef EXTRA_SECTIONS -#define EXTRA_SECTIONS in_sdata, in_rdata - -#undef INVOKE__main -#undef NAME__MAIN -#undef SYMBOL__MAIN - -#undef EXTRA_SECTION_FUNCTIONS -#define EXTRA_SECTION_FUNCTIONS \ - SECTION_FUNCTION_TEMPLATE(sdata_section, in_sdata, SDATA_SECTION_ASM_OP) \ - SECTION_FUNCTION_TEMPLATE(rdata_section, in_rdata, RDATA_SECTION_ASM_OP) - -#undef ASM_OUTPUT_CONSTRUCTOR -#undef ASM_OUTPUT_DESTRUCTOR - -#undef CTOR_LIST_BEGIN -#undef CTOR_LIST_END -#undef DTOR_LIST_BEGIN -#undef DTOR_LIST_END - -/* End of undefines to turn off .ctor/.dtor section support */ +#define SUBTARGET_ASM_SPEC "\ +%{mabi=64: -64} \ +%{!fno-PIC:%{!fno-pic:-KPIC}} \ +%{fno-PIC:-non_shared} %{fno-pic:-non_shared}" diff -up --recursive --new-file gcc-2.95.2.macro/gcc/config/mips/mips.h gcc-2.95.2/gcc/config/mips/mips.h --- gcc-2.95.2.macro/gcc/config/mips/mips.h Wed May 19 23:05:45 1999 +++ gcc-2.95.2/gcc/config/mips/mips.h Tue Aug 15 18:40:42 2000 @@ -599,11 +599,11 @@ extern void mips_select_section (); linker will default to using big-endian output files. The OUTPUT_FORMAT line must be in the linker script, otherwise -EB/-EL will not work. */ -#ifndef LINKER_ENDIAN_SPEC +#ifndef ENDIAN_SPEC #if TARGET_ENDIAN_DEFAULT == 0 -#define LINKER_ENDIAN_SPEC "%{!EB:%{!meb:-EL}}" +#define ENDIAN_SPEC "%{!EB:%{!meb:-EL}} %{EL} %{EB}" #else -#define LINKER_ENDIAN_SPEC "" +#define ENDIAN_SPEC "%{!EL:%{!mel:-EB}} %{EB} %{EL}" #endif #endif @@ -871,7 +871,8 @@ while (0) /* ASM_SPEC is the set of arguments to pass to the assembler. */ #define ASM_SPEC "\ -%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} %{mips4} \ +%(endian_spec) \ +%{G*} %{mips1} %{mips2} %{mips3} %{mips4} \ %{mips16:%{!mno-mips16:-mips16}} %{mno-mips16:-no-mips16} \ %(subtarget_asm_optimizing_spec) \ %(subtarget_asm_debugging_spec) \ @@ -925,9 +926,9 @@ while (0) #ifndef LINK_SPEC #define LINK_SPEC "\ -%{G*} %{EB} %{EL} %{mips1} %{mips2} %{mips3} %{mips4} \ -%{bestGnum} %{shared} %{non_shared} \ -%(linker_endian_spec)" +%(endian_spec) \ +%{G*} %{mips1} %{mips2} %{mips3} %{mips4} \ +%{bestGnum} %{shared} %{non_shared}" #endif /* LINK_SPEC defined */ /* Specs for the compiler proper */ @@ -1035,7 +1036,7 @@ while (0) { "subtarget_asm_optimizing_spec", SUBTARGET_ASM_OPTIMIZING_SPEC }, \ { "subtarget_asm_debugging_spec", SUBTARGET_ASM_DEBUGGING_SPEC }, \ { "subtarget_asm_spec", SUBTARGET_ASM_SPEC }, \ - { "linker_endian_spec", LINKER_ENDIAN_SPEC }, \ + { "endian_spec", ENDIAN_SPEC }, \ SUBTARGET_EXTRA_SPECS #ifndef SUBTARGET_EXTRA_SPECS diff -up --recursive --new-file gcc-2.95.2.macro/gcc/configure.in gcc-2.95.2/gcc/configure.in --- gcc-2.95.2.macro/gcc/configure.in Wed Oct 13 07:58:02 1999 +++ gcc-2.95.2/gcc/configure.in Mon May 29 22:16:31 2000 @@ -2356,16 +2356,23 @@ changequote([,])dnl # On NetBSD, the headers are already okay, except for math.h. tmake_file=t-netbsd ;; - mips*-*-linux*) # Linux MIPS, either endian. + mips*-*-linux*) # Linux MIPS, either endian. xmake_file=x-linux - xm_file="xm-siglist.h ${xm_file}" - case $machine in - mipsel-*) tm_file="mips/elfl.h mips/linux.h" ;; - *) tm_file="mips/elf.h mips/linux.h" ;; - esac - extra_parts="crtbegin.o crtend.o" + case $machine in + mips*el-*) + tm_file="mips/elfl.h mips/linux.h" + ;; + *) + tm_file="mips/elf.h mips/linux.h" + ;; + esac + tmake_file=t-linux + extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" gnu_ld=yes gas=yes + if test x$enable_threads = xyes; then + thread_file='posix' + fi ;; mips*el-*-openbsd*) # mips little endian target_cpu_default="MASK_GAS|MASK_ABICALLS"