public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug nptl/5784] [RFC] Support static linking with -lpthread.
       [not found] <bug-5784-131@http.sourceware.org/bugzilla/>
@ 2012-12-19 10:43 ` schwab@linux-m68k.org
  2014-07-02  7:18 ` fweimer at redhat dot com
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: schwab@linux-m68k.org @ 2012-12-19 10:43 UTC (permalink / raw)
  To: glibc-bugs

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

Andreas Schwab <schwab@linux-m68k.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|drepper.fsp at gmail dot    |unassigned at sourceware
                   |com                         |dot org

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug nptl/5784] [RFC] Support static linking with -lpthread.
       [not found] <bug-5784-131@http.sourceware.org/bugzilla/>
  2012-12-19 10:43 ` [Bug nptl/5784] [RFC] Support static linking with -lpthread 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
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: fweimer at redhat dot com @ 2014-07-02  7:18 UTC (permalink / raw)
  To: glibc-bugs

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

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
              Flags|                            |security-

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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug nptl/5784] Fix static linking with -lpthread.
       [not found] <bug-5784-131@http.sourceware.org/bugzilla/>
  2012-12-19 10:43 ` [Bug nptl/5784] [RFC] Support static linking with -lpthread schwab@linux-m68k.org
  2014-07-02  7:18 ` fweimer at redhat dot com
@ 2022-04-19 16:42 ` dushistov at mail dot ru
  2024-04-08 18:35 ` hjl.tools at gmail dot com
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: dushistov at mail dot ru @ 2022-04-19 16:42 UTC (permalink / raw)
  To: glibc-bugs

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

Evgeniy Dushistov <dushistov at mail dot ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dushistov at mail dot ru

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug nptl/5784] Fix static linking with -lpthread.
       [not found] <bug-5784-131@http.sourceware.org/bugzilla/>
                   ` (2 preceding siblings ...)
  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
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: hjl.tools at gmail dot com @ 2024-04-08 18:35 UTC (permalink / raw)
  To: glibc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hjl.tools at gmail dot com,
                   |                            |skpgkp2 at gmail dot com
            Version|unspecified                 |2.40

--- Comment #6 from H.J. Lu <hjl.tools at gmail dot com> ---
We can use "ld -r" to create a super .o for libc.a, which contains all
necessary pthread bits which must be included in a static pthread executable.

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug nptl/5784] Fix static linking with -lpthread.
       [not found] <bug-5784-131@http.sourceware.org/bugzilla/>
                   ` (3 preceding siblings ...)
  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
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: fweimer at redhat dot com @ 2024-04-08 19:28 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #7 from Florian Weimer <fweimer at redhat dot com> ---
This should no longer be necessary. If there are remaining bugs, it's because
of incorrect usage of weak symbols, and those should be straightforward to fix
nowadays.

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug nptl/5784] Fix static linking with -lpthread.
       [not found] <bug-5784-131@http.sourceware.org/bugzilla/>
                   ` (4 preceding siblings ...)
  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
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: hjl.tools at gmail dot com @ 2024-04-08 19:36 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #8 from H.J. Lu <hjl.tools at gmail dot com> ---
Glibc tests are needed to track it.

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug nptl/5784] Fix static linking with -lpthread.
       [not found] <bug-5784-131@http.sourceware.org/bugzilla/>
                   ` (5 preceding siblings ...)
  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
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: hjl.tools at gmail dot com @ 2024-04-08 19:39 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #9 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Florian Weimer from comment #7)
> This should no longer be necessary. If there are remaining bugs, it's
> because of incorrect usage of weak symbols, and those should be
> straightforward to fix nowadays.

GCC 13 and glibc 2.38 still fail with

[hjl@gnu-cfl-3 tmp]$ cat x.f90 
      use omp_lib
      implicit none
      integer, parameter :: NT = 4
      integer :: nThreads(NT)

      print *, 'Call omp_set_dynamic'
!$    call omp_set_dynamic(.false.)
      print *, 'Call omp_set_num_threads'
!$    call omp_set_num_threads(NT)
      print *, 'Now enter the parallel region'

!$omp parallel default(none) shared(nThreads)
      nThreads(omp_get_thread_num()+1) = omp_get_num_threads()
!$omp end parallel

      print*, nThreads

      END
[hjl@gnu-cfl-3 tmp]$ gfortran -static -fopenmp x.f90 
/usr/local/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/13/libgomp.a(target.o): in
function `gomp_target_init.part.0':
(.text+0x4d6): warning: Using 'dlopen' in statically linked applications
requires at runtime the shared libraries from the glibc version used for
linking
[hjl@gnu-cfl-3 tmp]$ ./a.out 
 Call omp_set_dynamic
 Call omp_set_num_threads
 Now enter the parallel region
           4           4           4           4

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:

Program received signal SIGABRT: Process abort signal.

Backtrace for this error:

Program received signal SIGABRT: Process abort signal.

Backtrace for this error:
Segmentation fault (core dumped)
[hjl@gnu-cfl-3 tmp]$

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug nptl/5784] Fix static linking with -lpthread.
       [not found] <bug-5784-131@http.sourceware.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2024-04-08 19:39 ` hjl.tools at gmail dot com
@ 2024-04-08 19:57 ` fweimer at redhat dot com
  2024-04-08 20:04 ` hjl.tools at gmail dot com
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: fweimer at redhat dot com @ 2024-04-08 19:57 UTC (permalink / raw)
  To: glibc-bugs

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.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug nptl/5784] Fix static linking with -lpthread.
       [not found] <bug-5784-131@http.sourceware.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2024-04-08 19:57 ` fweimer at redhat dot com
@ 2024-04-08 20:04 ` hjl.tools at gmail dot com
  2024-04-08 20:08 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: hjl.tools at gmail dot com @ 2024-04-08 20:04 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #11 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Florian Weimer from comment #10)
> 
> 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.

I opened:

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

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug nptl/5784] Fix static linking with -lpthread.
       [not found] <bug-5784-131@http.sourceware.org/bugzilla/>
                   ` (8 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-08 20:08 UTC (permalink / raw)
  To: glibc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu.org

--- Comment #12 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=39176#c2

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug nptl/5784] Fix static linking with -lpthread.
       [not found] <bug-5784-131@http.sourceware.org/bugzilla/>
                   ` (9 preceding siblings ...)
  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
  12 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-08 20:08 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #13 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Florian Weimer from comment #10)
> I
> think we cleaned all this up for libstdc++, looks like we missed libgfortran.

No you missed all of libgcc.

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug nptl/5784] Fix static linking with -lpthread.
       [not found] <bug-5784-131@http.sourceware.org/bugzilla/>
                   ` (10 preceding siblings ...)
  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
  12 siblings, 0 replies; 13+ messages in thread
From: bruno at clisp dot org @ 2024-04-08 21:36 UTC (permalink / raw)
  To: glibc-bugs

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

--- Comment #14 from Bruno Haible <bruno at clisp dot org> ---
(In reply to H.J. Lu from comment #9)
> GCC 13 and glibc 2.38 still fail with

Whereas the test cases from
https://sourceware.org/bugzilla/show_bug.cgi?id=21777 and
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87189 work fine with recent GCC
and glibc.

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Bug nptl/5784] Fix static linking with -lpthread.
       [not found] <bug-5784-131@http.sourceware.org/bugzilla/>
                   ` (11 preceding siblings ...)
  2024-04-08 21:36 ` bruno at clisp dot org
@ 2024-04-09 12:29 ` hjl.tools at gmail dot com
  12 siblings, 0 replies; 13+ messages in thread
From: hjl.tools at gmail dot com @ 2024-04-09 12:29 UTC (permalink / raw)
  To: glibc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |2.34
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED
            Version|2.40                        |2.34

--- Comment #15 from H.J. Lu <hjl.tools at gmail dot com> ---
Fixed in glibc 2.34.

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

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2024-04-09 12:29 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-5784-131@http.sourceware.org/bugzilla/>
2012-12-19 10:43 ` [Bug nptl/5784] [RFC] Support static linking with -lpthread 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
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

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).