crosstool and configure.in patches
Stuart Hughes
seh@zee2.com
Fri Dec 12 21:18:00 GMT 2003
Dan Kegel wrote:
>
> Stuart Hughes wrote:
> > I've been building a gcc-2.95 (from uclibc) using crosstool. This has
> > many patches, and one of them touches gcc/configure.in. I figured for
> > this to work, I'd need to run autoconf. To do this I put a really ugly
> > hack into the getandpatch.sh script:
> >
> > @@ -72,6 +72,12 @@
> > patch -p1 -f < $p
> > fi
> > done
> > + # seh: ugly hack as I know the patches for this version of gcc
> > + # modify gcc/configure.in so autoconf must be re-run
> > + if [ $BASENAME = "gcc-20011006" ]
> > + then
> > + ( cd gcc ; autoconf )
> > + fi
> > cd $TOP_DIR
> > }
> >
> >
> > Does anyone have a better way of handling situations like this.
>
> What patch, exactly, is it that touches configure.in?
>
> The right fix would be for that patch to also fix configure, imho.
Hi Dan,
I've attached the patch. It comes from the uclibc toolchain
distribution, and I think this was exploded out from the Debian gcc
package (but not certain of this). I used this patch to fix an error
saying:
/usr/local/mipsel-linux/gcc-2.95.4-glibc-2.2.2/mipsel-linux/bin/ld:
cannot open crtbeginS.o: No such file or directory
BTW: This toolchain has 41 patches for gcc (2.95.4 20010319
(prerelease)).
Regards, Stuart
-------------- next part --------------
diff -urN gcc-20011006.orig/gcc/config/mips/linux.h gcc-20011006/gcc/config/mips/linux.h
--- gcc-20011006.orig/gcc/config/mips/linux.h Wed Apr 14 04:46:45 1999
+++ gcc-20011006/gcc/config/mips/linux.h Tue Mar 12 22:42:47 2002
@@ -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 @@
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 @@
#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 @@
#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 -urN gcc-20011006.orig/gcc/config/mips/mips.h gcc-20011006/gcc/config/mips/mips.h
--- gcc-20011006.orig/gcc/config/mips/mips.h Wed May 19 17:05:45 1999
+++ gcc-20011006/gcc/config/mips/mips.h Tue Mar 12 22:42:47 2002
@@ -599,11 +599,11 @@
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 @@
/* 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 @@
#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 @@
{ "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 -urN gcc-20011006.orig/gcc/configure.in gcc-20011006/gcc/configure.in
--- gcc-20011006.orig/gcc/configure.in Tue Mar 12 22:41:52 2002
+++ gcc-20011006/gcc/configure.in Tue Mar 12 22:42:47 2002
@@ -2368,16 +2368,23 @@
# 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"
-------------- next part --------------
------
Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
More information about the crossgcc
mailing list