[LLVMdev] undefined reference to .Llabel

Ryan M. Lefever lefever at crhc.uiuc.edu
Tue Jun 24 02:03:35 PDT 2008


I have been working on a compilation process that involves steps such as 
passing an application through transforms that I've written and 
combining the application with support code that I've written.  When I 
compile an application using my compilation process without debugging, 
(i.e., "llvm-gcc -g"), everything works fine.  However, when I compile 
an application using my compilation process with debugging, (i.e., 
"llvm-gcc -g"), I get linking errors that complain about undefined 
references to .LlableX, where X is some number.

Let me explain how my compilation process works.  Let's say that an 
application is made of x.c and y.c and that the application is normally 
compiled as follows:

------------------------------
gcc -c -o x.o x.c
gcc -c -o y.o y.c
gcc -o exe x.o y.o
------------------------------

In my compilation process, that would be translated to something along 
the following lines:

------------------------------
// First we create the individual bc files
1: llvm-gcc -c -emit-llvm x.bc x.c
2: llvm-gcc -c -emit-llvm y.bc y.c

// Second we link the individual bc files into 1 combined bc file
llvm-link -o exe.comb.bc x.bc y.bc

// Next we run several steps that involve:
//   - linking the combined bc file with support code
//   - running the combined bc file through a transform of mine
// For example:
3: llvm-link -o exe.comb.support1.bc exe.comb.bc support1.bc
4: opt -load=mytransformlib.so -mytransform1 -o
     exe.comb.support1.transform1.bc exe.comb.support1.bc
...

// After performing those steps, we link the result and form a
// native executable
5: llvm-ld -native -o exe exe.comb.support1.transform1.bc
------------------------------

My problem is that if I use the -g option in lines 1 and 2, then when I 
run llvm-ld in line 5, it complains that there are undefined references 
to .LlableX.

Does anyone have any insight about why this may be happening or how I 
could go about diagnosing/fixing the problem?  If you need more details, 
please ask.

Thanks you very much in advance,
Ryan



More information about the llvm-dev mailing list