public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "fweimer at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug nptl/5784] Fix static linking with -lpthread.
Date: Mon, 08 Apr 2024 19:57:10 +0000	[thread overview]
Message-ID: <bug-5784-131-vtu66vr7Ha@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-5784-131@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=5784

--- Comment #10 from Florian Weimer <fweimer at redhat dot com> ---
Backtrace:

#0  0x0000000000000000 in ?? ()
#1  0x000000000040c645 in close_unit_1 ()
#2  0x000000000040c78a in _gfortrani_close_units ()
#3  0x0000000000463914 in call_fini ()
#4  0x000000000046c80a in __run_exit_handlers ()
#5  0x000000000046c96e in exit ()
#6  0x0000000000463daf in __libc_start_call_main ()
#7  0x0000000000465d18 in __libc_start_main_impl ()
#8  0x00000000004039b5 in _start ()

Crash location:

   0x000000000040c639 <+233>:   lea    0xe0(%rbx),%rdi
   0x000000000040c640 <+240>:   call   0x0
=> 0x000000000040c645 <+245>:   mov    %rbx,%rdi

So this is a weak symbol.

Looking at the symbol table:

File: /usr/lib/gcc/x86_64-redhat-linux/13/libgfortran.a(unit.o)
[…]
   102: 0000000000000000     0 NOTYPE  WEAK   DEFAULT  UND __pthread_key_create
   103: 0000000000000000     0 NOTYPE  WEAK   DEFAULT  UND
pthread_mutex_destroy
   104: 0000000000000000     0 NOTYPE  WEAK   DEFAULT  UND pthread_mutex_unlock
   105: 0000000000000000     0 NOTYPE  WEAK   DEFAULT  UND
pthread_mutex_trylock
   106: 0000000000000000     0 NOTYPE  WEAK   DEFAULT  UND pthread_mutex_lock

This is a GCC bug. It should not use weak symbols in static builds. Or dynamic
builds, but there it doesn't matter anymore since glibc 2.34. I think we
cleaned all this up for libstdc++, looks like we missed libgfortran.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2024-04-08 19:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-5784-131@http.sourceware.org/bugzilla/>
2012-12-19 10:43 ` [Bug nptl/5784] [RFC] Support " schwab@linux-m68k.org
2014-07-02  7:18 ` fweimer at redhat dot com
2022-04-19 16:42 ` [Bug nptl/5784] Fix " dushistov at mail dot ru
2024-04-08 18:35 ` hjl.tools at gmail dot com
2024-04-08 19:28 ` fweimer at redhat dot com
2024-04-08 19:36 ` hjl.tools at gmail dot com
2024-04-08 19:39 ` hjl.tools at gmail dot com
2024-04-08 19:57 ` fweimer at redhat dot com [this message]
2024-04-08 20:04 ` hjl.tools at gmail dot com
2024-04-08 20:08 ` pinskia at gcc dot gnu.org
2024-04-08 20:08 ` pinskia at gcc dot gnu.org
2024-04-08 21:36 ` bruno at clisp dot org
2024-04-09 12:29 ` hjl.tools at gmail dot com

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-5784-131-vtu66vr7Ha@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.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).