I’ve installed llvm-12 using apt install llvm-12
on my Ubuntu 20.04 x86_64. I want to compile all the *.c file to *.bc and using llvm-link-12
to consolidate to one .bc file. The first step is finished, but the error below occurs when doing the second step.
llvm-link-12 cgi.bc config.bc files.bc format.bc http.bc main.bc server.bc -o httpd.bc
error: Linking globals named ‘config’: symbol multiply defined!
make: *** [Makefile:14: httpd.bc] Error 1
To find the reason, I use llvm-nm-12
to check the config
global value. It shows that the main.h
define a global value named config, and other *.c all include main.h
cgi.c:#include “main.h”
config.c:#include “main.h”
files.c:#include “main.h”
format.c:#include “main.h”
http.c:#include “main.h”
main.c:#include “main.h”
server.c:#include “main.h”
win32.c:#include “main.h”
How could I solve this symbol name confict? In another post, it show a way to rename confilict symbols. But I think it doesn’t solve the root cause. Any help will be appreciated!