summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/ELFWriter.cpp
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2008-05-14 20:12:51 +0000
committerDale Johannesen <dalej@apple.com>2008-05-14 20:12:51 +0000
commitce4396bc92640e84cb8aa55e424f11341a3f1e3b (patch)
treee49fb307951b1f7cfdf182eee611d01333dc00df /llvm/lib/CodeGen/ELFWriter.cpp
parente94e0f66cdd503e02936f0705ddf74ed9bf44e0c (diff)
downloadbcm5719-llvm-ce4396bc92640e84cb8aa55e424f11341a3f1e3b.tar.gz
bcm5719-llvm-ce4396bc92640e84cb8aa55e424f11341a3f1e3b.zip
Add CommonLinkage; currently tentative definitions
are represented as "weak", but there are subtle differences in some cases on Darwin, so we need both. The intent is that "common" will behave identically to "weak" unless somebody changes their target to do something else. No functional change as yet. llvm-svn: 51118
Diffstat (limited to 'llvm/lib/CodeGen/ELFWriter.cpp')
-rw-r--r--llvm/lib/CodeGen/ELFWriter.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/ELFWriter.cpp b/llvm/lib/CodeGen/ELFWriter.cpp
index 63fee3a8d74..27f23f45cc0 100644
--- a/llvm/lib/CodeGen/ELFWriter.cpp
+++ b/llvm/lib/CodeGen/ELFWriter.cpp
@@ -282,7 +282,8 @@ void ELFWriter::EmitGlobal(GlobalVariable *GV) {
// If this global is part of the common block, add it now. Variables are
// part of the common block if they are zero initialized and allowed to be
// merged with other symbols.
- if (GV->hasLinkOnceLinkage() || GV->hasWeakLinkage()) {
+ if (GV->hasLinkOnceLinkage() || GV->hasWeakLinkage() ||
+ GV->hasCommonLinkage()) {
ELFSym CommonSym(GV);
// Value for common symbols is the alignment required.
CommonSym.Value = Align;
@@ -313,7 +314,7 @@ void ELFWriter::EmitGlobal(GlobalVariable *GV) {
BSSSym.SetType(ELFSym::STT_OBJECT);
switch (GV->getLinkage()) {
- default: // weak/linkonce handled above
+ default: // weak/linkonce/common handled above
assert(0 && "Unexpected linkage type!");
case GlobalValue::AppendingLinkage: // FIXME: This should be improved!
case GlobalValue::ExternalLinkage:
OpenPOWER on IntegriCloud