On Thu, Nov 13, 2014 at 8:59 PM, Jeff Law <l...@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. -- H.J. --- 2014-11-13 H.J. Lu <hongjiu...@intel.com> * config.gcc (default_gnu_indirect_function): Don't assume modern glibc when targeting Android. 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 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 unless we are targeting Android + case $target in + *-*-*android*) ;; + *) default_gnu_indirect_function=yes ;; + esac ;; x86_64-*-kfreebsd*-gnu) tm_file="${tm_file} kfreebsd-gnu.h i386/kfreebsd-gnu64.h" [hjl@gnu-6 gcc]$