[LLVMdev] Inline semantics.

Richard Pennington rich at pennware.com
Wed Jan 2 02:23:58 PST 2008


Ellsif compiles and runs bzip2. During testing I noticed that if I set 
the optimization level to O2 or greater, I'd get an unresolved symbol at 
link time.

It turns out that a function is declared in a header file and is used by 
two separate source files. In one of the source files, the function is 
defined with __inline__.

If I do function inlining during compilation (i.e. bitcode creation) I 
get the unresolved symbol because the function is discarded after it is 
inlined in the file that defines it. If I do function inlining during 
bitcode linking instead, everything works OK and the function is inlined 
everywhere it is used.

My question is, what should happen in this case? I don't mind deferring 
  inlining until the link phase, but I have a feeling that that isn't 
correct behavior. Should a diagnostic be issued in this case?

-Rich



More information about the llvm-dev mailing list