aboutsummaryrefslogtreecommitdiff
path: root/gprofng/libcollector/mmaptrace.c
AgeCommit message (Collapse)AuthorFilesLines
2024-01-04Update year range in copyright notice of binutils filesAlan Modra1-1/+1
Adds two new external authors to etc/update-copyright.py to cover bfd/ax_tls.m4, and adds gprofng to dirs handled automatically, then updates copyright messages as follows: 1) Update cgen/utils.scm emitted copyrights. 2) Run "etc/update-copyright.py --this-year" with an extra external author I haven't committed, 'Kalray SA.', to cover gas testsuite files (which should have their copyright message removed). 3) Build with --enable-maintainer-mode --enable-cgen-maint=yes. 4) Check out */po/*.pot which we don't update frequently.
2023-04-17gprofng: 30360 Seg. Fault when application uses std::threadVladimir Mezentsev1-8/+8
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-03-27gprofng: 30089 [display text] Invalid number of threadsVladimir Mezentsev1-82/+101
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-19gprofng: Use prototype to call libc functionsVladimir Mezentsev1-10/+0
libcollector may not link against libC. We use dlsym() to get a function from libc. In some files, pointers to these functions do not have prototypes. I also moved the shared definitions to libcollector/collect.h. gprofng/ChangeLog 2023-03-15 Vladimir Mezentsev <vladimir.mezentsev@oracle.com> libcollector/collector.c: Add prototypes. libcollector/dispatcher.c: Likewise. libcollector/heaptrace.c: Likewise. libcollector/iotrace.c: Likewise. libcollector/linetrace.c: Likewise. libcollector/mmaptrace.c: Likewise. libcollector/synctrace.c: Likewise. libcollector/collector.h: Add CALL_REAL(), NULL_PTR(), and DBG_LT.
2023-02-17gprofng: PR30036 Build failure on aarch64 w/ glibc: symbol `pwrite64' is ↵Vladimir Mezentsev1-1/+1
already defined gprofng/ChangeLog 2023-02-16 Vladimir Mezentsev <vladimir.mezentsev@oracle.com> PR gprofng/30036 * libcollector/iotrace.c: Define creat64 and pwrite64 only when __USE_LARGEFILE64 and __USE_FILE_OFFSET64 are not defined. * libcollector/mmaptrace.c: Likewise for mmap64.
2023-01-01Update year range in gprofng copyright noticesAlan Modra1-1/+1
This adds 'Innovative Computing Labs' as an external author to update-copyright.py, to cover the copyright notice in gprofng/common/opteron_pcbe.c, and uses that plus another external author 'Oracle and' to update gprofng copyright dates. I'm not going to commit 'Oracle and' as an accepted author, but that covers the string "Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved." found in gprofng/testsuite/gprofng.display/jsynprog files.
2022-10-04gprofng: fix build with --enable-pgo-build=ltoVladimir Mezentsev1-4/+4
gprofng/ChangeLog 2022-10-04 Vladimir Mezentsev <vladimir.mezentsev@oracle.com> PR gprofng/29579 * libcollector/dispatcher.c: Fix the symbol version in SYMVER_ATTRIBUTE. * libcollector/iotrace.c: Likewise. * libcollector/linetrace.c: Likewise. * libcollector/mmaptrace.c: Likewise. * libcollector/synctrace.c: Likewise.
2022-09-14gprofng: fix build issues on muslVladimir Mezentsev1-82/+50
gprofng/ChangeLog 2022-09-14 Vladimir Mezentsev <vladimir.mezentsev@oracle.com> PR gprofng/29477 * configure.ac: Set __MUSL_LIBC. * configure: Rebuild. * common/config.h.in: Rebuild. * src/collector_module.h: Fix compiler errors because mmap64, open64, pwrite64 are macros and getcontext() is absent on musl. * libcollector/collector.c: Likewise. * libcollector/hwprofile.c: Likewise. * libcollector/iolib.c: Likewise. * libcollector/libcol_util.c: Likewise. * libcollector/linetrace.c: Likewise. * libcollector/memmgr.c: Likewise. * libcollector/profile.c: Likewise. * libcollector/unwind.c: Likewise. * libcollector/dispatcher.c: Likewise. * src/Experiment.cc: Likewise. * libcollector/collector.h: Use dlsym() because dlvsym() is not defined on musl. * libcollector/iotrace.c: Remove interposition of versioned functions. * libcollector/mmaptrace.c: Likewise. * libcollector/libcol_util.h: Fix -Wint-to-pointer-cast warnings. * libcollector/jprofile.c: Likewise. * libcollector/synctrace.c: Include "collector.h". * src/Print.cc: Use get_basename() because basename() is not defined on musl. * common/hwcdrv.c: Fix -Wformat= warnings.
2022-05-26gprofng: fix build with -mx32Vladimir Mezentsev1-1/+1
gprofng/ChangeLog 2022-05-26 Vladimir Mezentsev <vladimir.mezentsev@oracle.com> PR gprofng/28983 * libcollector/libcol_util.h (__collector_getsp, __collector_getfp, __collector_getpc): Adapt for build with -mx32 * libcollector/heaptrace.c: Fix -Wpointer-to-int-cast warnings. * libcollector/hwprofile.h: Likewise. * libcollector/mmaptrace.c: Likewise. * libcollector/synctrace.c: Likewise. * libcollector/unwind.c: Likewise.
2022-03-16gprofng: Use symver attribute if availableH.J. Lu1-4/+2
Use symver attribute if available, instead of asm statement, to support LTO build. PR gprof/28962 * libcollector/dispatcher.c (timer_create@@GLIBC_2.3.3): Use SYMVER_ATTRIBUTE. (timer_create@GLIBC_2.2): Likewise. (timer_create@GLIBC_2.2.5): Likewise. (pthread_create@@GLIBC_2.1): Likewise. (pthread_create@GLIBC_2.0): Likewise. * libcollector/iotrace.c (open64@@GLIBC_2.2): Likewise. (open64@GLIBC_2.1): Likewise. (fopen@@GLIBC_2.1): Likewise. (fopen@GLIBC_2.0): Likewise. (fclose@@GLIBC_2.1): Likewise. (fclose@GLIBC_2.0): Likewise. (fdopen@@GLIBC_2.1): Likewise. (fdopen@GLIBC_2.0): Likewise. (pread@@GLIBC_2.2): Likewise. (pread@GLIBC_2.1): Likewise. (pwrite@@GLIBC_2.2): Likewise. (pwrite@GLIBC_2.1): Likewise. (pwrite64@@GLIBC_2.2): Likewise. (pwrite64@GLIBC_2.1): Likewise. (fgetpos@@GLIBC_2.2): Likewise. (fgetpos@GLIBC_2.0): Likewise. (fgetpos64@@GLIBC_2.2): Likewise. (fgetpos64@GLIBC_2.1): Likewise. (fsetpos@@GLIBC_2.2): Likewise. (fsetpos@GLIBC_2.0): Likewise. (fsetpos64@@GLIBC_2.2): Likewise. (fsetpos64@GLIBC_2.1): Likewise. * libcollector/linetrace.c (posix_spawn@@GLIBC_2.15): Likewise. (posix_spawn@GLIBC_2.2): Likewise. (posix_spawn@GLIBC_2.2.5): Likewise. (posix_spawnp@@GLIBC_2.15): Likewise. (posix_spawnp@GLIBC_2.2): Likewise. (posix_spawnp@GLIBC_2.2.5): Likewise. (popen@@GLIBC_2.1): Likewise. (popen@GLIBC_2.0): Likewise. (_popen@@GLIBC_2.1): Likewise. (_popen@GLIBC_2.0): Likewise. * libcollector/mmaptrace.c (dlopen@@GLIBC_2.1): Likewise. (dlopen@GLIBC_2.0): Likewise. * libcollector/synctrace.c (pthread_cond_wait@@GLIBC_2.3.2): Likewise. (pthread_cond_wait@GLIBC_2.0): Likewise. (pthread_cond_wait@GLIBC_2.2.5): Likewise. (pthread_cond_wait@GLIBC_2.2): Likewise. (pthread_cond_timedwait@@GLIBC_2.3.2): Likewise. (pthread_cond_timedwait@GLIBC_2.0): Likewise. (pthread_cond_timedwait@GLIBC_2.2.5): Likewise. (pthread_cond_timedwait@GLIBC_2.2): Likewise. (sem_wait@@GLIBC_2.1): Likewise. (sem_wait@GLIBC_2.0): Likewise. * src/collector_module.h (SYMVER_ATTRIBUTE): New.
2022-03-11gprofng: a new GNU profilerVladimir Mezentsev1-0/+1691
top-level * Makefile.def: Add gprofng module. * configure.ac: Add --enable-gprofng option. * src-release.sh: Add gprofng. * Makefile.in: Regenerate. * configure: Regenerate. * gprofng: New directory. binutils * MAINTAINERS: Add gprofng maintainer. * README-how-to-make-a-release: Add gprofng. include. * collectorAPI.h: New file. * libcollector.h: New file. * libfcollector.h: New file.