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

           Summary: LTO: function with attribute "used" is not emitted
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: d.g.gorbac...@gmail.com


============= bug.c =============
static void __attribute__((used)) 
foo(void) 
{ 
}

int main(void)
{
  __asm__("call foo");
  return 0;
}
=================================

$ gcc -flto bug.c
/tmp/ccCtTmmT.ltrans0.ltrans.o: In function `main':
ccCtTmmT.ltrans0.o:(.text+0x4): undefined reference to `foo'
collect2: ld returned 1 exit status

>From GCC documentation:

`used'
     This attribute, attached to a function, means that code must be
     emitted for the function even if it appears that the function is
     not referenced.  This is useful, for example, when the function is
     referenced only in inline assembly.

Reply via email to