[LLVMbugs] [Bug 11897] New: Should have IR support for the 'ifunc' attribute

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jan 31 03:49:46 PST 2012


http://llvm.org/bugs/show_bug.cgi?id=11897

             Bug #: 11897
           Summary: Should have IR support for the 'ifunc' attribute
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Core LLVM classes
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: clattner at apple.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Not a specifically high priority, but it would be nice for clang to eventually
support the 'ifunc' attribute, which models a feature available on both ELF and
MachO systems:
http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html

This seems natural to implement as a bit on GlobalAlias or something like that.

If we had IR support for this, in addition to supporting the ifunc attribute
for user code, we could also have globalopt statically evaluate them in some
cases (i.e. to optimize them out), etc.

It's not clear from the GCC Documentation, but there is no reason that the
attribute could not also work for data, to support efficient lazy
initialization.  For example:

int G __attribute__ ((ifunc ("my_g")));

static void *my_g() {
  static int X;
  X = foo();
  return &X;
}

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list