diff mbox

[Android] Enable ifuncs on Android

Message ID CAMe9rOqwbjDNPucKwCYX2qKmfxY00sEDY8qo8NCj3tE=x7hUYw@mail.gmail.com
State New
Headers show

Commit Message

H.J. Lu Nov. 14, 2014, 5:19 a.m. UTC
On Thu, Nov 13, 2014 at 8:59 PM, Jeff Law <law@redhat.com> wrote:
> On 11/13/14 21:46, H.J. Lu wrote:
>
>>
>> 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.
>> I
>
> I'm sorry, I'm objecting to this patch.  It is wrong for GCC to produce code
> that is incorrect solely for the benefit of optimizing for a new release of
> a library.
>
> The right way is to trigger the new code on some configure time option or a
> new configuration itself.
>
> Whether or not GCC is doing this right for glibc is irrelevant, the patch is
> _wrong_.
>

I see where the problem is now. For i[34567]86-*-linux* and x86_64-*-linux*
targets, config.gcc assumes modern glibc and enable IFUNC by default.
That is wrong for  i[34567]86-*-linux-android* and and x86_64-*-linux-android*
targets.  This patch fixes it.  The original patch should work with it.
diff mbox

Patch

diff --git a/gcc/config.gcc b/gcc/config.gcc
index a6b37d8..1f01a64 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 unless we are targeting Android
+ case $target in
+                *-*-*android*) ;;
+ *) 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