This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug lto/47934] New: LTO: function with attribute "used" is not emitted
- From: "d.g.gorbachev at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 1 Mar 2011 06:45:26 +0000
- Subject: [Bug lto/47934] New: LTO: function with attribute "used" is not emitted
- Auto-submitted: auto-generated
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: unassigned@gcc.gnu.org
ReportedBy: d.g.gorbachev@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.