From: Rafael Espindola Date: Thu, 5 Nov 2015 00:10:08 +0000 (+0000) Subject: Fix pr24832. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=11431b640c56b632c9d0bb014ac25e61e0340989;p=oota-llvm.git Fix pr24832. It is pretty simple now that the yak is shaved. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252105 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/MC/MCObjectStreamer.h b/include/llvm/MC/MCObjectStreamer.h index ca7bdd3347e..3de44f8e789 100644 --- a/include/llvm/MC/MCObjectStreamer.h +++ b/include/llvm/MC/MCObjectStreamer.h @@ -125,7 +125,6 @@ public: void EmitGPRel32Value(const MCExpr *Value) override; void EmitGPRel64Value(const MCExpr *Value) override; void EmitFill(uint64_t NumBytes, uint8_t FillValue) override; - void EmitZeros(uint64_t NumBytes) override; void FinishImpl() override; /// Emit the absolute difference between two symbols if possible. diff --git a/include/llvm/MC/MCStreamer.h b/include/llvm/MC/MCStreamer.h index 5724a99ad08..5b4f07240b0 100644 --- a/include/llvm/MC/MCStreamer.h +++ b/include/llvm/MC/MCStreamer.h @@ -567,7 +567,7 @@ public: /// \brief Emit NumBytes worth of zeros. /// This function properly handles data in virtual sections. - virtual void EmitZeros(uint64_t NumBytes); + void EmitZeros(uint64_t NumBytes); /// \brief Emit some number of copies of \p Value until the byte alignment \p /// ByteAlignment is reached. diff --git a/lib/MC/MCObjectStreamer.cpp b/lib/MC/MCObjectStreamer.cpp index f992371bc84..c47e2162b63 100644 --- a/lib/MC/MCObjectStreamer.cpp +++ b/lib/MC/MCObjectStreamer.cpp @@ -417,18 +417,10 @@ void MCObjectStreamer::EmitGPRel64Value(const MCExpr *Value) { } void MCObjectStreamer::EmitFill(uint64_t NumBytes, uint8_t FillValue) { - // FIXME: A MCFillFragment would be more memory efficient but MCExpr has - // problems evaluating expressions across multiple fragments. - MCDataFragment *DF = getOrCreateDataFragment(); - flushPendingLabels(DF, DF->getContents().size()); - DF->getContents().append(NumBytes, FillValue); -} - -void MCObjectStreamer::EmitZeros(uint64_t NumBytes) { const MCSection *Sec = getCurrentSection().first; assert(Sec && "need a section"); unsigned ItemSize = Sec->isVirtualSection() ? 0 : 1; - insert(new MCFillFragment(0, ItemSize, NumBytes)); + insert(new MCFillFragment(FillValue, ItemSize, NumBytes)); } void MCObjectStreamer::FinishImpl() { diff --git a/test/MC/X86/large-bss.s b/test/MC/X86/large-bss.s new file mode 100644 index 00000000000..edb111e9092 --- /dev/null +++ b/test/MC/X86/large-bss.s @@ -0,0 +1,14 @@ +// RUN: llvm-mc -triple x86_64-pc-linux -filetype=obj %s -o - | llvm-readobj -s | FileCheck %s + +.bss +.zero 0x10000000000000 + +// CHECK: Name: .bss +// CHECK-NEXT: Type: SHT_NOBITS +// CHECK-NEXT: Flags [ +// CHECK-NEXT: SHF_ALLOC +// CHECK-NEXT: SHF_WRITE +// CHECK-NEXT: ] +// CHECK-NEXT: Address: 0x0 +// CHECK-NEXT: Offset: 0x40 +// CHECK-NEXT: Size: 4503599627370496