Patchwork Problem configuring uclinux toolchain

login
register
mail settings
Submitter Maxim Kuvyrkov
Date July 11, 2010, 7:20 p.m.
Message ID <4C3A1999.7090801@codesourcery.com>
Download mbox | patch
Permalink /patch/58538/
State New
Headers show

Comments

Maxim Kuvyrkov - July 11, 2010, 7:20 p.m.
[Moving from gcc@ to gcc-patches@]

On 7/10/10 12:44 AM, Anthony Green wrote:
> On 7/9/2010 11:59 AM, Maxim Kuvyrkov wrote:
>> On 7/9/10 3:22 PM, Anthony Green wrote:
>>> Hi Maxim,
>>>
>>> Recent changes to config.gcc are preventing me from building a
>>> moxie-uclinux toolchain.

The following patch should fix the build of moxie-uclinux toolchain. 
The problem was that the piece of config.gcc defining supported linux C 
libraries isn't executed for most uclinux targets, moxie included. 
Still, many uclinux targets includes linux.h and linux.opt, which 
yielded an error.

The patch moves definitions of constants enumerating C libraries to top 
level and moves Android-specific definitions from 
LINUX_TARGET_OS_CPP_BUILTINS to ANDROID_TARGET_OS_CPP_BUILTINS.

Tested with arm-linux-androideabi build and partial moxie-uclinux build.

OK to apply?
Anthony Green - July 12, 2010, 12:44 p.m.
On 7/11/2010 3:20 PM, Maxim Kuvyrkov wrote:
> [Moving from gcc@ to gcc-patches@]
>
> On 7/10/10 12:44 AM, Anthony Green wrote:
>> On 7/9/2010 11:59 AM, Maxim Kuvyrkov wrote:
>>> On 7/9/10 3:22 PM, Anthony Green wrote:
>>>> Hi Maxim,
>>>>
>>>> Recent changes to config.gcc are preventing me from building a
>>>> moxie-uclinux toolchain.
>
> The following patch should fix the build of moxie-uclinux toolchain. The
> problem was that the piece of config.gcc defining supported linux C
> libraries isn't executed for most uclinux targets, moxie included.
> Still, many uclinux targets includes linux.h and linux.opt, which
> yielded an error.
>
> The patch moves definitions of constants enumerating C libraries to top
> level and moves Android-specific definitions from
> LINUX_TARGET_OS_CPP_BUILTINS to ANDROID_TARGET_OS_CPP_BUILTINS.
>
> Tested with arm-linux-androideabi build and partial moxie-uclinux build.


Thanks Maxim!  I've just tested this and confirm that it fixes the 
problem for moxie-uclinux.

AG



>
> OK to apply?
>

Patch

Index: gcc/config.gcc
===================================================================
--- gcc/config.gcc	(revision 162059)
+++ gcc/config.gcc	(working copy)
@@ -405,6 +405,9 @@  case ${target} in
 	;;
 esac
 
+# Common C libraries.  There are mere constants.
+tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3"
+
 # Common parts for widely ported systems.
 case ${target} in
 *-*-darwin*)
@@ -508,8 +511,6 @@  case ${target} in
     *-*-gnu*)
       tmake_file="$tmake_file t-gnu";;
   esac
-  # Common C libraries.
-  tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3"
   # glibc / uclibc / bionic switch.
   # uclibc and bionic aren't usable for GNU/Hurd and neither for GNU/k*BSD.
   case $target in
Index: gcc/config/linux.h
===================================================================
--- gcc/config/linux.h	(revision 162059)
+++ gcc/config/linux.h	(working copy)
@@ -96,8 +96,6 @@  see the files COPYING3 and COPYING.RUNTI
 	builtin_assert ("system=linux");			\
 	builtin_assert ("system=unix");				\
 	builtin_assert ("system=posix");			\
-	if (OPTION_ANDROID)					\
-	  builtin_define ("__ANDROID__");			\
     } while (0)
 
 #if defined(HAVE_LD_EH_FRAME_HDR)
Index: gcc/config/linux-android.h
===================================================================
--- gcc/config/linux-android.h	(revision 162059)
+++ gcc/config/linux-android.h	(working copy)
@@ -20,6 +20,12 @@ 
    along with GCC; see the file COPYING3.  If not see
    <http://www.gnu.org/licenses/>.  */
 
+#define ANDROID_TARGET_OS_CPP_BUILTINS()			\
+    do {							\
+	if (OPTION_ANDROID)					\
+	  builtin_define ("__ANDROID__");			\
+    } while (0)
+
 #if ANDROID_DEFAULT
 # define NOANDROID "mno-android"
 #else
Index: gcc/config/arm/linux-eabi.h
===================================================================
--- gcc/config/arm/linux-eabi.h	(revision 162059)
+++ gcc/config/arm/linux-eabi.h	(working copy)
@@ -27,6 +27,7 @@ 
     {						\
       TARGET_BPABI_CPP_BUILTINS();		\
       LINUX_TARGET_OS_CPP_BUILTINS();		\
+      ANDROID_TARGET_OS_CPP_BUILTINS();		\
     }						\
   while (false)