On 9/2/22 3:54 PM, Walter Bright wrote:
>On 9/2/2022 6:23 AM, Steven Schveighoffer wrote:
>What do you mean? If you are suggesting that probably the module sorting is insignificant, it definitely is not very intensive.
I am indeed suggesting it is insignificant.
I'd hazard to guess it's indistinguishable really. Probably on the order of a couple milliseconds, even on a large module set.
It's not so much the performance, but the principle, and also the requirement of code to do something that is knowable really at link-time.
>In the olden days, I (and others) would just have the executable self-patch itself. But such behavior was then banned by the OS.
I'm thinking more about either an intermediate step to the linker (once all objects are known), or a post-link step. Not something that happens at runtime.
What could happen is some --DRT switch to output the correct sorting, and then another tool that takes that as input, and can then properly edit the executable, or provide a specialized file to the compiler so it spits out a pre-organized module list. Can they be weak symbols, and then you just link the object file with that data ahead of everything else? Or, just the rt_init function could be told "use this pointer array as the list instead of the sorting."
Actually, I think that last idea is doable without any compiler changes... I'll have to investigate.
-Steve