[LLVMdev] undefined reference to extern variables

Robinson, Paul Paul_Robinson at playstation.sony.com
Mon Jul 13 07:34:08 PDT 2015



> -----Original Message-----
> From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On
> Behalf Of Haopeng Liu
> Sent: Saturday, July 11, 2015 8:24 PM
> To: LLVM Developers Mailing List
> Subject: [LLVMdev] undefined reference to extern variables
> 
> Hi All,
> 
> I defined some variables in
> tools/clang/lib/Frontend/CompilerInstance.cpp. Then I tried to refer
> these variables in lib/Bitcode/Writer/BitCodeWriter.cpp with extern
> keyword.

Clang is layered on top of LLVM.  You cannot make LLVM depend on Clang
in this way.  You will need to find some other way to pass data from
Clang to LLVM.  Common tactics include defining "backend" options using
the cl::opt mechanism, and you pass command-line strings from Clang to
LLVM; or add new fields in an existing structure that Clang already 
passes to LLVM.
--paulr

> 
> 'make' reports errors while linking opt. (error: undefined reference to
> "var_name"). I think I need modify some Makefiles to figure out that opt
> is depended on Frontend.
> 
> But I have no idea about how to modify. Any suggestion?
> 
> Thanks,
> Haopeng
> 
> 
> 
> 
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list