LLVM 20.0.0git
LoadRelocatableObject.h
Go to the documentation of this file.
1//===---- LoadRelocatableObject.h - Load relocatable objects ----*- C++ -*-===//
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// A wrapper for `MemoryBuffer::getFile` / `MemoryBuffer::getFileSlice` that:
10//
11// 1. Adds file paths to errors by default.
12// 2. Checks architecture compatibility up-front.
13// 3. Handles MachO universal binaries, returning the MemoryBuffer for the
14// requested slice only.
15//
16//===----------------------------------------------------------------------===//
17
18#ifndef LLVM_EXECUTIONENGINE_ORC_LOADRELOCATABLEOBJECT_H
19#define LLVM_EXECUTIONENGINE_ORC_LOADRELOCATABLEOBJECT_H
20
21#include "llvm/Support/Error.h"
24
25namespace llvm {
26namespace orc {
27
28// Load an object file compatible with the given triple (if given) from the
29// given path. May return a file slice if the path contains a universal binary.
30Expected<std::unique_ptr<MemoryBuffer>> loadRelocatableObject(StringRef Path,
31 const Triple &TT);
32
33} // End namespace orc
34} // End namespace llvm
35
36#endif // LLVM_EXECUTIONENGINE_ORC_LOADRELOCATABLEOBJECT_H
Expected< std::unique_ptr< MemoryBuffer > > loadRelocatableObject(StringRef Path, const Triple &TT)
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18