diff options
author | Eric Christopher <echristo@apple.com> | 2010-05-18 21:16:04 +0000 |
---|---|---|
committer | Eric Christopher <echristo@apple.com> | 2010-05-18 21:16:04 +0000 |
commit | 4d01cbe93b0e1a349b5c2881f1b319963f9e0504 (patch) | |
tree | 91a17f787461c04a71b94a9d340bb31f7f98a55d | |
parent | 0eeb05c969c6c314ca7991a10627451762787e2d (diff) | |
download | external_llvm-4d01cbe93b0e1a349b5c2881f1b319963f9e0504.zip external_llvm-4d01cbe93b0e1a349b5c2881f1b319963f9e0504.tar.gz external_llvm-4d01cbe93b0e1a349b5c2881f1b319963f9e0504.tar.bz2 |
Make EmitTBSSSymbol take a section argument so that we can find it later.
Fix up callers and users.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104057 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/MC/MCStreamer.h | 5 | ||||
-rw-r--r-- | lib/MC/MCAsmStreamer.cpp | 15 | ||||
-rw-r--r-- | lib/MC/MCNullStreamer.cpp | 4 | ||||
-rw-r--r-- | lib/MC/MCParser/AsmParser.cpp | 5 |
4 files changed, 18 insertions, 11 deletions
diff --git a/include/llvm/MC/MCStreamer.h b/include/llvm/MC/MCStreamer.h index 400f4c0..389b1e9 100644 --- a/include/llvm/MC/MCStreamer.h +++ b/include/llvm/MC/MCStreamer.h @@ -190,12 +190,13 @@ namespace llvm { /// 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 Size - The size of the symbol. /// @param ByteAlignment - The alignment of the thread local common symbol /// if non-zero. This must be a power of 2 on some targets. - virtual void EmitTBSSSymbol(MCSymbol *Symbol, uint64_t Size, - unsigned ByteAlignment = 0) = 0; + virtual void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol, + uint64_t Size, unsigned ByteAlignment = 0) = 0; /// @} /// @name Generating Data /// @{ diff --git a/lib/MC/MCAsmStreamer.cpp b/lib/MC/MCAsmStreamer.cpp index 4f7699c..f9182c5 100644 --- a/lib/MC/MCAsmStreamer.cpp +++ b/lib/MC/MCAsmStreamer.cpp @@ -126,8 +126,8 @@ public: virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0, unsigned Size = 0, unsigned ByteAlignment = 0); - virtual void EmitTBSSSymbol (MCSymbol *Symbol, uint64_t Size, - unsigned ByteAlignment = 0); + virtual void EmitTBSSSymbol (const MCSection *Section, MCSymbol *Symbol, + uint64_t Size, unsigned ByteAlignment = 0); virtual void EmitBytes(StringRef Data, unsigned AddrSpace); @@ -366,13 +366,16 @@ void MCAsmStreamer::EmitZerofill(const MCSection *Section, MCSymbol *Symbol, // .tbss sym, size, align // This depends that the symbol has already been mangled from the original, // e.g. _a. -void MCAsmStreamer::EmitTBSSSymbol(MCSymbol *Symbol, uint64_t Size, - unsigned ByteAlignment) { +void MCAsmStreamer::EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol, + uint64_t Size, unsigned ByteAlignment) { 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; - // Output align if we have it. - if (ByteAlignment != 0) OS << ", " << Log2_32(ByteAlignment); + // Output align if we have it. We default to 1 so don't bother printing + // that. + if (ByteAlignment > 1) OS << ", " << Log2_32(ByteAlignment); EmitEOL(); } diff --git a/lib/MC/MCNullStreamer.cpp b/lib/MC/MCNullStreamer.cpp index c206bb3..5332ade 100644 --- a/lib/MC/MCNullStreamer.cpp +++ b/lib/MC/MCNullStreamer.cpp @@ -55,8 +55,8 @@ namespace { virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0, unsigned Size = 0, unsigned ByteAlignment = 0) {} - virtual void EmitTBSSSymbol(MCSymbol *Symbol, uint64_t Size, - unsigned ByteAlignment) {} + virtual void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol, + uint64_t Size, unsigned ByteAlignment) {} virtual void EmitBytes(StringRef Data, unsigned AddrSpace) {} virtual void EmitValue(const MCExpr *Value, unsigned Size, diff --git a/lib/MC/MCParser/AsmParser.cpp b/lib/MC/MCParser/AsmParser.cpp index 6a89df1..1f045ac 100644 --- a/lib/MC/MCParser/AsmParser.cpp +++ b/lib/MC/MCParser/AsmParser.cpp @@ -1536,7 +1536,10 @@ bool AsmParser::ParseDirectiveDarwinTBSS() { if (!Sym->isUndefined()) 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; } |