From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id B637A3858405 for ; Mon, 21 Feb 2022 20:43:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B637A3858405 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org Received: by smtp.gentoo.org (Postfix, from userid 559) id AD7263433BD; Mon, 21 Feb 2022 20:43:30 +0000 (UTC) From: Mike Frysinger To: newlib@sourceware.org Subject: [PATCH] newlib: libm: workaround ar duplicate member behavior Date: Mon, 21 Feb 2022 15:43:27 -0500 Message-Id: <20220221204327.2945-1-vapier@gentoo.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Feb 2022 20:43:33 -0000 GNU ar has undocumented behavior where it doesn't dedupe its inputs if they're all on the same command line, so we have to dedupe ourselves. --- newlib/Makefile.am | 16 ++++++++++++++++ newlib/Makefile.in | 15 ++++++++++----- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/newlib/Makefile.am b/newlib/Makefile.am index 80256952da3d..5bbe266cc4d5 100644 --- a/newlib/Makefile.am +++ b/newlib/Makefile.am @@ -124,6 +124,22 @@ libm_a_CCASFLAGS = $(AM_CCASFLAGS) $(libm_a_CCASFLAGS_$(subst /,_,$(@D))) $(libm libm_a_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/libm/common $(libm_a_CPPFLAGS_$(subst /,_,$(@D))) $(libm_a_CPPFLAGS_$(subst /,_,$(@D)_$(/dev/null; then \ + rm -f $@.tmp/*; \ + for o in $(libm_a_OBJECTS); do cp $$o $@.tmp/ || exit $$?; done; \ + fi; \ + $(AR) $(ARFLAGS) $@ $@.tmp/*.o + $(AM_V_at)rm -rf $@.tmp + $(AM_V_at)$(RANLIB) $@ + if HAVE_MULTISUBDIR $(BUILD_MULTISUBDIR): $(MKDIR_P) $@ diff --git a/newlib/Makefile.in b/newlib/Makefile.in index 2b60ef1ca96c..84f3e0cbde37 100644 --- a/newlib/Makefile.in +++ b/newlib/Makefile.in @@ -3248,11 +3248,6 @@ libm/machine/x86_64/libm_a-fetestexcept.$(OBJEXT): \ libm/machine/x86_64/libm_a-feupdateenv.$(OBJEXT): \ libm/machine/x86_64/$(am__dirstamp) -libm.a: $(libm_a_OBJECTS) $(libm_a_DEPENDENCIES) $(EXTRA_libm_a_DEPENDENCIES) - $(AM_V_at)-rm -f libm.a - $(AM_V_AR)$(libm_a_AR) libm.a $(libm_a_OBJECTS) $(libm_a_LIBADD) - $(AM_V_at)$(RANLIB) libm.a - mostlyclean-compile: -rm -f *.$(OBJEXT) -rm -f libm/common/*.$(OBJEXT) @@ -8650,6 +8645,16 @@ libg.a: libc.a $(AM_V_GEN)ln libc.a libg.a >/dev/null 2>/dev/null || cp libc.a libg.a $(libm_a_OBJECTS): stmp-targ-include +libm.a: $(libm_a_OBJECTS) $(libm_a_DEPENDENCIES) + $(AM_V_at)rm -rf $@ $@.tmp && mkdir $@.tmp + $(AM_V_AR)if ! ln $(libm_a_OBJECTS) $@.tmp/ 2>/dev/null; then \ + rm -f $@.tmp/*; \ + for o in $(libm_a_OBJECTS); do cp $$o $@.tmp/ || exit $$?; done; \ + fi; \ + $(AR) $(ARFLAGS) $@ $@.tmp/*.o + $(AM_V_at)rm -rf $@.tmp + $(AM_V_at)$(RANLIB) $@ + @HAVE_MULTISUBDIR_TRUE@$(BUILD_MULTISUBDIR): @HAVE_MULTISUBDIR_TRUE@ $(MKDIR_P) $@ -- 2.34.1