[all-commits] [llvm/llvm-project] 3e1d4e: [ORC] loadRelocatableObject: universal binary supp...
Lang Hames via All-commits
all-commits at lists.llvm.org
Thu Aug 15 16:52:57 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 3e1d4ec671c59204e3e556cc58fd948894af1e1b
https://github.com/llvm/llvm-project/commit/3e1d4ec671c59204e3e556cc58fd948894af1e1b
Author: Lang Hames <lhames at gmail.com>
Date: 2024-08-16 (Fri, 16 Aug 2024)
Changed paths:
M llvm/include/llvm/ExecutionEngine/Orc/ExecutionUtils.h
A llvm/include/llvm/ExecutionEngine/Orc/LoadRelocatableObject.h
A llvm/include/llvm/ExecutionEngine/Orc/MachO.h
M llvm/lib/ExecutionEngine/Orc/CMakeLists.txt
M llvm/lib/ExecutionEngine/Orc/ExecutionUtils.cpp
A llvm/lib/ExecutionEngine/Orc/LoadRelocatableObject.cpp
A llvm/lib/ExecutionEngine/Orc/MachO.cpp
A llvm/test/ExecutionEngine/JITLink/Generic/MachO_universal_binaries.test
M llvm/tools/llvm-jitlink/llvm-jitlink.cpp
Log Message:
-----------
[ORC] loadRelocatableObject: universal binary support, clearer errors (#104406)
ORC supports loading relocatable object files into a JIT'd process. The
raw "add object file" API (ObjectLayer::add) accepts plain relocatable
object files as llvm::MemoryBuffers only and does not check that the
object file's format or architecture are compatible with the process
that it will be linked in to. This API is flexible, but places the
burden of error checking and universal binary support on clients.
This commit introduces a new utility, loadRelocatableObject, that takes
a path to load and a target triple and then:
1. If the path does not exist, returns a FileError containing the
invalid path.
2. If the path points to a MachO universal binary, identifies and
returns MemoryBuffer covering the slice that matches the given triple
(checking that the slice really does contains a valid MachO relocatable
object with a compatible arch).
3. If the path points to a regular relocatable object file, verifies
that the format and architecture are compatible with the triple.
Clients can use loadRelocatableObject in the common case of loading
object files from disk to simplify their code.
Note: Error checking for ELF and COFF is left as a FIXME.
rdar://133653290
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list