From patchwork Wed Jul 21 18:39:11 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Kuvyrkov X-Patchwork-Id: 59486 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id E4979B6EFE for ; Thu, 22 Jul 2010 04:39:25 +1000 (EST) Received: (qmail 19370 invoked by alias); 21 Jul 2010 18:39:23 -0000 Received: (qmail 19357 invoked by uid 22791); 21 Jul 2010 18:39:21 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 21 Jul 2010 18:39:16 +0000 Received: (qmail 23246 invoked from network); 21 Jul 2010 18:39:14 -0000 Received: from unknown (HELO ?172.16.1.24?) (maxim@127.0.0.2) by mail.codesourcery.com with ESMTPA; 21 Jul 2010 18:39:14 -0000 Message-ID: <4C473ECF.2040502@codesourcery.com> Date: Wed, 21 Jul 2010 22:39:11 +0400 From: Maxim Kuvyrkov User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.4) Gecko/20100608 Thunderbird/3.1 MIME-Version: 1.0 To: Nathan Froyd , David Edelsohn CC: Anthony Green , gcc-patches Subject: Re: [PATCH] Fix building several uclinux target References: <4C370662.8050906@moxielogic.com> <4C374760.8070705@codesourcery.com> <4C378A3A.8070309@moxielogic.com> <4C3A1999.7090801@codesourcery.com> <4C3F3098.4060407@codesourcery.com> <20100720182034.GJ26037@codesourcery.com> In-Reply-To: <20100720182034.GJ26037@codesourcery.com> X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org On 7/20/10 10:20 PM, Nathan Froyd wrote: > 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). ... > 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, Thanks for the analysis. I would rather not duplicate the case statement which matches a non-trivial list of targets. It would be just too error prone. How about instead we make the implicit effects of config/rs6000/sysv4.h explicit? I.e., default to GLIBC when no C library is specified. This was the behavior before UCLIBC_DEFAULT was replaced with DEFAULT_LIBC. David, Does the attached patch look OK? Thank you, Index: config/rs6000/sysv4.h =================================================================== --- config/rs6000/sysv4.h (revision 162345) +++ config/rs6000/sysv4.h (working copy) @@ -905,7 +905,7 @@ SVR4_ASM_SPEC \ #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 +#elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC #define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}" #else #error "Unsupported DEFAULT_LIBC"