diff mbox

PATCH: Add DEFAULT_LIBC=LIBC_BIONIC and ANDROID_DEFAULT=1 to *-android-*

Message ID 20111215164354.GA8290@intel.com
State New
Headers show

Commit Message

H.J. Lu Dec. 15, 2011, 4:43 p.m. UTC
Hi,

Linux/x86 target is configured as i686-android-linux. Changing it to
i686-linuxandroid requires changes in many packages.  This patch adds
DEFAULT_LIBC=LIBC_BIONIC and ANDROID_DEFAULT=1 to *-android-*.  OK for
trunk in stage 1?

Thanks.

H.J.
---
2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>

	* config.gcc: Add DEFAULT_LIBC=LIBC_BIONIC and
	ANDROID_DEFAULT=1 to *-android-*.

Comments

Joseph Myers Dec. 16, 2011, 11:27 p.m. UTC | #1
On Thu, 15 Dec 2011, H.J. Lu wrote:

> Hi,
> 
> Linux/x86 target is configured as i686-android-linux. Changing it to
> i686-linuxandroid requires changes in many packages.  This patch adds
> DEFAULT_LIBC=LIBC_BIONIC and ANDROID_DEFAULT=1 to *-android-*.  OK for
> trunk in stage 1?

I think using the "company" part of the target triplet to mean anything 
should be avoided; it's just an arbitrary identifier that users may set to 
distinguish multiple compilers for similar targets.  We may not be able to 
get rid of existing cases that treat it as significant, but can avoid 
adding new ones.  -linux-android (note the "-", not "-linuxandroid") 
matches the standard GNU practice where the last part is -KERNEL-OS (thus, 
-linux-gnu for Linux kernel, GNU OS, -linux-android for Linux kernel, 
Android OS).
H.J. Lu Dec. 17, 2011, 1:43 a.m. UTC | #2
On Fri, Dec 16, 2011 at 3:27 PM, Joseph S. Myers
<joseph@codesourcery.com> wrote:
> On Thu, 15 Dec 2011, H.J. Lu wrote:
>
>> Hi,
>>
>> Linux/x86 target is configured as i686-android-linux. Changing it to
>> i686-linuxandroid requires changes in many packages.  This patch adds
>> DEFAULT_LIBC=LIBC_BIONIC and ANDROID_DEFAULT=1 to *-android-*.  OK for
>> trunk in stage 1?
>
> I think using the "company" part of the target triplet to mean anything
> should be avoided; it's just an arbitrary identifier that users may set to

It means something only for GCC, nothing else.

> distinguish multiple compilers for similar targets.  We may not be able to
> get rid of existing cases that treat it as significant, but can avoid
> adding new ones.  -linux-android (note the "-", not "-linuxandroid")
> matches the standard GNU practice where the last part is -KERNEL-OS (thus,
> -linux-gnu for Linux kernel, GNU OS, -linux-android for Linux kernel,
> Android OS).
>

When I configure GCC with i686-linux-android target, don't I get
linux as vendor and android OS? Adding another arbitrary string
as vendor looks very strange to me.
Mike Stump Dec. 17, 2011, 8:56 a.m. UTC | #3
On Dec 16, 2011, at 3:27 PM, Joseph S. Myers wrote:
> I think using the "company" part of the target triplet to mean anything 
> should be avoided;

I disagree.  Think of the string as a key that subscripts a database which has precooked answers that are used instead of probing for the answers which are used to configure software.  In fact, any meaning whatsoever and the exact shape are, if you will completely arbitrary and don't really have any meaning in the grand scheme of things, save, just convention and an easier time on humans.  I think we have to approach each case one a case by case basis.

That said, in this case, I agree with the notion that the more natural form would be:

  arm-nokia-linux-android

where nokia is the hardware vendor the sells the device with the software on it.  android isn't a vendor, there is no such company that sells (vends) hardware.

> -linux-android (note the "-", not "-linuxandroid") matches the standard GNU practice

Agreed.
Mike Stump Dec. 17, 2011, 9:04 a.m. UTC | #4
On Dec 16, 2011, at 5:43 PM, H.J. Lu wrote:
> When I configure GCC with i686-linux-android target, don't I get
> linux as vendor and android OS?

No:

$ ./config.sub i686-linux-android
i686-pc-linux-android

pc is the vendor, though, I'd claim this is a misnomer and wrong.  A cell phone isn't PC compatible (usually).  unknown is the proper vendor, when, you don't want to guess or don't know or don't care.  The idea that linux only runs on a PC compatible computer, is, well, dated.  It used to be the case it only ran on PCs, but that is no longer true.

In matching, one would generally match i686-*-linux-android if one wanted to.  In config.sub land, you'd usually generate i686-unknown-linux-android.

> Adding another arbitrary string as vendor looks very strange to me.

For typing in a triplet, one can use i686-google-linux-android, if one wanted, not that strange.  Really, the user should be able to put any string in place of google and it shouldn't matter (except when a target maintainer wants to key off the vendor field for whatever reason).
diff mbox

Patch

diff --git a/gcc/config.gcc b/gcc/config.gcc
index b386424..0801431 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -585,7 +585,7 @@  case ${target} in
       tm_defines="$tm_defines SINGLE_LIBC";;
   esac
   case $target in
-    *-*-*android*)
+    *-*-*android* | *-android-*)
       tm_defines="$tm_defines DEFAULT_LIBC=LIBC_BIONIC"
       ;;
     *-*-*uclibc*)
@@ -609,7 +609,7 @@  case ${target} in
   esac
   # Enable compilation for Android by default for *android* targets.
   case $target in
-    *-*-*android*)
+    *-*-*android* | *-android-*)
       tm_defines="$tm_defines ANDROID_DEFAULT=1"
       ;;
     *)