Source:
static const int __attribute__((used)) i = 1;

int main(void)
{
    int r;
    __asm__ ("movl _i(%%rip), %0" : "=r"(r));
    return r;
}

> /usr/local/gcc46/bin/gcc -O3 -o attrused attrused.c 
> /usr/local/gcc46/bin/gcc -O3 -o attrused attrused.c -flto
Undefined symbols:
  "_i", referenced from:
      _main in ccMflGRF.lto.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

Not sure how to construct a failing program that doesn't involve asm.
This is the only thing left preventing ffmpeg (without asm disabled) from
compiling under LTO.


-- 
           Summary: ltp ignoring __attribute__((used))
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: astrange at ithinksw dot com
  GCC host triplet: x86_64-apple-darwin10.3.1


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

Reply via email to