Anton Korobeynikov
2007-May-25 14:53 UTC
[LLVMdev] Linking two external linkage GlobalValues
Hello, Bram.> My question: does this change break certain design decisions, > optimisations, ...?This is bug in the source code. You have two symbols with the same name in the different object files, which is definite redefinition. At least one of them should be declared with "extern". -- With best regards, Anton Korobeynikov. Faculty of Mathematics & Mechanics, Saint Petersburg State University.
Hi Anton,> This is bug in the source code. You have two symbols with the same > name in the different object files, which is definite redefinition. At > least one of them should be declared with "extern".C allows this. $ head foo.c bar.c ==> foo.c <= void bar(); int foo; int main() { bar(); return foo; } ==> bar.c <= int foo; void bar() { foo = 42; return; } $ gcc -Wall foo.c bar.c && ./a.out; echo $? 42 $ Better practice to have one definition I agree, but it's valid C. Cheers, Ralph.
Hi, Op 26-mei-07, om 23:14 heeft Chris Lattner het volgende geschreven:> Shouldn't these symbols get "common" linkage, aka llvm weak linkage? > > Are you building the source with -fno-common?Yes. What does this mean? Kind regards, Bram Adams GH-SEL, INTEC, Ghent University (Belgium)
On Fri, 25 May 2007, Anton Korobeynikov wrote:>> My question: does this change break certain design decisions, >> optimisations, ...? > This is bug in the source code. You have two symbols with the same name > in the different object files, which is definite redefinition. At least > one of them should be declared with "extern".Shouldn't these symbols get "common" linkage, aka llvm weak linkage? Are you building the source with -fno-common? If not, it could be an llvm bug. -Chris -- http://nondot.org/sabre/ http://llvm.org/