Bug 53833 - m68k-uclinux xgcc ICE when compiling libgcc (linux-atomic.c:203:1: in emit_library_call_value_1, at calls.c:4146)
Summary: m68k-uclinux xgcc ICE when compiling libgcc (linux-atomic.c:203:1: in emit_li...
Status: RESOLVED DUPLICATE of bug 68467
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.7.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-02 23:12 UTC by Larry Baker
Modified: 2016-11-17 18:53 UTC (History)
1 user (show)

See Also:
Host:
Target: m68k
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Make m68k-uclinux cross compiler (2.79 KB, application/octet-stream)
2012-07-02 23:12 UTC, Larry Baker
Details
Hacked binutils 1.22 bfd/elflink.c (89.44 KB, application/octet-stream)
2012-09-18 21:45 UTC, Larry Baker
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Larry Baker 2012-07-02 23:12:03 UTC
Created attachment 27732 [details]
Make m68k-uclinux cross compiler

Host: i686-pc-linux (also x86_64-apple-darwin10.8.0)
Target: m68k-uclinux (Coldfire)

I have been able to create native and cross compilers on CentOS Linux i386 for gcc 4.6.1 and 4.6.3.  However, all attempts to make a cross compiler for gcc 4.7 fail when the new xgcc compiles linux-atomic.c for libgcc (which did not exist in the gcc 4.6 versions).

I have been compiling the cross compiler with the same version of the native compiler.  Same thing happens when I compile a 4.7 cross compiler with a 4.6 native compiler.  (No surprise, because the compiler that fails is the new xgcc.)

Same result from my Mac OS X 10.6.8 (using a native gcc 4.7.1 compiler I compiled; 10.6.8 still defaults to a gcc compiler which I used to compile the native gcc 4.7.1).

Same result using the gcc-4.7-20120630.tar.gz (1 Jul 00:48, 102365191 Bytes) gcc 4.7 trunk tarball I found at http://fossies.org/unix/misc/.  (I saw there was a slight change in gcc/config/m68k/sync.md; didn't help.)

I suspect the new atomic builtins are no good for a Coldfire processor.  But, I don't know how the cross compiler is being told which flavor of M68000 it is.

The error message (i686-pc-linux to m68k-uclinux) is at:

/usr/local/src/gcc/./gcc/xgcc -B/usr/local/src/gcc/./gcc/ -B/opt/lantronix/sdk/toolchains/freescale-coldfire-2011.09/m68k-uclinux/bin/ -B/opt/lantronix/sdk/toolchains/freescale-coldfire-2011.09/m68k-uclinux/lib/ -isystem /opt/lantronix/sdk/toolchains/freescale-coldfire-2011.09/m68k-uclinux/include -isystem /opt/lantronix/sdk/toolchains/freescale-coldfire-2011.09/m68k-uclinux/sys-include --sysroot=/opt/lantronix/sdk/toolchains/freescale-coldfire-2011.09/m68k-uclinux/libc   -g -O2 -O2  -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector   -I. -I. -I../.././gcc -I../../../gcc-4.7.1/libgcc -I../../../gcc-4.7.1/libgcc/. -I../../../gcc-4.7.1/libgcc/../gcc -I../../../gcc-4.7.1/libgcc/../include  -DHAVE_CC_TLS  -o unwind-dw2-fde.o -MT unwind-dw2-fde.o -MD -MP -MF unwind-dw2-fde.dep -fexceptions -c ../../../gcc-4.7.1/libgcc/unwind-dw2-fde.c 
../../../gcc-4.7.1/libgcc/config/m68k/linux-atomic.c: In function '__sync_bool_compare_and_swap_1':
../../../gcc-4.7.1/libgcc/config/m68k/linux-atomic.c:203:1: internal compiler error: in emit_library_call_value_1, at calls.c:4146
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

I have attached the make file I use.  (It has a bunch of lines at the bottom that are disabled from the CodeSourcery shell script I used as a template, from https://sourcery.mentor.com/GNUToolchain/package9493/public/m68k-uclinux/freescale-coldfire-2011.09-23-m68k-uclinux.src.tar.bz2.  They have their own source for their 4.6.1 compiler.

The reason I'm doing this is that all the CodeSourcery cross compilers and the GNU 4.6.1 and 4.6.3 cross compilers fail with an ICE when I use -fstack-limit-symbol=_stack_start.  I'm trying to figure out if that is fixed in the 4.7 compilers before I file a bug report.)

Thank you in advance for your assistance.
Comment 1 Larry Baker 2012-07-05 18:07:48 UTC
I didn't try to figure out why the code in libgcc/config/m68k/linux-atomic.c is causing the GCC 4.7.1 xgcc cross compiler to fail.  I just patched libgcc/config.host to disable atomic builtins when compiling for Motorola m68k/ColdFire running uClinux with uClibc:

--- gcc-4.7.1/libgcc/config.host.orig	2012-04-30 10:39:57.000000000 -0700
+++ gcc-4.7.1/libgcc/config.host	2012-07-05 00:01:17.000000000 -0700
@@ -710,3 +710,3 @@
m68k-*-uclinux*)	# Motorola m68k/ColdFire running uClinux with uClibc
-	tmake_file="$tmake_file m68k/t-floatlib m68k/t-linux"
+	tmake_file="$tmake_file m68k/t-floatlib"
	md_unwind_header=m68k/linux-unwind.h

Someone still needs to figure out why the implementation fails for m68k-uclinux --with-arch=cf.
Comment 2 Larry Baker 2012-09-12 20:55:00 UTC
Same bug occurs fo GCC 4.8.  Here's the patch I used to build a GCC 4.8 cross-compiler:

--- gcc-4.8-20120909/libgcc/config.host
+++ gcc-4.8-20120909-patched/libgcc/config.host
@@ -704,3 +704,3 @@
 m68k-*-uclinux*)	# Motorola m68k/ColdFire running uClinux with uClibc
-	tmake_file="$tmake_file m68k/t-floatlib m68k/t-linux"
+	tmake_file="$tmake_file m68k/t-floatlib"
 	md_unwind_header=m68k/linux-unwind.h
Comment 3 Larry Baker 2012-09-18 21:45:23 UTC
Created attachment 28217 [details]
Hacked binutils 1.22 bfd/elflink.c

I added a bunch of debugging output to bfd/elflink.c to find out where the link failure occurs.
Comment 4 Larry Baker 2012-09-18 21:51:36 UTC
(In reply to comment #3)
> Created attachment 28217 [details]
> Hacked binutils 1.22 bfd/elflink.c
> 
> I added a bunch of debugging output to bfd/elflink.c to find out where the link
> failure occurs.

This doesn't belong here -- it is for Bug no. 54584.

Will the moderator please remove it?

Sorry.
Comment 5 angelo 2016-04-16 13:47:32 UTC
There are 5 comments with related job to collect logs and help gcc community, and other as me facing similar issues compiling with "--with-arch=cf".

I know gcc is an open community and we can't pretend anything,
anyway, at least a reply in 4 years would be good.
Comment 6 Jeffrey A. Law 2016-11-17 18:53:43 UTC
Tracking via 68467.  What we really need here is a .i file we can feed back into the compiler for debugging purposes.

*** This bug has been marked as a duplicate of bug 68467 ***