Blame SOURCES/0023-Call-ar-in-deterministic-mode.patch

cfe30e
From 656e495d515b0fc1f01add164aa4bba9a49ceb31 Mon Sep 17 00:00:00 2001
cfe30e
From: Peter Jones <pjones@redhat.com>
cfe30e
Date: Tue, 13 Mar 2018 15:20:34 -0400
cfe30e
Subject: [PATCH 23/25] Call ar in deterministic mode.
cfe30e
cfe30e
We need the x86_64 and i686 builds of .a's to be the same, and that
cfe30e
means we need to not have timestamps.  Also force the timestamps on disk
cfe30e
just in case that doesn't work, because RHEL's ar /silently ignores -D/.
cfe30e
cfe30e
v2: use "ar rvD" not "ar rv -D".
cfe30e
cfe30e
It's a wonder anybody ever gets these command line options right, if
cfe30e
"ar rv -D libfoo.a foo.o" doesn't use deterministic mode (or
cfe30e
complain), but "ar rvD libfoo.a foo.o" does.
cfe30e
cfe30e
v3: Add a bunch of junk to try to set timestamps to 0 manually
cfe30e
cfe30e
For some reason I'm still getting timestamps in the .a even though ar seems to
cfe30e
be invoked correctly.  When I do "mock -r rhel-7-build --shell" and run make
cfe30e
manually, they're fine.  Very strange.
cfe30e
cfe30e
v4: go back to v2, the problem isn't in the make process.
cfe30e
cfe30e
"ar rDv" works just fine, but /usr/lib/rpm/redhat/brp-strip-static-archive is
cfe30e
calling "%{__strip} -g $for_each.a", and it's rewriting our binary from
cfe30e
ts/uid/gid of 0/0/0 to $epoch/$UID/$GID.  Awesomely /usr/bin/strip it seems to
cfe30e
have 3 modes of operation:
cfe30e
-U: the default, which adds $epoch/$UID/$GID to your binary archive
cfe30e
    instead of just removing stuff.  Clearly the Principle of Least
cfe30e
    Surprise is strong here.
cfe30e
-p: preserve the timestamp from the original .a, but add UID and GID,
cfe30e
    because this is 1980 and people use ar(1) for archiving stuff they
cfe30e
    might want that out of.
cfe30e
-D: Condescend at you in a command line error and explain that -D both
cfe30e
    is and is not a valid option:
cfe30e
      /usr/bin/strip: invalid option -- 'D'
cfe30e
      Usage: /usr/bin/strip <option(s)> in-file(s)
cfe30e
      Removes symbols and sections from files
cfe30e
      The options are:
cfe30e
      ...
cfe30e
      -D --enable-deterministic-archives
cfe30e
                  Produce deterministic output when stripping archives
cfe30e
    So I agree that it's invalid, but I think we may be pronouncing that
cfe30e
    second vowel differently.  They say in-VAL-id, I say IN-vuh-lid.
cfe30e
cfe30e
Nobody should ever have to run "strace -ttt -v -f -o make.strace make all",
cfe30e
just to discover the problem isn't even in there.
cfe30e
cfe30e
Related: rhbz#1310782
cfe30e
cfe30e
Signed-off-by: Peter Jones <pjones@redhat.com>
cfe30e
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
cfe30e
---
cfe30e
 Make.defaults | 2 +-
cfe30e
 1 file changed, 1 insertion(+), 1 deletion(-)
cfe30e
cfe30e
diff --git a/Make.defaults b/Make.defaults
cfe30e
index ed4b60c2423..ba743f17893 100755
cfe30e
--- a/Make.defaults
cfe30e
+++ b/Make.defaults
cfe30e
@@ -177,7 +177,7 @@ CFLAGS  += $(ARCH3264) -g -O2 -Wall -Wextra -Werror \
cfe30e
            $(if $(findstring gcc,$(CC)),-fno-merge-all-constants,)
cfe30e
 endif
cfe30e
 
cfe30e
-ARFLAGS += -U
cfe30e
+ARFLAGS := rDv
cfe30e
 ASFLAGS += $(ARCH3264)
cfe30e
 LDFLAGS	+= -nostdlib --warn-common --no-undefined --fatal-warnings \
cfe30e
 	   --build-id=sha1
cfe30e
-- 
cfe30e
2.15.0
cfe30e