Bugzilla – Bug 245
Linking weak and strong global variables is dependent on link order
Last modified: 2004-02-17 15:59:30
You need to log in before you can comment on or make changes to this bug.
Attached are two LLVM assembly languages files. Both define the same global variable with the same initialization value, but one has weak linkage and the other has strong linkage. llvm-link -o test test1.bc test2.bc works, but llvm-link -o test test2.bc test1.bc does not.
Created an attachment (id=83) [details] First test file for reproducing the problem
Created an attachment (id=84) [details] Second file for reproducing the problem.
The assertion failure is: llvm-link: Linker.cpp:572: bool LinkGlobalInits(llvm::Module*, const llvm::Module*, std::map<const llvm::Value*, llvm::Value*, std::less<const llvm::Value*>, std::allocator<std::pair<const llvm::Value* const, llvm::Value*> > >&, std::string*): Assertion `SGV->getLinkage() == DGV->getLinkage()' failed. (The line number is a little off due to added debugging. It was originally line 569).
Great catch! I'm preparing a fix. -Chris
Fixed. Patch here: http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20040216/011833.html Testcase here: Regression/Linker/2004-02-17-WeakStrongLinkage.ll -Chris