summaryrefslogtreecommitdiff
path: root/lib/MC/MCMachOStreamer.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2018-02-01 21:07:55 +0000
committerDimitry Andric <dim@FreeBSD.org>2018-02-01 21:07:55 +0000
commit4a6a1ccbecd7e34f40b05b4ba0a05d0031dd1eff (patch)
treebd998e25df07b7abd964ad088180d19152336f8d /lib/MC/MCMachOStreamer.cpp
parenta096e0bdf6cfa020569afca490d8e4c9ac8ebb01 (diff)
Notes
Diffstat (limited to 'lib/MC/MCMachOStreamer.cpp')
-rw-r--r--lib/MC/MCMachOStreamer.cpp28
1 files changed, 9 insertions, 19 deletions
diff --git a/lib/MC/MCMachOStreamer.cpp b/lib/MC/MCMachOStreamer.cpp
index 82b75afabb3c..3969143bb2c7 100644
--- a/lib/MC/MCMachOStreamer.cpp
+++ b/lib/MC/MCMachOStreamer.cpp
@@ -411,29 +411,19 @@ void MCMachOStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
void MCMachOStreamer::EmitZerofill(MCSection *Section, MCSymbol *Symbol,
uint64_t Size, unsigned ByteAlignment) {
- getAssembler().registerSection(*Section);
-
- // The symbol may not be present, which only creates the section.
- if (!Symbol)
- return;
-
// On darwin all virtual sections have zerofill type.
assert(Section->isVirtualSection() && "Section does not have zerofill type!");
- assert(Symbol->isUndefined() && "Cannot define a symbol twice!");
+ PushSection();
+ SwitchSection(Section);
- getAssembler().registerSymbol(*Symbol);
-
- // Emit an align fragment if necessary.
- if (ByteAlignment != 1)
- new MCAlignFragment(ByteAlignment, 0, 0, ByteAlignment, Section);
-
- MCFragment *F = new MCFillFragment(0, Size, Section);
- Symbol->setFragment(F);
-
- // Update the maximum alignment on the zero fill section if necessary.
- if (ByteAlignment > Section->getAlignment())
- Section->setAlignment(ByteAlignment);
+ // The symbol may not be present, which only creates the section.
+ if (Symbol) {
+ EmitValueToAlignment(ByteAlignment, 0, 1, 0);
+ EmitLabel(Symbol);
+ EmitZeros(Size);
+ }
+ PopSection();
}
// This should always be called with the thread local bss section. Like the