Message ID | 4C3F3098.4060407@codesourcery.com |
---|---|
State | New |
Headers | show |
Maxim Kuvyrkov wrote: >> 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? OK.
On Thu, Jul 15, 2010 at 08:00:24PM +0400, Maxim Kuvyrkov wrote: >> 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. This patch breaks building a cross to powerpc-eabispe (possibly other powerpc SysV4-ish non-Linux targets). Reverting this bit: > 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 fixes things. I think this is because of this hunk in config/rs6000/sysv4.h: #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1" #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" #if DEFAULT_LIBC == LIBC_UCLIBC #define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}" #elif DEFAULT_LIBC == LIBC_GLIBC #define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}" #else #error "Unsupported DEFAULT_LIBC" #endif #define LINUX_DYNAMIC_LINKER \ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER) After your patch, LIBC_{UCLIBC,GLIBC} are defined unconditionally; DEFAULT_LIBC is not defined, so we now fall through to the #error case. Perhaps the toplevel code should now be: case $target in *-*-*linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu) # Common C libraries. tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3" ;; esac to catch the uclinux targets as well? -Nathan
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)