summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2019-01-27 16:42:12 +0000
committerpatrick <patrick@openbsd.org>2019-01-27 16:42:12 +0000
commitb773203fb58f3ef282fb69c832d8710cab5bc82d (patch)
treee75913f147570fbd75169647b144df85b88a038c /gnu/llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp
parenttweak errno in previous (diff)
downloadwireguard-openbsd-b773203fb58f3ef282fb69c832d8710cab5bc82d.tar.xz
wireguard-openbsd-b773203fb58f3ef282fb69c832d8710cab5bc82d.zip
Import LLVM 7.0.1 release including clang, lld and lldb.
Diffstat (limited to 'gnu/llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp')
-rw-r--r--gnu/llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/gnu/llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp b/gnu/llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp
index 59ed0324bdb..c8305ad9c54 100644
--- a/gnu/llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp
+++ b/gnu/llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp
@@ -10,9 +10,9 @@
#include "AddressPool.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/CodeGen/AsmPrinter.h"
-#include "llvm/CodeGen/TargetLoweringObjectFile.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/MC/MCStreamer.h"
+#include "llvm/Target/TargetLoweringObjectFile.h"
#include <utility>
using namespace llvm;
@@ -24,8 +24,26 @@ unsigned AddressPool::getIndex(const MCSymbol *Sym, bool TLS) {
return IterBool.first->second.Number;
}
+
+void AddressPool::emitHeader(AsmPrinter &Asm, MCSection *Section) {
+ static const uint8_t AddrSize = Asm.getDataLayout().getPointerSize();
+ Asm.OutStreamer->SwitchSection(Section);
+
+ uint64_t Length = sizeof(uint16_t) // version
+ + sizeof(uint8_t) // address_size
+ + sizeof(uint8_t) // segment_selector_size
+ + AddrSize * Pool.size(); // entries
+ Asm.emitInt32(Length); // TODO: Support DWARF64 format.
+ Asm.emitInt16(Asm.getDwarfVersion());
+ Asm.emitInt8(AddrSize);
+ Asm.emitInt8(0); // TODO: Support non-zero segment_selector_size.
+}
+
// Emit addresses into the section given.
void AddressPool::emit(AsmPrinter &Asm, MCSection *AddrSection) {
+ if (Asm.getDwarfVersion() >= 5)
+ emitHeader(Asm, AddrSection);
+
if (Pool.empty())
return;