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.
/// \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.
}
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() {
--- /dev/null
+// 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