diff mbox

Enable non-complex math builtins from C99 for Bionic

Message ID CACysShgCzaTtSDapaw-+vkpUtqBtfRpKVWzd=NUOtrGP1AMPtg@mail.gmail.com
State New
Headers show

Commit Message

Alexander Ivchenko Aug. 22, 2013, 1:04 p.m. UTC
Ugh.. thanks, you are right. That points to another problem that I
didn't see before:

3) *linux* targets that do not append to tm_p_file (s390x-*-linux* and
s390x-ibm-tpf* - your patch addresses that problem correctly) OR
tmake_file (bfin*-linux-uclibc* or crisv32-*-linux* | cris-*-linux*)

(btw bfin*-linux-uclibc* or crisv32-*-linux* | cris-*-linux* are
broken now anyways:

opening glibc-c.o: No such file or directory
make[1]: *** [cc1-checksum.c] Error 1
make[1]: *** Waiting for unfinished jobs...)

Sorry again for the inconvenience, here is the updated patch that now,
hopefully, fixes the issues with my initial patch.
(Andreas patch still needs to be applied)

Is it OK?

+#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function


thanks,
Alexander

2013/8/22 Andreas Krebbel <krebbel@linux.vnet.ibm.com>:
> On Wed, Aug 21, 2013 at 11:21:32PM +0400, Alexander Ivchenko wrote:
>> I'm sorry for that. The following patch cured my build of those
>> targets; it is also preserving the initial presence of c99. There were
>> plenty of targets that were changed by my patch, I hope this time I
>> didn't miss anything.
>
> S/390 bootstrap still fails. The reason is that when we set
> tm_file/tm_p_file in config.gcc we do not append to the existing
> content so your adjustments done before are ignored and gcc complains
> about unknown linux_android_libc_has_function.
>
> However, since with s390 Linux and TPF we only target GNU Linux
> systems with Glibc we can default to gnu_libc_has_functions anyway:
>
> Index: gcc/config/s390/linux.h
> ===================================================================
> *** gcc/config/s390/linux.h.orig        2013-01-14 07:48:06.000000000 +0000
> --- gcc/config/s390/linux.h     2013-08-22 07:57:46.006014197 +0000
> *************** along with GCC; see the file COPYING3.
> *** 87,90 ****
> --- 87,93 ----
>   /* Define if long doubles should be mangled as 'g'.  */
>   #define TARGET_ALTERNATE_LONG_DOUBLE_MANGLING
>
> + #undef TARGET_LIBC_HAS_FUNCTION
> + #define TARGET_LIBC_HAS_FUNCTION gnu_libc_has_function
> +
>   #endif
> Index: gcc/config/s390/tpf.h
> ===================================================================
> *** gcc/config/s390/tpf.h.orig  2013-08-22 07:01:48.000000000 +0000
> --- gcc/config/s390/tpf.h       2013-08-22 07:57:27.706013534 +0000
> *************** along with GCC; see the file COPYING3.
> *** 111,118 ****
>   /* IBM copies these libraries over with these names.  */
>   #define MATH_LIBRARY "CLBM"
>   #define LIBSTDCXX "CPP2"
> - #endif /* ! _TPF_H */
>
> - /* We redefine this hook so the version from elfos.h header won't be used.  */
>   #undef TARGET_LIBC_HAS_FUNCTION
> ! #define TARGET_LIBC_HAS_FUNCTION default_libc_has_function
> --- 111,118 ----
>   /* IBM copies these libraries over with these names.  */
>   #define MATH_LIBRARY "CLBM"
>   #define LIBSTDCXX "CPP2"
>
>   #undef TARGET_LIBC_HAS_FUNCTION
> ! #define TARGET_LIBC_HAS_FUNCTION gnu_libc_has_function
> !
> ! #endif /* ! _TPF_H */
>

Comments

Michael Meissner Sept. 3, 2013, 11:05 p.m. UTC | #1
On Thu, Aug 22, 2013 at 05:04:21PM +0400, Alexander Ivchenko wrote:
> Ugh.. thanks, you are right. That points to another problem that I
> didn't see before:
> 
> 3) *linux* targets that do not append to tm_p_file (s390x-*-linux* and
> s390x-ibm-tpf* - your patch addresses that problem correctly) OR
> tmake_file (bfin*-linux-uclibc* or crisv32-*-linux* | cris-*-linux*)
> 
> (btw bfin*-linux-uclibc* or crisv32-*-linux* | cris-*-linux* are
> broken now anyways:
> 
> opening glibc-c.o: No such file or directory
> make[1]: *** [cc1-checksum.c] Error 1
> make[1]: *** Waiting for unfinished jobs...)
> 
> Sorry again for the inconvenience, here is the updated patch that now,
> hopefully, fixes the issues with my initial patch.
> (Andreas patch still needs to be applied)
> 
> Is it OK?
> 
> diff --git a/gcc/ChangeLog b/gcc/ChangeLog
> index 6e27be2..2d15fb1 100644
> --- a/gcc/ChangeLog
> +++ b/gcc/ChangeLog
> @@ -1,3 +1,17 @@
> +2013-08-21  Alexander Ivchenko  <alexander.ivchenko@intel.com>
> +
> + * config/linux-android.c (linux_android_libc_has_function): Fix
> + checks for libc.
> + * config/bfin/uclinux.h: Define TARGET_LIBC_HAS_FUNCTION as
> + no_c99_libc_has_function.
> + * config/c6x/uclinux-elf.h: Ditto.
> + * config/lm32/uclinux-elf.h: Ditto.
> + * config/m68k/uclinux.h: Ditto.
> + * config/moxie/uclinux.h: Ditto.
> + * config.gcc (bfin*-linux-uclibc*): Add t-linux-android to tmake_file.
> + (crisv32-*-linux*, cris-*-linux*): Ditto.
> + * config/bfin/bfin.c: Include "tm_p.h".
> +
>  2013-08-21  Joern Rennecke  <joern.rennecke@embecosm.com>
> 
>   * reload.h (struct reg_equivs): Rename to ..

Please do not put diff's of the ChangeLog file in the patch.  Instead you
should have the ChangeLog parts in the message, and if it is more than a few
lines, the patch (without the ChangeLog bits) should be a separate attachment.
That allows us to apply the patch without an error.

I just got back from vacation, and noticed the powerpc linux compiler no longer
builds, and I've been reading my old mail from the last week or so.  I suspect
we will need similar patches for the powerpc.
Maxim Kuvyrkov Sept. 4, 2013, 5:15 a.m. UTC | #2
On 23/08/2013, at 1:04 AM, Alexander Ivchenko wrote:

> Ugh.. thanks, you are right. That points to another problem that I
> didn't see before:
> 
> 3) *linux* targets that do not append to tm_p_file (s390x-*-linux* and
> s390x-ibm-tpf* - your patch addresses that problem correctly) OR
> tmake_file (bfin*-linux-uclibc* or crisv32-*-linux* | cris-*-linux*)

Could you be more verbose, please?  What some of the *linux* target do not append to tm_p_file?

It seems that there are at least two separate problems:

1. OPTION_BIONIC is not defined in linux-android.c .  I think the right fix here is to copy definitions of OPTION_BIONIC (and, optionally, OPTION_UCLIBC) from gcc/config/linux.h to rs6000/linux.h, rs6000/linux64.h and alpha/linux.h -- in other words, define OPTION_BIONIC and OPTION_UCLIBC whenever OPTION_GLIBC is defined.

2. The second problem is to do with definitions of TARGET_LIBC_HAS_FUNCTION for bfin, c6x, lm32, m68k and moxie.  What is the failure scenario here?

> diff --git a/gcc/config.gcc b/gcc/config.gcc
> index 7e1d529..89cf30a 100644
> --- a/gcc/config.gcc
> +++ b/gcc/config.gcc
> @@ -1018,7 +1018,7 @@ bfin*-uclinux*)
>  ;;
> bfin*-linux-uclibc*)
>  tm_file="${tm_file} dbxelf.h elfos.h bfin/elf.h gnu-user.h linux.h
> glibc-stdint.h bfin/linux.h ./linux-sysroot-suffix.h"
> - tmake_file="bfin/t-bfin-linux t-slibgcc"
> + tmake_file="bfin/t-bfin-linux t-slibgcc t-linux-android"
>  use_collect2=no
>  ;;
> bfin*-rtems*)

Why?  Bfin has nothing to do with android.

> @@ -1053,7 +1053,7 @@ cris-*-elf | cris-*-none)
> crisv32-*-linux* | cris-*-linux*)
>  tm_file="dbxelf.h elfos.h ${tm_file} gnu-user.h linux.h
> glibc-stdint.h cris/linux.h"
>  # We need to avoid using t-linux, so override default tmake_file
> - tmake_file="cris/t-cris cris/t-linux t-slibgcc"
> + tmake_file="cris/t-cris cris/t-linux t-slibgcc t-linux-android"
>  extra_options="${extra_options} cris/linux.opt"
>  case $target in
>   cris-*-*)

Same question here.

> diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c
> index 7fab975..18457f8 100644
> --- a/gcc/config/bfin/bfin.c
> +++ b/gcc/config/bfin/bfin.c
> @@ -46,6 +46,7 @@
> #include "cgraph.h"
> #include "langhooks.h"
> #include "bfin-protos.h"
> +#include "tm_p.h"
> #include "tm-preds.h"
> #include "tm-constrs.h"
> #include "gt-bfin.h"
> diff --git a/gcc/config/bfin/uclinux.h b/gcc/config/bfin/uclinux.h
> index ca0f4ee..63cba99 100644
> --- a/gcc/config/bfin/uclinux.h
> +++ b/gcc/config/bfin/uclinux.h
> @@ -44,3 +44,6 @@ see the files COPYING3 and COPYING.RUNTIME
> respectively.  If not, see
> #define TARGET_SUPPORTS_SYNC_CALLS 1
> 
> #define SUBTARGET_FDPIC_NOT_SUPPORTED
> +
> +#undef TARGET_LIBC_HAS_FUNCTION
> +#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
> diff --git a/gcc/config/c6x/uclinux-elf.h b/gcc/config/c6x/uclinux-elf.h
> index 5d61f4d..fa0937e 100644
> --- a/gcc/config/c6x/uclinux-elf.h
> +++ b/gcc/config/c6x/uclinux-elf.h
> @@ -62,3 +62,5 @@
>     : "0" (_beg), "b" (_end), "b" (_scno)); \
> }
> 
> +#undef TARGET_LIBC_HAS_FUNCTION
> +#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
> diff --git a/gcc/config/linux-android.c b/gcc/config/linux-android.c
> index 4a4b48d..e9d9e9a 100644
> --- a/gcc/config/linux-android.c
> +++ b/gcc/config/linux-android.c
> @@ -35,9 +35,9 @@ linux_android_has_ifunc_p (void)
> bool
> linux_android_libc_has_function (enum function_class fn_class)
> {
> -  if (OPTION_GLIBC)
> +  if (linux_libc == LIBC_GLIBC)
>     return true;
> -  if (OPTION_BIONIC)
> +  if (linux_libc == LIBC_BIONIC)
>     if (fn_class == function_c94
>  || fn_class == function_c99_misc
>  || fn_class == function_sincos)

The above hunk should not be necessary after (1).

> diff --git a/gcc/config/lm32/uclinux-elf.h b/gcc/config/lm32/uclinux-elf.h
> index 3a556d7..a5e8163 100644
> --- a/gcc/config/lm32/uclinux-elf.h
> +++ b/gcc/config/lm32/uclinux-elf.h
> @@ -77,3 +77,5 @@
> #undef  CC1_SPEC
> #define CC1_SPEC "%{G*} %{!fno-PIC:-fPIC}"
> 
> +#undef TARGET_LIBC_HAS_FUNCTION
> +#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
> diff --git a/gcc/config/m68k/uclinux.h b/gcc/config/m68k/uclinux.h
> index 8d74312..b1af7d2 100644
> --- a/gcc/config/m68k/uclinux.h
> +++ b/gcc/config/m68k/uclinux.h
> @@ -67,3 +67,6 @@ along with GCC; see the file COPYING3.  If not see
>    sections.  */
> #undef M68K_OFFSETS_MUST_BE_WITHIN_SECTIONS_P
> #define M68K_OFFSETS_MUST_BE_WITHIN_SECTIONS_P 1
> +
> +#undef TARGET_LIBC_HAS_FUNCTION
> +#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
> diff --git a/gcc/config/moxie/uclinux.h b/gcc/config/moxie/uclinux.h
> index 498037e..85c65f2 100644
> --- a/gcc/config/moxie/uclinux.h
> +++ b/gcc/config/moxie/uclinux.h
> @@ -37,3 +37,6 @@ see the files COPYING3 and COPYING.RUNTIME
> respectively.  If not, see
>  --wrap=mmap --wrap=munmap --wrap=alloca\
>  %{fmudflapth: --wrap=pthread_create\
> }} %{fmudflap|fmudflapth: --wrap=main}"
> +
> +#undef TARGET_LIBC_HAS_FUNCTION
> +#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
> 
> 

Thanks,

--
Maxim Kuvyrkov
www.kugelworks.com
Alexander Ivchenko Sept. 4, 2013, 7:43 a.m. UTC | #3
Hi Maxim,

2013/9/4 Maxim Kuvyrkov <maxim@kugelworks.com>:
> On 23/08/2013, at 1:04 AM, Alexander Ivchenko wrote:
>
>> Ugh.. thanks, you are right. That points to another problem that I
>> didn't see before:
>>
>> 3) *linux* targets that do not append to tm_p_file (s390x-*-linux* and
>> s390x-ibm-tpf* - your patch addresses that problem correctly) OR
>> tmake_file (bfin*-linux-uclibc* or crisv32-*-linux* | cris-*-linux*)
>
> Could you be more verbose, please?  What some of the *linux* target do not append to tm_p_file?

*linux* targets that do not append to tm_p_file are 390x-*-linux* and
s390x-ibm-tpf* and Andrew is already addressed this problem.


> It seems that there are at least two separate problems:
>
> 1. OPTION_BIONIC is not defined in linux-android.c .  I think the right fix here is to copy definitions of OPTION_BIONIC (and, optionally, OPTION_UCLIBC) from gcc/config/linux.h to rs6000/linux.h, rs6000/linux64.h and alpha/linux.h -- in other words, define OPTION_BIONIC and OPTION_UCLIBC whenever OPTION_GLIBC is defined.

Why can't we just use the checks like "if (linux_libc == LIBC_GLIBC)".
Seems that we have all infrastructure in place (linux_libc,
LIBC_GLIBC, LIBC_BIONIC, LIBC_UCLIBC are defined for all *linux*
targets). I don't see the reason to make new defines.

> 2. The second problem is to do with definitions of TARGET_LIBC_HAS_FUNCTION for bfin, c6x, lm32, m68k and moxie.  What is the failure scenario here?

"For them we have ar: linux-android.o: No such file or directory" So I
added t-linux-android rules to tmake_file.

(and for bfin additionally we have:
"../../gcc/gcc/config/bfin/bfin.c:5812:29: error:
‘linux_android_libc_has_function’ was not declared in this scope".
because
the tm_p.h is not included in bfin.c)

>
>> diff --git a/gcc/config.gcc b/gcc/config.gcc
>> index 7e1d529..89cf30a 100644
>> --- a/gcc/config.gcc
>> +++ b/gcc/config.gcc
>> @@ -1018,7 +1018,7 @@ bfin*-uclinux*)
>>  ;;
>> bfin*-linux-uclibc*)
>>  tm_file="${tm_file} dbxelf.h elfos.h bfin/elf.h gnu-user.h linux.h
>> glibc-stdint.h bfin/linux.h ./linux-sysroot-suffix.h"
>> - tmake_file="bfin/t-bfin-linux t-slibgcc"
>> + tmake_file="bfin/t-bfin-linux t-slibgcc t-linux-android"
>>  use_collect2=no
>>  ;;
>> bfin*-rtems*)
>
> Why?  Bfin has nothing to do with android.

Since ‘linux_android_libc_has_function’ handles all three libc options
for all linux targets, that's natural to use this function. May be it
should be called "linux_libc_has_function" and be located in linux.c
(we don't have this file..).

>> @@ -1053,7 +1053,7 @@ cris-*-elf | cris-*-none)
>> crisv32-*-linux* | cris-*-linux*)
>>  tm_file="dbxelf.h elfos.h ${tm_file} gnu-user.h linux.h
>> glibc-stdint.h cris/linux.h"
>>  # We need to avoid using t-linux, so override default tmake_file
>> - tmake_file="cris/t-cris cris/t-linux t-slibgcc"
>> + tmake_file="cris/t-cris cris/t-linux t-slibgcc t-linux-android"
>>  extra_options="${extra_options} cris/linux.opt"
>>  case $target in
>>   cris-*-*)
>
> Same question here.

Please, see above.

>> diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c
>> index 7fab975..18457f8 100644
>> --- a/gcc/config/bfin/bfin.c
>> +++ b/gcc/config/bfin/bfin.c
>> @@ -46,6 +46,7 @@
>> #include "cgraph.h"
>> #include "langhooks.h"
>> #include "bfin-protos.h"
>> +#include "tm_p.h"
>> #include "tm-preds.h"
>> #include "tm-constrs.h"
>> #include "gt-bfin.h"
>> diff --git a/gcc/config/bfin/uclinux.h b/gcc/config/bfin/uclinux.h
>> index ca0f4ee..63cba99 100644
>> --- a/gcc/config/bfin/uclinux.h
>> +++ b/gcc/config/bfin/uclinux.h
>> @@ -44,3 +44,6 @@ see the files COPYING3 and COPYING.RUNTIME
>> respectively.  If not, see
>> #define TARGET_SUPPORTS_SYNC_CALLS 1
>>
>> #define SUBTARGET_FDPIC_NOT_SUPPORTED
>> +
>> +#undef TARGET_LIBC_HAS_FUNCTION
>> +#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
>> diff --git a/gcc/config/c6x/uclinux-elf.h b/gcc/config/c6x/uclinux-elf.h
>> index 5d61f4d..fa0937e 100644
>> --- a/gcc/config/c6x/uclinux-elf.h
>> +++ b/gcc/config/c6x/uclinux-elf.h
>> @@ -62,3 +62,5 @@
>>     : "0" (_beg), "b" (_end), "b" (_scno)); \
>> }
>>
>> +#undef TARGET_LIBC_HAS_FUNCTION
>> +#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
>> diff --git a/gcc/config/linux-android.c b/gcc/config/linux-android.c
>> index 4a4b48d..e9d9e9a 100644
>> --- a/gcc/config/linux-android.c
>> +++ b/gcc/config/linux-android.c
>> @@ -35,9 +35,9 @@ linux_android_has_ifunc_p (void)
>> bool
>> linux_android_libc_has_function (enum function_class fn_class)
>> {
>> -  if (OPTION_GLIBC)
>> +  if (linux_libc == LIBC_GLIBC)
>>     return true;
>> -  if (OPTION_BIONIC)
>> +  if (linux_libc == LIBC_BIONIC)
>>     if (fn_class == function_c94
>>  || fn_class == function_c99_misc
>>  || fn_class == function_sincos)
>
> The above hunk should not be necessary after (1).
>
>> diff --git a/gcc/config/lm32/uclinux-elf.h b/gcc/config/lm32/uclinux-elf.h
>> index 3a556d7..a5e8163 100644
>> --- a/gcc/config/lm32/uclinux-elf.h
>> +++ b/gcc/config/lm32/uclinux-elf.h
>> @@ -77,3 +77,5 @@
>> #undef  CC1_SPEC
>> #define CC1_SPEC "%{G*} %{!fno-PIC:-fPIC}"
>>
>> +#undef TARGET_LIBC_HAS_FUNCTION
>> +#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
>> diff --git a/gcc/config/m68k/uclinux.h b/gcc/config/m68k/uclinux.h
>> index 8d74312..b1af7d2 100644
>> --- a/gcc/config/m68k/uclinux.h
>> +++ b/gcc/config/m68k/uclinux.h
>> @@ -67,3 +67,6 @@ along with GCC; see the file COPYING3.  If not see
>>    sections.  */
>> #undef M68K_OFFSETS_MUST_BE_WITHIN_SECTIONS_P
>> #define M68K_OFFSETS_MUST_BE_WITHIN_SECTIONS_P 1
>> +
>> +#undef TARGET_LIBC_HAS_FUNCTION
>> +#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
>> diff --git a/gcc/config/moxie/uclinux.h b/gcc/config/moxie/uclinux.h
>> index 498037e..85c65f2 100644
>> --- a/gcc/config/moxie/uclinux.h
>> +++ b/gcc/config/moxie/uclinux.h
>> @@ -37,3 +37,6 @@ see the files COPYING3 and COPYING.RUNTIME
>> respectively.  If not, see
>>  --wrap=mmap --wrap=munmap --wrap=alloca\
>>  %{fmudflapth: --wrap=pthread_create\
>> }} %{fmudflap|fmudflapth: --wrap=main}"
>> +
>> +#undef TARGET_LIBC_HAS_FUNCTION
>> +#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
>>
>>
>
> Thanks,
>
> --
> Maxim Kuvyrkov
> www.kugelworks.com


Thanks for the review,
Alexander
Maxim Kuvyrkov Sept. 4, 2013, 8:11 a.m. UTC | #4
On 4/09/2013, at 7:43 PM, Alexander Ivchenko wrote:

> Hi Maxim,
> 
> 2013/9/4 Maxim Kuvyrkov <maxim@kugelworks.com>:
>> On 23/08/2013, at 1:04 AM, Alexander Ivchenko wrote:
>> 
>>> Ugh.. thanks, you are right. That points to another problem that I
>>> didn't see before:
>>> 
>>> 3) *linux* targets that do not append to tm_p_file (s390x-*-linux* and
>>> s390x-ibm-tpf* - your patch addresses that problem correctly) OR
>>> tmake_file (bfin*-linux-uclibc* or crisv32-*-linux* | cris-*-linux*)
>> 
>> Could you be more verbose, please?  What some of the *linux* target do not append to tm_p_file?
> 
> *linux* targets that do not append to tm_p_file are 390x-*-linux* and
> s390x-ibm-tpf* and Andrew is already addressed this problem.

OK.

> 
> 
>> It seems that there are at least two separate problems:
>> 
>> 1. OPTION_BIONIC is not defined in linux-android.c .  I think the right fix here is to copy definitions of OPTION_BIONIC (and, optionally, OPTION_UCLIBC) from gcc/config/linux.h to rs6000/linux.h, rs6000/linux64.h and alpha/linux.h -- in other words, define OPTION_BIONIC and OPTION_UCLIBC whenever OPTION_GLIBC is defined.
> 
> Why can't we just use the checks like "if (linux_libc == LIBC_GLIBC)".
> Seems that we have all infrastructure in place (linux_libc,
> LIBC_GLIBC, LIBC_BIONIC, LIBC_UCLIBC are defined for all *linux*
> targets). I don't see the reason to make new defines.

Same reason why the existing defines are in place.  OPTION_X is not always the same as (linux_libc == LIBC_X).

> 
>> 2. The second problem is to do with definitions of TARGET_LIBC_HAS_FUNCTION for bfin, c6x, lm32, m68k and moxie.  What is the failure scenario here?
> 
> "For them we have ar: linux-android.o: No such file or directory" So I
> added t-linux-android rules to tmake_file.
> 
> (and for bfin additionally we have:
> "../../gcc/gcc/config/bfin/bfin.c:5812:29: error:
> ‘linux_android_libc_has_function’ was not declared in this scope".
> because
> the tm_p.h is not included in bfin.c)

OK.

> 
>> 
>>> diff --git a/gcc/config.gcc b/gcc/config.gcc
>>> index 7e1d529..89cf30a 100644
>>> --- a/gcc/config.gcc
>>> +++ b/gcc/config.gcc
>>> @@ -1018,7 +1018,7 @@ bfin*-uclinux*)
>>> ;;
>>> bfin*-linux-uclibc*)
>>> tm_file="${tm_file} dbxelf.h elfos.h bfin/elf.h gnu-user.h linux.h
>>> glibc-stdint.h bfin/linux.h ./linux-sysroot-suffix.h"
>>> - tmake_file="bfin/t-bfin-linux t-slibgcc"
>>> + tmake_file="bfin/t-bfin-linux t-slibgcc t-linux-android"
>>> use_collect2=no
>>> ;;
>>> bfin*-rtems*)
>> 
>> Why?  Bfin has nothing to do with android.
> 
> Since ‘linux_android_libc_has_function’ handles all three libc options
> for all linux targets, that's natural to use this function. May be it
> should be called "linux_libc_has_function" and be located in linux.c
> (we don't have this file..).

OK.

Ideally we would have linux.c with linux_libc_has_function that knows nothing about Bionic and linux-android.c with linux_android_libc_has_function.

The patch is OK with definitions of OPTION_GLIBC, OPTION_UCLIBC and OPTION_BIONIC copied verbatim from gcc/config/linux.h to rs6000 and alpha versions.

It is then on my plate to refactor handling of Bionic libc and remove it from targets that don't support it.

Thanks,

--
Maxim Kuvyrkov
www.kugelworks.com
Kirill Yukhin Sept. 5, 2013, 11:02 a.m. UTC | #5
Hello,
On 04 Sep 20:11, Maxim Kuvyrkov wrote:
> On 4/09/2013, at 7:43 PM, Alexander Ivchenko wrote:
> The patch is OK with definitions of OPTION_GLIBC, OPTION_UCLIBC and OPTION_BIONIC copied verbatim from gcc/config/l

Checked into main trunk: http://gcc.gnu.org/ml/gcc-cvs/2013-09/msg00137.html

--
Thanks, K
Bernhard Reutner-Fischer Sept. 5, 2013, 7:02 p.m. UTC | #6
On 5 September 2013 13:02:29 Kirill Yukhin <kirill.yukhin@gmail.com> wrote:
> Hello,
> On 04 Sep 20:11, Maxim Kuvyrkov wrote:
> > On 4/09/2013, at 7:43 PM, Alexander Ivchenko wrote:
> > The patch is OK with definitions of OPTION_GLIBC, OPTION_UCLIBC and 
> OPTION_BIONIC copied verbatim from gcc/config/l
>
> Checked into main trunk: http://gcc.gnu.org/ml/gcc-cvs/2013-09/msg00137.html


Unless i am missing something crucial I am not really convinced that this 
bionic support stuff you guys are aiming at is proper, to be defensive..

uClibc has C99 math support optionally as well as other optional, 
nonstandard feature sets. Your patch does not seem to check (in a 
cross-compilable fashion, of course) if C99 math is supported in libc or 
not, thus regressing on uClibc with C99_MATH enabled.

Please revert this patch and handle your libc in a sensible manner as 
everyone else has to since years.. I.e. either be C99 complete or fixup 
your conditions, ideally in the public port.

Thanks,
>
> --
> Thanks, K


Sent with AquaMail for Android
http://www.aqua-mail.com
Joseph Myers Sept. 5, 2013, 7:46 p.m. UTC | #7
On Thu, 5 Sep 2013, Bernhard Reutner-Fischer wrote:

> uClibc has C99 math support optionally as well as other optional, nonstandard
> feature sets. Your patch does not seem to check (in a cross-compilable
> fashion, of course) if C99 math is supported in libc or not, thus regressing
> on uClibc with C99_MATH enabled.

It is a basic principle that it should be possible to bootstrap cross 
tools by building the compiler, once, then using it to build runtime 
libraries.  We haven't got there yet, but configure-time tests for library 
features that affect how the compiler behaves are best avoided so as to 
support such bootstraps - and if present, it's best for there to be a 
corresponding configure option to override them, and a command-line option 
to control things on a per-multilib basis.  To the extent that we do have 
configure support for checking library headers if those are available when 
the compiler is configured, it only supports checking the default multilib 
and not headers for other multilibs.
diff mbox

Patch

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6e27be2..2d15fb1 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,17 @@ 
+2013-08-21  Alexander Ivchenko  <alexander.ivchenko@intel.com>
+
+ * config/linux-android.c (linux_android_libc_has_function): Fix
+ checks for libc.
+ * config/bfin/uclinux.h: Define TARGET_LIBC_HAS_FUNCTION as
+ no_c99_libc_has_function.
+ * config/c6x/uclinux-elf.h: Ditto.
+ * config/lm32/uclinux-elf.h: Ditto.
+ * config/m68k/uclinux.h: Ditto.
+ * config/moxie/uclinux.h: Ditto.
+ * config.gcc (bfin*-linux-uclibc*): Add t-linux-android to tmake_file.
+ (crisv32-*-linux*, cris-*-linux*): Ditto.
+ * config/bfin/bfin.c: Include "tm_p.h".
+
 2013-08-21  Joern Rennecke  <joern.rennecke@embecosm.com>

  * reload.h (struct reg_equivs): Rename to ..
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 7e1d529..89cf30a 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1018,7 +1018,7 @@  bfin*-uclinux*)
  ;;
 bfin*-linux-uclibc*)
  tm_file="${tm_file} dbxelf.h elfos.h bfin/elf.h gnu-user.h linux.h
glibc-stdint.h bfin/linux.h ./linux-sysroot-suffix.h"
- tmake_file="bfin/t-bfin-linux t-slibgcc"
+ tmake_file="bfin/t-bfin-linux t-slibgcc t-linux-android"
  use_collect2=no
  ;;
 bfin*-rtems*)
@@ -1053,7 +1053,7 @@  cris-*-elf | cris-*-none)
 crisv32-*-linux* | cris-*-linux*)
  tm_file="dbxelf.h elfos.h ${tm_file} gnu-user.h linux.h
glibc-stdint.h cris/linux.h"
  # We need to avoid using t-linux, so override default tmake_file
- tmake_file="cris/t-cris cris/t-linux t-slibgcc"
+ tmake_file="cris/t-cris cris/t-linux t-slibgcc t-linux-android"
  extra_options="${extra_options} cris/linux.opt"
  case $target in
   cris-*-*)
diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c
index 7fab975..18457f8 100644
--- a/gcc/config/bfin/bfin.c
+++ b/gcc/config/bfin/bfin.c
@@ -46,6 +46,7 @@ 
 #include "cgraph.h"
 #include "langhooks.h"
 #include "bfin-protos.h"
+#include "tm_p.h"
 #include "tm-preds.h"
 #include "tm-constrs.h"
 #include "gt-bfin.h"
diff --git a/gcc/config/bfin/uclinux.h b/gcc/config/bfin/uclinux.h
index ca0f4ee..63cba99 100644
--- a/gcc/config/bfin/uclinux.h
+++ b/gcc/config/bfin/uclinux.h
@@ -44,3 +44,6 @@  see the files COPYING3 and COPYING.RUNTIME
respectively.  If not, see
 #define TARGET_SUPPORTS_SYNC_CALLS 1

 #define SUBTARGET_FDPIC_NOT_SUPPORTED
+
+#undef TARGET_LIBC_HAS_FUNCTION
+#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
diff --git a/gcc/config/c6x/uclinux-elf.h b/gcc/config/c6x/uclinux-elf.h
index 5d61f4d..fa0937e 100644
--- a/gcc/config/c6x/uclinux-elf.h
+++ b/gcc/config/c6x/uclinux-elf.h
@@ -62,3 +62,5 @@ 
     : "0" (_beg), "b" (_end), "b" (_scno)); \
 }

+#undef TARGET_LIBC_HAS_FUNCTION
+#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
diff --git a/gcc/config/linux-android.c b/gcc/config/linux-android.c
index 4a4b48d..e9d9e9a 100644
--- a/gcc/config/linux-android.c
+++ b/gcc/config/linux-android.c
@@ -35,9 +35,9 @@  linux_android_has_ifunc_p (void)
 bool
 linux_android_libc_has_function (enum function_class fn_class)
 {
-  if (OPTION_GLIBC)
+  if (linux_libc == LIBC_GLIBC)
     return true;
-  if (OPTION_BIONIC)
+  if (linux_libc == LIBC_BIONIC)
     if (fn_class == function_c94
  || fn_class == function_c99_misc
  || fn_class == function_sincos)
diff --git a/gcc/config/lm32/uclinux-elf.h b/gcc/config/lm32/uclinux-elf.h
index 3a556d7..a5e8163 100644
--- a/gcc/config/lm32/uclinux-elf.h
+++ b/gcc/config/lm32/uclinux-elf.h
@@ -77,3 +77,5 @@ 
 #undef  CC1_SPEC
 #define CC1_SPEC "%{G*} %{!fno-PIC:-fPIC}"

+#undef TARGET_LIBC_HAS_FUNCTION
+#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
diff --git a/gcc/config/m68k/uclinux.h b/gcc/config/m68k/uclinux.h
index 8d74312..b1af7d2 100644
--- a/gcc/config/m68k/uclinux.h
+++ b/gcc/config/m68k/uclinux.h
@@ -67,3 +67,6 @@  along with GCC; see the file COPYING3.  If not see
    sections.  */
 #undef M68K_OFFSETS_MUST_BE_WITHIN_SECTIONS_P
 #define M68K_OFFSETS_MUST_BE_WITHIN_SECTIONS_P 1
+
+#undef TARGET_LIBC_HAS_FUNCTION
+#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function
diff --git a/gcc/config/moxie/uclinux.h b/gcc/config/moxie/uclinux.h
index 498037e..85c65f2 100644
--- a/gcc/config/moxie/uclinux.h
+++ b/gcc/config/moxie/uclinux.h
@@ -37,3 +37,6 @@  see the files COPYING3 and COPYING.RUNTIME
respectively.  If not, see
  --wrap=mmap --wrap=munmap --wrap=alloca\
  %{fmudflapth: --wrap=pthread_create\
 }} %{fmudflap|fmudflapth: --wrap=main}"
+
+#undef TARGET_LIBC_HAS_FUNCTION