This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix building several uclinux target


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,

--
Maxim Kuvyrkov
CodeSourcery
maxim@codesourcery.com
(650) 331-3385 x724

Attachment: fsf-gcc-ppc-sysv4.ChangeLog
Description: Text document

Attachment: fsf-gcc-ppc-sysv4.patch
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]