LLVM 22.0.0git
XCOFF.cpp
Go to the documentation of this file.
1//===-------------- XCOFF.cpp - JIT linker function for XCOFF -------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// XCOFF jit-link function.
10//
11//===----------------------------------------------------------------------===//
12
16
17using namespace llvm;
18
19#define DEBUG_TYPE "jitlink"
20
21namespace llvm {
22namespace jitlink {
23
26 std::shared_ptr<orc::SymbolStringPool> SSP) {
27 // Check magic
28 file_magic Magic = identify_magic(ObjectBuffer.getBuffer());
29 if (Magic != file_magic::xcoff_object_64)
30 return make_error<JITLinkError>("Invalid XCOFF 64 Header");
31
32 // TODO: See if we need to add more checks
33 //
34 return createLinkGraphFromXCOFFObject_ppc64(ObjectBuffer, std::move(SSP));
35}
36
37void link_XCOFF(std::unique_ptr<LinkGraph> G,
38 std::unique_ptr<JITLinkContext> Ctx) {
39 link_XCOFF_ppc64(std::move(G), std::move(Ctx));
40}
41
42} // namespace jitlink
43} // namespace llvm
#define G(x, y, z)
Definition MD5.cpp:56
Tagged union holding either a T or a Error.
Definition Error.h:485
StringRef getBuffer() const
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI file_magic identify_magic(StringRef magic)
Identify the type of a binary file based on how magical it is.
Definition Magic.cpp:33
Error make_error(ArgTs &&... Args)
Make a Error instance representing failure using the given error info type.
Definition Error.h:340
file_magic - An "enum class" enumeration of file types based on magic (the first N bytes of the file)...
Definition Magic.h:21
@ xcoff_object_64
64-bit XCOFF object file
Definition Magic.h:53