Adding dllimport, dllexport and external weak linkage types.

DLL* linkages got full (I hope) codegeneration support in C & both x86
assembler backends.
External weak linkage added for future use, we don't provide any
codegeneration, etc. support for it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30374 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Anton Korobeynikov
2006-09-14 18:23:27 +00:00
parent a17cf0a7e2
commit b74ed07bfd
30 changed files with 477 additions and 103 deletions

View File

@@ -1054,7 +1054,11 @@ bool CWriter::doInitialization(Module &M) {
Out << "extern ";
printType(Out, I->getType()->getElementType(), Mang->getValueName(I));
Out << ";\n";
}
} else if (I->hasDLLImportLinkage()) {
Out << "__declspec(dllimport) ";
printType(Out, I->getType()->getElementType(), Mang->getValueName(I));
Out << ";\n";
}
}
}
@@ -1118,6 +1122,11 @@ bool CWriter::doInitialization(Module &M) {
if (I->hasInternalLinkage())
Out << "static ";
else if (I->hasDLLImportLinkage())
Out << "__declspec(dllimport) ";
else if (I->hasDLLExportLinkage())
Out << "__declspec(dllexport) ";
printType(Out, I->getType()->getElementType(), Mang->getValueName(I));
if (I->hasLinkOnceLinkage())
Out << " __attribute__((common))";
@@ -1267,6 +1276,8 @@ void CWriter::printFunctionSignature(const Function *F, bool Prototype) {
bool isCStructReturn = F->getCallingConv() == CallingConv::CSRet;
if (F->hasInternalLinkage()) Out << "static ";
if (F->hasDLLImportLinkage()) Out << "__declspec(dllimport) ";
if (F->hasDLLExportLinkage()) Out << "__declspec(dllexport) ";
// Loop over the arguments, printing them...
const FunctionType *FT = cast<FunctionType>(F->getFunctionType());