[LLVMbugs] [Bug 7516] New: inlining a C function causes clang to not link properly

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jun 28 09:19:22 PDT 2010


           Summary: inlining a C function causes clang to not link
           Product: clang
           Version: unspecified
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: clusty1 at gmail.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com

Created an attachment (id=5128)
 --> (http://llvm.org/bugs/attachment.cgi?id=5128)
code snippet that i used to test the inlining

i tried compiling/linking with:

clang -v mmult_test.c and got the following error:

Apple clang version 2.0 (tags/Apple/clang-107.1)
Target: x86_64-apple-darwin10
Thread model: posix
 "/usr/bin/clang" -cc1 -triple x86_64-apple-darwin10.0.0 -emit-obj -mrelax-all
-disable-free -disable-llvm-verifier -main-file-name mmult_test.c -pic-level 1
-mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -v
-resource-dir /usr/lib/clang/2.0 -ferror-limit 19 -fmessage-length 80
-stack-protector 1 -fblocks -fdiagnostics-show-option -fcolor-diagnostics -o
/var/folders/g6/g6GhF79RHCKbQPIgPZPtTE+++TI/-Tmp-/cc-7E1kNp.o -x c mmult_test.c
clang -cc1 version 2.0 based upon llvm 2.8svn hosted on x86_64-apple-darwin10
#include "..." search starts here:
#include <...> search starts here:
 /System/Library/Frameworks (framework directory)
 /Library/Frameworks (framework directory)
End of search list.
 "/usr/bin/../libexec/gcc/i686-apple-darwin10/4.2.1/ld" -dynamic -arch x86_64
-macosx_version_min 10.6.0 -o a.out -lcrt1.10.6.o
-L/usr/bin/../lib/gcc/i686-apple-darwin10/4.2.1 -L/usr/bin/../lib/gcc
-L/usr/bin/../lib/i686-apple-darwin10/4.2.1 -L/usr/bin/../lib
/var/folders/g6/g6GhF79RHCKbQPIgPZPtTE+++TI/-Tmp-/cc-7E1kNp.o -lSystem -lgcc
Undefined symbols:
  "_dot", referenced from:
      _mv in cc-7E1kNp.o
ld: symbol(s) not found
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Removing the inline makes the code work properly.

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