aboutsummaryrefslogtreecommitdiff
path: root/gprofng/src
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/src
parent8422cbe455d762f068ed1edefc717f36a105da42 (diff)
downloadgdb-fe39ffdc202f04397f31557f17170b40bc42b77a.zip
gdb-fe39ffdc202f04397f31557f17170b40bc42b77a.tar.gz
gdb-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/src')
-rw-r--r--gprofng/src/Experiment.cc4
-rw-r--r--gprofng/src/Print.cc6
-rw-r--r--gprofng/src/collector_module.h6
3 files changed, 9 insertions, 7 deletions
diff --git a/gprofng/src/Experiment.cc b/gprofng/src/Experiment.cc
index c797724..98aae97 100644
--- a/gprofng/src/Experiment.cc
+++ b/gprofng/src/Experiment.cc
@@ -6466,7 +6466,7 @@ int
Experiment::copy_file_to_archive (const char *name, const char *aname, int hide_msg)
{
errno = 0;
- int fd_w = open64 (aname, O_WRONLY | O_CREAT | O_EXCL, 0644);
+ int fd_w = ::open64 (aname, O_WRONLY | O_CREAT | O_EXCL, 0644);
if (fd_w == -1)
{
if (errno == EEXIST)
@@ -6484,7 +6484,7 @@ Experiment::copy_file_to_archive (const char *name, const char *aname, int hide_
return 1;
}
- int fd_r = open64 (name, O_RDONLY);
+ int fd_r = ::open64 (name, O_RDONLY);
if (fd_r == -1)
{
fprintf (stderr, GTXT ("er_archive: unable to open `%s': %s\n"),
diff --git a/gprofng/src/Print.cc b/gprofng/src/Print.cc
index d415d59..0393253 100644
--- a/gprofng/src/Print.cc
+++ b/gprofng/src/Print.cc
@@ -2209,14 +2209,14 @@ print_anno_file (char *name, const char *sel, const char *srcFile,
{
fitem = func->getDefSrc ();
found = (func->line_first > 0)
- && strcmp (basename (srcFile),
- basename (fitem->get_name ())) == 0;
+ && strcmp (get_basename (srcFile),
+ get_basename (fitem->get_name ())) == 0;
}
else
{
Vec_loop (SourceFile*, sources, index, fitem)
{
- if (strcmp (basename (srcFile), basename (fitem->get_name ())) == 0)
+ if (strcmp (get_basename (srcFile), get_basename (fitem->get_name ())) == 0)
{
found = true;
break;
diff --git a/gprofng/src/collector_module.h b/gprofng/src/collector_module.h
index f608dab..6cf53d5 100644
--- a/gprofng/src/collector_module.h
+++ b/gprofng/src/collector_module.h
@@ -25,6 +25,7 @@
#include <stdarg.h>
#include <stdio.h>
#include <unistd.h>
+#include <ucontext.h>
#include <dirent.h>
#include "gp-defs.h"
@@ -55,6 +56,7 @@ typedef struct CollectorUtilFuncs
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)();
char *(*getcwd)(char *buf, size_t size);
char *(*getenv)(const char *name);
@@ -66,7 +68,7 @@ typedef struct CollectorUtilFuncs
int (*mkdir)();
time_t (*mktime)(struct tm *timeptr);
void *(*mmap)(void *, size_t, int, int, int, off_t);
- void *(*mmap64)();
+ void *(*mmap64_)();
int (*munmap)();
int (*open)(const char *, int, ...);
int (*open_bare)(const char *, int, ...);
@@ -75,7 +77,7 @@ typedef struct CollectorUtilFuncs
FILE *(*popen)(const char *command, const char *mode);
int (*putenv)(char *string);
ssize_t (*pwrite)();
- ssize_t (*pwrite64)();
+ ssize_t (*pwrite64_)();
ssize_t (*read)();
int (*setenv)(const char *name, const char *value, int overwrite);
int (*sigfillset)(sigset_t *set);