[llvm] r252105 - Fix pr24832.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 4 16:10:08 PST 2015


Author: rafael
Date: Wed Nov  4 18:10:08 2015
New Revision: 252105

URL: http://llvm.org/viewvc/llvm-project?rev=252105&view=rev
Log:
Fix pr24832.

It is pretty simple now that the yak is shaved.

Added:
    llvm/trunk/test/MC/X86/large-bss.s
Modified:
    llvm/trunk/include/llvm/MC/MCObjectStreamer.h
    llvm/trunk/include/llvm/MC/MCStreamer.h
    llvm/trunk/lib/MC/MCObjectStreamer.cpp

Modified: llvm/trunk/include/llvm/MC/MCObjectStreamer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCObjectStreamer.h?rev=252105&r1=252104&r2=252105&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCObjectStreamer.h (original)
+++ llvm/trunk/include/llvm/MC/MCObjectStreamer.h Wed Nov  4 18:10:08 2015
@@ -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.

Modified: llvm/trunk/include/llvm/MC/MCStreamer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCStreamer.h?rev=252105&r1=252104&r2=252105&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCStreamer.h (original)
+++ llvm/trunk/include/llvm/MC/MCStreamer.h Wed Nov  4 18:10:08 2015
@@ -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.

Modified: llvm/trunk/lib/MC/MCObjectStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCObjectStreamer.cpp?rev=252105&r1=252104&r2=252105&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCObjectStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCObjectStreamer.cpp Wed Nov  4 18:10:08 2015
@@ -417,18 +417,10 @@ void MCObjectStreamer::EmitGPRel64Value(
 }
 
 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() {

Added: llvm/trunk/test/MC/X86/large-bss.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/X86/large-bss.s?rev=252105&view=auto
==============================================================================
--- llvm/trunk/test/MC/X86/large-bss.s (added)
+++ llvm/trunk/test/MC/X86/large-bss.s Wed Nov  4 18:10:08 2015
@@ -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




More information about the llvm-commits mailing list