public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libquadmath/112963] New: [14 Regression] Incorrect linking of libquadmath since r14-4863
Date: Mon, 11 Dec 2023 15:23:15 +0000	[thread overview]
Message-ID: <bug-112963-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112963

            Bug ID: 112963
           Summary: [14 Regression] Incorrect linking of libquadmath since
                    r14-4863
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libquadmath
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

Since r14-4863-g538dcde872abba589b3c8a57181bd7f91018c67a libquadmath is linked
incorrectly on Linux, without the required libm.so.6 DT_NEEDED entry, even when
it
calls libm.so.6 signgam, sqrt and on powerpc64le-linux also __sqrtieee128
entrypoints.
Short reproducer reduced from libtool's testsuite on powerpc64le-linux:

( echo '      subroutine a1(res)'; echo '      integer*4 res'; echo '     
res=1'; echo '      return'; echo '      end' ) > a1.f; sed 's/1/2/g' < a1.f >
a2.f; ( echo '      program main'; echo '      integer*4 res'; echo '      call
a1(res)'; echo '      call a2(res)'; echo '      end' ) > main2.f; rm -rf
.libs; mkdir .libs; gfortran -O2 -mcpu=power8 -c a1.f -fPIC -o .libs/a1.o;
gfortran -O2 -mcpu=power8 -c a2.f -fPIC -o .libs/a2.o; gfortran -O2
-mcpu=power8 -c main2.f -fPIC -o .libs/main2.o; ar cr .libs/liba1.a .libs/a1.o;
ranlib .libs/liba1.a; ar cr .libs/liba2.a .libs/a2.o; ranlib .libs/liba2.a;
gfortran -shared -fPIC -Wl,--whole-archive ./.libs/liba1.a ./.libs/liba2.a
-Wl,--no-whole-archive -lgfortran -lm -lgcc_s -lquadmath -lm -lgcc_s -lc
-lgcc_s -O2 -mcpu=power8 -Wl,-z -Wl,relro -Wl,--as-needed -Wl,--build-id=sha1
-Wl,-soname -Wl,liba12.so.0 -o .libs/liba12.so.0.0.0; ln -sf liba12.so.0.0.0
.libs/liba12.so.0; ln -sf liba12.so.0.0.0 .libs/liba12.so; gfortran -O2
-mcpu=power8 -Wl,-z -Wl,relro -Wl,--as-needed -Wl,--build-id=sha1 -o .libs/main
.libs/main2.o ./.libs/liba12.so -Wl,-rpath,.libs/; .libs/main
This segfaults now, the above can be compiled even with gcc 13 and/or run
against gcc 13 libgfortran.so.5 and/or libgcc_s.so.1, the only thing for the
crash that matters is whether it dynamically links against gcc 13
libquadmath.so.0 (then it works) or gcc 14 libquadmath.so.0 (then it crashes).

             reply	other threads:[~2023-12-11 15:23 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-11 15:23 jakub at gcc dot gnu.org [this message]
2023-12-11 15:23 ` [Bug libquadmath/112963] " jakub at gcc dot gnu.org
2023-12-11 15:43 ` schwab@linux-m68k.org
2023-12-11 15:44 ` iains at gcc dot gnu.org
2023-12-11 15:46 ` iains at gcc dot gnu.org
2023-12-11 15:53 ` pinskia at gcc dot gnu.org
2023-12-11 15:59 ` jakub at gcc dot gnu.org
2023-12-11 16:05 ` iains at gcc dot gnu.org
2023-12-11 16:19 ` jakub at gcc dot gnu.org
2023-12-11 16:27 ` iains at gcc dot gnu.org
2023-12-11 16:31 ` jakub at gcc dot gnu.org
2023-12-11 16:35 ` jakub at gcc dot gnu.org
2023-12-11 16:40 ` iains at gcc dot gnu.org
2023-12-11 22:48 ` iains at gcc dot gnu.org
2023-12-11 22:50 ` jakub at gcc dot gnu.org
2023-12-12  8:07 ` cvs-commit at gcc dot gnu.org
2023-12-12  8:10 ` jakub at gcc dot gnu.org

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=bug-112963-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).