[llvm] New tool 'llvm-elf2bin'. (NOT READY FOR REVIEW – NO TESTS) (PR #73625)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 28 08:18:15 PST 2023


================
@@ -0,0 +1,326 @@
+//===- bin.cpp - Code to write binary and VHX output for llvm-elf2bin -----===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm-elf2bin.h"
+
+#include <algorithm>
+#include <cassert>
+#include <memory>
+#include <queue>
+
+#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/bit.h"
+#include "llvm/Support/raw_ostream.h"
+
+using namespace llvm;
+
+/*
+ * Abstraction that provides a means of getting binary data from
+ * somewhere. In the simple case this will involve reading data from a
+ * segment in an ELF file. In more complex cases there might also be
+ * zero-byte padding, or one of these stream objects filtering out the
+ * even-index bytes of another.
+ */
----------------
MaskRay wrote:

anonymous namespace

(otherwise, if there is another `BinaryDataStream` in the global namespace, their vtable would conflict.)

https://github.com/llvm/llvm-project/pull/73625


More information about the llvm-commits mailing list