2013-05-17 33 views
0
$ cat test.c 
int printf(const char *, ...); 
int main() { printf("ok\n");} 

$ clang -c test.c 
$ llvm-ld test.o -o test /usr/lib/crt1.o -lSystem 
$ ./test 
'main' function not found in module. 
$ ld test.o -o test /usr/lib/crt1.o -lSystem 
$ ./test 
ok 

我想鏗鏘編譯簡單的程序,然後用LLVM-LD鏈接它,我的目標是避免GNU LD。我必須以錯誤的方式使用它?與LLVM鐺LLVM LD主要鏈接沒有發現

回答

0

llvm-ld使用位碼文件作爲輸入來獲取可執行文件或將所有輸入文件合併到一個新的位碼文件中。對於目標文件,您需要使用lld