Disabling timestamps, was Re: [PATCH roland/Versions.def]....
Michael Matz
matz@suse.de
Tue Mar 18 10:38:00 GMT 2014
Hi,
On Mon, 17 Mar 2014, Brooks Moses wrote:
> We were discussing binutils --enable-deterministic-archives in
> libc-alpha@, and Andreas mentioned your recent SUSE binutils commit that
> had the description "Disable --enable-deterministic-archives again, as
> it breaks valid Makefiles." Any chance you could comment on what
> exactly it broke?
Sure. The testsuite of GNU make will break (in particular
features/archives), and it points to a real conflict of expectations
between make and enable-deterministic-archives ar:
If I write such Makefile:
---------------------------
all: libxx.a(a1.o)
---------------------------
then touch a1.o, any POSIX make will create libxx.a via 'ar rv libx.a
a1.o'. When I then make all again (without touching a1.o again), then
libxx.a must not be remade. When binutils is configured with
--enable-deterministic-archives it will be remade (because the recorded
timestamp of a1.o in libxx.a will be epoch, which will always be older
than the real filedate of a1.o, so libxx.a is always out of date).
As Makefiles can be validly written in a way to expect that targets aren't
remade when their prerequisites aren't such binutils are broken. I'll
freely admit that such use of native archive support in make is not very
common, so the real-world breakage is probably small. But as I also
couldn't think of a way to have both (short of something like an
environment variable that could be set for those few programs that neither
can change ARFLAGS but still expect normal behaviour) I had to remove
--enable-deterministic-archives again.
Of course the behaviour of ar can be changed with adding U to ARFLAGS, but
that isn't POSIX anymore and effectively is a change of the Makefile, the
whole point being that it must work unchanged.
I think a better way to achieve the intention of that option is rather to
ignore timestamps in .a files when comparing them, or even more
aggressive, to zero out those timestamps when installing archives.
Ciao,
Michael.
More information about the Libc-alpha
mailing list