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

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