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

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