diff options
author | Dale Johannesen <dalej@apple.com> | 2008-05-14 20:12:51 +0000 |
---|---|---|
committer | Dale Johannesen <dalej@apple.com> | 2008-05-14 20:12:51 +0000 |
commit | aafce77b17d340aace52bcd49d1944109d82f14a (patch) | |
tree | e7d1caf5f9d6c359802174c4a01644b9aa326202 /lib/CodeGen/MachOWriter.cpp | |
parent | 50871247216dfef8386a112766e972a1792b0b56 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51118 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachOWriter.cpp')
-rw-r--r-- | lib/CodeGen/MachOWriter.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/CodeGen/MachOWriter.cpp b/lib/CodeGen/MachOWriter.cpp index 2726f706d7..c2b42ec48a 100644 --- a/lib/CodeGen/MachOWriter.cpp +++ b/lib/CodeGen/MachOWriter.cpp @@ -403,7 +403,8 @@ void MachOWriter::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 (NoInit || GV->hasLinkOnceLinkage() || GV->hasWeakLinkage()) { + if (NoInit || GV->hasLinkOnceLinkage() || GV->hasWeakLinkage() || + GV->hasCommonLinkage()) { MachOSym ExtOrCommonSym(GV, Mang->getValueName(GV), MachOSym::NO_SECT,TM); // For undefined (N_UNDF) external (N_EXT) types, n_value is the size in // bytes of the symbol. @@ -951,6 +952,7 @@ MachOSym::MachOSym(const GlobalValue *gv, std::string name, uint8_t sect, break; case GlobalValue::WeakLinkage: case GlobalValue::LinkOnceLinkage: + case GlobalValue::CommonLinkage: assert(!isa<Function>(gv) && "Unexpected linkage type for Function!"); case GlobalValue::ExternalLinkage: GVName = TAI->getGlobalPrefix() + name; |