Hi,<br><br>I have a program that runs when statically compiled using llc and gcc but crashes with a segmentation fault when run with lli. I am trying to debug it with bugpoint and the initial part of bugpoint seems to be suggesting that I am somehow missing the linking with the libraries having dlsym/dlopen although I am passing it to lli :<br>
<br><b>$ bugpoint -run-jit $HOME/gap/gap4r4/bin/i686-pc-linux-gnu-llvm-gcc/gap.bc --tool-args -load=/usr/lib/libm.so -load=/usr/lib/libdl.so --args -l $HOME/gap/gap4r4/ -m 1024M</b><br><br>Read input file : '/home/pprabhu/gap/gap4r4/bin/i686-pc-linux-gnu-llvm-gcc/gap.bc'<br>
*** All input ok<br>Initializing execution environment: Found lli: /home/pprabhu/llvm/llvm-install/bin/lli<br>Running the code generator to test for a crash:<br>Generating reference output from raw program: <cbe><gcc><br>
Error running tool:<br> /usr/bin/gcc -x c -fno-strict-aliasing bugpoint-test-program.bc.cbe.c -x none -o bugpoint-test-program.bc.cbe.c.gcc.exe -lm -O2 -Wl,-R.<br>bugpoint-test-program.bc.cbe.c:5149: warning: conflicting types for built-in function 'malloc'<br>
bugpoint-test-program.bc.cbe.c: In function 'ExecProccall0args':<br>bugpoint-test-program.bc.cbe.c:401008: warning: passing argument 1 of 'longjmp' from incompatible pointer type<br><br>....<br><br><br><b>/tmp/cc08IpX8.o: In function `SyLoadModule':<br>
bugpoint-test-program.bc.cbe.c:(.text+0x25705): undefined reference to `dlopen'<br>bugpoint-test-program.bc.cbe.c:(.text+0x25719): undefined reference to `dlsym'<br>/tmp/cc08IpX8.o: In function `SyFindOrLinkGapRootFile':<br>
bugpoint-test-program.bc.cbe.c:(.text+0x6b951): undefined reference to `dlopen'<br>bugpoint-test-program.bc.cbe.c:(.text+0x6b965): undefined reference to `dlsym'<br>/tmp/cc08IpX8.o: In function `FuncLOAD_DYN':<br>
bugpoint-test-program.bc.cbe.c:(.text+0x12a92d): undefined reference to `dlopen'<br>bugpoint-test-program.bc.cbe.c:(.text+0x12a945): undefined reference to `dlsym'<br>/tmp/cc08IpX8.o: In function `LoadWorkspace':<br>
bugpoint-test-program.bc.cbe.c:(.text+0x14487a): undefined reference to `dlopen'<br>bugpoint-test-program.bc.cbe.c:(.text+0x144892): undefined reference to `dlsym'<br>collect2: ld returned 1 exit status</b><br><br>
*** Debugging code generator crash!<br><br>Checking to see if we can delete global inits:<br> - Removing all global inits hides problem!<br><br>*** Attempting to reduce the number of global variables in the testcase<br>Checking for crash with only these global variables: Revision_ariths_c ZeroFuncs ZeroMutFuncs AInvFuncs AInvMutFuncs OneFuncs OneMutFuncs InvFuncs InvMutFuncs EqFuncs... <5919 total>:<br>
<br>*** Attempting to reduce the number of functions in the testcase<br>Checking for crash with only these functions: InstallZeroObject VerboseZeroObject ZeroObject FuncZERO InstallZeroMutObject VerboseZeroMutObject ZeroMutObject FuncZERO_MUT InstallAinvObject VerboseAInvObject... <2883 total>:<br>
Checking for crash with only these blocks: entry entry bb bb2 entry bb bb2 entry bb1 bb2... <77209 total>:<br><br><br><br>Is there something that I missing here (like some more parameters to lli or to bugpoint) because the program seems to run fine when compiled with llc. <br>
<br>Thanks for your time.<br><br>- Prakash<br><br>