binutils-gdb/gprofng/libcollector
Vladimir Mezentsev 35fab451d9 gprofng: 30360 Seg. Fault when application uses std::thread
We interpose a lot of libC functions (dlopen, fork, pthread_create, etc.).
Some of these functions have versions. For example,

% nm -D /lib64/gprofng/libgp-collector.so  | grep thread_create@ | sort
000000000004b420 T pthread_create@GLIBC_2.34
000000000004b490 T pthread_create@GLIBC_2.17
000000000004b500 T pthread_create@GLIBC_2.2.5
000000000004b570 T pthread_create@GLIBC_2.1
000000000004b5e0 T pthread_create@GLIBC_2.0

Our library does not set the default version for symbols.
This is correct because we don't know which libC will be used.

gcc and g++ links differently the version symbols when the default version is
not set. c-linker is using our pthread_create@GLIBC_2.34 and c++-linker is using
our pthread_create@GLIBC_2.0 by default.

The current implementation of the interposed functions is:
  If we are in our pthread_create@GLIBC_<NN>,
  we use dlvsym (dlflag, "pthread_create", "GLIBC_<NN>") to find and call
  the same function from libC.
In the test from PR 30360, pthread_create@GLIBC_2.0 is not in the current libC.
We need to call the default version symbol from libC.

gprofng/ChangeLog
2023-04-16  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	PR gprofng/30360
	* libcollector/iotrace.c: Find and call a default libC version symbol.
	* libcollector/dispatcher.c: Likewise.
	* libcollector/iotrace.c: Likewise.
	* libcollector/linetrace.c: Likewise.
	* libcollector/mmaptrace.c: Likewise.
	* libcollector/synctrace.c: Likewise.
	* libcollector/collector.h (REAL_DCL): Remove an unused argument.
2023-04-17 13:01:38 -07:00
..
aclocal.m4
CHK_LIBC_OBJ
collector.c gprofng: Use prototype to call libc functions 2023-03-19 18:03:58 -07:00
collector.h gprofng: 30360 Seg. Fault when application uses std::thread 2023-04-17 13:01:38 -07:00
collectorAPI.c
configure gprofng: 30089 [display text] Invalid number of threads 2023-03-27 11:47:52 -07:00
configure.ac gprofng: 30089 [display text] Invalid number of threads 2023-03-27 11:47:52 -07:00
descendants.h
dispatcher.c gprofng: 30360 Seg. Fault when application uses std::thread 2023-04-17 13:01:38 -07:00
envmgmt.c
gethrtime.c
heaptrace.c gprofng: Use prototype to call libc functions 2023-03-19 18:03:58 -07:00
hwprofile.c
hwprofile.h
iolib.c
iotrace.c gprofng: 30360 Seg. Fault when application uses std::thread 2023-04-17 13:01:38 -07:00
jprofile.c
libcol_hwcdrv.c
libcol_hwcfuncs.c
libcol_util.c gprofng: 30089 [display text] Invalid number of threads 2023-03-27 11:47:52 -07:00
libcol_util.h
libcol-i386-dis.c
libgprofng.ver gprofng: Add version symbols to libgprofng.ver 2023-03-29 23:09:40 -07:00
linetrace.c gprofng: 30360 Seg. Fault when application uses std::thread 2023-04-17 13:01:38 -07:00
Makefile.am gprofng: 30089 [display text] Invalid number of threads 2023-03-27 11:47:52 -07:00
Makefile.in gprofng: 30089 [display text] Invalid number of threads 2023-03-27 11:47:52 -07:00
memmgr.c
memmgr.h
mmaptrace.c gprofng: 30360 Seg. Fault when application uses std::thread 2023-04-17 13:01:38 -07:00
profile.c
synctrace.c gprofng: 30360 Seg. Fault when application uses std::thread 2023-04-17 13:01:38 -07:00
tsd.c
tsd.h
unwind.c