#pragma once #include "builder.hpp" #include "coff_reader.hpp" #include "elf_reader.hpp" #include "macho_reader.hpp" #include #include namespace voidlibc::voidlink { struct LoweredText { SectionSpec section; // code + relocs (portable IR) std::vector symbols; // unified: exports first, then imports }; // Lower the .text section of an ELF .o into a portable VoidLibC // SectionSpec + unified SymbolSpec list. std::variant lower_elf_text(const elf::ParsedObject& obj, voidlibc::format::TargetOS target_os); // Lower a COFF .obj (x86-64 Windows) into portable VoidLibC representation. // Handles IMAGE_REL_AMD64_REL32 / REL32_1..5 / ADDR64 and produces the same // LoweredText as lower_elf_text() so that fuse / pack-elf work uniformly. std::variant lower_coff_text(const coff::ParsedObject& obj, voidlibc::format::TargetOS target_os); // Lower a Mach-O .o (x86-64 macOS) into portable VoidLibC representation. // Handles X86_64_RELOC_SIGNED / BRANCH / UNSIGNED / GOT_LOAD / SUBTRACTOR. std::variant lower_macho_text(const macho::ParsedObject& obj, voidlibc::format::TargetOS target_os); } // namespace voidlibc::voidlink