diff options
-rw-r--r-- | include/llvm/MC/MCStreamer.h | 3 | ||||
-rw-r--r-- | lib/MC/MCAsmStreamer.cpp | 9 | ||||
-rw-r--r-- | lib/MC/MCMachOStreamer.cpp | 5 | ||||
-rw-r--r-- | lib/MC/MCNullStreamer.cpp | 2 | ||||
-rw-r--r-- | test/MC/AsmParser/directive_lcomm.s | 6 | ||||
-rw-r--r-- | test/MC/AsmParser/labels.s | 2 | ||||
-rw-r--r-- | tools/llvm-mc/AsmParser.cpp | 8 |
7 files changed, 18 insertions, 17 deletions
diff --git a/include/llvm/MC/MCStreamer.h b/include/llvm/MC/MCStreamer.h index f4545bef22..626b34d609 100644 --- a/include/llvm/MC/MCStreamer.h +++ b/include/llvm/MC/MCStreamer.h @@ -152,9 +152,8 @@ namespace llvm { /// @param Symbol - The common symbol to emit. /// @param Size - The size of the common symbol. /// @param Pow2Alignment - The alignment of the common symbol if non-zero. - /// @param IsLocal - If true, then the symbol is to be a local common virtual void EmitCommonSymbol(MCSymbol *Symbol, unsigned Size, - unsigned Pow2Alignment, bool IsLocal) = 0; + unsigned Pow2Alignment) = 0; /// EmitZerofill - Emit a the zerofill section and possiblity a symbol, if /// @param Symbol is non-NULL, for @param Size and with the @param diff --git a/lib/MC/MCAsmStreamer.cpp b/lib/MC/MCAsmStreamer.cpp index 4c2f128b1d..fa7c7cf09a 100644 --- a/lib/MC/MCAsmStreamer.cpp +++ b/lib/MC/MCAsmStreamer.cpp @@ -56,7 +56,7 @@ public: virtual void EmitLocalSymbol(MCSymbol *Symbol, const MCValue &Value); virtual void EmitCommonSymbol(MCSymbol *Symbol, unsigned Size, - unsigned Pow2Alignment, bool IsLocal); + unsigned Pow2Alignment); virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0, unsigned Size = 0, unsigned Pow2Alignment = 0); @@ -178,11 +178,8 @@ void MCAsmStreamer::EmitLocalSymbol(MCSymbol *Symbol, const MCValue &Value) { } void MCAsmStreamer::EmitCommonSymbol(MCSymbol *Symbol, unsigned Size, - unsigned Pow2Alignment, bool IsLocal) { - if (IsLocal) - OS << ".lcomm"; - else - OS << ".comm"; + unsigned Pow2Alignment) { + OS << ".comm"; OS << ' ' << Symbol << ',' << Size; if (Pow2Alignment != 0) OS << ',' << Pow2Alignment; diff --git a/lib/MC/MCMachOStreamer.cpp b/lib/MC/MCMachOStreamer.cpp index 7e8a715eaa..e89f7d8dbd 100644 --- a/lib/MC/MCMachOStreamer.cpp +++ b/lib/MC/MCMachOStreamer.cpp @@ -105,7 +105,7 @@ public: virtual void EmitLocalSymbol(MCSymbol *Symbol, const MCValue &Value); virtual void EmitCommonSymbol(MCSymbol *Symbol, unsigned Size, - unsigned Pow2Alignment, bool IsLocal); + unsigned Pow2Alignment); virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0, unsigned Size = 0, unsigned Pow2Alignment = 0); @@ -268,8 +268,7 @@ void MCMachOStreamer::EmitLocalSymbol(MCSymbol *Symbol, const MCValue &Value) { } void MCMachOStreamer::EmitCommonSymbol(MCSymbol *Symbol, unsigned Size, - unsigned Pow2Alignment, - bool IsLocal) { + unsigned Pow2Alignment) { llvm_unreachable("FIXME: Not yet implemented!"); } diff --git a/lib/MC/MCNullStreamer.cpp b/lib/MC/MCNullStreamer.cpp index 14534ed01b..fa2aec392d 100644 --- a/lib/MC/MCNullStreamer.cpp +++ b/lib/MC/MCNullStreamer.cpp @@ -44,7 +44,7 @@ namespace { virtual void EmitLocalSymbol(MCSymbol *Symbol, const MCValue &Value) {} virtual void EmitCommonSymbol(MCSymbol *Symbol, unsigned Size, - unsigned Pow2Alignment, bool IsLocal) {} + unsigned Pow2Alignment) {} virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0, unsigned Size = 0, unsigned Pow2Alignment = 0) {} diff --git a/test/MC/AsmParser/directive_lcomm.s b/test/MC/AsmParser/directive_lcomm.s index afc61216c4..d38805fc47 100644 --- a/test/MC/AsmParser/directive_lcomm.s +++ b/test/MC/AsmParser/directive_lcomm.s @@ -1,9 +1,9 @@ # RUN: llvm-mc -triple i386-unknown-unknown %s | FileCheck %s # CHECK: TEST0: -# CHECK: .lcomm a,7,4 -# CHECK: .lcomm b,8 -# CHECK: .lcomm c,0 +# CHECK: .zerofill __DATA,__bss,a,7,4 +# CHECK: .zerofill __DATA,__bss,b,8 +# CHECK: .zerofill __DATA,__bss,c,0 TEST0: .lcomm a, 8-1, 4 .lcomm b,8 diff --git a/test/MC/AsmParser/labels.s b/test/MC/AsmParser/labels.s index f306685256..30daeb7642 100644 --- a/test/MC/AsmParser/labels.s +++ b/test/MC/AsmParser/labels.s @@ -44,7 +44,7 @@ foo: // CHECK: .comm "a 6",1 .comm "a 6", 1 -// CHECK: .lcomm "a 7",1 +// CHECK: .zerofill __DATA,__bss,"a 7",1 .lcomm "a 7", 1 // CHECK: .lsym "a 8",1 diff --git a/tools/llvm-mc/AsmParser.cpp b/tools/llvm-mc/AsmParser.cpp index 9f219925b0..74512ca935 100644 --- a/tools/llvm-mc/AsmParser.cpp +++ b/tools/llvm-mc/AsmParser.cpp @@ -1258,7 +1258,13 @@ bool AsmParser::ParseDirectiveComm(bool IsLocal) { return Error(IDLoc, "invalid symbol redefinition"); // Create the Symbol as a common or local common with Size and Pow2Alignment - Out.EmitCommonSymbol(Sym, Size, Pow2Alignment, IsLocal); + if (IsLocal) + Out.EmitZerofill(getMachOSection("__DATA", "__bss", + MCSectionMachO::S_ZEROFILL, 0, + SectionKind()), + Sym, Size, Pow2Alignment); + else + Out.EmitCommonSymbol(Sym, Size, Pow2Alignment); return false; } |