[LLVMdev] [LLVMDev] Trouble Linking

Jeff Kunkel jdkunk3 at gmail.com
Fri Oct 15 13:16:47 PDT 2010


I'm sorry, I don't know what you were looking for. The first 5 were
scattered amidst different e-mails. The others have to do with
following what "RAFast" and "RALinScan" as examples. It's a linker
error, and I do not know why only opt and bugpoint does not compiler,
and why llc does not show my reg alloc pass anymore. It worked before
the API change e-mail was released.

1) I created my .cpp file RegAllocJDKunk.cpp in llvm/lib/CodeGen/ directory.
2) I updated the CMakeList.txt in the directory llvm/lib/CodeGen/ to
include RegAllocJDKunk.cpp.
3) I added "(void) llvm::createJDKunkRegisterAllocator();" to the
struct ForcePassLinking::ForcePassLinking() method in
"llvm\include\llvm\LinkAllPasses.h"
4) I added "FunctionPass* createJDKunkRegisterAllocator();" to header
"llvm\CodeGen\Passes.h."
5) I implemented "FunctionPass* createJDKunkRegisterAllocator()" in my cpp file.
6) I added "initializeRAJDKunk(Registry);" to
llvm/lib/CodeGen/CodeGen.cpp in the "void
llvm::initializeCodeGen(PassRegistry &Registry)"
7) I added "void initializeRAJDKunk(PassRegistry&);" to the header
file "llvm\include\llvm\InitializePasses.h."
8) Cmake ran, and Visaul Studio build all but opt and bugpoint because
of the errors at the bottom of this message.
9) I don't know why this does not link anymore. I remember it worked
before the API change e-mail was sent, so I assumed I missed something
with the api change. This is the only reason I can see.

2>     Creating library C:/Users/JDKunk/Documents/Visual Studio
2010/Projects/VSllvm/lib/Debug/bugpoint.lib and object
C:/Users/JDKunk/Documents/Visual Studio
2010/Projects/VSllvm/lib/Debug/bugpoint.exp
2>bugpoint.obj : error LNK2019: unresolved external symbol "class
llvm::FunctionPass * __cdecl
llvm::createJDKunkRegisterAllocator(void)"
(?createJDKunkRegisterAllocator at llvm@@YAPAVFunctionPass at 1@XZ)
referenced in function "public: __thiscall `anonymous
namespace'::ForcePassLinking::ForcePassLinking(void)"
(??0ForcePassLinking@?A0xb2143f5b@@QAE at XZ)

4>     Creating library C:/Users/JDKunk/Documents/Visual Studio
2010/Projects/VSllvm/lib/Debug/opt.lib and object
C:/Users/JDKunk/Documents/Visual Studio
2010/Projects/VSllvm/lib/Debug/opt.exp
4>opt.obj : error LNK2019: unresolved external symbol "class
llvm::FunctionPass * __cdecl
llvm::createJDKunkRegisterAllocator(void)"
(?createJDKunkRegisterAllocator at llvm@@YAPAVFunctionPass at 1@XZ)
referenced in function "public: __thiscall `anonymous
namespace'::ForcePassLinking::ForcePassLinking(void)"
(??0ForcePassLinking@?A0x853fd888@@QAE at XZ)

On Fri, Oct 15, 2010 at 3:10 PM, Óscar Fuentes <ofv at wanadoo.es> wrote:
> Jeff Kunkel <jdkunk3 at gmail.com> writes:
>
>> I ran cmake to build the visual studio projects. Then I included my
>> code under the Visual Studio interface, but I placed my code separate
>> from the CodeGen code. Visual studio was smart enough to compile and
>> link in my code into the CodeGen library. Thus, I did not need to add
>> my code into the same directory as the CodeGen files, and I did not
>> need to change the CMakeList.txt.
>
> Next time you update your LLVM sources, that VS solution will be
> overwritten.
>
>> The offical name is LLVMCodeGen.
>>
>> However, the "opt.obj" and "bugpoint.obj" cannot find the reference
>> function "llvm::createJDKunkRegisterAllocator." I added this file to
>> the header described previously. I implemented it, in my
>> RegAllocJDKunk.cpp file.
>
> As you do not provide the information I asked for, I can't help you
> anymore.
>
>
> _______________________________________________
> 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