[LLVMdev] "multiple definition of .. " in clang 2.8

Xinfinity xinfinity_a at yahoo.com
Thu Nov 4 03:59:26 PDT 2010


Thanks, I receive the comments and I've seen it.
I tested it and you are right, it works with std=gnu89. I have checked it
before with std=c89 and it didn't work, but it looks like gnu89 is the
solution.

Alexandra


Dale Johannesen wrote:
> 
> It appears you filed PR 8538 about this, but didn't cc yourself.  You
> should look at it; I don't think this is a clang problem.
>> It seems that the problem occurs from the optimization level. In the 2.7
>> version I was using -O0 and in 2.8 I tested the same benchmarks with -O3.
>> 
>> clang -O0 works fine, while clang -O3 makes redefinitions (probably it is
>> related to inlining) of the functions from stdlib.h, math.h and some
>> other
>> libraries. To give one example, function atoi is defined in the generated
>> *.ll file: 
>> 
>> define i32 @atoi(i8* %__nptr) nounwind inlinehint {
>> entry:
>>   %call = tail call i64 @strtol(i8* nocapture %__nptr, i8** null, i32 10)
>> nounwind readonly
>>   %conv = trunc i64 %call to i32
>>   ret i32 %conv
>> }
>> 
>> although it is not defined in the original C file.
>> 
>> And clang redefines it in all the *.ll files it generates, from each C
>> file
>> in the perlbench (SPEC CPU 2006).
>> 
>> Similarly for all the other functions, which appear in the end to be
>> redefined and give errors.
>> 
>> Am I on the right track with this errors? I need to use the -O3
>> optimization
>> level in my tests, so how can I avoid this problem?
>> 
>> Alexandra
>> -- 
> 
> 
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> 
> 

-- 
View this message in context: http://old.nabble.com/%22multiple-definition-of-..-%22--in-clang-2.8-tp30126502p30130852.html
Sent from the LLVM - Dev mailing list archive at Nabble.com.




More information about the llvm-dev mailing list