On Mon, Oct 07, 2002 at 11:22:08AM +0200, Dirk Heinrichs wrote: > Hello, > > I tried to build gcc 3.2 from sources on Woody/m68k. I took the original > sources and diffs (as of 24.09.) from the debian pool directory and > manually applied all the patches the debian build system would have > applied for m68k. Compilation with > > make CFLAGS='-O' LIBCFLAGS='-g -O2' \ > LIBCXXFLAGS='-g -O2 -fno-implicit-templates' bootstrap
are you sure you want to use this CFLAGS? > as found in the build instructions work fine but comparison of stages 2 > and 3 fails. > > I didn't try the binutils from the pool (yet), but vanilla 2.13. Can I go > on and just restart make without the bootstrap target or could I run into > more serious problems. looks like pretty serious. Binutils 2.13 may be producing wrong code with gcc-3.2, this was fixed only very recently. gcc-3.2 works very good for me with another set of patches, no idea what kind of patches are in the debian-gcc-3.2. There is also a problem that some binutils used to produce code that is sometimes (actually very rarely) incompatible with the dynamic loader in glibc, not sure if this is already fixed in debian. I have attached some patches in case you want to play with it. The gcc patch has also the effect to change cpu target default to 68020-60. Richard
>From [EMAIL PROTECTED] Sat Aug 24 20:18:13 2002 Return-Path: <root> Received: (from [EMAIL PROTECTED]) by rz.de (8.8.8/8.8.8) id UAA00603 for rz; Sat, 24 Aug 2002 20:18:12 +0200 Received: from faui80.informatik.uni-erlangen.de (faui80.informatik.uni-erlangen.de [131.188.38.1]) by faui02.informatik.uni-erlangen.de (8.12.5/8.12.5) with ESMTP id g7OGW9DI017074 for <[EMAIL PROTECTED]>; Sat, 24 Aug 2002 18:32:09 +0200 (MEST) Received: from faui45.informatik.uni-erlangen.de ([EMAIL PROTECTED] [131.188.34.45]) by faui80.informatik.uni-erlangen.de (8.9.1a/8.1.13-FAU) with ESMTP id SAA27783 for <[EMAIL PROTECTED]>; Sat, 24 Aug 2002 18:32:08 +0200 (MEST) Received: from nerdtwo.nerdnet.nl ([EMAIL PROTECTED] [217.119.4.49]) by faui45.informatik.uni-erlangen.de (8.9.1/8.1.49-FAU) with ESMTP id SAA25450 for <[EMAIL PROTECTED]>; Sat, 24 Aug 2002 18:32:05 +0200 (MET DST) Received: from Cantor.suse.de (ns.suse.de [213.95.15.193]) by nerdtwo.nerdnet.nl (8.12.3/8.12.3/Debian -4) with ESMTP id g7OGVwqd018815 for <[EMAIL PROTECTED]>; Sat, 24 Aug 2002 18:31:59 +0200 Received: from Hermes.suse.de (Charybdis.suse.de [213.95.15.201]) by Cantor.suse.de (Postfix) with ESMTP id 6F1FB145FB; Sat, 24 Aug 2002 18:31:58 +0200 (MEST) X-Authentication-Warning: sykes.suse.de: schwab set sender to [EMAIL PROTECTED] using -f To: Richard Zidlicky <[EMAIL PROTECTED]> Cc: "H. J. Lu" <[EMAIL PROTECTED]>, [EMAIL PROTECTED] Subject: Re: binutils problem References: <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> X-Yow: I just put lots of the EGG SALAD in the SILK SOCKS -- From: Andreas Schwab <[EMAIL PROTECTED]> Date: Sat, 24 Aug 2002 18:31:56 +0200 In-Reply-To: <[EMAIL PROTECTED]> (Richard Zidlicky's message of "Sat, 24 Aug 2002 13:55:59 +0200") Message-ID: <[EMAIL PROTECTED]> User-Agent: Gnus/5.090007 (Oort Gnus v0.07) Emacs/21.3.50 (ia64-suse-linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-SBPass: NoBounce Status: RO Content-Length: 1767 Lines: 66 Richard Zidlicky <[EMAIL PROTECTED]> writes: |> On Fri, Aug 23, 2002 at 10:07:32PM -0700, H. J. Lu wrote: |> > I don't know much about m68k. Does anyone have any ideas? |> |> I have produced a much smaller testcase: |> |> ====== |> .section .rodata.str1.1,"aMS",@progbits,1 |> .LC1: |> .string "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" |> |> |> .LC88: .string "__builtin_memcpy" |> |> .text |> .align 2 |> .globl foobar |> .type foobar,@function |> foobar: |> pea .LC88+10 |> |> .align 2 |> ======= |> |> objdump -x shows: |> |> RELOCATION RECORDS FOR [.text]: |> OFFSET TYPE VALUE |> 00000002 R_68K_32 .LC88+0x00000033 |> |> this is wrong, the 0x33 are from start of the section. Here is a patch: 2002-08-24 Andreas Schwab <[EMAIL PROTECTED]> * config/tc-m68k.c (tc_m68k_fix_adjustable): Don't adjust symbols in merge sections. Index: gas/config/tc-m68k.c =================================================================== RCS file: /cvs/src/src/gas/config/tc-m68k.c,v retrieving revision 1.40 diff -u -p -a -u -p -a -r1.40 gas/config/tc-m68k.c --- gas/config/tc-m68k.c 20 Aug 2002 23:49:27 -0000 1.40 +++ gas/config/tc-m68k.c 24 Aug 2002 16:28:21 -0000 @@ -848,6 +848,10 @@ tc_m68k_fix_adjustable (fixP) if (! relaxable_symbol (fixP->fx_addsy)) return 0; + /* Don't adjust symbols in merge sections. */ + if ((S_GET_SEGMENT (fixP->fx_addsy)->flags & SEC_MERGE) != 0) + return 0; + /* adjust_reloc_syms doesn't know about the GOT */ switch (fixP->fx_r_type) { Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."
--- glibc-2.2.90/sysdeps/m68k/dl-machine.h.rz Mon Aug 26 11:44:44 2002 +++ glibc-2.2.90/sysdeps/m68k/dl-machine.h Mon Aug 26 11:45:31 2002 @@ -311,6 +311,8 @@ Elf32_Addr *const reloc_addr = (void *) (l_addr + reloc->r_offset); if (ELF32_R_TYPE (reloc->r_info) == R_68K_JMP_SLOT) *reloc_addr += l_addr; + else if (ELF32_R_TYPE (reloc->r_info) == R_68K_NONE) + return; else _dl_reloc_bad_type (map, ELF32_R_TYPE (reloc->r_info), 1); }
--- gcc-3.2-cvs/gcc/config/m68k/t-linux.rz Wed Dec 16 16:07:26 1998 +++ gcc-3.2-cvs/gcc/config/m68k/t-linux Wed Aug 21 22:49:01 2002 @@ -1,2 +1,4 @@ # On GNU/Linux we can print long double ENQUIRE_CFLAGS = -DNO_MEM -O0 + +TARGET_LIBGCC2_CFLAGS = -Dmc68060 -D__mc68060__ --- gcc-3.2-cvs/gcc/config/m68k/linux.h.rz Mon Apr 15 16:27:31 2002 +++ gcc-3.2-cvs/gcc/config/m68k/linux.h Wed Aug 21 22:49:01 2002 @@ -37,8 +37,8 @@ #undef TARGET_VERSION #define TARGET_VERSION fprintf (stderr, " (68k GNU/Linux with ELF)"); -/* 68020 with 68881 */ -#define TARGET_DEFAULT (MASK_BITFIELD|MASK_68881|MASK_68020) +/* RZ: use default target 68020-60 */ +#define TARGET_DEFAULT (MASK_BITFIELD|MASK_68881|MASK_68020|MASK_68040|MASK_68060) /* for 68k machines this only needs to be TRUE for the 68000 */ @@ -112,25 +112,29 @@ #undef WCHAR_TYPE_SIZE #define WCHAR_TYPE_SIZE BITS_PER_WORD +/* mc68020 is defined always, mc68040 and mc68060 dependening on target */ #define CPP_PREDEFINES \ "-D__ELF__ -Dunix -Dmc68000 -Dmc68020 -D__gnu_linux__ -Dlinux -Asystem=unix -Asystem=posix -Acpu=m68k -Amachine=m68k" +/* machine dependent defines go here */ +#define EXTRA_CPP_DEFINES "%{m68040:-Dmc68040 -D__mc68040__} %{mc68060:-Dmc68060 -D__mc68060__} %{m68020-40:-Dmc68040 -D__mc68040__} %{m68020-60:-Dmc68040 -Dmc68060 -D__mc68040__ -D__mc68060__} %{!m680*:-Dmc68040 -Dmc68060 -D__mc68040__ -D__mc68060__}" + #undef CPP_SPEC #ifdef USE_GNULIBC_1 #if TARGET_DEFAULT & MASK_68881 #define CPP_SPEC \ - "%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{!msoft-float:-D__HAVE_68881__} %{posix:-D_POSIX_SOURCE}" + "%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{!msoft-float:-D__HAVE_68881__} %{posix:-D_POSIX_SOURCE} "/**/EXTRA_CPP_DEFINES #else #define CPP_SPEC \ - "%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{m68881:-D__HAVE_68881__} %{posix:-D_POSIX_SOURCE}" + "%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{m68881:-D__HAVE_68881__} %{posix:-D_POSIX_SOURCE} "/**/EXTRA_CPP_DEFINES #endif #else #if TARGET_DEFAULT & MASK_68881 #define CPP_SPEC \ - "%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{!msoft-float:-D__HAVE_68881__} %{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}" + "%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{!msoft-float:-D__HAVE_68881__} %{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT} "/**/EXTRA_CPP_DEFINES #else #define CPP_SPEC \ - "%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{m68881:-D__HAVE_68881__} %{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}" + "%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{m68881:-D__HAVE_68881__} %{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT} "/**/EXTRA_CPP_DEFINES #endif #endif @@ -139,7 +143,7 @@ #undef ASM_SPEC #define ASM_SPEC \ "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \ -%{m68040} %{m68060:-m68040}" +%{m68040} %{m68060:-m68060}" /* Provide a LINK_SPEC appropriate for GNU/Linux. Here we provide support for the special GCC options -static and -shared, which allow us to --- gcc-3.2-cvs/gcc/longlong.h.rz Fri Feb 8 22:08:05 2002 +++ gcc-3.2-cvs/gcc/longlong.h Wed Aug 21 22:49:01 2002 @@ -586,11 +586,12 @@ "g" ((USItype) (bl))) /* The '020, '030, '040 and CPU32 have 32x32->64 and 64/32->32q-32r. */ -#if defined (__mc68020__) || defined(mc68020) \ +#if !defined(__mc68060__) && !defined(mc68060) && \ + (defined (__mc68020__) || defined(mc68020) \ || defined(__mc68030__) || defined(mc68030) \ || defined(__mc68040__) || defined(mc68040) \ || defined(__mcpu32__) || defined(mcpu32) \ - || defined(__NeXT__) + || defined(__NeXT__)) #define umul_ppmm(w1, w0, u, v) \ __asm__ ("mulu%.l %3,%1:%0" \ : "=d" ((USItype) (w0)), \ --- gcc-3.2-cvs/gcc/simplify-rtx.c.rz Wed Mar 6 17:43:21 2002 +++ gcc-3.2-cvs/gcc/simplify-rtx.c Sat Aug 24 23:06:34 2002 @@ -2618,6 +2618,7 @@ suppress this simplification. If the hard register is the stack, frame, or argument pointer, leave this as a SUBREG. */ +#if 0 if (REG_P (op) && (! REG_FUNCTION_VALUE_P (op) || ! rtx_equal_function_value_matters) @@ -2662,6 +2663,7 @@ return x; } } +#endif /* If we have a SUBREG of a register that we are replacing and we are replacing it with a MEM, make a new MEM and try replacing the --- gcc-3.2-cvs/gcc/flow.c.rz Thu Apr 18 16:21:09 2002 +++ gcc-3.2-cvs/gcc/flow.c Wed Aug 21 22:49:01 2002 @@ -1770,8 +1770,11 @@ so they are made live. */ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) if (global_regs[i]) - mark_used_reg (pbi, gen_rtx_REG (reg_raw_mode[i], i), - cond, insn); + { + SET_REGNO_REG_SET (pbi->reg_live, i); + mark_used_reg (pbi, gen_rtx_REG (reg_raw_mode[i], i), + cond, insn); + } } } --- gcc-3.2-cvs/gcc/config.gcc.rz Tue Aug 6 11:20:55 2002 +++ gcc-3.2-cvs/gcc/config.gcc Wed Aug 21 22:49:01 2002 @@ -2078,7 +2078,7 @@ # GNU/Linux C library 5 tm_file=m68k/linux.h tmake_file="t-slibgcc-elf-ver t-linux t-linux-gnulibc1 m68k/t-linux" - extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" + extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o crtbeginT.o" float_format=m68k gnu_ld=yes ;; @@ -2087,7 +2087,7 @@ # aka the GNU/Linux C library 6. tm_file=m68k/linux.h tmake_file="t-slibgcc-elf-ver t-linux m68k/t-linux" - extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" + extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o crtbeginT.o" float_format=m68k gnu_ld=yes ;;