I've gotten interested in how the linker works so I've been going over this book for a while (https://www.amazon.com/Linkers-Kaufmann-Software-Engineering-Programming/dp/1558604960) and I think it 's an amazing read.
You'd think it'd be out of date but it's very informative since embedded is stuck in the past anyways, and linkers haven't changed too much since then. It even has a section on gnu linker scripts!
If you want a reference book, I think this might be interesting. I did not read it, so I can't vouch for it, but I saw several people recommend it:
https://www.amazon.com/Linkers-Kaufmann-Software-Engineering-Programming/dp/1558604960
As to how you become to understand it, as with anything, just work with them. Change it, see what happens, what is different. Check out the compiler manual, that should outline a lot of the syntax and illuminate the usage. See where the sections come from the code, check the mapfile and see what is actually put in there.
What do you want to do, more exactly? You want to change it in order to... what? What compiler and what target are you using?
The general answer is to read as many books on C++ as you can find. The definitive list is in the sidebar. As for linking and loading, there is a severe dearth of books on the subject. I recently finished Linkers and Loaders which provides a detailed description of several different object formats and linker strategies.
This book was recommended in one of the other discussions. I can vouch for it personally myself.
The linker script in the OP is a useful resource in also just understanding what kind of information you need to track down to build a script from scratch for a new platform:
I can't help you with specifics but if you're looking for something in depth, the answers you're looking for may be in here.
Which ever one you pick, don't forget Linkers and Loaders
>There are a number of patterns for compile-time polymorphism, tagged dispatch, and selective compiling. There are expression templates that you can composite your functions and the compiler can generate optimized code {...}
Can you link to some blogs/books you think are particularly insightful?
>Compile times don't matter. I would abhor delivering an inferior product because I was incensed by a compile time.
For what it's worth, we also use distributed compiling using IncrediBuild -- our build system is complex enough to have a dedicated engineer working on it, and I would not pretend to totally understand how it works.
I will say that despite the minimal use of templates, pushing all configuration to scripting to minimize our C++ footprint, and our (hopefully not needlessly) sophisticated build system, a total build/compilation of all of our software would still take hours.
It could be that some of our developers aren't outstanding. It could also be that we have some legacy code that needs to be rewritten. But whatever the reason is, it's very easy to say "hey, I want to write the best possible software, development time be damned", but there is a finite amount of time our developers can spend working, and it would be a shame to spend a large amount of those hours waiting for things to compile.
I used to agree with you. I could never understand why compilation times matter as long as the software works. Then I started working as a professional developer, with requirements and deadlines.
Please realize that this isn't an attempt to lecture you. You definitely have a lot more experience than I do, and I want to hear your thoughts. Some of what you said just doesn't seem to line up with my experience is all.
And this doesn't even get into the issues with debugging -- maybe your (seemingly) extensive experience working with templates has given you the means to decipher those cryptic error messages, but I usually can't make heads or tails of them, which is why I asked you for some recommended resources. It's somewhat unfortunate that I won't get the experience through my job directly, which is rooted in what led me to this anti-template bias in the first place.
>cached builds
I would also like to read more about this, if anything comes to mind. As I mentioned, I'm not super familiar with the build process; I have a linker textbook on my shelf that I intend to get to soon, but I don't think that will help with what you refer to here.
There are two aspects of compiling and linking: a pragmatic application of tools to get the job done and the actual mechanisms these tools use to put the bits and bytes together. On the pragmatic side, you have build systems like autoconf, CMake, ninja, and others (though the first two are the most prevalent). There are a multitude of books and online resources for learning how to use these tools. I don't use CMake, myself, but I can recommend some books on autoconf, if you are interested.
For the more technical details of how compilers and linkers work together to make an executable, there is a real dearth of information on the internet about this and even fewer books that cover it with any regard. In fact, I have only found two books that cover the material with any real depth: John Levine's <em>Linkers and Loaders</em> and Milan Stevanovic's <em>Advanced C and C++ Compiling</em>.