diff options
author | Chris Lattner <sabre@nondot.org> | 2003-11-03 17:32:38 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-11-03 17:32:38 +0000 |
commit | 2580d4f232ce0885e1ffc03240ebbcc031b05a43 (patch) | |
tree | 519c9c77248ae928112ab80cc27fb13ad141984e /lib/Target/CBackend/CBackend.cpp | |
parent | fd35c6417d5d3cb7323702e5cd6fadd32f014a4f (diff) |
Fix bugs with attribute weak emission
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9678 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/CBackend/CBackend.cpp')
-rw-r--r-- | lib/Target/CBackend/CBackend.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index e32987cbd2..0fd3046021 100644 --- a/lib/Target/CBackend/CBackend.cpp +++ b/lib/Target/CBackend/CBackend.cpp @@ -653,6 +653,7 @@ void CWriter::printModule(Module *M) { if ((I->hasInternalLinkage() || !MangledGlobals.count(I)) && !I->getIntrinsicID()) { printFunctionSignature(I, true); + if (I->hasWeakLinkage()) Out << " __attribute__((weak))"; Out << ";\n"; } } @@ -671,7 +672,11 @@ void CWriter::printModule(Module *M) { if (!I->isExternal()) { Out << "extern "; printType(Out, I->getType()->getElementType(), Mang->getValueName(I)); - + + if (I->hasLinkOnceLinkage()) + Out << " __attribute__((common))"; + else if (I->hasWeakLinkage()) + Out << " __attribute__((weak))"; Out << ";\n"; } } @@ -903,8 +908,6 @@ void CWriter::printFunctionSignature(const Function *F, bool Prototype) { FunctionInnards << ")"; // Print out the return type and the entire signature for that matter printType(Out, F->getReturnType(), FunctionInnards.str()); - - if (F->hasWeakLinkage()) Out << " __attribute((weak))"; } void CWriter::printFunction(Function *F) { |