Hi,
This is Crystal. I have some questions about llvm-gcc. Could you please give me
some advice? Thanks in advance.
Problem description:
Env:
llvm-gcc (GCC) 4.2.1
gcc (GCC) 4.1.2
OS:fedora7
I tried to compile a C programme test.c with llvm-gcc by task:
[root at localhost mylib]# llvm-gcc -emit-llvm test.c -Llibmylib.a -c -o test.bc
[root at localhost mylib]# lli test.bc
after running the command "lli test.bc",print the error info as
follows:
ERROR: Program used external function 'gt' which could not be resolved!
lli[0x85c245f]
/lib/libc.so.6(abort+0x101)[0x6988b1]
lli(_ZN4llvm3JIT25getPointerToNamedFunctionERKSs+0xd2)[0x8267952]
Aborted
Static libraries are produced by these 3 ways below, but always got the same
issue:
1.
# llvm-gcc -c mylib.c
# llvm-ar cr libmylib.a mylib.o
2.
# llvm-gcc -c mylib.c
# ar cr libmylib.a mylib.o
3.
# gcc -c mylib.c
# ar cr libmylib.a mylib.o
I have to analyse c program with some static libraries by LLVM bitcode
files .
Here is my test code:
=====================test.c:
----------------------
#include<stdio.h>
#include<string.h>
#include"mylib.h"
int main(void){
int len =
10;
if
(gt(&len) == 0){
printf("call mylib function gt successfully!\n");
}
else{
printf("call mylib function gt fail!\n");
}
return 0;
}
mylib.h:
------------------------
#ifndef MYLIB_H
#define MYLIB_H
int gt(int *len);
#endif
mylib.c :
------------------------
#include<stdio.h>
#include<string.h>
#include"mylib.h"
int gt( int *length){
int len;
len =
*length;
printf("Mylib be call, parameter length is %d\n",len);
return 0;
}
-------------------------------------------------------------------
新浪空间——与朋友开心分享网络新生活!(http://space.sina.com.cn/ )
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20081018/7c9b522c/attachment.html>