diff mbox series

claim ifunc support on several NetBSD architectures

Message ID 20190407133114.GA202@SDF.ORG
State New
Headers show
Series claim ifunc support on several NetBSD architectures | expand

Commit Message

Maya Rashish April 7, 2019, 1:31 p.m. UTC
architecture list from netbsd src/tests/libexec/ld.elf_so/t_ifunc.c
(quick reference: https://github.com/NetBSD/src/blob/trunk/tests/libexec/ld.elf_so/t_ifunc.c#L38 )
tested on netbsd/amd64.

ifuncs worked anyway, but I can't use target_clones without this change.
that is one very cool feature I'd like to use :)

gcc/ChangeLog:
2019-04-07	Maya Rashish	<coypu@sdf.org>
	* config.gcc (default_gnu_indirect_function): Default to yes
	for arm*-*-netbsd*, i[34567]86-*-netbsd*, powerpc*-*-netbsd*,
	sparc*-*-netbsd*, x86_64-*-netbsd*

Comments

Maya Rashish April 8, 2019, 3:08 p.m. UTC | #1
Small addition for ARM. Since it doesn't have a geneirc way to detect
CPU features the code in libatomic relies on a linux-specific behaviour,
the ifunc condition is only defined for linux.

To unbreak compilation, I'd like to exclude netbsd/arm from the
libatomic ifunc camp :)

libatomic/ChangeLog:
        * configure.tgt: Exclude arm*-*-netbsd* from try_ifunc.

diff --git a/libatomic/configure.tgt b/libatomic/configure.tgt
index ecbb7d33cc1..4a1294bc1ff 100644
--- a/libatomic/configure.tgt
+++ b/libatomic/configure.tgt
@@ -53,7 +53,7 @@ case "${target_cpu}" in
   arm*)
 	ARCH=arm
 	case "${target}" in
-            arm*-*-freebsd*)
+            arm*-*-freebsd* | arm*-*-netbsd*)
                 ;;
             *)
                 # ??? Detect when -march=armv7 is already enabled.
Jeff Law April 9, 2019, 3:06 p.m. UTC | #2
On 4/7/19 7:31 AM, coypu@sdf.org wrote:
> architecture list from netbsd src/tests/libexec/ld.elf_so/t_ifunc.c
> (quick reference: https://github.com/NetBSD/src/blob/trunk/tests/libexec/ld.elf_so/t_ifunc.c#L38 )
> tested on netbsd/amd64.
> 
> ifuncs worked anyway, but I can't use target_clones without this change.
> that is one very cool feature I'd like to use :)
> 
> gcc/ChangeLog:
> 2019-04-07	Maya Rashish	<coypu@sdf.org>
> 	* config.gcc (default_gnu_indirect_function): Default to yes
> 	for arm*-*-netbsd*, i[34567]86-*-netbsd*, powerpc*-*-netbsd*,
> 	sparc*-*-netbsd*, x86_64-*-netbsd*
This falls into a similar bucket as the prior patch -- though I'm not
sure if we've got anyone that can say conclusively that all the
supported NetBSD releases have ifuncs.   I'd prefer to defer this to gcc-10.

jeff
Jeff Law April 29, 2019, 7:49 p.m. UTC | #3
On 4/7/19 7:31 AM, coypu@sdf.org wrote:
> architecture list from netbsd src/tests/libexec/ld.elf_so/t_ifunc.c
> (quick reference: https://github.com/NetBSD/src/blob/trunk/tests/libexec/ld.elf_so/t_ifunc.c#L38 )
> tested on netbsd/amd64.
> 
> ifuncs worked anyway, but I can't use target_clones without this change.
> that is one very cool feature I'd like to use :)
> 
> gcc/ChangeLog:
> 2019-04-07	Maya Rashish	<coypu@sdf.org>
> 	* config.gcc (default_gnu_indirect_function): Default to yes
> 	for arm*-*-netbsd*, i[34567]86-*-netbsd*, powerpc*-*-netbsd*,
> 	sparc*-*-netbsd*, x86_64-*-netbsd*
THanks.  I've installed this on the trunk.
jeff
diff mbox series

Patch

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 3eb2e800fc5..73debdde10f 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -849,6 +849,11 @@  case ${target} in
   nbsd_tm_file="netbsd.h netbsd-stdint.h netbsd-elf.h"
   default_use_cxa_atexit=yes
   target_has_targetdm=yes
+  case ${target} in
+    arm*-* | i[34567]86-* | powerpc*-* | sparc*-* | x86_64-*)
+      default_gnu_indirect_function=yes
+      ;;
+  esac
   ;;
 *-*-openbsd*)
   tmake_file="t-openbsd"