Binutils and glibc implemented STT_GNU_IFUNC:

http://groups.google.com/group/generic-abi

A new ifunc attribute can provide user access to this
feature at C language level. Several options:

1. Ifunc attribute with argument:

int foo (…);

__typeof (foo) *
__attribute__ ((ifunc ("foo")))
foo_ifunc (void)
{
  <return address of foo_{1,2,3}>
}

foo_ifunc is a dummy place holder which isn't necessary.

2. Ifunc attribute without argument:

void *
__attribute__ ((ifunc))
foo (void)
{
  <return address of foo_{1,2,3}>
}

We can't call foo in the same file where foo is defined
since we need a different prototype when calling foo.

3. Ifunc attribute with prototype, but without argument:

int
__attribute__ ((ifunc))
foo (...)
{
  <return address of foo_{1,2,3}>
}

We can call foo in the same file. Gcc checks the return value for
foo.


-- 
           Summary: Add a new ifunc attribute
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hjl dot tools at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40528

Reply via email to