public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Problem configuring uclinux toolchain
       [not found]   ` <4C378A3A.8070309@moxielogic.com>
@ 2010-07-11 19:21     ` Maxim Kuvyrkov
  2010-07-12 12:44       ` Anthony Green
  2010-07-15 16:00       ` [PATCH] Fix building several uclinux target Maxim Kuvyrkov
  0 siblings, 2 replies; 7+ messages in thread
From: Maxim Kuvyrkov @ 2010-07-11 19:21 UTC (permalink / raw)
  To: Anthony Green; +Cc: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 931 bytes --]

[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?

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

[-- Attachment #2: android-uclinux-fix.ChangeLog --]
[-- Type: text/plain, Size: 376 bytes --]

2010-07-11  Maxim Kuvyrkov  <maxim@codesourcery.com>

	gcc/
	* config.gcc (LIBC_GLIBC, LIBC_UCLIBC, LIBC_BIONIC): Move constants
	to top level.
	* config/linux.h (LINUX_TARGET_OS_CPP_BUILTINS): Move Android-specific
	definitions ...
	* config/linux-android.h (ANDROID_TARGET_OS_CPP_BUILTINS): ... here.
	New macro.
	* config/arm/linux-eabi.h (TARGET_OS_CPP_BUILTINS): Use it.

[-- Attachment #3: android-uclinux-fix.patch --]
[-- Type: text/plain, Size: 2122 bytes --]

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)
 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Problem configuring uclinux toolchain
  2010-07-11 19:21     ` Problem configuring uclinux toolchain Maxim Kuvyrkov
@ 2010-07-12 12:44       ` Anthony Green
  2010-07-15 16:00       ` [PATCH] Fix building several uclinux target Maxim Kuvyrkov
  1 sibling, 0 replies; 7+ messages in thread
From: Anthony Green @ 2010-07-12 12:44 UTC (permalink / raw)
  To: Maxim Kuvyrkov; +Cc: gcc-patches

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?
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] Fix building several uclinux target
  2010-07-11 19:21     ` Problem configuring uclinux toolchain Maxim Kuvyrkov
  2010-07-12 12:44       ` Anthony Green
@ 2010-07-15 16:00       ` Maxim Kuvyrkov
  2010-07-19 16:33         ` Mark Mitchell
  2010-07-20 18:20         ` Nathan Froyd
  1 sibling, 2 replies; 7+ messages in thread
From: Maxim Kuvyrkov @ 2010-07-15 16:00 UTC (permalink / raw)
  To: Anthony Green; +Cc: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1102 bytes --]

On 7/11/10 11: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.

Ping.

Anthony reported in another message that the patch fixes moxie-uclinux 
build.

>
> 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?
>

Thanks,

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

[-- Attachment #2: android-uclinux-fix.ChangeLog --]
[-- Type: text/plain, Size: 376 bytes --]

2010-07-11  Maxim Kuvyrkov  <maxim@codesourcery.com>

	gcc/
	* config.gcc (LIBC_GLIBC, LIBC_UCLIBC, LIBC_BIONIC): Move constants
	to top level.
	* config/linux.h (LINUX_TARGET_OS_CPP_BUILTINS): Move Android-specific
	definitions ...
	* config/linux-android.h (ANDROID_TARGET_OS_CPP_BUILTINS): ... here.
	New macro.
	* config/arm/linux-eabi.h (TARGET_OS_CPP_BUILTINS): Use it.

[-- Attachment #3: android-uclinux-fix.patch --]
[-- Type: text/plain, Size: 2122 bytes --]

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)
 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Fix building several uclinux target
  2010-07-15 16:00       ` [PATCH] Fix building several uclinux target Maxim Kuvyrkov
@ 2010-07-19 16:33         ` Mark Mitchell
  2010-07-20 18:20         ` Nathan Froyd
  1 sibling, 0 replies; 7+ messages in thread
From: Mark Mitchell @ 2010-07-19 16:33 UTC (permalink / raw)
  To: Maxim Kuvyrkov; +Cc: Anthony Green, gcc-patches

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.

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Fix building several uclinux target
  2010-07-15 16:00       ` [PATCH] Fix building several uclinux target Maxim Kuvyrkov
  2010-07-19 16:33         ` Mark Mitchell
@ 2010-07-20 18:20         ` Nathan Froyd
  2010-07-21 18:39           ` Maxim Kuvyrkov
  1 sibling, 1 reply; 7+ messages in thread
From: Nathan Froyd @ 2010-07-20 18:20 UTC (permalink / raw)
  To: Maxim Kuvyrkov; +Cc: Anthony Green, gcc-patches

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Fix building several uclinux target
  2010-07-20 18:20         ` Nathan Froyd
@ 2010-07-21 18:39           ` Maxim Kuvyrkov
  2010-07-21 23:09             ` David Edelsohn
  0 siblings, 1 reply; 7+ messages in thread
From: Maxim Kuvyrkov @ 2010-07-21 18:39 UTC (permalink / raw)
  To: Nathan Froyd, David Edelsohn; +Cc: Anthony Green, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 2042 bytes --]

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 #2: fsf-gcc-ppc-sysv4.ChangeLog --]
[-- Type: text/plain, Size: 154 bytes --]

2010-07-21  Maxim Kuvyrkov  <maxim@codesourcery.com>

	* config/rs6000/sysv4.h (CHOOSE_DYNAMIC_LINKER): Default to GLIBC
	when no C library is specified.

[-- Attachment #3: fsf-gcc-ppc-sysv4.patch --]
[-- Type: text/plain, Size: 566 bytes --]

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"

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Fix building several uclinux target
  2010-07-21 18:39           ` Maxim Kuvyrkov
@ 2010-07-21 23:09             ` David Edelsohn
  0 siblings, 0 replies; 7+ messages in thread
From: David Edelsohn @ 2010-07-21 23:09 UTC (permalink / raw)
  To: Maxim Kuvyrkov; +Cc: Nathan Froyd, Anthony Green, gcc-patches

On Wed, Jul 21, 2010 at 2:39 PM, Maxim Kuvyrkov <maxim@codesourcery.com> wrote:

> 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.

That seems like a reasonable solution.

Okay.

Thanks, David

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-07-21 23:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <4C370662.8050906@moxielogic.com>
     [not found] ` <4C374760.8070705@codesourcery.com>
     [not found]   ` <4C378A3A.8070309@moxielogic.com>
2010-07-11 19:21     ` Problem configuring uclinux toolchain Maxim Kuvyrkov
2010-07-12 12:44       ` Anthony Green
2010-07-15 16:00       ` [PATCH] Fix building several uclinux target Maxim Kuvyrkov
2010-07-19 16:33         ` Mark Mitchell
2010-07-20 18:20         ` Nathan Froyd
2010-07-21 18:39           ` Maxim Kuvyrkov
2010-07-21 23:09             ` David Edelsohn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).