irx.h: make IRX import/export tables work when built with clang #15
Loading…
Reference in a new issue
No description provided.
Delete branch "llvm-irx-tables"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
With LLVM,
DECLARE_IMPORT_TABLEandDECLARE_EXPORT_TABLEput the table header in a section literally named.text\n\t#(GNU as treats it as.textplus a comment). That section is not part of the loaded image, so the module's imports were never linked andRegisterLibraryEntriesreturned garbage.Under
__clang__the headers are now written as assembly in.text, in order with the stubs and pointers. GCC output is unchanged.Needs LLVM PR ps2/llvm#4 and the
-mllvm -mips-split-hi16IOP flag for the module to be IRX1. Verified with a clean-SDK build: iomanX, fileXio, usbd, bdm, bdmfs_fatfs and usbmass_bd built with LLVM load in PCSX2 and the std::filesystem example passes (0 failures).🤖 Generated with Claude Code
The GNU assembler reads section(".text\n\t#") as .text followed by a comment. Clang takes it literally and puts each table header in a section named ".text\n\t#", outside the loaded image and away from the stubs and function pointers that follow it, so the loader never linked the module's imports. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>