This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Android] Enable ifuncs on Android
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Jeff Law <law at redhat dot com>
- Cc: Alexander Ivchenko <aivchenk at gmail dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, enh <enh at google dot com>, Andrew Hsieh <andrewhsieh at google dot com>
- Date: Thu, 13 Nov 2014 20:46:46 -0800
- Subject: Re: [Android] Enable ifuncs on Android
- Authentication-results: sourceware.org; auth=none
- References: <CACysShhcx+rmo5MVNOZf8La3_wMaTPZD0PE-phP07PSMkiB2UA at mail dot gmail dot com> <5464EC1A dot 6070709 at redhat dot com>
On Thu, Nov 13, 2014 at 9:36 AM, Jeff Law <law@redhat.com> wrote:
> On 11/12/14 03:02, Alexander Ivchenko wrote:
>>
>> Hi,
>>
>> Bionic - Android libc - supports indirect functions right now, but
>> they are disabled in gcc;
>>
>> We cannot do the configure-time check for that, because there is only
>> one version of each compiler shipped in ndk for all Android platforms.
>> On the other hand, having different runtime targets like -mandroid-19,
>> -mandroid-20 would be a nightmare. But, keeping in mind that the last
>> version of Android is a priority, I think that enabling ifuncs
>> unconditionally would be the right thing.
>>
>> Is the patch ok? Bootstrapped/regtested on x86_64-unknown-linux-gnu +
>> checked that the behavior of i686-linux-android is correct.
>>
>>
>> diff --git a/gcc/ChangeLog b/gcc/ChangeLog
>> index eac19cf..9932323 100644
>> --- a/gcc/ChangeLog
>> +++ b/gcc/ChangeLog
>> @@ -1,3 +1,8 @@
>> +2014-11-11 Alexander Ivchenko <alexander.ivchenko@intel.com>
>> +
>> + * config/linux.c (linux_has_ifunc_p): Remove.
>> + * config/linux.h (TARGET_HAS_IFUNC_P): Use the default version.
>
> This feels like a bad idea to me simply because a new compiler with an old
> runtime will generate code that fails, right?
>
> If you can't do a configure-time test, then the way to go is either a
> compile-time option, or to use a different target. If there's some minimum
> version of android that has this capability, then this isn't terribly hard.
> You may not even need a config file for this since you could define
> LIBC_BIONIC_USE_IFUNCS or something like that when configured for a suitably
> new android version.
Hi Jeff,
I believe the patch is correct. Not all glibcs support IFUNC. It doesn't mean
we should disable IFUNC for all glibcs. By default, we do a configure time
check for IFUNC. We DO want to use configure time check for IFUNC for
Android NDK.
Alexander, configure time check for IFUNC should work for Android. If
it doesn't,
please let me know and I will fix it.
--
H.J.