On 12/27/22 1:26 PM, Willy Tarreau wrote:
Yes, and quite frankly I prefer to make that the least complicated. Doing just a simple loop in the _start code is trivial. The main concern was to store the data. Till now we had an optional .bss section, we didn't save environ and errno was optional. But let's be honest, while it does allow for writing the smallest programs, most programs will have at least one global variable and will get this section anyway, so we don't save anything in practice. This concern used to be valid when I was making tiny executables when running on floppies where each byte mattered, but now that's pointless.
Thus what I'm proposing is to switch to weak symbol definitions for errno, environ, and auxv. I did a quick test to make sure that the same symbol was properly used when accessed from two units and that's OK, I'm seeing the same instance for all of them (which is better than the current situation where errno is static, hence per-unit).
Looks good to me.
Thus now my focus will be on storing these variables where relevant for all archs, so that your getauxval() implementation works on top of it. It will be much cleaner and will also improve programs' ease of implementation and reliability.
Are you going to wire up a patchset for it?
If so, I'll wait for it. When it's already committed, I'll base this series on top it.
Or I take your series locally then submit your patches and mine in a single series.
What do you prefer?