Hi Sam,
> 1. I put "#ifdef __DATE__" in constobj.d -- is this really necessary?
> Are there compilers that do not support __DATE__ & __TIME__?
No, __DATE__ and __TIME__ are well supported by all C and C++ compilers.
> 2. https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html:
>
> >> If GCC cannot determine the current date, it will emit a warning
> >> message (once per compilation) and __DATE__ will expand to "??? ??
> >> ????".
>
> Does this really ever happen?
Let's look in the source code. gcc-7.3.0/libcpp/macro.c lines 346..400.
Apparently it can happen in very exotic situations.
The reason __DATE__ and __TIME__ can generate warnings (gcc -Wdate-time)
is because there is a movement to achieve reproducible builds [1]. But
the warning is pretty pointless because the goal of having reproducible builds
can equally be achieved by setting the SOURCE_DATE_EPOCH environment variable
[2]:
$ cat foo.c
#include <stdio.h>
int main ()
{
printf ("%s %s\n", __DATE__, __TIME__);
}
$ SOURCE_DATE_EPOCH=1600000000 gcc foo.c -Wdate-time
foo.c: In function 'main':
foo.c:4:22: warning: macro "__DATE__" might prevent reproducible builds [-Wdate-time]
printf ("%s %s\n", __DATE__, __TIME__);
^~~~~~~~
foo.c:4:32: warning: macro "__TIME__" might prevent reproducible builds [-Wdate-time]
printf ("%s %s\n", __DATE__, __TIME__);
^~~~~~~~
$ ./a.out
Sep 13 2020 12:26:40
It would be quite some work to make clisp produce reproducible builds (4-8 weeks,
I guess). IMO the work would contain three parts:
- Remove timestamps from object files.
- Make the lisp.run invocations during builds not access the current time but instead
the SOURCE_DATE_EPOCH.
- Make the memory images immune against ASLR.
Bruno
[1] https://reproducible-builds.org/
[2] https://reproducible-builds.org/specs/source-date-epoch/
|