mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
llvm-mc: Emit .lcomm as .zerofill.
llvm-svn: 80343
This commit is contained in:
parent
42ad4294d0
commit
09ed9fabde
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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!");
|
||||
}
|
||||
|
||||
|
@ -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) {}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user