aboutsummaryrefslogtreecommitdiff
path: root/gprofng/common
diff options
context:
space:
mode:
authorVladimir Mezentsev <vladimir.mezentsev@oracle.com>2022-09-14 01:11:45 -0700
committerVladimir Mezentsev <vladimir.mezentsev@oracle.com>2022-09-14 18:38:09 -0700
commitfe39ffdc202f04397f31557f17170b40bc42b77a (patch)
treec3ca6dc745c7d4a6d13d1403fabf2240844b7ba9 /gprofng/common
parent8422cbe455d762f068ed1edefc717f36a105da42 (diff)
downloadbinutils-fe39ffdc202f04397f31557f17170b40bc42b77a.zip
binutils-fe39ffdc202f04397f31557f17170b40bc42b77a.tar.gz
binutils-fe39ffdc202f04397f31557f17170b40bc42b77a.tar.bz2
gprofng: fix build issues on musl
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.
Diffstat (limited to 'gprofng/common')
-rw-r--r--gprofng/common/config.h.in3
-rw-r--r--gprofng/common/hwcdrv.c6
2 files changed, 6 insertions, 3 deletions
diff --git a/gprofng/common/config.h.in b/gprofng/common/config.h.in
index 8409ce7..f8484f2 100644
--- a/gprofng/common/config.h.in
+++ b/gprofng/common/config.h.in
@@ -118,3 +118,6 @@
/* Define to 1 if you need to in order for `stat' and other things to work. */
#undef _POSIX_SOURCE
+
+/* Build with musl-libc. */
+#undef __MUSL_LIBC
diff --git a/gprofng/common/hwcdrv.c b/gprofng/common/hwcdrv.c
index caab983..05390e2 100644
--- a/gprofng/common/hwcdrv.c
+++ b/gprofng/common/hwcdrv.c
@@ -440,7 +440,7 @@ typedef struct
{ // per-thread context
counter_state_t *ctr_list;
int signal_fd; // fd that caused the most recent signal
- pthread_t tid; // for debugging signal delivery problems
+ pid_t tid; // for debugging signal delivery problems
} hdrv_pcl_ctx_t;
/*---------------------------------------------------------------------------*/
@@ -1321,7 +1321,7 @@ hwcdrv_free_counters () // note: only performs shutdown for this thread
for (int ii = 0; ii < hdrv_pcl_state.hwcdef_cnt; ii++)
if (stop_one_ctr (ii, ctr_list))
hwc_rc = HWCFUNCS_ERROR_GENERIC;
- TprintfT (DBG_LT1, "hwcdrv: hwcdrv_free_counters(tid=0x%lx).\n", pctx->tid);
+ TprintfT (DBG_LT1, "hwcdrv: hwcdrv_free_counters(tid=0x%lx).\n", (long) pctx->tid);
pctx->ctr_list = NULL;
return hwc_rc;
}
@@ -1351,7 +1351,7 @@ hwcdrv_start (void) /* must be called from each thread ? */
return HWCFUNCS_ERROR_UNEXPECTED;
}
pctx->tid = hwcdrv_gettid ();
- TprintfT (DBG_LT1, "hwcdrv: hwcdrv_start(tid=0x%lx)\n", pctx->tid);
+ TprintfT (DBG_LT1, "hwcdrv: hwcdrv_start(tid=0x%lx)\n", (long) pctx->tid);
/*
* create per-thread counter list