Hacker News new | past | comments | ask | show | jobs | submit login
Linkers, part 1 (2007) (airs.com)
51 points by weinzierl on May 24, 2015 | hide | past | favorite | 7 comments



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.


This 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.


here's a toc with links to all 20 articles of the series http://lwn.net/Articles/276782/


This is an in-depth introduction to linkers by Ian Lance Taylor, the author of the gold linker. Before reading this I thought I knew what linker did and how it worked, this series set me straight.


>what linker did and how it worked

But isn't that highly language and implementation specific? E.g. if I recall correctly the original Turbo Pascal linker was a trivial piece of software and did very little while modern C++ linkers (like gold linker) are monstrously complex and do a hell lot.


Excellent, thank you. I was just wondering whether I should build a custom linker for the compiler I'm building. This should clear that question right up :)


thanks for posting, this and the 19 other articles that follow were great.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: