3 ms·
Perhaps some linker enthousiast could give me feedback on an idea for a compiler I'm working on. My strategy is that my compiler produces a database of external
by tinco 11y ago
Perhaps some linker enthousiast could give me feedback on an idea for a compiler I'm working on. My strategy is that my compiler produces a database of externally visible functions in an position independent format and with a metadata table that has information about each reference to an undefined symbol, that information would be fully qualified paths and types. A static linker would then walk a tree from the main function down to each referenced external function, concatenating them and resolving the locations.
A dynamic link would simply be the same but then embedded as a runtime of the executable.
I have read the ELF book, and am now reading this article series. I think my strategy is pretty similar to how ELF works with its PLT, but I'd like to do the dynamic linking at load time, not with a jump table. The fully qualified path and types are just a case of fancier symbol names probably.
The idea of the compiler+linker would be to bring a Java/C# like experience to a native compiled language. Perhaps Rust could be an inspiration, I haven't read much about their compile process yet.
- ternaryoperator 11y agoThis is fairly typical and, except for the use of a database, the way most object files are converted to executables: that is they make it easy to access the list of unresolved references and include some (generally minimal) data about the reference they're expecting.