[LLVMdev] Strange error of llvm-ld

Holger Schurig hs4233 at mail.mn-solutions.de
Thu Aug 16 03:03:51 PDT 2007


> I have just committed a patch to cause the linker to properly
> propagate error messages from the LinkModules method up to
> higher levels of the linker.

That helped. The strange error message is:

$ llvm-ld -v -stats -native -O1 -strip-all -o main \
  .obj/conf.o .obj/configwriter.o \
  -L/usr/share/qt3/lib -L/usr/X11R6/lib \
  -lcrypto -lusb -lutil -lqt-mt -lXext -lX11 -lm -lpthread

  Linking bitcode file '.obj/conf.o'
  Linked in file '.obj/conf.o'
  Linking bitcode file '.obj/configwriter.o'
llvm-ld: error: Cannot link file '.obj/configwriter.o': Linking
functions named 'strcmp': symbols have different visibilities!

Now, this happens when I compile the two source files
with "--fvisibility=hidden". If I omit this option, then llvm-ld
happily links those two files.

I made .o files with and without --fvisibility=hidden for both
files. One thing to note is that both versions emit the same
code for the strcmp:

$ grep strcmp *.ll
conf.hidden.o.ll:	%tmp13 = tail call i32 @strcmp( i8* %tmp11, i8* %name )		; <i32> [#uses=1]
conf.hidden.o.ll:declare i32 @strcmp(i8*, i8*)
conf.hidden.o.ll:	%tmp421 = tail call i32 @strcmp( i8* %tmp11, i8* getelementptr ([6 x i8]* @.str5, i32 0, i32 0) )		; <i32> [#uses=1]
conf.normal.o.ll:	%tmp13 = tail call i32 @strcmp( i8* %tmp11, i8* %name )		; <i32> [#uses=1]
conf.normal.o.ll:declare i32 @strcmp(i8*, i8*)
conf.normal.o.ll:	%tmp421 = tail call i32 @strcmp( i8* %tmp11, i8* getelementptr ([6 x i8]* @.str5, i32 0, i32 0) )		; <i32> [#uses=1]
configwriter.hidden.o.ll:	%tmp434 = call i32 @strcmp( i8* %tmp411, i8* %tmp394 )		; <i32> [#uses=1]
configwriter.hidden.o.ll:declare i32 @strcmp(i8*, i8*)
configwriter.normal.o.ll:	%tmp434 = call i32 @strcmp( i8* %tmp411, i8* %tmp394 )		; <i32> [#uses=1]
configwriter.normal.o.ll:declare i32 @strcmp(i8*, i8*)



More information about the llvm-dev mailing list