NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

toolchain/52221: something wrong with ifunc



>Number:         52221
>Category:       toolchain
>Synopsis:       something wrong with ifunc
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon May 08 22:00:00 +0000 2017
>Originator:     coypu
>Release:        NetBSD 7.99.70
>Organization:
>Environment:
NetBSD loggy 7.99.70 NetBSD 7.99.70 (GENERIC) #5: Sat Apr 22 11:50:07 IDT 2017  fly@loggy:/home/fly/amd64/sys/arch/amd64/compile/GENERIC amd64

>Description:
GCC claims we do not support ifunc.

I added to config.gcc (in wip/gcc8snapshot):

--- gcc/config.gcc.orig	2017-05-05 17:31:57.000000000 +0000
+++ gcc/config.gcc
@@ -775,10 +775,15 @@ case ${target} in
 *-*-netbsd*)
...
+  default_gnu_indirect_function=yes

Now any ifunc test is crashing if run, e.g.
gcc/testsuite/g++.dg/ext/attr-ifunc-1.C:

/* { dg-do run }  */
/* { dg-require-ifunc "" } */
/* { dg-options "-Wno-pmf-conversions" } */

#include <stdio.h>

struct Klass
{
  int implementation ();
  int magic ();
  static void *resolver ();
};

int Klass::implementation (void)
{
  printf ("'ere I am JH\n");
  return 0;
}

void *Klass::resolver (void)
{
  int (Klass::*pmf) () = &Klass::implementation;
  
  return (void *)(int (*)(Klass *))(((Klass *)0)->*pmf);
}

int Klass::magic (void) __attribute__ ((ifunc ("_ZN5Klass8resolverEv")));

int main ()
{
  Klass obj;
  
  return obj.magic () != 0;
}

$ /usr/pkg/gcc8snapshot/bin/gcc -Wno-pmf-conversions attr-ifunc-1.C
$ ./a.out
[1]   Segmentation fault (core dumped) ./a.out

>How-To-Repeat:
cd /usr/pkgsrc/wip/gcc8snapshot; make install
/usr/pkg/gcc8snapshot/bin/gcc -Wno-pmf-conversions work/gcc-8-*/gcc/testsuite/g++.dg/ext/attr-ifunc-1.C
./a.out
>Fix:



Home | Main Index | Thread Index | Old Index