[LLVMbugs] [Bug 20983] New: Inline procedure defined in the same module isn't found by the linker

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Sep 17 13:31:05 PDT 2014


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

            Bug ID: 20983
           Summary: Inline procedure defined in the same module isn't
                    found by the linker
           Product: clang
           Version: trunk
          Hardware: PC
                OS: FreeBSD
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: yuri at tsoft.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Function setRGB is first declared as inline, then defined as inline, and then
not found by the linker.

$ clang -I/usr/local/include -lm -L/usr/local/lib -lpng -o makePNG makePNG.c
/tmp/makePNG-3638e2.o: In function `writeImage':
makePNG.c:(.text+0x6e8): undefined reference to `setRGB'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Removing 'inline' attribute fixes the compile.
This problem is particularly bad due to the simplicity of this situation.

The testcase is from this book:
http://www.labbookpages.co.uk/software/imgProc/libPNG.html
Particular failing program:
http://www.labbookpages.co.uk/software/imgProc/files/libPNG/makePNG.c
(The only change I made is replaced malloc.h -> stdlib.h)

gcc compiles it successfully.

Observed in rev.217271 on FreeBSD 10

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140917/a9dfccfb/attachment.html>


More information about the llvm-bugs mailing list