From patchwork Sat Nov 20 08:17:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacob Kroon X-Patchwork-Id: 47962 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A3C573858411 for ; Sat, 20 Nov 2021 08:18:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A3C573858411 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1637396321; bh=Zeo83k5ebL6Tt5o7bTuxtpTpI0cVFT1eN3vRfdZBkp8=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=ZsC8oKFiJpS8ZGWGP4NpDXKCrYhr0c6y6i8IO2oNjLvcGE9+0TgGcnqXcRCi1/yGw LC6oW4NrRfLz1ilvTJPoITEwo4EsqCti1d5zCxfdgeAC29sh2gWdmrxPcv1D491pCt IlDDMUVrKMGRz9kygK4PEjBJX3w7ChaTfcI+QdxQ= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by sourceware.org (Postfix) with ESMTPS id 5B7DF3858D3C for ; Sat, 20 Nov 2021 08:18:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5B7DF3858D3C Received: by mail-lf1-x12d.google.com with SMTP id bi37so54411764lfb.5 for ; Sat, 20 Nov 2021 00:18:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=Zeo83k5ebL6Tt5o7bTuxtpTpI0cVFT1eN3vRfdZBkp8=; b=Cl4XTOC5+EmU6WByVJ9zD4rGDVV6DbPc5CCIv1PQ2zfKi6RlWLnRAXjc588Y4Le2sv 7HsNDSr0owhd064lmx9vst3UFxpPW897PpNExuIrY8QJm79doDRNlYWAjAtmlbHARTF2 /h4U1r3dmm12Xmx1pe8b9nLmWbCUe9lLKsgKR2Jl/6w6ljxnIoxFxbJhgmGPdUnzejPK Kp4R82rsUQY+ElJ68HGxB4K95i4y2NMMKDrsD/brdNABKLB3ogOuj0x6d0s8fDv6MFJB ed7h/9gxh332GS7JloLfihwVctfisDbIRXOt6eZgJ+I6aMX0hl1J4hcVKzXKhQBLkZlM Y/jg== X-Gm-Message-State: AOAM531TdSzemmDJaZnvOsBW1INI38YuHPwtpFWDWOS8eRlNsAnza8g/ xrKi7O3PiVntQM573WjWQeHSUAVpsxGKqQ== X-Google-Smtp-Source: ABdhPJyGsDb4HJf9RjbhUJt5Do1jrhFT7sXIrcx9dZaGqcntDeCjr649gsZA1Ra9F0WEl+Q3tTAJ4A== X-Received: by 2002:a2e:b751:: with SMTP id k17mr32385315ljo.467.1637396290869; Sat, 20 Nov 2021 00:18:10 -0800 (PST) Received: from localhost.localdomain (37-247-29-68.customers.ownit.se. [37.247.29.68]) by smtp.gmail.com with ESMTPSA id p3sm250940lfu.1.2021.11.20.00.18.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 20 Nov 2021 00:18:10 -0800 (PST) To: gcc-patches@gcc.gnu.org Subject: [RFC PATCH] gcc: Improve reproducability when building cc1/cc1plus Date: Sat, 20 Nov 2021 09:17:48 +0100 Message-Id: <20211120081748.1160013-1-jacob.kroon@gmail.com> X-Mailer: git-send-email 2.33.1 MIME-Version: 1.0 X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jacob Kroon via Gcc-patches From: Jacob Kroon Reply-To: Jacob Kroon Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" cc1/cc1plus both include a checksum of the object files, archives and options used during linking. Unless the host binutils has been built with --enable-deterministic-archives, the archives will have different checksums each build due to changes in timestamps of the containing object files, and thus the checksum that is embedded in cc1/cc1plus will also change. Fix this by passing "D" to ar/ranlib when creating the archives. Signed-off-by: Jacob Kroon --- Makefile.in | 4 ++-- gcc/Makefile.in | 2 +- libbacktrace/configure | 2 +- libcody/Makefile.in | 4 ++-- libcpp/Makefile.in | 4 ++-- libdecnumber/Makefile.in | 4 ++-- libiberty/Makefile.in | 6 +++--- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Makefile.in b/Makefile.in index 860cf8f067b..8c451ed2121 100644 --- a/Makefile.in +++ b/Makefile.in @@ -416,7 +416,7 @@ MAKEINFOFLAGS = --split-size=5000000 AS = @AS@ AR = @AR@ -AR_FLAGS = rc +AR_FLAGS = rcD CC = @CC@ CXX = @CXX@ DLLTOOL = @DLLTOOL@ @@ -23571,7 +23571,7 @@ configure-libbacktrace: $$s/$$module_srcdir/configure \ --srcdir=$${topdir}/$$module_srcdir \ $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ - --target=${target_alias} \ + --target=${target_alias} RANLIB="ranlib -D" \ || exit 1 @endif libbacktrace diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 571e9c28e29..828b13d9b54 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -243,7 +243,7 @@ AR = @AR@ AR_FLAGS = rc NM = @NM@ RANLIB = @RANLIB@ -RANLIB_FLAGS = @ranlib_flags@ +RANLIB_FLAGS = @ranlib_flags@ -D # Libraries to use on the host. HOST_LIBS = @HOST_LIBS@ diff --git a/libbacktrace/configure b/libbacktrace/configure index a2f33c0f35d..5b18966ea80 100755 --- a/libbacktrace/configure +++ b/libbacktrace/configure @@ -6669,7 +6669,7 @@ else fi test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru +test -z "$AR_FLAGS" && AR_FLAGS=crD diff --git a/libcody/Makefile.in b/libcody/Makefile.in index 7eaf8ace8ce..f1e8be352b5 100644 --- a/libcody/Makefile.in +++ b/libcody/Makefile.in @@ -126,8 +126,8 @@ LIBCODY.O := buffer.o client.o fatal.o netclient.o netserver.o \ all:: libcody.a libcody.a: $(LIBCODY.O) - $(AR) -cr $@ $^ - $(RANLIB) $@ + $(AR) -crD $@ $^ + $(RANLIB) -D $@ mostlyclean:: diff --git a/libcpp/Makefile.in b/libcpp/Makefile.in index 34e4206957d..53d220c4e0b 100644 --- a/libcpp/Makefile.in +++ b/libcpp/Makefile.in @@ -26,7 +26,7 @@ top_builddir = . VPATH = @srcdir@ INSTALL = @INSTALL@ AR = @AR@ -ARFLAGS = cru +ARFLAGS = crD ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ @@ -101,7 +101,7 @@ all: libcpp.a $(USED_CATALOGS) libcpp.a: $(libcpp_a_OBJS) -rm -f libcpp.a $(AR) $(ARFLAGS) libcpp.a $(libcpp_a_OBJS) - $(RANLIB) libcpp.a + $(RANLIB) -D libcpp.a # Rules to rebuild the configuration diff --git a/libdecnumber/Makefile.in b/libdecnumber/Makefile.in index 7e086fccafa..3b03064fc4d 100644 --- a/libdecnumber/Makefile.in +++ b/libdecnumber/Makefile.in @@ -26,7 +26,7 @@ top_builddir = . VPATH = @srcdir@ INSTALL = @INSTALL@ AR = @AR@ -ARFLAGS = cru +ARFLAGS = crD ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ @@ -88,7 +88,7 @@ all: libdecnumber.a libdecnumber.a: $(libdecnumber_a_OBJS) -rm -f $@ $(AR) $(ARFLAGS) $@ $(libdecnumber_a_OBJS) - $(RANLIB) $@ + $(RANLIB) -D $@ # Rules to rebuild the configuration diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in index 884cc6c4af2..9f507a54657 100644 --- a/libiberty/Makefile.in +++ b/libiberty/Makefile.in @@ -252,19 +252,19 @@ $(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) -rm -f $(TARGETLIB) pic/$(TARGETLIB) noasan/$(TARGETLIB) $(AR) $(AR_FLAGS) $(TARGETLIB) \ $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) - $(RANLIB) $(TARGETLIB) + $(RANLIB) -D $(TARGETLIB) if [ x"$(PICFLAG)" != x ]; then \ cd pic; \ $(AR) $(AR_FLAGS) $(TARGETLIB) \ $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \ - $(RANLIB) $(TARGETLIB); \ + $(RANLIB) -D $(TARGETLIB); \ cd ..; \ else true; fi; \ if [ x"$(NOASANFLAG)" != x ]; then \ cd noasan; \ $(AR) $(AR_FLAGS) $(TARGETLIB) \ $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS); \ - $(RANLIB) $(TARGETLIB); \ + $(RANLIB) -D $(TARGETLIB); \ cd ..; \ else true; fi