binutils/binutils-gprofng-gcc15-fixes.patch
2026-02-26 16:07:57 +00:00

1068 lines
44 KiB
Diff

diff -rup fred/gprofng/common/hwcentry.h binutils-2.41/gprofng/common/hwcentry.h
--- fred/gprofng/common/hwcentry.h 2026-02-26 10:57:17.827404618 +0000
+++ binutils-2.41/gprofng/common/hwcentry.h 2026-02-26 13:25:33.203776043 +0000
@@ -202,7 +202,7 @@ extern "C"
/* Return a CPU HWC document reference, or NULL. */
// TBR
- extern char *hwc_get_default_cntrs ();
+ extern char *hwc_get_default_cntrs (void);
/* Return a default HW counter string; may be NULL, or zero-length */
/* NULL means none is defined in the table; or zero-length means string defined could not be loaded */
@@ -211,7 +211,7 @@ extern "C"
/* but allows other styles of formatting as well */
/* deprecate and eventually remove hwc_get_default_cntrs() */
- extern char *hwc_get_orig_default_cntrs ();
+ extern char *hwc_get_orig_default_cntrs (int);
/* Get the default HW counter string as set in the table */
/* NULL means none is defined in the table */
@@ -221,7 +221,7 @@ extern "C"
extern char *hwc_get_cpuname (char *buf, size_t buflen);
/* Return the cpc cpu name for this system, or NULL. */
- extern unsigned hwc_get_max_regs ();
+ extern unsigned hwc_get_max_regs (void);
/* Return number of counters registers for this system. */
extern unsigned hwc_get_max_concurrent (int forKernel);
diff -rup fred/gprofng/common/hwctable.c binutils-2.41/gprofng/common/hwctable.c
--- fred/gprofng/common/hwctable.c 2026-02-26 10:57:17.827404618 +0000
+++ binutils-2.41/gprofng/common/hwctable.c 2026-02-26 13:25:34.765783400 +0000
@@ -3195,7 +3195,7 @@ check_tables ()
}
#endif
-static int try_a_counter ();
+static int try_a_counter (int);
static void hwc_process_raw_ctrs (int forKernel, Hwcentry ***pstd_out,
Hwcentry ***praw_out, Hwcentry ***phidden_out,
Hwcentry**static_tables,
@@ -4288,7 +4288,7 @@ hwc_get_docref (char *buf, size_t buflen
//TBR:
extern char*
-hwc_get_default_cntrs ()
+hwc_get_default_cntrs (void)
{
setup_cpcx ();
if (cpcx_default_hwcs[0] != NULL)
@@ -4579,7 +4579,7 @@ hwc_hwcentry_specd_string (char *buf, si
}
unsigned
-hwc_get_max_regs ()
+hwc_get_max_regs (void)
{
setup_cpcx ();
return cpcx_npics;
diff -rup fred/gprofng/libcollector/collector.c binutils-2.41/gprofng/libcollector/collector.c
--- fred/gprofng/libcollector/collector.c 2026-02-26 10:57:17.827982759 +0000
+++ binutils-2.41/gprofng/libcollector/collector.c 2026-02-26 13:04:55.192049204 +0000
@@ -1584,7 +1584,7 @@ __collector_resume_experiment ()
}
/* Code to support Samples and Pause/Resume */
-void collector_sample () __attribute__ ((weak, alias ("__collector_sample")));
+void collector_sample (char *) __attribute__ ((weak, alias ("__collector_sample")));
void
__collector_sample (char *name)
{
@@ -1784,7 +1784,7 @@ __collector_pause ()
}
void
-__collector_pause_m (char *reason)
+__collector_pause_m (const char *reason)
{
hrtime_t now;
char xreason[MAXPATHLEN];
@@ -2451,8 +2451,8 @@ __collector_dlog (int tflag, int level,
static void (*__real__exit) (int status) = NULL; /* libc only: _exit */
static void (*__real__Exit) (int status) = NULL; /* libc only: _Exit */
-void _exit () __attribute__ ((weak, alias ("__collector_exit")));
-void _Exit () __attribute__ ((weak, alias ("__collector_Exit")));
+void _exit (int) __attribute__ ((weak, alias ("__collector_exit")));
+void _Exit (int) __attribute__ ((weak, alias ("__collector_Exit")));
void
__collector_exit (int status)
diff -rup fred/gprofng/libcollector/collector.h binutils-2.41/gprofng/libcollector/collector.h
--- fred/gprofng/libcollector/collector.h 2026-02-26 10:57:17.827982759 +0000
+++ binutils-2.41/gprofng/libcollector/collector.h 2026-02-26 11:15:04.726908530 +0000
@@ -122,9 +122,9 @@ extern void __collector_close_experiment
extern void __collector_terminate_expt ();
extern void __collector_terminate_hook ();
extern void __collector_sample (char *name);
-extern void __collector_pause ();
-extern void __collector_pause_m ();
-extern void __collector_resume ();
+extern void __collector_pause (void);
+extern void __collector_pause_m (const char *);
+extern void __collector_resume (void);
extern int collector_sigemt_sigaction (const struct sigaction*,
struct sigaction*);
extern int collector_sigchld_sigaction (const struct sigaction*,
diff -rup fred/gprofng/libcollector/collectorAPI.c binutils-2.41/gprofng/libcollector/collectorAPI.c
--- fred/gprofng/libcollector/collectorAPI.c 2026-02-26 10:57:17.827982759 +0000
+++ binutils-2.41/gprofng/libcollector/collectorAPI.c 2026-02-26 13:14:07.392589154 +0000
@@ -26,16 +26,16 @@
#include "collectorAPI.h"
#include "gp-experiment.h"
-static void *__real_collector_sample = NULL;
-static void *__real_collector_pause = NULL;
-static void *__real_collector_resume = NULL;
-static void *__real_collector_terminate_expt = NULL;
-static void *__real_collector_func_load = NULL;
-static void *__real_collector_func_unload = NULL;
+static void (*__real_collector_sample)(const char *) = NULL;
+static void (*__real_collector_pause)(void) = NULL;
+static void (*__real_collector_resume)(void) = NULL;
+static void (*__real_collector_terminate_expt)(void) = NULL;
+static void (*__real_collector_func_load)(const char *, const char *, const char *, void *, int, int, Lineno *) = NULL;
+static void (*__real_collector_func_unload)(void *) = NULL;
#define INIT_API if (init_API == 0) collectorAPI_initAPI()
#define NULL_PTR(x) (__real_##x == NULL)
-#define CALL_REAL(x) (*(void(*)())__real_##x)
+#define CALL_REAL(x) (__real_##x)
#define CALL_IF_REAL(x) INIT_API; if (!NULL_PTR(x)) CALL_REAL(x)
static int init_API = 0;
diff -rup fred/gprofng/libcollector/dispatcher.c binutils-2.41/gprofng/libcollector/dispatcher.c
--- fred/gprofng/libcollector/dispatcher.c 2026-02-26 10:57:17.827982759 +0000
+++ binutils-2.41/gprofng/libcollector/dispatcher.c 2026-02-26 11:20:42.432640350 +0000
@@ -909,8 +909,8 @@ sigset (int sig, sighandler_t handler)
// map interposed symbol versions
static int
-gprofng_timer_create (int (real_func) (), clockid_t clockid,
- struct sigevent *sevp, timer_t *timerid)
+gprofng_timer_create (int (real_func) (clockid_t, struct sigevent *, timer_t *),
+ clockid_t clockid, struct sigevent *sevp, timer_t *timerid)
{
// collector reserves SIGPROF
if (sevp == NULL || sevp->sigev_notify != SIGEV_SIGNAL ||
@@ -1045,7 +1045,7 @@ __collector_thr_sigsetmask (int how, con
// map interposed symbol versions
static int
-gprofng_pthread_sigmask (int (real_func) (),
+gprofng_pthread_sigmask (int (real_func) (int how, const sigset_t *, sigset_t*),
int how, const sigset_t *iset, sigset_t* oset)
{
sigset_t lsigset;
@@ -1140,7 +1140,8 @@ collector_root (void *cargs)
// map interposed symbol versions
static int
-gprofng_pthread_create (int (real_func) (), pthread_t *thread,
+gprofng_pthread_create (int (real_func) (pthread_t *, const pthread_attr_t *, void *(*)(void*), void *),
+ pthread_t *thread,
const pthread_attr_t *attr,
void *(*func)(void*), void *arg)
{
@@ -1277,6 +1278,6 @@ __collector_ext_clone_pthread (int (*fn)
}
// weak symbols:
-int sigprocmask () __attribute__ ((weak, alias ("__collector_sigprocmask")));
-int thr_sigsetmask () __attribute__ ((weak, alias ("__collector_thr_sigsetmask")));
-int setitimer () __attribute__ ((weak, alias ("_setitimer")));
+int sigprocmask (int, const sigset_t *, sigset_t *) __attribute__ ((weak, alias ("__collector_sigprocmask")));
+int thr_sigsetmask (int, const sigset_t *, sigset_t *) __attribute__ ((weak, alias ("__collector_thr_sigsetmask")));
+int setitimer (__itimer_which_t, const struct itimerval *, struct itimerval *) __attribute__ ((weak, alias ("_setitimer")));
diff -rup fred/gprofng/libcollector/envmgmt.c binutils-2.41/gprofng/libcollector/envmgmt.c
--- fred/gprofng/libcollector/envmgmt.c 2026-02-26 10:57:17.827982759 +0000
+++ binutils-2.41/gprofng/libcollector/envmgmt.c 2026-02-26 11:47:12.920154541 +0000
@@ -692,8 +692,8 @@ __collector_env_update (char *envp[])
/*------------------------------------------------------------- putenv */
-int putenv () __attribute__ ((weak, alias ("__collector_putenv")));
-int _putenv () __attribute__ ((weak, alias ("__collector_putenv")));
+int putenv (char *) __attribute__ ((weak, alias ("__collector_putenv")));
+int _putenv (char *) __attribute__ ((weak, alias ("__collector_putenv")));
int
__collector_putenv (char * string)
@@ -701,9 +701,9 @@ __collector_putenv (char * string)
if (CALL_UTIL (putenv) == __collector_putenv ||
CALL_UTIL (putenv) == NULL)
{ // __collector_libc_funcs_init failed
- CALL_UTIL (putenv) = (int(*)())dlsym (RTLD_NEXT, "putenv");
+ CALL_UTIL (putenv) = (int(*)(char *))dlsym (RTLD_NEXT, "putenv");
if (CALL_UTIL (putenv) == NULL || CALL_UTIL (putenv) == __collector_putenv)
- CALL_UTIL (putenv) = (int(*)())dlsym (RTLD_DEFAULT, "putenv");
+ CALL_UTIL (putenv) = (int(*)(char *))dlsym (RTLD_DEFAULT, "putenv");
if (CALL_UTIL (putenv) == NULL || CALL_UTIL (putenv) == __collector_putenv)
{
TprintfT (DBG_LT2, "__collector_putenv(): ERROR: no pointer found.\n");
@@ -719,8 +719,8 @@ __collector_putenv (char * string)
}
/*------------------------------------------------------------- setenv */
-int setenv () __attribute__ ((weak, alias ("__collector_setenv")));
-int _setenv () __attribute__ ((weak, alias ("__collector_setenv")));
+int setenv (const char *, const char *, int) __attribute__ ((weak, alias ("__collector_setenv")));
+int _setenv (const char *, const char *, int) __attribute__ ((weak, alias ("__collector_setenv")));
int
__collector_setenv (const char *name, const char *value, int overwrite)
@@ -728,9 +728,9 @@ __collector_setenv (const char *name, co
if (CALL_UTIL (setenv) == __collector_setenv ||
CALL_UTIL (setenv) == NULL)
{ // __collector_libc_funcs_init failed
- CALL_UTIL (setenv) = (int(*)())dlsym (RTLD_NEXT, "setenv");
+ CALL_UTIL (setenv) = (int(*)(const char *, const char *, int))dlsym (RTLD_NEXT, "setenv");
if (CALL_UTIL (setenv) == NULL || CALL_UTIL (setenv) == __collector_setenv)
- CALL_UTIL (setenv) = (int(*)())dlsym (RTLD_DEFAULT, "setenv");
+ CALL_UTIL (setenv) = (int(*)(const char *, const char *, int))dlsym (RTLD_DEFAULT, "setenv");
if (CALL_UTIL (setenv) == NULL || CALL_UTIL (setenv) == __collector_setenv)
{
TprintfT (DBG_LT2, "__collector_setenv(): ERROR: no pointer found.\n");
@@ -765,8 +765,8 @@ __collector_setenv (const char *name, co
}
/*------------------------------------------------------------- unsetenv */
-int unsetenv () __attribute__ ((weak, alias ("__collector_unsetenv")));
-int _unsetenv () __attribute__ ((weak, alias ("__collector_unsetenv")));
+int unsetenv (const char *) __attribute__ ((weak, alias ("__collector_unsetenv")));
+int _unsetenv (const char *) __attribute__ ((weak, alias ("__collector_unsetenv")));
int
__collector_unsetenv (const char *name)
@@ -774,9 +774,9 @@ __collector_unsetenv (const char *name)
if (CALL_UTIL (unsetenv) == __collector_unsetenv ||
CALL_UTIL (unsetenv) == NULL)
{ // __collector_libc_funcs_init failed
- CALL_UTIL (unsetenv) = (int(*)())dlsym (RTLD_NEXT, "unsetenv");
+ CALL_UTIL (unsetenv) = (int(*)(const char *))dlsym (RTLD_NEXT, "unsetenv");
if (CALL_UTIL (unsetenv) == NULL || CALL_UTIL (unsetenv) == __collector_unsetenv)
- CALL_UTIL (unsetenv) = (int(*)())dlsym (RTLD_DEFAULT, "unsetenv");
+ CALL_UTIL (unsetenv) = (int(*)(const char *))dlsym (RTLD_DEFAULT, "unsetenv");
if (CALL_UTIL (unsetenv) == NULL || CALL_UTIL (unsetenv) == __collector_unsetenv)
{
TprintfT (DBG_LT2, "__collector_unsetenv(): ERROR: no pointer found.\n");
diff -rup fred/gprofng/libcollector/iolib.c binutils-2.41/gprofng/libcollector/iolib.c
--- fred/gprofng/libcollector/iolib.c 2026-02-26 10:57:17.827982759 +0000
+++ binutils-2.41/gprofng/libcollector/iolib.c 2026-02-26 11:17:43.975843911 +0000
@@ -118,7 +118,7 @@ static void deleteBuffer (Buffer *buf);
* Common buffer management routines
*/
static void
-init ()
+init (void)
{
/* set the block size */
long pgsz = CALL_UTIL (sysconf)(_SC_PAGESIZE);
@@ -243,7 +243,7 @@ __collector_create_handle (char *descp)
{
/* allocate our buffers in virtual memory */
/* later, we will remap buffers individually to the file */
- uint8_t *memory = (uint8_t*) CALL_UTIL (mmap64_) (0,
+ uint8_t *memory = (uint8_t*) CALL_UTIL (mmap64_) (NULL,
(size_t) (NBUFS * blksz), PROT_READ | PROT_WRITE,
#if ARCH(SPARC)
MAP_SHARED | MAP_ANON,
@@ -514,7 +514,7 @@ allocateChunk (DataHandle *hndl, unsigne
if (__collector_cas_ptr (&hndl->chunks[ichunk], NULL, CHUNK_BUSY) == NULL)
{
/* allocate virtual memory */
- uint8_t *newchunk = (uint8_t*) CALL_UTIL (mmap64_) (0,
+ uint8_t *newchunk = (uint8_t*) CALL_UTIL (mmap64_) (NULL,
(size_t) (blksz * hndl->nflow), PROT_READ | PROT_WRITE,
#if ARCH(SPARC)
MAP_SHARED | MAP_ANON,
diff -rup fred/gprofng/libcollector/iotrace.c binutils-2.41/gprofng/libcollector/iotrace.c
--- fred/gprofng/libcollector/iotrace.c 2026-02-26 10:57:17.827982759 +0000
+++ binutils-2.41/gprofng/libcollector/iotrace.c 2026-02-26 13:16:30.257243113 +0000
@@ -1473,7 +1473,7 @@ close (int fildes)
/*------------------------------------------------------------- fopen */
static FILE*
-gprofng_fopen (FILE*(real_fopen) (), const char *filename, const char *mode)
+gprofng_fopen (FILE*(real_fopen) (const char *, const char *), const char *filename, const char *mode)
{
int *guard;
FILE *fp = NULL;
@@ -1547,7 +1547,7 @@ DCL_FOPEN (fopen)
/*------------------------------------------------------------- fclose */
static int
-gprofng_fclose (int(real_fclose) (), FILE *stream)
+gprofng_fclose (int(real_fclose) (FILE *), FILE *stream)
{
int *guard;
int stat;
@@ -1633,7 +1633,7 @@ fflush (FILE *stream)
/*------------------------------------------------------------- fdopen */
static FILE*
-gprofng_fdopen (FILE*(real_fdopen) (), int fildes, const char *mode)
+gprofng_fdopen (FILE*(real_fdopen) (int, const char *), int fildes, const char *mode)
{
int *guard;
FILE *fp = NULL;
@@ -2945,7 +2945,7 @@ DCL_FGETPOS (fgetpos)
/*------------------------------------------------------------- fgetpos64 */
static int
-gprofng_fgetpos64 (int(real_fgetpos64) (), FILE *stream, fpos64_t *pos)
+gprofng_fgetpos64 (int(real_fgetpos64) (FILE *, fpos64_t *), FILE *stream, fpos64_t *pos)
{
int *guard;
int ret;
diff -rup fred/gprofng/libcollector/libcol_util.c binutils-2.41/gprofng/libcollector/libcol_util.c
--- fred/gprofng/libcollector/libcol_util.c 2026-02-26 10:57:17.827982759 +0000
+++ binutils-2.41/gprofng/libcollector/libcol_util.c 2026-02-26 12:55:01.083418747 +0000
@@ -1116,7 +1116,7 @@ __collector_util_init ()
ptr = dlsym (libc, "munmap");
if (ptr)
- __collector_util_funcs.munmap = (int(*)())ptr;
+ __collector_util_funcs.munmap = (int(*)(const void *, size_t))ptr;
else
{
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT munmap: %s\n", dlerror ());
@@ -1125,7 +1125,7 @@ __collector_util_init ()
ptr = dlsym (libc, "close");
if (ptr)
- __collector_util_funcs.close = (int(*)())ptr;
+ __collector_util_funcs.close = (int(*)(int))ptr;
else
{
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT close: %s\n", dlerror ());
@@ -1160,7 +1160,7 @@ __collector_util_init ()
ptr = dlsym (libc, "close");
if (ptr)
- __collector_util_funcs.close = (int(*)())ptr;
+ __collector_util_funcs.close = (int(*)(int)) ptr;
else
{
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT close: %s\n", dlerror ());
@@ -1169,7 +1169,7 @@ __collector_util_init ()
ptr = dlsym (libc, "read");
if (ptr)
- __collector_util_funcs.read = (ssize_t (*)())ptr;
+ __collector_util_funcs.read = (ssize_t (*)(int, const void *, size_t)) ptr;
else
{
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT read: %s\n", dlerror ());
@@ -1178,7 +1178,7 @@ __collector_util_init ()
ptr = dlsym (libc, "write");
if (ptr)
- __collector_util_funcs.write = (ssize_t (*)())ptr;
+ __collector_util_funcs.write = (ssize_t (*)(int, const void *, size_t))ptr;
else
{
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT write: %s\n", dlerror ());
@@ -1188,14 +1188,14 @@ __collector_util_init ()
#if ARCH(Intel) && WSIZE(32)
ptr = dlvsym (libc, "pwrite", "GLIBC_2.2"); // it is in /lib/libpthread.so.0
if (ptr)
- __collector_util_funcs.pwrite = (ssize_t (*)())ptr;
+ __collector_util_funcs.pwrite = (ssize_t (*)(int, const void *, size_t, off_t)) ptr;
else
{
Tprintf (DBG_LT0, "libcol_util: WARNING: dlvsym for %s@%s failed. Using dlsym() instead.", "pwrite", "GLIBC_2.2");
#endif /* ARCH(Intel) && WSIZE(32) */
ptr = dlsym (libc, "pwrite");
if (ptr)
- __collector_util_funcs.pwrite = (ssize_t (*)())ptr;
+ __collector_util_funcs.pwrite = (ssize_t (*)(int, const void *, size_t, off_t)) ptr;
else
{
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT pwrite: %s\n", dlerror ());
@@ -1208,14 +1208,14 @@ __collector_util_init ()
#if ARCH(Intel) && WSIZE(32)
ptr = dlvsym (libc, "pwrite64", "GLIBC_2.2"); // it is in /lib/libpthread.so.0
if (ptr)
- __collector_util_funcs.pwrite64_ = (ssize_t (*)())ptr;
+ __collector_util_funcs.pwrite64_ = (ssize_t (*)(int, const void *, size_t, off64_t)) ptr;
else
{
Tprintf (DBG_LT0, "libcol_util: WARNING: dlvsym for %s@%s failed. Using dlsym() instead.", "pwrite64", "GLIBC_2.2");
#endif /* ARCH(Intel) && WSIZE(32) */
ptr = dlsym (libc, "pwrite64");
if (ptr)
- __collector_util_funcs.pwrite64_ = (ssize_t (*)())ptr;
+ __collector_util_funcs.pwrite64_ = (ssize_t (*)(int, const void *, size_t, off64_t)) ptr;
else
__collector_util_funcs.pwrite64_ = __collector_util_funcs.pwrite;
#if ARCH(Intel) && WSIZE(32)
@@ -1224,7 +1224,7 @@ __collector_util_init ()
ptr = dlsym (libc, "lseek");
if (ptr)
- __collector_util_funcs.lseek = (off_t (*)())ptr;
+ __collector_util_funcs.lseek = (off_t (*)(int, off_t, int)) ptr;
else
{
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT lseek: %s\n", dlerror ());
@@ -1233,7 +1233,7 @@ __collector_util_init ()
ptr = dlsym (libc, "access");
if (ptr)
- __collector_util_funcs.access = (int(*)())ptr;
+ __collector_util_funcs.access = (int(*)(const char *, int)) ptr;
else
{
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT access: %s\n", dlerror ());
@@ -1242,7 +1242,7 @@ __collector_util_init ()
ptr = dlsym (libc, "mkdir");
if (ptr)
- __collector_util_funcs.mkdir = (int(*)())ptr;
+ __collector_util_funcs.mkdir = (int(*)(const char *, mode_t)) ptr;
else
{
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT mkdir: %s\n", dlerror ());
@@ -1251,7 +1251,7 @@ __collector_util_init ()
ptr = dlsym (libc, "opendir");
if (ptr)
- __collector_util_funcs.opendir = (DIR * (*)())ptr;
+ __collector_util_funcs.opendir = (DIR * (*)(const char *)) ptr;
else
{
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT opendir: %s\n", dlerror ());
@@ -1260,7 +1260,7 @@ __collector_util_init ()
ptr = dlsym (libc, "closedir");
if (ptr)
- __collector_util_funcs.closedir = (int(*)())ptr;
+ __collector_util_funcs.closedir = (int(*)(DIR *)) ptr;
else
{
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT closedir: %s\n", dlerror ());
@@ -1269,7 +1269,7 @@ __collector_util_init ()
ptr = dlsym (libc, "execv");
if (ptr)
- __collector_util_funcs.execv = (int(*)())ptr;
+ __collector_util_funcs.execv = (int(*)(const char *, char * const *))ptr;
else
{
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT execv: %s\n", dlerror ());
@@ -1278,7 +1278,7 @@ __collector_util_init ()
ptr = dlsym (libc, "exit");
if (ptr)
- __collector_util_funcs.exit = (void(*)())ptr;
+ __collector_util_funcs.exit = (void(*)(int)) ptr;
else
{
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT exit: %s\n", dlerror ());
@@ -1287,7 +1287,7 @@ __collector_util_init ()
ptr = dlsym (libc, "vfork");
if (ptr)
- __collector_util_funcs.vfork = (pid_t (*)())ptr;
+ __collector_util_funcs.vfork = (pid_t (*)(void)) ptr;
else
{
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT vfork: %s\n", dlerror ());
@@ -1296,14 +1296,14 @@ __collector_util_init ()
ptr = dlsym (libc, "waitpid");
if (ptr)
- __collector_util_funcs.waitpid = (pid_t (*)())ptr;
+ __collector_util_funcs.waitpid = (pid_t (*)(pid_t, int *, int)) ptr;
else
{
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT waitpid: %s\n", dlerror ());
err = COL_ERROR_UTIL_INIT;
}
- int (*__collector_getcpuid)() = (int(*)()) & getcpuid;
+ int (*__collector_getcpuid)() = (int(*)(void)) & getcpuid;
#if ARCH(Intel)
/* if sched_getcpu() not found, init our getcpuid() */
sched_getcpu_ptr = (sched_getcpu_ptr_t) dlsym (libc, "sched_getcpu");
@@ -1315,7 +1315,7 @@ __collector_util_init ()
ptr = dlsym (libc, "getcontext");
if (ptr)
- __collector_util_funcs.getcontext = (int(*)())ptr;
+ __collector_util_funcs.getcontext = (int(*)(ucontext_t *))ptr;
else
{
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT getcontext: %s\n", dlerror ());
@@ -1333,7 +1333,7 @@ __collector_util_init ()
ptr = dlsym (libc, "putenv");
if (ptr)
- __collector_util_funcs.putenv = (int(*)())ptr;
+ __collector_util_funcs.putenv = (int(*)(char *))ptr;
else
{
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT putenv: %s\n", dlerror ());
@@ -1342,7 +1342,7 @@ __collector_util_init ()
ptr = dlsym (libc, "getenv");
if (ptr)
- __collector_util_funcs.getenv = (char*(*)())ptr;
+ __collector_util_funcs.getenv = (char*(*)(const char *))ptr;
else
{
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT getenv: %s\n", dlerror ());
@@ -1351,7 +1351,7 @@ __collector_util_init ()
ptr = dlsym (libc, "time");
if (ptr)
- __collector_util_funcs.time = (time_t (*)())ptr;
+ __collector_util_funcs.time = (time_t (*)(time_t *))ptr;
else
{
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT time: %s\n", dlerror ());
@@ -1360,7 +1360,7 @@ __collector_util_init ()
ptr = dlsym (libc, "mktime");
if (ptr)
- __collector_util_funcs.mktime = (time_t (*)())ptr;
+ __collector_util_funcs.mktime = (time_t (*)(struct tm *))ptr;
else
{
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT mktime: %s\n", dlerror ());
@@ -1374,7 +1374,7 @@ __collector_util_init ()
ptr = dlsym (libc, "gmtime_r");
if (ptr)
- __collector_util_funcs.gmtime_r = (struct tm * (*)())ptr;
+ __collector_util_funcs.gmtime_r = (struct tm * (*)(const time_t *, struct tm *))ptr;
else
{
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT gmtime_r: %s\n", dlerror ());
@@ -1383,7 +1383,7 @@ __collector_util_init ()
ptr = dlsym (libc, "strtol");
if (ptr)
- __collector_util_funcs.strtol = (long (*)())ptr;
+ __collector_util_funcs.strtol = (long (*)(const char *, char **, int))ptr;
else
{
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT strtol: %s\n", dlerror ());
@@ -1392,7 +1392,7 @@ __collector_util_init ()
ptr = dlsym (libc, "strtoll");
if (ptr)
- __collector_util_funcs.strtoll = (long long (*)())ptr;
+ __collector_util_funcs.strtoll = (long long (*)(const char *, char **, int))ptr;
else
{
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT strtoll: %s\n", dlerror ());
@@ -1404,7 +1404,7 @@ __collector_util_init ()
ptr = dlsym (libc, "setenv");
if (ptr)
- __collector_util_funcs.setenv = (int(*)())ptr;
+ __collector_util_funcs.setenv = (int(*)(const char *, const char *, int)) ptr;
else
{
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT setenv: %s\n", dlerror ());
@@ -1413,7 +1413,7 @@ __collector_util_init ()
ptr = dlsym (libc, "unsetenv");
if (ptr)
- __collector_util_funcs.unsetenv = (int(*)())ptr;
+ __collector_util_funcs.unsetenv = (int(*)(const char *))ptr;
else
{
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT unsetenv: %s\n", dlerror ());
@@ -1422,7 +1422,7 @@ __collector_util_init ()
ptr = dlsym (libc, "atof");
if (ptr)
- __collector_util_funcs.atof = (double (*)())ptr;
+ __collector_util_funcs.atof = (double (*)(const char *))ptr;
else
{
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT atof: %s\n", dlerror ());
@@ -1431,7 +1431,7 @@ __collector_util_init ()
ptr = dlsym (libc, "sysinfo");
if (ptr)
- __collector_util_funcs.sysinfo = (long (*)())ptr;
+ __collector_util_funcs.sysinfo = (long (*)(int, char *, long))ptr;
else
{
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT sysinfo: %s\n", dlerror ());
@@ -1440,7 +1440,7 @@ __collector_util_init ()
ptr = dlsym (libc, "clearenv");
if (ptr)
- __collector_util_funcs.clearenv = (int(*)())ptr;
+ __collector_util_funcs.clearenv = (int(*)(void))ptr;
else
{
/* suppress warning on S10 or earlier Solaris */
@@ -1500,7 +1500,7 @@ __collector_util_init ()
ptr = dlsym (libc, "pclose");
if (ptr)
- __collector_util_funcs.pclose = (int(*)())ptr;
+ __collector_util_funcs.pclose = (int(*)(FILE *))ptr;
else
{
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT pclose: %s\n", dlerror ());
@@ -1509,7 +1509,7 @@ __collector_util_init ()
ptr = dlsym (libc, "fgets");
if (ptr)
- __collector_util_funcs.fgets = (char*(*)())ptr;
+ __collector_util_funcs.fgets = (char*(*)(char *, int, FILE *))ptr;
else
{
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT fgets: %s\n", dlerror ());
@@ -1536,7 +1536,7 @@ __collector_util_init ()
ptr = dlsym (libc, "vsnprintf");
if (ptr)
- __collector_util_funcs.vsnprintf = (int(*)())ptr;
+ __collector_util_funcs.vsnprintf = (int(*)(char *, size_t, const char *, va_list)) ptr;
else
{
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT vsnprintf: %s\n", dlerror ());
@@ -1545,7 +1545,7 @@ __collector_util_init ()
ptr = dlsym (libc, "atoi");
if (ptr)
- __collector_util_funcs.atoi = (int(*)())ptr;
+ __collector_util_funcs.atoi = (int(*)(const char *))ptr;
else
{
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT atoi: %s\n", dlerror ());
@@ -1554,7 +1554,7 @@ __collector_util_init ()
ptr = dlsym (libc, "calloc");
if (ptr)
- __collector_util_funcs.calloc = (void*(*)())ptr;
+ __collector_util_funcs.calloc = (void*(*)(size_t, size_t))ptr;
else
{
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT calloc: %s\n", dlerror ());
@@ -1564,7 +1564,7 @@ __collector_util_init ()
ptr = dlsym (libc, "free");
if (ptr)
{
- __collector_util_funcs.free = (void(*)())ptr;
+ __collector_util_funcs.free = (void(*)(void *)) ptr;
}
else
{
@@ -1574,7 +1574,7 @@ __collector_util_init ()
ptr = dlsym (libc, "strdup");
if (ptr)
- __collector_util_funcs.libc_strdup = (char*(*)())ptr;
+ __collector_util_funcs.libc_strdup = (char*(*)(const char *))ptr;
else
{
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT strdup: %s\n", dlerror ());
@@ -1587,7 +1587,7 @@ __collector_util_init ()
ptr = dlsym (libc, "strerror");
if (ptr)
- __collector_util_funcs.strerror = (char*(*)())ptr;
+ __collector_util_funcs.strerror = (char*(*)(int)) ptr;
else
{
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT strerror: %s\n", dlerror ());
@@ -1595,7 +1595,7 @@ __collector_util_init ()
}
ptr = dlsym (libc, "strerror_r");
if (ptr)
- __collector_util_funcs.strerror_r = (int(*)())ptr;
+ __collector_util_funcs.strerror_r = (int(*)(int, char *, size_t)) ptr;
else
{
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT strerror_r: %s\n", dlerror ());
@@ -1603,7 +1603,7 @@ __collector_util_init ()
}
ptr = dlsym (libc, "strspn");
if (ptr)
- __collector_util_funcs.strspn = (size_t (*)())ptr;
+ __collector_util_funcs.strspn = (size_t (*)(const char *, const char *)) ptr;
else
{
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT strspn: %s\n", dlerror ());
@@ -1612,7 +1612,7 @@ __collector_util_init ()
ptr = dlsym (libc, "strtoul");
if (ptr)
- __collector_util_funcs.strtoul = (unsigned long int(*)())ptr;
+ __collector_util_funcs.strtoul = (unsigned long int(*)(const char *, char **, int)) ptr;
else
{
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT strtoul: %s\n", dlerror ());
@@ -1621,7 +1621,7 @@ __collector_util_init ()
ptr = dlsym (libc, "strtoull");
if (ptr)
- __collector_util_funcs.strtoull = (unsigned long long int(*)())ptr;
+ __collector_util_funcs.strtoull = (unsigned long long int(*)(const char *, char **, int)) ptr;
else
{
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT strtoull: %s\n", dlerror ());
@@ -1630,7 +1630,7 @@ __collector_util_init ()
ptr = dlsym (libc, "fcntl");
if (ptr)
- __collector_util_funcs.fcntl = (int(*)(int, int, ...))ptr;
+ __collector_util_funcs.fcntl = (int(*)(int, int, ...)) ptr;
else
{
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT fcntl: %s\n", dlerror ());
@@ -1639,7 +1639,7 @@ __collector_util_init ()
ptr = dlsym (libc, "ioctl");
if (ptr)
- __collector_util_funcs.ioctl = (int(*)(int, int, ...))ptr;
+ __collector_util_funcs.ioctl = (int(*)(int, int, ...)) ptr;
else
{
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT ioctl: %s\n", dlerror ());
@@ -1648,7 +1648,7 @@ __collector_util_init ()
ptr = dlsym (libc, "symlink");
if (ptr)
- __collector_util_funcs.symlink = (int(*)(const char*, const char*))ptr;
+ __collector_util_funcs.symlink = (int(*)(const char*, const char*)) ptr;
else
{
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT symlink: %s\n", dlerror ());
@@ -1666,7 +1666,7 @@ __collector_util_init ()
ptr = dlsym (libc, "sysconf");
if (ptr)
- __collector_util_funcs.sysconf = (long(*)())ptr;
+ __collector_util_funcs.sysconf = (long(*)(int)) ptr;
else
{
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT sysconf: %s\n", dlerror ());
@@ -1675,7 +1675,7 @@ __collector_util_init ()
ptr = dlsym (libc, "sigfillset");
if (ptr)
- __collector_util_funcs.sigfillset = (int(*)())ptr;
+ __collector_util_funcs.sigfillset = (int(*)(sigset_t *)) ptr;
else
{
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT sigfillset: %s\n", dlerror ());
@@ -1684,7 +1684,7 @@ __collector_util_init ()
ptr = dlsym (libc, "sigprocmask");
if (ptr)
- __collector_util_funcs.sigprocmask = (int(*)())ptr;
+ __collector_util_funcs.sigprocmask = (int(*)(int, const sigset_t *, sigset_t *)) ptr;
else
{
CALL_UTIL (fprintf)(stderr, "collector_util_init COL_ERROR_UTIL_INIT sigprocmask: %s\n", dlerror ());
diff -rup fred/gprofng/libcollector/libcol_util.h binutils-2.41/gprofng/libcollector/libcol_util.h
--- fred/gprofng/libcollector/libcol_util.h 2026-02-26 10:57:17.827982759 +0000
+++ binutils-2.41/gprofng/libcollector/libcol_util.h 2026-02-26 11:16:33.295428744 +0000
@@ -82,9 +82,9 @@ extern int __collector_mutex_trylock (co
void __collector_sample (char *name);
void __collector_terminate_expt ();
-void __collector_pause ();
-void __collector_pause_m ();
-void __collector_resume ();
+void __collector_pause (void);
+void __collector_pause_m (const char *);
+void __collector_resume (void);
struct DT_lineno;
diff -rup fred/gprofng/libcollector/linetrace.c binutils-2.41/gprofng/libcollector/linetrace.c
--- fred/gprofng/libcollector/linetrace.c 2026-02-26 10:57:17.827982759 +0000
+++ binutils-2.41/gprofng/libcollector/linetrace.c 2026-02-26 12:32:17.045604191 +0000
@@ -1207,7 +1207,7 @@ __collector_vfork (void)
}
/*------------------------------------------------------------- execve */
-int execve () __attribute__ ((weak, alias ("__collector_execve")));
+int execve (const char *, char * const *, char * const *) __attribute__ ((weak, alias ("__collector_execve")));
int
__collector_execve (const char* path, char *const argv[], char *const envp[])
@@ -1237,7 +1237,7 @@ __collector_execve (const char* path, ch
return ret;
}
-int execvp () __attribute__ ((weak, alias ("__collector_execvp")));
+int execvp (const char *, char * const *) __attribute__ ((weak, alias ("__collector_execvp")));
int
__collector_execvp (const char* file, char *const argv[])
@@ -1269,7 +1269,7 @@ __collector_execvp (const char* file, ch
return ret;
}
-int execv () __attribute__ ((weak, alias ("__collector_execv")));
+int execv (const char *, char * const *) __attribute__ ((weak, alias ("__collector_execv")));
int
__collector_execv (const char* path, char *const argv[])
@@ -1408,7 +1408,7 @@ __collector_execl (const char* path, con
/*-------------------------------------------------------- posix_spawn */
// map interposed symbol versions
static int
-gprofng_posix_spawn (int(real_posix_spawn) (),
+gprofng_posix_spawn (int (real_posix_spawn) (pid_t *, const char *, const posix_spawn_file_actions_t *, const posix_spawnattr_t *, char *const *, char *const *),
pid_t *pidp, const char *path,
const posix_spawn_file_actions_t *file_actions,
const posix_spawnattr_t *attrp,
@@ -1466,7 +1466,7 @@ DCL_POSIX_SPAWN (posix_spawn)
/*-------------------------------------------------------- posix_spawnp */
static int
-gprofng_posix_spawnp (int (real_posix_spawnp) (),
+gprofng_posix_spawnp (int (real_posix_spawnp) (pid_t *, const char *, const posix_spawn_file_actions_t *, const posix_spawnattr_t *, char * const *, char * const *),
pid_t *pidp, const char *path,
const posix_spawn_file_actions_t *file_actions,
const posix_spawnattr_t *attrp,
@@ -1521,7 +1521,7 @@ DCL_FUNC_VER (DCL_POSIX_SPAWNP, posix_sp
DCL_POSIX_SPAWNP (posix_spawnp)
/*------------------------------------------------------------- system */
-int system () __attribute__ ((weak, alias ("__collector_system")));
+int system (char *) __attribute__ ((weak, alias ("__collector_system")));
int
__collector_system (const char *cmd)
@@ -1576,7 +1576,7 @@ DCL_FUNC_VER (DCL_POPEN, popen_2_0, pope
DCL_POPEN (popen)
/*------------------------------------------------------------- grantpt */
-int grantpt () __attribute__ ((weak, alias ("__collector_grantpt")));
+int grantpt (int) __attribute__ ((weak, alias ("__collector_grantpt")));
int
__collector_grantpt (const int fildes)
@@ -1601,7 +1601,7 @@ __collector_grantpt (const int fildes)
}
/*------------------------------------------------------------- ptsname */
-char *ptsname () __attribute__ ((weak, alias ("__collector_ptsname")));
+char *ptsname (int) __attribute__ ((weak, alias ("__collector_ptsname")));
char *
__collector_ptsname (const int fildes)
@@ -1754,8 +1754,8 @@ __collector_clone (int (*fn)(void *), vo
}
/*-------------------------------------------------------------------- setuid */
-int setuid () __attribute__ ((weak, alias ("__collector_setuid")));
-int _setuid () __attribute__ ((weak, alias ("__collector_setuid")));
+int setuid (uid_t) __attribute__ ((weak, alias ("__collector_setuid")));
+int _setuid (uid_t) __attribute__ ((weak, alias ("__collector_setuid")));
int
__collector_setuid (uid_t ruid)
@@ -1770,8 +1770,8 @@ __collector_setuid (uid_t ruid)
}
/*------------------------------------------------------------------- seteuid */
-int seteuid () __attribute__ ((weak, alias ("__collector_seteuid")));
-int _seteuid () __attribute__ ((weak, alias ("__collector_seteuid")));
+int seteuid (uid_t) __attribute__ ((weak, alias ("__collector_seteuid")));
+int _seteuid (uid_t) __attribute__ ((weak, alias ("__collector_seteuid")));
int
__collector_seteuid (uid_t euid)
@@ -1786,8 +1786,8 @@ __collector_seteuid (uid_t euid)
}
/*------------------------------------------------------------------ setreuid */
-int setreuid () __attribute__ ((weak, alias ("__collector_setreuid")));
-int _setreuid () __attribute__ ((weak, alias ("__collector_setreuid")));
+int setreuid (uid_t,uid_t) __attribute__ ((weak, alias ("__collector_setreuid")));
+int _setreuid (uid_t,uid_t) __attribute__ ((weak, alias ("__collector_setreuid")));
int
__collector_setreuid (uid_t ruid, uid_t euid)
@@ -1802,8 +1802,8 @@ __collector_setreuid (uid_t ruid, uid_t
}
/*-------------------------------------------------------------------- setgid */
-int setgid () __attribute__ ((weak, alias ("__collector_setgid")));
-int _setgid () __attribute__ ((weak, alias ("__collector_setgid")));
+int setgid (gid_t) __attribute__ ((weak, alias ("__collector_setgid")));
+int _setgid (gid_t) __attribute__ ((weak, alias ("__collector_setgid")));
int
__collector_setgid (gid_t rgid)
@@ -1818,8 +1818,8 @@ __collector_setgid (gid_t rgid)
}
/*------------------------------------------------------------------- setegid */
-int setegid () __attribute__ ((weak, alias ("__collector_setegid")));
-int _setegid () __attribute__ ((weak, alias ("__collector_setegid")));
+int setegid (gid_t) __attribute__ ((weak, alias ("__collector_setegid")));
+int _setegid (gid_t) __attribute__ ((weak, alias ("__collector_setegid")));
int
__collector_setegid (gid_t egid)
@@ -1834,8 +1834,8 @@ __collector_setegid (gid_t egid)
}
/*------------------------------------------------------------------ setregid */
-int setregid () __attribute__ ((weak, alias ("__collector_setregid")));
-int _setregid () __attribute__ ((weak, alias ("__collector_setregid")));
+int setregid (gid_t,gid_t) __attribute__ ((weak, alias ("__collector_setregid")));
+int _setregid (gid_t,gid_t) __attribute__ ((weak, alias ("__collector_setregid")));
int
__collector_setregid (gid_t rgid, gid_t egid)
diff -rup fred/gprofng/libcollector/mmaptrace.c binutils-2.41/gprofng/libcollector/mmaptrace.c
--- fred/gprofng/libcollector/mmaptrace.c 2026-02-26 10:57:17.827982759 +0000
+++ binutils-2.41/gprofng/libcollector/mmaptrace.c 2026-02-26 11:24:29.202727459 +0000
@@ -314,7 +314,7 @@ __collector_mmap_fork_child_cleanup ()
}
static int
-init_mmap_files ()
+init_mmap_files (void)
{
TprintfT (DBG_LT2, "init_mmap_files\n");
/* also create the headerless dyntext file (if required) */
@@ -1209,7 +1209,7 @@ process_vsyscall_page ()
/*
* collector API for dynamic functions
*/
-void collector_func_load () __attribute__ ((weak, alias ("__collector_func_load")));
+void collector_func_load (char *, char *, char *, void *, int, int, DT_lineno *) __attribute__ ((weak, alias ("__collector_func_load")));
void
__collector_func_load (char *name, char *alias, char *sourcename,
void *vaddr, int size, int lntsize, DT_lineno *lntable)
@@ -1218,7 +1218,7 @@ __collector_func_load (char *name, char
vaddr, size, lntsize, lntable);
}
-void collector_func_unload () __attribute__ ((weak, alias ("__collector_func_unload")));
+void collector_func_unload (void *) __attribute__ ((weak, alias ("__collector_func_unload")));
void
__collector_func_unload (void *vaddr)
{
diff -rup fred/gprofng/libcollector/unwind.c binutils-2.41/gprofng/libcollector/unwind.c
--- fred/gprofng/libcollector/unwind.c 2026-02-26 10:57:17.827982759 +0000
+++ binutils-2.41/gprofng/libcollector/unwind.c 2026-02-26 12:33:20.676902736 +0000
@@ -412,7 +412,7 @@ __collector_ext_unwind_init (int record)
omp_no_walk = 1;
if (__collector_VM_ReadByteInstruction == NULL)
- __collector_VM_ReadByteInstruction = (int(*)()) dlsym (RTLD_DEFAULT, "Async_VM_ReadByteInstruction");
+ __collector_VM_ReadByteInstruction = (int(*)(unsigned char *)) dlsym (RTLD_DEFAULT, "Async_VM_ReadByteInstruction");
#if ARCH(SPARC)
#if WSIZE(64)
diff -rup fred/gprofng/src/Elf.cc binutils-2.41/gprofng/src/Elf.cc
--- fred/gprofng/src/Elf.cc 2026-02-26 10:57:17.828468817 +0000
+++ binutils-2.41/gprofng/src/Elf.cc 2026-02-26 13:20:16.074282081 +0000
@@ -390,6 +390,8 @@ Elf::get_sec_name (unsigned int sec)
Elf_Data *
Elf::elf_getdata (unsigned int sec)
{
+ if (sec >= ehdrp->e_shnum)
+ return NULL;
if (data == NULL)
{
data = (Elf_Data **) malloc (ehdrp->e_shnum * sizeof (Elf_Data *));
diff -rup fred/gprofng/src/collctrl.cc binutils-2.41/gprofng/src/collctrl.cc
--- fred/gprofng/src/collctrl.cc 2026-02-26 10:57:17.829596072 +0000
+++ binutils-2.41/gprofng/src/collctrl.cc 2026-02-26 13:22:30.018913076 +0000
@@ -1080,11 +1080,11 @@ Coll_Ctrl::set_synctrace (const char *st
int tval = (int) strtol (val, &endchar, 0);
if (*endchar != 0 || tval < 0)
{
- free (val);
/* invalid setting */
/* restore the comma, if it was zeroed out */
if (comma_p != NULL)
*comma_p = ',';
+ free (val);
return dbe_sprintf (GTXT ("Unrecognized synchronization tracing threshold `%s'\n"), string);
}
free (val);
diff -rup fred/gprofng/src/collector_module.h binutils-2.41/gprofng/src/collector_module.h
--- fred/gprofng/src/collector_module.h 2026-02-26 10:57:17.829596072 +0000
+++ binutils-2.41/gprofng/src/collector_module.h 2026-02-26 12:47:59.512212113 +0000
@@ -40,24 +40,24 @@ struct tm;
* If you add any, please put it in the right place */
typedef struct CollectorUtilFuncs
{
- int (*access)();
+ int (*access)(const char *, int);
int (*atoi)(const char *nptr);
void *(*calloc)(size_t nelem, size_t elsize);
int (*clearenv)(void);
int (*close)(int);
- int (*closedir)();
+ int (*closedir)(DIR *);
int (*execv)(const char *path, char *const argv[]);
void (*exit)(int status);
int (*fclose)(FILE *stream);
int (*fcntl)(int fd, int cmd, ...);
char *(*fgets)(char *s, int n, FILE *stream);
FILE *(*fopen)(const char *filename, const char *mode);
- pid_t (*vfork)();
+ pid_t (*vfork)(void);
int (*fprintf)(FILE *stream, const char *format, ...);
void (*free)(void *ptr);
int (*fstat)(int fd, struct stat *buf);
int (*getcontext)(ucontext_t *ucp);
- int (*getcpuid)();
+ int (*getcpuid)(void);
char *(*getcwd)(char *buf, size_t size);
char *(*getenv)(const char *name);
struct tm *(*gmtime_r)(const time_t *clock, struct tm *res);
@@ -65,20 +65,20 @@ typedef struct CollectorUtilFuncs
off_t (*lseek)(int fd, off_t offset, int whence);
void *(*malloc)(size_t size);
void *(*memset)(void *s1, int c, size_t n);
- int (*mkdir)();
+ int (*mkdir)(const char *, mode_t);
time_t (*mktime)(struct tm *timeptr);
void *(*mmap)(void *, size_t, int, int, int, off_t);
- void *(*mmap64_)();
- int (*munmap)();
+ void *(*mmap64_)(void *, size_t, int, int, int, off64_t);
+ int (*munmap)(const void *, size_t);
int (*open)(const char *, int, ...);
int (*open_bare)(const char *, int, ...);
- DIR *(*opendir)();
+ DIR *(*opendir)(const char *);
int (*pclose)(FILE *stream);
FILE *(*popen)(const char *command, const char *mode);
int (*putenv)(char *string);
- ssize_t (*pwrite)();
- ssize_t (*pwrite64_)();
- ssize_t (*read)();
+ ssize_t (*pwrite)(int, const void *, size_t, off_t);
+ ssize_t (*pwrite64_)(int, const void *, size_t, off64_t);
+ ssize_t (*read)(int, const void *, size_t);
int (*setenv)(const char *name, const char *value, int overwrite);
int (*sigfillset)(sigset_t *set);
int (*sigprocmask)(int how, const sigset_t *set, sigset_t *oldset);
@@ -110,8 +110,8 @@ typedef struct CollectorUtilFuncs
int (*unsetenv)(const char *name);
int (*vsnprintf)(char *str, size_t size, const char *format, va_list ap);
pid_t (*waitpid)(pid_t pid, int *stat_loc, int options);
- ssize_t (*write)();
- double (*atof)();
+ ssize_t (*write)(int, const void *, size_t);
+ double (*atof)(const char *);
void *n_a;
} CollectorUtilFuncs;