summaryrefslogtreecommitdiffstats
path: root/lib/MC/MCLinkerOptimizationHint.cpp
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2014-11-24 09:08:18 +0000
committerdim <dim@FreeBSD.org>2014-11-24 09:08:18 +0000
commite27feadae0885aa074df58ebfda2e7a7f7a7d590 (patch)
treef5944309621cee4fe0976be6f9ac619b7ebfc4c2 /lib/MC/MCLinkerOptimizationHint.cpp
parent87ba4fbed530c9d0dff7505d121035f5ed09c9f3 (diff)
downloadFreeBSD-src-e27feadae0885aa074df58ebfda2e7a7f7a7d590.zip
FreeBSD-src-e27feadae0885aa074df58ebfda2e7a7f7a7d590.tar.gz
Vendor import of llvm RELEASE_350/final tag r216957 (effectively, 3.5.0 release):
https://llvm.org/svn/llvm-project/llvm/tags/RELEASE_350/final@216957
Diffstat (limited to 'lib/MC/MCLinkerOptimizationHint.cpp')
-rw-r--r--lib/MC/MCLinkerOptimizationHint.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/MC/MCLinkerOptimizationHint.cpp b/lib/MC/MCLinkerOptimizationHint.cpp
new file mode 100644
index 0000000..3f8d620
--- /dev/null
+++ b/lib/MC/MCLinkerOptimizationHint.cpp
@@ -0,0 +1,35 @@
+//===-- llvm/MC/MCLinkerOptimizationHint.cpp ----- LOH handling -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/MC/MCLinkerOptimizationHint.h"
+#include "llvm/MC/MCAsmLayout.h"
+#include "llvm/Support/LEB128.h"
+#include "llvm/MC/MCStreamer.h"
+
+using namespace llvm;
+
+// Each LOH is composed by, in this order (each field is encoded using ULEB128):
+// - Its kind.
+// - Its number of arguments (let say N).
+// - Its arg1.
+// - ...
+// - Its argN.
+// <arg1> to <argN> are absolute addresses in the object file, i.e.,
+// relative addresses from the beginning of the object file.
+void MCLOHDirective::Emit_impl(raw_ostream &OutStream,
+ const MachObjectWriter &ObjWriter,
+ const MCAsmLayout &Layout) const {
+ const MCAssembler &Asm = Layout.getAssembler();
+ encodeULEB128(Kind, OutStream);
+ encodeULEB128(Args.size(), OutStream);
+ for (LOHArgs::const_iterator It = Args.begin(), EndIt = Args.end();
+ It != EndIt; ++It)
+ encodeULEB128(ObjWriter.getSymbolAddress(&Asm.getSymbolData(**It), Layout),
+ OutStream);
+}
OpenPOWER on IntegriCloud