public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: FX Coudert <fxcoudert@gmail.com>
To: fortran@gcc.gnu.org
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
	"ro@cebitec.uni-bielefeld.de " <ro@CeBiTec.Uni-Bielefeld.DE>,
	Iain Sandoe <iain@sandoe.co.uk>
Subject: [PATCH] libgfortran: avoid duplicate libraries in spec
Date: Tue, 19 Dec 2023 09:02:23 +0100	[thread overview]
Message-ID: <2DEF0EE4-2C93-4195-AAE3-7A188CADC0E6@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1158 bytes --]

When gfortran invokes the linker, it reads the linking spec from libgfortran. This ends up doing things like:

-lm -lgcc_s -lgcc -lc -lgcc_s -lgcc

where you can see that libgcc (both -lgcc and -lgcc_s) is linked in twice. This wasn’t a problem, until the new macOS linker, which gives a warning for this: the warning is innocuous, but having a warning for every time you call gfortran for linking clutters the terminal, and makes all the testsuite fail. And linking twice is superfluous, so removing it will not be a problem.

I am the author of the original commit to the spec, in 2010, but honestly I have no memory: I think I vaguely remember saying “better safe than sorry”, but 13 years later it could just be a false memory ;)

Anyway, this was tested on x86_64-darwin and x64_86-linux, as well as *-*-solaris2.11 by Rainer.
OK to commit? (seems admissible in stage 3 because it fixes regtesting on darwin22 and darwin23).

FX



libgfortran/ChangeLog:

	PR libfortran/110651
	* libgfortran.spec.in: Remove duplicate libraries.
---
 libgfortran/libgfortran.spec.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)



[-- Attachment #2: 0001-libgfortran-avoid-duplicate-libraries-in-spec.patch --]
[-- Type: application/octet-stream, Size: 990 bytes --]

From e06aa9670dda36b141e3c67bf11ad743f59a6370 Mon Sep 17 00:00:00 2001
From: Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Date: Mon, 18 Dec 2023 16:17:22 +0100
Subject: [PATCH] libgfortran: avoid duplicate libraries in spec

The linking of libgcc is already present in %(liborig), so the current
situation duplicates libraries. This was not an issue until macOS's new
linker started giving warnings for such cases.

libgfortran/ChangeLog:

	PR libfortran/110651
	* libgfortran.spec.in: Remove duplicate libraries.
---
 libgfortran/libgfortran.spec.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libgfortran/libgfortran.spec.in b/libgfortran/libgfortran.spec.in
index 367d485c230..058ee5775bf 100644
--- a/libgfortran/libgfortran.spec.in
+++ b/libgfortran/libgfortran.spec.in
@@ -5,4 +5,4 @@
 #
 
 %rename lib liborig
-*lib: @LIBQUADSPEC@ @LIBM@ %(libgcc) %(liborig)
+*lib: @LIBQUADSPEC@ @LIBM@ %(liborig)
-- 
2.39.3 (Apple Git-145)


             reply	other threads:[~2023-12-19  8:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-19  8:02 FX Coudert [this message]
2023-12-19 21:04 ` Jerry D
2023-12-19 21:10   ` FX Coudert
2023-12-19 21:12     ` Jerry D

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2DEF0EE4-2C93-4195-AAE3-7A188CADC0E6@gmail.com \
    --to=fxcoudert@gmail.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=iain@sandoe.co.uk \
    --cc=ro@CeBiTec.Uni-Bielefeld.DE \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).