Skip to content

Instantly share code, notes, and snippets.


Zoë Knox mszoek

View GitHub Profile
mszoek / llvm.diff
Created April 3, 2022 21:10
LLVM patches for ELF Framework bundles on FreeBSD
View llvm.diff
diff --git a/contrib/llvm-project/clang/include/clang/Driver/ b/contrib/llvm-project/clang/include/clang/Driver/
index a0cbcae0bdc3..a5ef948450c3 100644
--- a/contrib/llvm-project/clang/include/clang/Driver/
+++ b/contrib/llvm-project/clang/include/clang/Driver/
@@ -634,7 +634,7 @@ def D : JoinedOrSeparate<["-"], "D">, Group<Preprocessor_Group>,
HelpText<"Define <macro> to <value> (or 1 if <value> omitted)">;
def E : Flag<["-"], "E">, Flags<[NoXarchOption,CC1Option, FlangOption, FC1Option]>, Group<Action_Group>,
HelpText<"Only run the preprocessor">;
-def F : JoinedOrSeparate<["-"], "F">, Flags<[RenderJoined,CC1Option]>,
+def F : JoinedOrSeparate<["-"], "F">, Flags<[RenderJoined,CC1Option,LinkerInput]>,
mszoek /
Last active January 29, 2023 00:27
ravynOS: Executing MachO

Some notes on implementing MachO loading and dyld on ravynOS as an early PoC.

So far, I have modified rtld-elf (the FreeBSD runtime linker) to handle simple MachO objects. It can now successfully load and run a trivial MachO executable built on a Mac with an external library dependency (libSystem.B.dylib - the C library). The linker also still handles ELF objects, so I call this monstrosity the "Macho ELF".

Loading a MachO object into the dynamic linker

★ zoe@haru ~/airyx-freebsd/libexec/dyldᐳ llvm-objdump -d hello