public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Richard Biener <rguenth@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-8240] target/89125 - BSD and math functions Date: Mon, 25 Apr 2022 07:26:10 +0000 (GMT) [thread overview] Message-ID: <20220425072610.5F8513858418@sourceware.org> (raw) https://gcc.gnu.org/g:b6e22db8564827c82108e0b7fa1a84675379c12b commit r12-8240-gb6e22db8564827c82108e0b7fa1a84675379c12b Author: Steve Kargl <kargl@gcc.gnu.org> Date: Mon Apr 25 09:23:56 2022 +0200 target/89125 - BSD and math functions Back story: When GCC is configured and built on non-glibc platforms, it seems very little to no effort is made to enumerate the available C99 libm functions. It is all or nothing for C99 libm. The patch introduces a new function, used on only FreeBSD, to inform gcc that it has C99 libm functions (minus a few which clearly GCC does not check nor test). 2022-04-15 Steven G. Kargl <kargl@gcc.gnu.org> PR target/89125 * config/freebsd.h: Define TARGET_LIBC_HAS_FUNCTION to be bsd_libc_has_function. * targhooks.cc (bsd_libc_has_function): New function. Expand the supported math functions to inclue C99 libm. * targhooks.h (bsd_libc_has_function): New Prototype. Diff: --- gcc/config/freebsd.h | 2 +- gcc/targhooks.cc | 14 ++++++++++++++ gcc/targhooks.h | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/gcc/config/freebsd.h b/gcc/config/freebsd.h index 28ebcad88d4..d89ee7dfc97 100644 --- a/gcc/config/freebsd.h +++ b/gcc/config/freebsd.h @@ -55,7 +55,7 @@ along with GCC; see the file COPYING3. If not see #endif #undef TARGET_LIBC_HAS_FUNCTION -#define TARGET_LIBC_HAS_FUNCTION no_c99_libc_has_function +#define TARGET_LIBC_HAS_FUNCTION bsd_libc_has_function /* Use --as-needed -lgcc_s for eh support. */ #ifdef HAVE_LD_AS_NEEDED diff --git a/gcc/targhooks.cc b/gcc/targhooks.cc index e22bc66a6c8..399d6f874dc 100644 --- a/gcc/targhooks.cc +++ b/gcc/targhooks.cc @@ -1843,6 +1843,20 @@ no_c99_libc_has_function (enum function_class fn_class ATTRIBUTE_UNUSED, return false; } +/* Assume some c99 functions are present at the runtime including sincos. */ +bool +bsd_libc_has_function (enum function_class fn_class, + tree type ATTRIBUTE_UNUSED) +{ + if (fn_class == function_c94 + || fn_class == function_c99_misc + || fn_class == function_sincos) + return true; + + return false; +} + + tree default_builtin_tm_load_store (tree ARG_UNUSED (type)) { diff --git a/gcc/targhooks.h b/gcc/targhooks.h index ecfa11287ef..ecce55ebe79 100644 --- a/gcc/targhooks.h +++ b/gcc/targhooks.h @@ -212,6 +212,7 @@ extern bool default_libc_has_function (enum function_class, tree); extern bool default_libc_has_fast_function (int fcode); extern bool no_c99_libc_has_function (enum function_class, tree); extern bool gnu_libc_has_function (enum function_class, tree); +extern bool bsd_libc_has_function (enum function_class, tree); extern tree default_builtin_tm_load_store (tree);
reply other threads:[~2022-04-25 7:26 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220425072610.5F8513858418@sourceware.org \ --to=rguenth@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).