[LLVMbugs] [Bug 8788] New: inline and global function causes undefined reference

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Dec 14 03:42:50 PST 2010


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

           Summary: inline and global function causes undefined reference
           Product: clang
           Version: 2.7
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Driver
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: r.marek at assembler.cz
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=5899)
 --> (http://llvm.org/bugs/attachment.cgi?id=5899)
Compile with clang bug.c

Hello,

By accident i found following code cannot link:

inline int fn(void) {
    return 0;
}

int main(void) {
return fn();
}

/tmp/cc-bS3Ask.o: In function `main':
bug.c:(.text+0xe): undefined reference to `fn'
collect2: ld returned 1 exit status
clang: error: linker command failed with exit code 1 (use -v to see invocation)

If invoked with -c I got following:

         U fn
00000000 T main

I would expect to get "T" and not "U". Adding "static" "fixes" the problem.

I use ubuntu 10.04 clang version:

$ clang --version
clang version 1.1 (branches/release_27)
Target: i386-pc-linux-gnu
Thread model: posix

Thanks,
Rudolf

-- 
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