mirror of
https://github.com/RPCSX/llvm.git
synced 2025-01-31 17:42:40 +00:00
Work around a bug in GCC where it can't handle common variables marked weak.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9679 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2580d4f232
commit
5ea326a23b
@ -693,7 +693,14 @@ void CWriter::printModule(Module *M) {
|
|||||||
Out << " __attribute__((common))";
|
Out << " __attribute__((common))";
|
||||||
else if (I->hasWeakLinkage())
|
else if (I->hasWeakLinkage())
|
||||||
Out << " __attribute__((weak))";
|
Out << " __attribute__((weak))";
|
||||||
if (!I->getInitializer()->isNullValue()) {
|
|
||||||
|
// If the initializer is not null, emit the initializer. If it is null,
|
||||||
|
// we try to avoid emitting large amounts of zeros. The problem with
|
||||||
|
// this, however, occurs when the variable has weak linkage. In this
|
||||||
|
// case, the assembler will complain about the variable being both weak
|
||||||
|
// and common, so we disable this optimization.
|
||||||
|
if (!I->getInitializer()->isNullValue() ||
|
||||||
|
I->hasWeakLinkage()) {
|
||||||
Out << " = " ;
|
Out << " = " ;
|
||||||
writeOperand(I->getInitializer());
|
writeOperand(I->getInitializer());
|
||||||
}
|
}
|
||||||
|
@ -693,7 +693,14 @@ void CWriter::printModule(Module *M) {
|
|||||||
Out << " __attribute__((common))";
|
Out << " __attribute__((common))";
|
||||||
else if (I->hasWeakLinkage())
|
else if (I->hasWeakLinkage())
|
||||||
Out << " __attribute__((weak))";
|
Out << " __attribute__((weak))";
|
||||||
if (!I->getInitializer()->isNullValue()) {
|
|
||||||
|
// If the initializer is not null, emit the initializer. If it is null,
|
||||||
|
// we try to avoid emitting large amounts of zeros. The problem with
|
||||||
|
// this, however, occurs when the variable has weak linkage. In this
|
||||||
|
// case, the assembler will complain about the variable being both weak
|
||||||
|
// and common, so we disable this optimization.
|
||||||
|
if (!I->getInitializer()->isNullValue() ||
|
||||||
|
I->hasWeakLinkage()) {
|
||||||
Out << " = " ;
|
Out << " = " ;
|
||||||
writeOperand(I->getInitializer());
|
writeOperand(I->getInitializer());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user