skeeto / w64devkit

Portable C and C++ Development Kit for x64 (and x86) Windows
The Unlicense
2.68k stars 185 forks source link

just a question #55

Open randvmbone opened 1 year ago

randvmbone commented 1 year ago

why?: sed -ri 's/(static bool insert_timestamp = )/\1!/' ld/emultempl/pe*.em

I googled but could not find any sources other than your Dockerfile. I understand it replaces "static bool insert_timestamp =" with "static bool insert_timestamp = !" I just don't understand what this does.

skeeto commented 1 year ago

That disables timestamps by default, as though --no-insert-timestamp was passed to the linker. Normally Binutils populates the PE "TimeDateStamp" field, leading to a non-deterministic binary. IMHO, this behavior is a mistake and toolchain outputs should be reproducible by default. Since it's trivial, I make it work the way I prefer.

In general, if you build the same source with the same w64devkit release using the same command, you get bit-for-bit identical results without needing to do extra work for it. You can observe this with pieces of w64devkit itself, though only if the upstream build (e.g. autotools) doesn't mess it up. For instance, compile the included pkg-config.c using the compiler options listed in included Dockerfile and you'll get an identical pkg-config.exe. That you can reproduce such results yourself ought to be a indicator of trustworthiness.

skeeto commented 1 year ago

I just remembered: I strive to keep the w64devkit commit log concise and informative, so you can "git blame" any line to get more information for why it's there. In this case: 160bfa9d7bb2473b58e1400dd3f202bc0749c790.

randvmbone commented 1 year ago

that's good to know and useful. so this would effect everything made with binutils? I'm still a newbie to git/hub and am trying to take your Dockerfile and build my own custom tools. I appreciate your responses.

skeeto commented 1 year ago

Specifically it affects all output from ld using the PE linker scripts. That means .exe and .dll. It won't affect tools like objcopy or objdump.