[uClibc] gcc-uclibc followup patch (was Re: crosstools-patches)

Carl Miller chaz at energoncube.net
Thu Jan 8 14:41:51 MST 2004


> > Here's how far we get - there's obviously something broken with the 
> > unwind-dw2-fde-glib stuff:
> > 
> > ...
> > mipsel-unknown-linux-uclibc-hello-static
> > + 
> > /opt/crosstool/mipsel-unknown-linux-uclibc/gcc-3.3.2-uClibc-0.9.23/bin/mipsel-unknown-linux-uclibc-gcc 
> > hello.c -o mipsel-unknown-linux-uclibc-hello
> > + cat
> > + 
> > /opt/crosstool/mipsel-unknown-linux-uclibc/gcc-3.3.2-uClibc-0.9.23/bin/mipsel-unknown-linux-uclibc-g++ 
> > -static hello2.cc -o mipsel-unknown-linux-uclibc-hello2-static
> > /opt/crosstool/mipsel-unknown-linux-uclibc/gcc-3.3.2-uClibc-0.9.23/lib/gcc-lib/mipsel-unknown-linux-uclibc/3.3.2/libgcc_eh.a(unwind-dw2-fde-glibc.o)(.text+0x23a0): 
> > In function `_Unwind_Find_FDE':
> > /home/charlieb/rpms/BUILD/crosstool-0.25/build/mipsel-unknown-linux-uclibc/gcc-3.3.2-uClibc-0.9.23/gcc-3.3.2/gcc/unwind-dw2-fde-glibc.c:283: 
> > undefined reference to `dl_iterate_phdr'
> > collect2: ld returned 1 exit status
> 
> Hrm, yeah, I just recreated that same error message.  Looks like somehow
> gcc didn't get the message to use generic stack frame unwinding when
> handling C++ exceptions rather than the glibc-specific variety.  I'll
> look into that.....

Found the problem.  It appears I left the arm, cris, mips, and sh
architectures out of the first gcc-uclibc compatibility patch.  I think
the first time around, I went through gcc/config.gcc searching for
linux-gnu, and those four architectures call out only linux* for an OS
spec.  So your compiler was indeed built with glibc-specific stack frame
unwinding and without the uClibc dynamic linker called out in the specs
file.  The attached patch(es) should fix this.  They include the missing
uClibc stuff for arm, cris, mips, and sh.

Use the -update01 patch if you already applied my previous gcc-uclibc
patch.  It contains only the arm, cris, mips, sh stuff that was missing
from the first one.

Use the -full01 patch if you've got a fresh gcc-3.3.2 tree, or if you
want to archive "the proper patch" (realizing the definition of that term
is subject to change in the future).  It is the union of my previous
gcc-uclibc patch and the -update01 patch.


                             -----Carl
-------------- next part --------------
Index: gcc/config.gcc
===================================================================
RCS file: /home/cvs/tools/gcc-3.3.2/gcc/config.gcc,v
retrieving revision 1.2
retrieving revision 1.4
diff -d -u -r1.2 -r1.4
--- gcc/config.gcc	18 Dec 2003 02:18:35 -0000	1.2
+++ gcc/config.gcc	8 Jan 2004 19:14:25 -0000	1.4
@@ -712,6 +712,11 @@
 		thread_file='posix'
 		;;
 	esac
+	case $machine in
+	arm*-*-linux-uclibc*)
+		tmake_file="${tmake_file} t-linux-uclibc"
+		;;
+	esac
 	;;
 arm*-*-uclinux*)		# ARM ucLinux
 	tm_file="dbxelf.h elfos.h arm/unknown-elf.h arm/elf.h arm/aout.h arm/arm.h arm/linux-gas.h arm/linux-elf.h arm/uclinux-elf.h"
@@ -780,6 +785,11 @@
 cris-*-linux*)
 	tm_file="dbxelf.h elfos.h svr4.h ${tm_file} linux.h cris/linux.h"
 	tmake_file="cris/t-cris t-slibgcc-elf-ver cris/t-linux"
+	case $machine in
+	cris*-*-linux-uclibc*)
+		tmake_file="${tmake_file} t-linux-uclibc"
+		;;
+	esac
 	;;
 d30v-*)
 	tm_file="dbxelf.h elfos.h svr4.h ${tm_file}"
@@ -1907,6 +1917,11 @@
                 ;;
         esac
 	tmake_file="t-slibgcc-elf-ver t-linux mips/t-linux"
+	case $machine in
+	mips*-*-linux*uclibc*)
+		tmake_file="${tmake_file} t-linux-uclibc"
+		;;
+	esac
 	;;
 mips*el-*-openbsd*)	# mips little endian
 	target_cpu_default="MASK_GAS|MASK_ABICALLS"
@@ -2353,6 +2368,11 @@
 	case $machine in
 	sh[234]*) tmake_file="${tmake_file} sh/t-monolib" ;;
 	esac
+	case $machine in
+	sh*-*-linux-uclibc*)
+		tmake_file="${tmake_file} t-linux-uclibc"
+		;;
+	esac
 	;;
 sh-*-netbsdelf* | shl*-*-netbsdelf* | sh5-*-netbsd* | sh5l*-*-netbsd* | \
   sh64-*-netbsd* | sh64l*-*-netbsd*)
Index: gcc/config/arm/linux-elf.h
===================================================================
RCS file: /home/cvs/tools/gcc-3.3.2/gcc/config/arm/linux-elf.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -d -u -r1.1 -r1.2
--- gcc/config/arm/linux-elf.h	4 Dec 2003 01:19:29 -0000	1.1
+++ gcc/config/arm/linux-elf.h	8 Jan 2004 19:14:32 -0000	1.2
@@ -78,6 +78,18 @@
   "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
 
 #undef  LINK_SPEC
+#ifdef USE_UCLIBC
+#define LINK_SPEC "%{h*} %{version:-v} \
+   %{b} %{Wl,*:%*} \
+   %{static:-Bstatic} \
+   %{shared:-shared} \
+   %{symbolic:-Bsymbolic} \
+   %{rdynamic:-export-dynamic} \
+   %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0} \
+   -X \
+   %{mbig-endian:-EB}" \
+   SUBTARGET_EXTRA_LINK_SPEC
+#else
 #define LINK_SPEC "%{h*} %{version:-v} \
    %{b} %{Wl,*:%*} \
    %{static:-Bstatic} \
@@ -88,6 +100,7 @@
    -X \
    %{mbig-endian:-EB}" \
    SUBTARGET_EXTRA_LINK_SPEC
+#endif
 
 #define TARGET_OS_CPP_BUILTINS()		\
     do {					\
Index: gcc/config/mips/linux.h
===================================================================
RCS file: /home/cvs/tools/gcc-3.3.2/gcc/config/mips/linux.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -d -u -r1.1 -r1.2
--- gcc/config/mips/linux.h	4 Dec 2003 01:19:29 -0000	1.1
+++ gcc/config/mips/linux.h	8 Jan 2004 05:25:00 -0000	1.2
@@ -175,6 +175,17 @@
 
 /* Borrowed from sparc/linux.h */
 #undef LINK_SPEC
+#ifdef USE_UCLIBC
+#define LINK_SPEC \
+ "%(endian_spec) \
+  %{shared:-shared} \
+  %{!shared: \
+    %{!ibcs: \
+      %{!static: \
+        %{rdynamic:-export-dynamic} \
+        %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}} \
+        %{static:-static}}}"
+#else
 #define LINK_SPEC \
  "%(endian_spec) \
   %{shared:-shared} \
@@ -184,6 +195,7 @@
         %{rdynamic:-export-dynamic} \
         %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}} \
         %{static:-static}}}"
+#endif
 
 #undef SUBTARGET_ASM_SPEC
 #define SUBTARGET_ASM_SPEC "\
Index: gcc/config/sh/linux.h
===================================================================
RCS file: /home/cvs/tools/gcc-3.3.2/gcc/config/sh/linux.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -d -u -r1.1 -r1.2
--- gcc/config/sh/linux.h	4 Dec 2003 01:19:29 -0000	1.1
+++ gcc/config/sh/linux.h	8 Jan 2004 19:14:32 -0000	1.2
@@ -44,12 +44,21 @@
 #undef SUBTARGET_LINK_EMUL_SUFFIX
 #define SUBTARGET_LINK_EMUL_SUFFIX "_linux"
 #undef SUBTARGET_LINK_SPEC
+#ifdef USE_UCLIBC
+#define SUBTARGET_LINK_SPEC \
+  "%{shared:-shared} \
+   %{!static: \
+     %{rdynamic:-export-dynamic} \
+     %{!dynamic-linker:-dynamic-linker /lib/ld-uClibc.so.0}} \
+   %{static:-static}"
+#else
 #define SUBTARGET_LINK_SPEC \
   "%{shared:-shared} \
    %{!static: \
      %{rdynamic:-export-dynamic} \
      %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
    %{static:-static}"
+#endif
 
 /* The GNU C++ standard library requires that these macros be defined.  */
 #undef CPLUSPLUS_CPP_SPEC
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcc-uclibc-full01.patch.gz
Type: application/octet-stream
Size: 10244 bytes
Desc: not available
Url : http://uclibc.org/lists/uclibc/attachments/20040108/6eb2f82b/gcc-uclibc-full01.patch.obj


More information about the uClibc mailing list