Partial code for emitting thread local bss data.

llvm-svn: 104197
This commit is contained in:
Eric Christopher 2010-05-20 00:49:07 +00:00
parent de852faef9
commit 27e7ffc7d4
4 changed files with 10 additions and 0 deletions

View File

@ -303,6 +303,7 @@ namespace llvm {
// Accessors.
//
bool hasMachoZeroFillDirective() const { return HasMachoZeroFillDirective; }
bool hasMachoTBSSDirective() const { return HasMachoTBSSDirective; }
bool hasStaticCtorDtorReferenceInStaticMode() const {
return HasStaticCtorDtorReferenceInStaticMode;
}

View File

@ -311,6 +311,13 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
return;
}
// Handle the tbss directive on darwin which is a thread local bss directive
// like zerofill.
if (GVKind.isThreadBSS() && MAI->hasMachoTBSSDirective()) {
OutStreamer.EmitTBSSSymbol(TheSection, GVSym, Size, 1 << AlignLog);
return;
}
OutStreamer.SwitchSection(TheSection);
EmitLinkage(GV->getLinkage(), GVSym);

View File

@ -21,6 +21,7 @@ using namespace llvm;
MCAsmInfo::MCAsmInfo() {
HasSubsectionsViaSymbols = false;
HasMachoZeroFillDirective = false;
HasMachoTBSSDirective = false;
HasStaticCtorDtorReferenceInStaticMode = false;
MaxInstLength = 4;
PCSymbol = "$";

View File

@ -35,6 +35,7 @@ MCAsmInfoDarwin::MCAsmInfoDarwin() {
WeakRefDirective = "\t.weak_reference ";
ZeroDirective = "\t.space\t"; // ".space N" emits N zeros.
HasMachoZeroFillDirective = true; // Uses .zerofill
HasMachoTBSSDirective = true; // Uses .tbss
HasStaticCtorDtorReferenceInStaticMode = true;
HiddenVisibilityAttr = MCSA_PrivateExtern;