1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

Make EmitTBSSSymbol take a section argument so that we can find it later.

Fix up callers and users.

llvm-svn: 104057
This commit is contained in:
Eric Christopher 2010-05-18 21:16:04 +00:00
parent 1d0a54cb9d
commit 4a9013f115
4 changed files with 18 additions and 11 deletions

View File

@ -190,12 +190,13 @@ namespace llvm {
/// EmitTBSSSymbol - Emit a thread local bss (.tbss) symbol. /// EmitTBSSSymbol - Emit a thread local bss (.tbss) symbol.
/// ///
/// @param Section - The thread local common section.
/// @param Symbol - The thread local common symbol to emit. /// @param Symbol - The thread local common symbol to emit.
/// @param Size - The size of the symbol. /// @param Size - The size of the symbol.
/// @param ByteAlignment - The alignment of the thread local common symbol /// @param ByteAlignment - The alignment of the thread local common symbol
/// if non-zero. This must be a power of 2 on some targets. /// if non-zero. This must be a power of 2 on some targets.
virtual void EmitTBSSSymbol(MCSymbol *Symbol, uint64_t Size, virtual void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
unsigned ByteAlignment = 0) = 0; uint64_t Size, unsigned ByteAlignment = 0) = 0;
/// @} /// @}
/// @name Generating Data /// @name Generating Data
/// @{ /// @{

View File

@ -126,8 +126,8 @@ public:
virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0, virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0,
unsigned Size = 0, unsigned ByteAlignment = 0); unsigned Size = 0, unsigned ByteAlignment = 0);
virtual void EmitTBSSSymbol (MCSymbol *Symbol, uint64_t Size, virtual void EmitTBSSSymbol (const MCSection *Section, MCSymbol *Symbol,
unsigned ByteAlignment = 0); uint64_t Size, unsigned ByteAlignment = 0);
virtual void EmitBytes(StringRef Data, unsigned AddrSpace); virtual void EmitBytes(StringRef Data, unsigned AddrSpace);
@ -366,13 +366,16 @@ void MCAsmStreamer::EmitZerofill(const MCSection *Section, MCSymbol *Symbol,
// .tbss sym, size, align // .tbss sym, size, align
// This depends that the symbol has already been mangled from the original, // This depends that the symbol has already been mangled from the original,
// e.g. _a. // e.g. _a.
void MCAsmStreamer::EmitTBSSSymbol(MCSymbol *Symbol, uint64_t Size, void MCAsmStreamer::EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
unsigned ByteAlignment) { uint64_t Size, unsigned ByteAlignment) {
assert(Symbol != NULL && "Symbol shouldn't be NULL!"); assert(Symbol != NULL && "Symbol shouldn't be NULL!");
// Instead of using the Section we'll just use the shortcut.
// This is a mach-o specific directive and section.
OS << ".tbss " << *Symbol << ", " << Size; OS << ".tbss " << *Symbol << ", " << Size;
// Output align if we have it. // Output align if we have it. We default to 1 so don't bother printing
if (ByteAlignment != 0) OS << ", " << Log2_32(ByteAlignment); // that.
if (ByteAlignment > 1) OS << ", " << Log2_32(ByteAlignment);
EmitEOL(); EmitEOL();
} }

View File

@ -55,8 +55,8 @@ namespace {
virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0, virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0,
unsigned Size = 0, unsigned ByteAlignment = 0) {} unsigned Size = 0, unsigned ByteAlignment = 0) {}
virtual void EmitTBSSSymbol(MCSymbol *Symbol, uint64_t Size, virtual void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
unsigned ByteAlignment) {} uint64_t Size, unsigned ByteAlignment) {}
virtual void EmitBytes(StringRef Data, unsigned AddrSpace) {} virtual void EmitBytes(StringRef Data, unsigned AddrSpace) {}
virtual void EmitValue(const MCExpr *Value, unsigned Size, virtual void EmitValue(const MCExpr *Value, unsigned Size,

View File

@ -1536,7 +1536,10 @@ bool AsmParser::ParseDirectiveDarwinTBSS() {
if (!Sym->isUndefined()) if (!Sym->isUndefined())
return Error(IDLoc, "invalid symbol redefinition"); return Error(IDLoc, "invalid symbol redefinition");
Out.EmitTBSSSymbol(Sym, Size, Pow2Alignment ? 1 << Pow2Alignment : 0); Out.EmitTBSSSymbol(Ctx.getMachOSection("__DATA", "__thread_bss",
MCSectionMachO::S_THREAD_LOCAL_ZEROFILL,
0, SectionKind::getThreadBSS()),
Sym, Size, 1 << Pow2Alignment);
return false; return false;
} }