[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Undefined use of weak symbols in gnulib

From: Bruno Haible
Subject: Re: Undefined use of weak symbols in gnulib
Date: Wed, 28 Apr 2021 16:48:20 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-206-generic; KDE/5.18.0; x86_64; ; )

Florian Weimer wrote:
> > $ gcc -Wall -fpie -pie foo.c ; ./a.out 
> > initialization code
> >
> > $ gcc -Wall -fpie -pie foo.c -Wl,--no-as-needed -lpthread ; ./a.out
> > multi-threaded initialization
> > initialization code
> >
> > What will change for this program with glibc 2.34?
> If recompiled in this way: The presence of -lpthread will not matter, it
> will always behave is if linked with -lpthread.

So it will print
  multi-threaded initialization
  initialization code
in all cases. This is perfectly fine.

> The relevant scenario here is LD_PRELOAD of a library that depends on
> libpthread.so.0 ...
> If not recompiled and linked without -lpthread against glibc 2.33 or
> earlier, the behavior with the current glibc 2.34 snapshot is
> architecture-dependent and also depends on the binutils version used for
> linking the program.  In some cases, calling pthread_once jumps to
> address zero (causing a crash), or the call to pthread_once is elided
> from the executable.  This scenario can be emulated with older glibc
> using LD_PRELOAD=libpthread.so.0.

I'm confused again. Are you saying that the crash will occur when old
binaries are being used with glibc 2.34 also *without* LD_PRELOAD?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]