binutils-gdb/gprofng/libcollector/Makefile.am
Vladimir Mezentsev 66f76c545b gprofng: 30089 [display text] Invalid number of threads
The real problem is that libcollector doesn't interpose thread_create@GLIBC_2.34
We interpose a lot of libC functions (dlopen, fork, pthread_create, etc.).
Some of these functions have versions. For example, dlopen@GLIBC_2.34,
dlopen@GLIBC_2.17, dlopen@GLIBC_2.2.5, etc.
We have to interpose each of the functions because we don't know
which version of libC will be used during profiling.
Historically, we have used three versions of scripts (mapfile.aarch64-Linux,
mapfile.amd64-Linux, mapfile.intel-Linux).
Three are not needed. One is enough

The fixes below include:
 - merged all version symbols into one version script.
 - added new version symbols which are defined in latest versions of libC.
 - removed unused defines and duplicated code.
 - added the DCL_FUNC_VER macro to define the version symbols.

Tested on x86_64 and aarch64 (OL8/OL9). No regression.

gprofng/ChangeLog
2023-03-23  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	PR gprofng/30089
	* libcollector/Makefile.am: Use libgprofng.ver instead of mapfile.*
	* libcollector/configure.ac: Delete GPROFNG_VARIANT.
	* src/collector_module.h: Move the SYMVER_ATTRIBUTE macro to collector.h
	* libcollector/collector.h: Add macros (SYMVER_ATTRIBUTE, DCL_FUNC_VER).
	Remove unused defines.
	* libcollector/dispatcher.c: Interpose functions from libC.
	Clean up the old code.
	* libcollector/iotrace.c: Likewise.
	* libcollector/libcol_util.c: Likewise.
	* libcollector/linetrace.c: Likewise.
	* libcollector/mmaptrace.c: Likewise.
	* libcollector/synctrace.c: Likewise.
	* libcollector/libgprofng.ver: New file.
	* libcollector/Makefile.in: Rebuild.
	* libcollector/configure: Rebuild.
	* libcollector/mapfile.aarch64-Linux: Removed.
	* libcollector/mapfile.amd64-Linux: Removed.
	* libcollector/mapfile.intel-Linux: Removed.
	* libcollector/mapfile.sparc-Linux: Removed.
	* libcollector/mapfile.sparcv9-Linux: Removed.
2023-03-27 11:47:52 -07:00

84 lines
2.5 KiB
Makefile

## Process this file with automake to generate Makefile.in
#
# Copyright (C) 2021-2023 Free Software Foundation, Inc.
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
AUTOMAKE_OPTIONS = foreign
ACLOCAL_AMFLAGS = -I . -I ../..
CSOURCES = \
gethrtime.c \
dispatcher.c \
iolib.c \
mmaptrace.c \
memmgr.c \
tsd.c \
profile.c \
envmgmt.c \
linetrace.c \
libcol_hwcdrv.c \
libcol_hwcfuncs.c \
libcol-i386-dis.c \
hwprofile.c \
jprofile.c \
unwind.c \
libcol_util.c \
collector.c \
$(NULL)
AM_CFLAGS = $(GPROFNG_CFLAGS) $(GPROFNG_NO_NONNULL_COMPARE_CFLAGS)
AM_CPPFLAGS = $(GPROFNG_CPPFLAGS) -I.. -I$(srcdir) \
-I$(srcdir)/../common -I$(srcdir)/../src \
-I$(srcdir)/../../include
AM_LDFLAGS = -module -avoid-version \
-Wl,--version-script,$(srcdir)/libgprofng.ver \
$(LD_NO_AS_NEEDED) -Wl,-lrt -Wl,-ldl
myincludedir = @includedir@
myinclude_HEADERS = $(srcdir)/../../include/collectorAPI.h \
$(srcdir)/../../include/libcollector.h \
$(srcdir)/../../include/libfcollector.h
pkglib_LTLIBRARIES = libgp-collector.la libgp-collectorAPI.la libgp-heap.la \
libgp-sync.la libgp-iotrace.la
libgp_collector_la_SOURCES = $(CSOURCES)
libgp_collector_la_CPPFLAGS = $(AM_CPPFLAGS) $(jdk_inc) \
-I../../bfd -I$(srcdir)/../..
# Prevent libtool from reordering -Wl,--no-as-needed after -lrt by
# disguising -lrt as a linker flag.
libgp_collector_la_LDFLAGS = $(AM_LDFLAGS)
libgp_collector_la_LIBADD = $(CLOCK_GETTIME_LINK)
libgp_heap_la_SOURCES = heaptrace.c
libgp_heap_la_LDFLAGS = $(AM_LDFLAGS)
libgp_sync_la_SOURCES = synctrace.c
libgp_sync_la_LDFLAGS = $(AM_LDFLAGS)
libgp_iotrace_la_SOURCES = iotrace.c
libgp_iotrace_la_LDFLAGS = $(AM_LDFLAGS)
libgp_collectorAPI_la_SOURCES = collectorAPI.c
libgp_collectorAPI_la_LIBADD = -lc -ldl
.PHONY: install-data-local
install-data-local: install-pkglibLTLIBRARIES
for f in libgp-collector libgp-heap libgp-sync libgp-iotrace ; do \
rm -f $(DESTDIR)/$(pkglibdir)/$$f.la $(DESTDIR)/$(pkglibdir)/$$f.a ; \
done