diff mbox

PATCH: Don't assume modern glibc for x86 Android targets

Message ID 20141114143802.GA6207@intel.com
State New
Headers show

Commit Message

H.J. Lu Nov. 14, 2014, 2:38 p.m. UTC
On Thu, Nov 13, 2014 at 09:32:07PM -0800, H.J. Lu wrote:
> For i[34567]86-*-linux* and x86_64-*-linux* targets, config.gcc assumes
> modern glibc and set default_gnu_indirect_function to yes.  That is wrong
> for i[34567]86-*-linux-android* and x86_64-*-linux-android* targets.
> This patch fixes it.  Tested on Linux/x86-64, Linux/ia32 and cross-teste
> for i686-linux-android and x86_64-linux-android.  OK for trunk?
> 
> Thanks.
> 
> 
> H.J.
> ----
> 2014-11-13  H.J. Lu  <hongjiu.lu@intel.com>
> 
> 	* config.gcc (default_gnu_indirect_function): Don't assume
> 	modern glibc for i[34567]86-*-linux* and x86_64-*-linux* when
> 	targeting Android.
> 

Here is the updated patch to cover uclibc.  OK for trunk?

Thanks.

H.J.
---
2014-11-14  H.J. Lu  <hongjiu.lu@intel.com>

	* config.gcc (default_gnu_indirect_function): Set to yes
	for i[34567]86-*-linux* and x86_64-*-linux* if not targeting
	Android nor uclibc.

Comments

Alexander Ivchenko Nov. 14, 2014, 3:10 p.m. UTC | #1
should we also change this comment in gcc/configure?

  --enable-gnu-indirect-function
                          enable the use of the @gnu_indirect_function to
                          glibc systems

So, if the patch that I sent for removing linux_has_ifunc_p is
approved, we will just add   "--enable-gnu-indirect-function"
configure option for upcoming ndk releases and ifuncs are supported,
right?

2014-11-14 17:38 GMT+03:00 H.J. Lu <hongjiu.lu@intel.com>:
> On Thu, Nov 13, 2014 at 09:32:07PM -0800, H.J. Lu wrote:
>> For i[34567]86-*-linux* and x86_64-*-linux* targets, config.gcc assumes
>> modern glibc and set default_gnu_indirect_function to yes.  That is wrong
>> for i[34567]86-*-linux-android* and x86_64-*-linux-android* targets.
>> This patch fixes it.  Tested on Linux/x86-64, Linux/ia32 and cross-teste
>> for i686-linux-android and x86_64-linux-android.  OK for trunk?
>>
>> Thanks.
>>
>>
>> H.J.
>> ----
>> 2014-11-13  H.J. Lu  <hongjiu.lu@intel.com>
>>
>>       * config.gcc (default_gnu_indirect_function): Don't assume
>>       modern glibc for i[34567]86-*-linux* and x86_64-*-linux* when
>>       targeting Android.
>>
>
> Here is the updated patch to cover uclibc.  OK for trunk?
>
> Thanks.
>
> H.J.
> ---
> 2014-11-14  H.J. Lu  <hongjiu.lu@intel.com>
>
>         * config.gcc (default_gnu_indirect_function): Set to yes
>         for i[34567]86-*-linux* and x86_64-*-linux* if not targeting
>         Android nor uclibc.
>
> diff --git a/gcc/config.gcc b/gcc/config.gcc
> index a6b37d8..a2c502e 100644
> --- a/gcc/config.gcc
> +++ b/gcc/config.gcc
> @@ -1404,8 +1404,11 @@ i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | i
>         i[34567]86-*-linux*)
>                 tm_file="${tm_file} linux.h linux-android.h"
>                 extra_options="${extra_options} linux-android.opt"
> -               # Assume modern glibc
> -               default_gnu_indirect_function=yes
> +               # Assume modern glibc if not targeting Android nor uclibc.
> +               case ${target} in
> +               *-*-*android*|*-*-*uclibc*) ;;
> +               *) default_gnu_indirect_function=yes ;;
> +               esac
>                 if test x$enable_targets = xall; then
>                         tm_file="${tm_file} i386/x86-64.h i386/gnu-user-common.h i386/gnu-user64.h i386/linux-common.h i386/linux64.h"
>                         tm_defines="${tm_defines} TARGET_BI_ARCH=1"
> @@ -1467,8 +1470,11 @@ x86_64-*-linux* | x86_64-*-kfreebsd*-gnu | x86_64-*-knetbsd*-gnu)
>         x86_64-*-linux*)
>                 tm_file="${tm_file} linux.h linux-android.h i386/linux-common.h i386/linux64.h"
>                 extra_options="${extra_options} linux-android.opt"
> -               # Assume modern glibc
> -               default_gnu_indirect_function=yes
> +               # Assume modern glibc if not targeting Android nor uclibc.
> +               case ${target} in
> +               *-*-*android*|*-*-*uclibc*) ;;
> +               *) default_gnu_indirect_function=yes ;;
> +               esac
>                 ;;
>         x86_64-*-kfreebsd*-gnu)
>                 tm_file="${tm_file} kfreebsd-gnu.h i386/kfreebsd-gnu64.h"
H.J. Lu Nov. 14, 2014, 3:46 p.m. UTC | #2
On Fri, Nov 14, 2014 at 7:10 AM, Alexander Ivchenko <aivchenk@gmail.com> wrote:
> should we also change this comment in gcc/configure?
>
>   --enable-gnu-indirect-function
>                           enable the use of the @gnu_indirect_function to
>                           glibc systems

That will be a separate issue.

> So, if the patch that I sent for removing linux_has_ifunc_p is
> approved, we will just add   "--enable-gnu-indirect-function"
> configure option for upcoming ndk releases and ifuncs are supported,
> right?
>

Yes.
Uros Bizjak Nov. 14, 2014, 3:51 p.m. UTC | #3
On Fri, Nov 14, 2014 at 3:38 PM, H.J. Lu <hongjiu.lu@intel.com> wrote:
> On Thu, Nov 13, 2014 at 09:32:07PM -0800, H.J. Lu wrote:
>> For i[34567]86-*-linux* and x86_64-*-linux* targets, config.gcc assumes
>> modern glibc and set default_gnu_indirect_function to yes.  That is wrong
>> for i[34567]86-*-linux-android* and x86_64-*-linux-android* targets.
>> This patch fixes it.  Tested on Linux/x86-64, Linux/ia32 and cross-teste
>> for i686-linux-android and x86_64-linux-android.  OK for trunk?
>>
>> Thanks.
>>
>>
>> H.J.
>> ----
>> 2014-11-13  H.J. Lu  <hongjiu.lu@intel.com>
>>
>>       * config.gcc (default_gnu_indirect_function): Don't assume
>>       modern glibc for i[34567]86-*-linux* and x86_64-*-linux* when
>>       targeting Android.
>>
>
> Here is the updated patch to cover uclibc.  OK for trunk?
>
> Thanks.
>
> H.J.
> ---
> 2014-11-14  H.J. Lu  <hongjiu.lu@intel.com>
>
>         * config.gcc (default_gnu_indirect_function): Set to yes
>         for i[34567]86-*-linux* and x86_64-*-linux* if not targeting
>         Android nor uclibc.

Please split target selectors to separate lines.

OK with this change.

Thanks,
Uros.

> diff --git a/gcc/config.gcc b/gcc/config.gcc
> index a6b37d8..a2c502e 100644
> --- a/gcc/config.gcc
> +++ b/gcc/config.gcc
> @@ -1404,8 +1404,11 @@ i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | i
>         i[34567]86-*-linux*)
>                 tm_file="${tm_file} linux.h linux-android.h"
>                 extra_options="${extra_options} linux-android.opt"
> -               # Assume modern glibc
> -               default_gnu_indirect_function=yes
> +               # Assume modern glibc if not targeting Android nor uclibc.
> +               case ${target} in
> +               *-*-*android*|*-*-*uclibc*) ;;
> +               *) default_gnu_indirect_function=yes ;;
> +               esac
>                 if test x$enable_targets = xall; then
>                         tm_file="${tm_file} i386/x86-64.h i386/gnu-user-common.h i386/gnu-user64.h i386/linux-common.h i386/linux64.h"
>                         tm_defines="${tm_defines} TARGET_BI_ARCH=1"
> @@ -1467,8 +1470,11 @@ x86_64-*-linux* | x86_64-*-kfreebsd*-gnu | x86_64-*-knetbsd*-gnu)
>         x86_64-*-linux*)
>                 tm_file="${tm_file} linux.h linux-android.h i386/linux-common.h i386/linux64.h"
>                 extra_options="${extra_options} linux-android.opt"
> -               # Assume modern glibc
> -               default_gnu_indirect_function=yes
> +               # Assume modern glibc if not targeting Android nor uclibc.
> +               case ${target} in
> +               *-*-*android*|*-*-*uclibc*) ;;
> +               *) default_gnu_indirect_function=yes ;;
> +               esac
>                 ;;
>         x86_64-*-kfreebsd*-gnu)
>                 tm_file="${tm_file} kfreebsd-gnu.h i386/kfreebsd-gnu64.h"
diff mbox

Patch

diff --git a/gcc/config.gcc b/gcc/config.gcc
index a6b37d8..a2c502e 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1404,8 +1404,11 @@  i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | i
 	i[34567]86-*-linux*)
 		tm_file="${tm_file} linux.h linux-android.h"
 		extra_options="${extra_options} linux-android.opt"
-		# Assume modern glibc
-		default_gnu_indirect_function=yes
+		# Assume modern glibc if not targeting Android nor uclibc.
+		case ${target} in
+		*-*-*android*|*-*-*uclibc*) ;;
+		*) default_gnu_indirect_function=yes ;;
+		esac
 		if test x$enable_targets = xall; then
 			tm_file="${tm_file} i386/x86-64.h i386/gnu-user-common.h i386/gnu-user64.h i386/linux-common.h i386/linux64.h"
 			tm_defines="${tm_defines} TARGET_BI_ARCH=1"
@@ -1467,8 +1470,11 @@  x86_64-*-linux* | x86_64-*-kfreebsd*-gnu | x86_64-*-knetbsd*-gnu)
 	x86_64-*-linux*)
 		tm_file="${tm_file} linux.h linux-android.h i386/linux-common.h i386/linux64.h"
 		extra_options="${extra_options} linux-android.opt"
-		# Assume modern glibc
-		default_gnu_indirect_function=yes
+		# Assume modern glibc if not targeting Android nor uclibc.
+		case ${target} in
+		*-*-*android*|*-*-*uclibc*) ;;
+		*) default_gnu_indirect_function=yes ;;
+		esac
 	  	;;
 	x86_64-*-kfreebsd*-gnu)
 		tm_file="${tm_file} kfreebsd-gnu.h i386/kfreebsd-gnu64.h"