From patchwork Sun Jul 11 19:20:57 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Problem configuring uclinux toolchain From: Maxim Kuvyrkov X-Patchwork-Id: 58538 Message-Id: <4C3A1999.7090801@codesourcery.com> To: Anthony Green Cc: gcc-patches Date: Sun, 11 Jul 2010 23:20:57 +0400 [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? 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 . */ +#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)