aboutsummaryrefslogtreecommitdiff
path: root/gprofng
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2022-03-14 14:46:25 -0700
committerH.J. Lu <hjl.tools@gmail.com>2022-03-16 06:45:06 -0700
commitf4be26838dc9937a4ae3e9cf4fbec50efd7786a2 (patch)
treece206b7152f6f242e4a9e56e378b41f4ed5dd694 /gprofng
parent61a1f2e71118206dd700fc1ddf244b2178bf6610 (diff)
downloadgdb-f4be26838dc9937a4ae3e9cf4fbec50efd7786a2.zip
gdb-f4be26838dc9937a4ae3e9cf4fbec50efd7786a2.tar.gz
gdb-f4be26838dc9937a4ae3e9cf4fbec50efd7786a2.tar.bz2
gprofng: Use symver attribute if available
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.
Diffstat (limited to 'gprofng')
-rw-r--r--gprofng/libcollector/dispatcher.c12
-rw-r--r--gprofng/libcollector/iotrace.c55
-rw-r--r--gprofng/libcollector/linetrace.c27
-rw-r--r--gprofng/libcollector/mmaptrace.c6
-rw-r--r--gprofng/libcollector/synctrace.c47
-rw-r--r--gprofng/src/collector_module.h11
6 files changed, 72 insertions, 86 deletions
diff --git a/gprofng/libcollector/dispatcher.c b/gprofng/libcollector/dispatcher.c
index f9a7de1..f030860 100644
--- a/gprofng/libcollector/dispatcher.c
+++ b/gprofng/libcollector/dispatcher.c
@@ -818,6 +818,7 @@ static int
__collector_timer_create_symver (int(real_timer_create) (), clockid_t clockid, struct sigevent *sevp,
timer_t *timerid);
+SYMVER_ATTRIBUTE (__collector_timer_create_2_3_3, timer_create@@GLIBC_2.3.3)
int
__collector_timer_create_2_3_3 (clockid_t clockid, struct sigevent *sevp,
timer_t *timerid)
@@ -827,11 +828,11 @@ __collector_timer_create_2_3_3 (clockid_t clockid, struct sigevent *sevp,
TprintfT (DBG_LTT, "dispatcher: GLIBC: __collector_timer_create_2_3_3@%p\n", CALL_REAL (timer_create_2_3_3));
return __collector_timer_create_symver (CALL_REAL (timer_create_2_3_3), clockid, sevp, timerid);
}
-__asm__(".symver __collector_timer_create_2_3_3,timer_create@@GLIBC_2.3.3");
#endif /* ARCH(SPARC) || ARCH(Intel)*/
#if ARCH(SPARC)
+SYMVER_ATTRIBUTE (__collector_timer_create_2_2, timer_create@GLIBC_2.2)
int
__collector_timer_create_2_2 (clockid_t clockid, struct sigevent *sevp,
timer_t *timerid)
@@ -842,10 +843,9 @@ __collector_timer_create_2_2 (clockid_t clockid, struct sigevent *sevp,
return __collector_timer_create_symver (CALL_REAL (timer_create_2_2), clockid, sevp, timerid);
}
-__asm__(".symver __collector_timer_create_2_2,timer_create@GLIBC_2.2");
-
#elif ARCH(Intel)
+SYMVER_ATTRIBUTE (__collector_timer_create_2_2_5, timer_create@GLIBC_2.2.5)
int
__collector_timer_create_2_2_5 (clockid_t clockid, struct sigevent *sevp,
timer_t *timerid)
@@ -855,7 +855,6 @@ __collector_timer_create_2_2_5 (clockid_t clockid, struct sigevent *sevp,
TprintfT (DBG_LTT, "dispatcher: GLIBC: __collector_timer_create_2_2_5@%p\n", CALL_REAL (timer_create_2_2_5));
return __collector_timer_create_symver (CALL_REAL (timer_create_2_2_5), clockid, sevp, timerid);
}
-__asm__(".symver __collector_timer_create_2_2_5,timer_create@GLIBC_2.2.5");
#endif /* ARCH() */
#endif /* WSIZE(64) */
@@ -1079,6 +1078,7 @@ __collector_pthread_create_symver (int(real_pthread_create) (),
void *(*func)(void*),
void *arg);
+SYMVER_ATTRIBUTE (__collector_pthread_create_2_1, pthread_create@@GLIBC_2.1)
int
__collector_pthread_create_2_1 (pthread_t *thread,
const pthread_attr_t *attr,
@@ -1091,6 +1091,7 @@ __collector_pthread_create_2_1 (pthread_t *thread,
return __collector_pthread_create_symver (CALL_REAL (pthread_create_2_1), thread, attr, func, arg);
}
+SYMVER_ATTRIBUTE (__collector_pthread_create_2_0, pthread_create@GLIBC_2.0)
int
__collector_pthread_create_2_0 (pthread_t *thread,
const pthread_attr_t *attr,
@@ -1103,9 +1104,6 @@ __collector_pthread_create_2_0 (pthread_t *thread,
return __collector_pthread_create_symver (CALL_REAL (pthread_create_2_0), thread, attr, func, arg);
}
-__asm__(".symver __collector_pthread_create_2_1,pthread_create@@GLIBC_2.1");
-__asm__(".symver __collector_pthread_create_2_0,pthread_create@GLIBC_2.0");
-
#endif
#if ARCH(Intel) && WSIZE(32)
diff --git a/gprofng/libcollector/iotrace.c b/gprofng/libcollector/iotrace.c
index 462ccf2..9b47724 100644
--- a/gprofng/libcollector/iotrace.c
+++ b/gprofng/libcollector/iotrace.c
@@ -1069,6 +1069,7 @@ static int
__collector_open64_symver (int(real_open64) (const char *, int, ...),
const char *path, int oflag, mode_t mode);
+SYMVER_ATTRIBUTE (__collector_open64_2_2, open64@@GLIBC_2.2)
int
__collector_open64_2_2 (const char *path, int oflag, ...)
{
@@ -1085,6 +1086,7 @@ __collector_open64_2_2 (const char *path, int oflag, ...)
return __collector_open64_symver (CALL_REAL (open64_2_2), path, oflag, mode);
}
+SYMVER_ATTRIBUTE (__collector_open64_2_1, open64@GLIBC_2.1)
int
__collector_open64_2_1 (const char *path, int oflag, ...)
{
@@ -1101,9 +1103,6 @@ __collector_open64_2_1 (const char *path, int oflag, ...)
return __collector_open64_symver (CALL_REAL (open64_2_1), path, oflag, mode);
}
-__asm__(".symver __collector_open64_2_2,open64@@GLIBC_2.2");
-__asm__(".symver __collector_open64_2_1,open64@GLIBC_2.1");
-
#endif /* ARCH(Intel) && WSIZE(32) */
#if WSIZE(32)
#if ARCH(Intel) && WSIZE(32)
@@ -1635,6 +1634,7 @@ close (int fildes)
static FILE*
__collector_fopen_symver (FILE*(real_fopen) (), const char *filename, const char *mode);
+SYMVER_ATTRIBUTE (__collector_fopen_2_1, fopen@@GLIBC_2.1)
FILE*
__collector_fopen_2_1 (const char *filename, const char *mode)
{
@@ -1644,6 +1644,7 @@ __collector_fopen_2_1 (const char *filename, const char *mode)
return __collector_fopen_symver (CALL_REAL (fopen_2_1), filename, mode);
}
+SYMVER_ATTRIBUTE (__collector_fopen_2_0, fopen@GLIBC_2.0)
FILE*
__collector_fopen_2_0 (const char *filename, const char *mode)
{
@@ -1653,9 +1654,6 @@ __collector_fopen_2_0 (const char *filename, const char *mode)
return __collector_fopen_symver (CALL_REAL (fopen_2_0), filename, mode);
}
-__asm__(".symver __collector_fopen_2_1,fopen@@GLIBC_2.1");
-__asm__(".symver __collector_fopen_2_0,fopen@GLIBC_2.0");
-
#endif
#if ARCH(Intel) && WSIZE(32)
@@ -1748,6 +1746,7 @@ fopen (const char *filename, const char *mode)
static int
__collector_fclose_symver (int(real_fclose) (), FILE *stream);
+SYMVER_ATTRIBUTE (__collector_fclose_2_1, fclose@@GLIBC_2.1)
int
__collector_fclose_2_1 (FILE *stream)
{
@@ -1757,6 +1756,7 @@ __collector_fclose_2_1 (FILE *stream)
return __collector_fclose_symver (CALL_REAL (fclose_2_1), stream);
}
+SYMVER_ATTRIBUTE (__collector_fclose_2_0, fclose@GLIBC_2.0)
int
__collector_fclose_2_0 (FILE *stream)
{
@@ -1766,9 +1766,6 @@ __collector_fclose_2_0 (FILE *stream)
return __collector_fclose_symver (CALL_REAL (fclose_2_0), stream);
}
-__asm__(".symver __collector_fclose_2_1,fclose@@GLIBC_2.1");
-__asm__(".symver __collector_fclose_2_0,fclose@GLIBC_2.0");
-
#endif
#if ARCH(Intel) && WSIZE(32)
@@ -1873,6 +1870,7 @@ fflush (FILE *stream)
static FILE*
__collector_fdopen_symver (FILE*(real_fdopen) (), int fildes, const char *mode);
+SYMVER_ATTRIBUTE (__collector_fdopen_2_1, fdopen@@GLIBC_2.1)
FILE*
__collector_fdopen_2_1 (int fildes, const char *mode)
{
@@ -1882,6 +1880,7 @@ __collector_fdopen_2_1 (int fildes, const char *mode)
return __collector_fdopen_symver (CALL_REAL (fdopen_2_1), fildes, mode);
}
+SYMVER_ATTRIBUTE (__collector_fdopen_2_0, fdopen@GLIBC_2.0)
FILE*
__collector_fdopen_2_0 (int fildes, const char *mode)
{
@@ -1891,9 +1890,6 @@ __collector_fdopen_2_0 (int fildes, const char *mode)
return __collector_fdopen_symver (CALL_REAL (fdopen_2_0), fildes, mode);
}
-__asm__(".symver __collector_fdopen_2_1,fdopen@@GLIBC_2.1");
-__asm__(".symver __collector_fdopen_2_0,fdopen@GLIBC_2.0");
-
#endif
#if ARCH(Intel) && WSIZE(32)
@@ -2342,6 +2338,7 @@ fwrite (const void *ptr, size_t size, size_t nitems, FILE *stream)
static int
__collector_pread_symver (int(real_pread) (), int fildes, void *buf, size_t nbyte, off_t offset);
+SYMVER_ATTRIBUTE (__collector_pread_2_2, pread@@GLIBC_2.2)
int
__collector_pread_2_2 (int fildes, void *buf, size_t nbyte, off_t offset)
{
@@ -2352,6 +2349,7 @@ __collector_pread_2_2 (int fildes, void *buf, size_t nbyte, off_t offset)
return __collector_pread_symver (CALL_REAL (pread_2_2), fildes, buf, nbyte, offset);
}
+SYMVER_ATTRIBUTE (__collector_pread_2_1, pread@GLIBC_2.1)
int
__collector_pread_2_1 (int fildes, void *buf, size_t nbyte, off_t offset)
{
@@ -2362,9 +2360,6 @@ __collector_pread_2_1 (int fildes, void *buf, size_t nbyte, off_t offset)
return __collector_pread_symver (CALL_REAL (pread_2_1), fildes, buf, nbyte, offset);
}
-__asm__(".symver __collector_pread_2_2,pread@@GLIBC_2.2");
-__asm__(".symver __collector_pread_2_1,pread@GLIBC_2.1");
-
static int
__collector_pread_symver (int(real_pread) (), int fildes, void *buf, size_t nbyte, off_t offset)
{
@@ -2422,6 +2417,7 @@ pread (int fildes, void *buf, size_t nbyte, off_t offset)
static int
__collector_pwrite_symver (int(real_pwrite) (), int fildes, const void *buf, size_t nbyte, off_t offset);
+SYMVER_ATTRIBUTE (__collector_pwrite_2_2, pwrite@@GLIBC_2.2)
int
__collector_pwrite_2_2 (int fildes, const void *buf, size_t nbyte, off_t offset)
{
@@ -2432,6 +2428,7 @@ __collector_pwrite_2_2 (int fildes, const void *buf, size_t nbyte, off_t offset)
return __collector_pwrite_symver (CALL_REAL (pwrite_2_2), fildes, buf, nbyte, offset);
}
+SYMVER_ATTRIBUTE (__collector_pwrite_2_1, pwrite@GLIBC_2.1)
int
__collector_pwrite_2_1 (int fildes, const void *buf, size_t nbyte, off_t offset)
{
@@ -2442,9 +2439,6 @@ __collector_pwrite_2_1 (int fildes, const void *buf, size_t nbyte, off_t offset)
return __collector_pwrite_symver (CALL_REAL (pwrite_2_1), fildes, buf, nbyte, offset);
}
-__asm__(".symver __collector_pwrite_2_2,pwrite@@GLIBC_2.2");
-__asm__(".symver __collector_pwrite_2_1,pwrite@GLIBC_2.1");
-
static int
__collector_pwrite_symver (int(real_pwrite) (), int fildes, const void *buf, size_t nbyte, off_t offset)
{
@@ -2502,6 +2496,7 @@ pwrite (int fildes, const void *buf, size_t nbyte, off_t offset)
static int
__collector_pwrite64_symver (int(real_pwrite64) (), int fildes, const void *buf, size_t nbyte, off64_t offset);
+SYMVER_ATTRIBUTE (__collector_pwrite64_2_2, pwrite64@@GLIBC_2.2)
int
__collector_pwrite64_2_2 (int fildes, const void *buf, size_t nbyte, off64_t offset)
{
@@ -2512,6 +2507,7 @@ __collector_pwrite64_2_2 (int fildes, const void *buf, size_t nbyte, off64_t off
return __collector_pwrite64_symver (CALL_REAL (pwrite64_2_2), fildes, buf, nbyte, offset);
}
+SYMVER_ATTRIBUTE (__collector_pwrite64_2_1, pwrite64@GLIBC_2.1)
int
__collector_pwrite64_2_1 (int fildes, const void *buf, size_t nbyte, off64_t offset)
{
@@ -2522,9 +2518,6 @@ __collector_pwrite64_2_1 (int fildes, const void *buf, size_t nbyte, off64_t off
return __collector_pwrite64_symver (CALL_REAL (pwrite64_2_1), fildes, buf, nbyte, offset);
}
-__asm__(".symver __collector_pwrite64_2_2,pwrite64@@GLIBC_2.2");
-__asm__(".symver __collector_pwrite64_2_1,pwrite64@GLIBC_2.1");
-
static int
__collector_pwrite64_symver (int(real_pwrite64) (), int fildes, const void *buf, size_t nbyte, off64_t offset)
{
@@ -3258,6 +3251,7 @@ ftell (FILE *stream)
static int
__collector_fgetpos_symver (int(real_fgetpos) (), FILE *stream, fpos_t *pos);
+SYMVER_ATTRIBUTE (__collector_fgetpos_2_2, fgetpos@@GLIBC_2.2)
int
__collector_fgetpos_2_2 (FILE *stream, fpos_t *pos)
{
@@ -3267,6 +3261,7 @@ __collector_fgetpos_2_2 (FILE *stream, fpos_t *pos)
return __collector_fgetpos_symver (CALL_REAL (fgetpos_2_2), stream, pos);
}
+SYMVER_ATTRIBUTE (__collector_fgetpos_2_0, fgetpos@GLIBC_2.0)
int
__collector_fgetpos_2_0 (FILE *stream, fpos_t *pos)
{
@@ -3275,9 +3270,6 @@ __collector_fgetpos_2_0 (FILE *stream, fpos_t *pos)
TprintfT (DBG_LTT, "iotrace: __collector_fgetpos_2_0@%p\n", CALL_REAL (fgetpos_2_0));
return __collector_fgetpos_symver (CALL_REAL (fgetpos_2_0), stream, pos);
}
-
-__asm__(".symver __collector_fgetpos_2_2,fgetpos@@GLIBC_2.2");
-__asm__(".symver __collector_fgetpos_2_0,fgetpos@GLIBC_2.0");
#endif
#if ARCH(Intel) && WSIZE(32)
@@ -3344,6 +3336,7 @@ fgetpos (FILE *stream, fpos_t *pos)
static int
__collector_fgetpos64_symver (int(real_fgetpos64) (), FILE *stream, fpos64_t *pos);
+SYMVER_ATTRIBUTE (__collector_fgetpos64_2_2, fgetpos64@@GLIBC_2.2)
int
__collector_fgetpos64_2_2 (FILE *stream, fpos64_t *pos)
{
@@ -3354,6 +3347,7 @@ __collector_fgetpos64_2_2 (FILE *stream, fpos64_t *pos)
return __collector_fgetpos64_symver (CALL_REAL (fgetpos64_2_2), stream, pos);
}
+SYMVER_ATTRIBUTE (__collector_fgetpos64_2_1, fgetpos64@GLIBC_2.1)
int
__collector_fgetpos64_2_1 (FILE *stream, fpos64_t *pos)
{
@@ -3364,9 +3358,6 @@ __collector_fgetpos64_2_1 (FILE *stream, fpos64_t *pos)
return __collector_fgetpos64_symver (CALL_REAL (fgetpos64_2_1), stream, pos);
}
-__asm__(".symver __collector_fgetpos64_2_2,fgetpos64@@GLIBC_2.2");
-__asm__(".symver __collector_fgetpos64_2_1,fgetpos64@GLIBC_2.1");
-
static int
__collector_fgetpos64_symver (int(real_fgetpos64) (), FILE *stream, fpos64_t *pos)
{
@@ -3427,6 +3418,7 @@ fgetpos64 (FILE *stream, fpos64_t *pos)
static int
__collector_fsetpos_symver (int(real_fsetpos) (), FILE *stream, const fpos_t *pos);
+SYMVER_ATTRIBUTE (__collector_fsetpos_2_2, fsetpos@@GLIBC_2.2)
int
__collector_fsetpos_2_2 (FILE *stream, const fpos_t *pos)
{
@@ -3436,6 +3428,7 @@ __collector_fsetpos_2_2 (FILE *stream, const fpos_t *pos)
return __collector_fsetpos_symver (CALL_REAL (fsetpos_2_2), stream, pos);
}
+SYMVER_ATTRIBUTE (__collector_fsetpos_2_0, fsetpos@GLIBC_2.0)
int
__collector_fsetpos_2_0 (FILE *stream, const fpos_t *pos)
{
@@ -3444,9 +3437,6 @@ __collector_fsetpos_2_0 (FILE *stream, const fpos_t *pos)
TprintfT (DBG_LTT, "iotrace: __collector_fsetpos_2_0@%p\n", CALL_REAL (fsetpos_2_0));
return __collector_fsetpos_symver (CALL_REAL (fsetpos_2_0), stream, pos);
}
-
-__asm__(".symver __collector_fsetpos_2_2,fsetpos@@GLIBC_2.2");
-__asm__(".symver __collector_fsetpos_2_0,fsetpos@GLIBC_2.0");
#endif
#if ARCH(Intel) && WSIZE(32)
@@ -3511,6 +3501,7 @@ fsetpos (FILE *stream, const fpos_t *pos)
static int
__collector_fsetpos64_symver (int(real_fsetpos64) (), FILE *stream, const fpos64_t *pos);
+SYMVER_ATTRIBUTE (__collector_fsetpos64_2_2, fsetpos64@@GLIBC_2.2)
int
__collector_fsetpos64_2_2 (FILE *stream, const fpos64_t *pos)
{
@@ -3521,6 +3512,7 @@ __collector_fsetpos64_2_2 (FILE *stream, const fpos64_t *pos)
return __collector_fsetpos64_symver (CALL_REAL (fsetpos64_2_2), stream, pos);
}
+SYMVER_ATTRIBUTE (__collector_fsetpos64_2_1, fsetpos64@GLIBC_2.1)
int
__collector_fsetpos64_2_1 (FILE *stream, const fpos64_t *pos)
{
@@ -3531,9 +3523,6 @@ __collector_fsetpos64_2_1 (FILE *stream, const fpos64_t *pos)
return __collector_fsetpos64_symver (CALL_REAL (fsetpos64_2_1), stream, pos);
}
-__asm__(".symver __collector_fsetpos64_2_2,fsetpos64@@GLIBC_2.2");
-__asm__(".symver __collector_fsetpos64_2_1,fsetpos64@GLIBC_2.1");
-
static int
__collector_fsetpos64_symver (int(real_fsetpos64) (), FILE *stream, const fpos64_t *pos)
{
diff --git a/gprofng/libcollector/linetrace.c b/gprofng/libcollector/linetrace.c
index 970d68c..978c550 100644
--- a/gprofng/libcollector/linetrace.c
+++ b/gprofng/libcollector/linetrace.c
@@ -1353,6 +1353,7 @@ __collector_posix_spawn_symver (int(real_posix_spawn) (),
const posix_spawnattr_t *attrp,
char *const argv[], char *const envp[]);
+SYMVER_ATTRIBUTE (__collector_posix_spawn_2_15, posix_spawn@@GLIBC_2.15)
int
__collector_posix_spawn_2_15 (pid_t *pidp, const char *path,
const posix_spawn_file_actions_t *file_actions,
@@ -1367,9 +1368,8 @@ __collector_posix_spawn_2_15 (pid_t *pidp, const char *path,
path, file_actions, attrp, argv, envp);
}
-__asm__(".symver __collector_posix_spawn_2_15,posix_spawn@@GLIBC_2.15");
-
#if WSIZE(32)
+SYMVER_ATTRIBUTE (__collector_posix_spawn_2_2, posix_spawn@GLIBC_2.2)
int
__collector_posix_spawn_2_2 (pid_t *pidp, const char *path,
const posix_spawn_file_actions_t *file_actions,
@@ -1384,9 +1384,8 @@ __collector_posix_spawn_2_2 (pid_t *pidp, const char *path,
path, file_actions, attrp, argv, envp);
}
-__asm__(".symver __collector_posix_spawn_2_2,posix_spawn@GLIBC_2.2");
-
#else /* ^WSIZE(32) */
+SYMVER_ATTRIBUTE (__collector_posix_spawn_2_2_5, posix_spawn@GLIBC_2.2.5)
int
__collector_posix_spawn_2_2_5 (pid_t *pidp, const char *path,
const posix_spawn_file_actions_t *file_actions,
@@ -1400,8 +1399,6 @@ __collector_posix_spawn_2_2_5 (pid_t *pidp, const char *path,
return __collector_posix_spawn_symver (CALL_REAL (posix_spawn_2_2_5), pidp,
path, file_actions, attrp, argv, envp);
}
-
-__asm__(".symver __collector_posix_spawn_2_2_5,posix_spawn@GLIBC_2.2.5");
#endif /* ^WSIZE(32) */
static int
@@ -1466,6 +1463,7 @@ __collector_posix_spawnp_symver (int(real_posix_spawnp) (), pid_t *pidp,
const posix_spawnattr_t *attrp,
char *const argv[], char *const envp[]);
+SYMVER_ATTRIBUTE (__collector_posix_spawnp_2_15, posix_spawnp@@GLIBC_2.15)
int // Common interposition
__collector_posix_spawnp_2_15 (pid_t *pidp, const char *path,
const posix_spawn_file_actions_t *file_actions,
@@ -1480,10 +1478,9 @@ __collector_posix_spawnp_2_15 (pid_t *pidp, const char *path,
path, file_actions, attrp, argv, envp);
}
-__asm__(".symver __collector_posix_spawnp_2_15,posix_spawnp@@GLIBC_2.15");
-
#if WSIZE(32)
+SYMVER_ATTRIBUTE (__collector_posix_spawnp_2_2, posix_spawnp@GLIBC_2.2)
int
__collector_posix_spawnp_2_2 (pid_t *pidp, const char *path,
const posix_spawn_file_actions_t *file_actions,
@@ -1498,9 +1495,8 @@ __collector_posix_spawnp_2_2 (pid_t *pidp, const char *path,
path, file_actions, attrp, argv, envp);
}
-__asm__(".symver __collector_posix_spawnp_2_2,posix_spawnp@GLIBC_2.2");
-
#else /* ^WSIZE(32) */
+SYMVER_ATTRIBUTE (__collector_posix_spawnp_2_2_5, posix_spawnp@GLIBC_2.2.5)
int
__collector_posix_spawnp_2_2_5 (pid_t *pidp, const char *path,
const posix_spawn_file_actions_t *file_actions,
@@ -1515,8 +1511,6 @@ __collector_posix_spawnp_2_2_5 (pid_t *pidp, const char *path,
path, file_actions, attrp, argv, envp);
}
-__asm__(".symver __collector_posix_spawnp_2_2_5,posix_spawnp@GLIBC_2.2.5");
-
#endif /* ^WSIZE(32) */
static int
@@ -1601,6 +1595,7 @@ __collector_system (const char *cmd)
static FILE *
__collector_popen_symver (FILE*(real_popen) (), const char *cmd, const char *mode);
+SYMVER_ATTRIBUTE (__collector_popen_2_1, popen@@GLIBC_2.1)
FILE *
__collector_popen_2_1 (const char *cmd, const char *mode)
{
@@ -1610,6 +1605,7 @@ __collector_popen_2_1 (const char *cmd, const char *mode)
return __collector_popen_symver (CALL_REALF (popen_2_1), cmd, mode);
}
+SYMVER_ATTRIBUTE (__collector_popen_2_0, popen@GLIBC_2.0)
FILE *
__collector_popen_2_0 (const char *cmd, const char *mode)
{
@@ -1619,6 +1615,7 @@ __collector_popen_2_0 (const char *cmd, const char *mode)
return __collector_popen_symver (CALL_REALF (popen_2_0), cmd, mode);
}
+SYMVER_ATTRIBUTE (__collector__popen_2_1, _popen@@GLIBC_2.1)
FILE *
__collector__popen_2_1 (const char *cmd, const char *mode)
{
@@ -1628,6 +1625,7 @@ __collector__popen_2_1 (const char *cmd, const char *mode)
return __collector_popen_symver (CALL_REALF (popen_2_1), cmd, mode);
}
+SYMVER_ATTRIBUTE (__collector__popen_2_0, _popen@GLIBC_2.0)
FILE *
__collector__popen_2_0 (const char *cmd, const char *mode)
{
@@ -1635,11 +1633,6 @@ __collector__popen_2_0 (const char *cmd, const char *mode)
init_lineage_intf ();
return __collector_popen_symver (CALL_REALF (popen_2_0), cmd, mode);
}
-
-__asm__(".symver __collector_popen_2_1,popen@@GLIBC_2.1");
-__asm__(".symver __collector_popen_2_0,popen@GLIBC_2.0");
-__asm__(".symver __collector__popen_2_1,_popen@@GLIBC_2.1");
-__asm__(".symver __collector__popen_2_0,_popen@GLIBC_2.0");
#else // WSIZE(64)
FILE * popen () __attribute__ ((weak, alias ("__collector_popen")));
#endif
diff --git a/gprofng/libcollector/mmaptrace.c b/gprofng/libcollector/mmaptrace.c
index ac5c997..bf3294d 100644
--- a/gprofng/libcollector/mmaptrace.c
+++ b/gprofng/libcollector/mmaptrace.c
@@ -1556,6 +1556,7 @@ munmap (void *start, size_t length)
static void *
__collector_dlopen_symver (void*(real_dlopen) (), void *caller, const char *pathname, int mode);
+SYMVER_ATTRIBUTE (__collector_dlopen_2_1, dlopen@@GLIBC_2.1)
void *
__collector_dlopen_2_1 (const char *pathname, int mode)
{
@@ -1565,6 +1566,7 @@ __collector_dlopen_2_1 (const char *pathname, int mode)
return __collector_dlopen_symver (CALL_REAL (dlopen_2_1), caller, pathname, mode);
}
+SYMVER_ATTRIBUTE (__collector_dlopen_2_0, dlopen@GLIBC_2.0)
void *
__collector_dlopen_2_0 (const char *pathname, int mode)
{
@@ -1573,10 +1575,6 @@ __collector_dlopen_2_0 (const char *pathname, int mode)
void* caller = __builtin_return_address (0); // must be called inside dlopen first layer interpostion
return __collector_dlopen_symver (CALL_REAL (dlopen_2_0), caller, pathname, mode);
}
-
-__asm__(".symver __collector_dlopen_2_1,dlopen@@GLIBC_2.1");
-__asm__(".symver __collector_dlopen_2_0,dlopen@GLIBC_2.0");
-
#endif
#if (ARCH(Intel) && WSIZE(32)) || ARCH(SPARC)
diff --git a/gprofng/libcollector/synctrace.c b/gprofng/libcollector/synctrace.c
index 401c8f2..969c681 100644
--- a/gprofng/libcollector/synctrace.c
+++ b/gprofng/libcollector/synctrace.c
@@ -758,6 +758,10 @@ pthread_mutex_lock (pthread_mutex_t *mp)
static int
__collector_pthread_cond_wait_symver (int(real_pthread_cond_wait) (), pthread_cond_t *cond, pthread_mutex_t *mutex);
+#if ARCH(Intel) || ARCH(SPARC)
+SYMVER_ATTRIBUTE (__collector_pthread_cond_wait_2_3_2,
+ pthread_cond_wait@@GLIBC_2.3.2)
+#endif
int
__collector_pthread_cond_wait_2_3_2 (pthread_cond_t *cond, pthread_mutex_t *mutex)
{
@@ -767,12 +771,10 @@ __collector_pthread_cond_wait_2_3_2 (pthread_cond_t *cond, pthread_mutex_t *mute
return __collector_pthread_cond_wait_symver (CALL_REAL (pthread_cond_wait_2_3_2), cond, mutex);
}
-#if ARCH(Intel) || ARCH(SPARC)
-__asm__(".symver __collector_pthread_cond_wait_2_3_2,pthread_cond_wait@@GLIBC_2.3.2");
-#endif
-
#if WSIZE(32)
+SYMVER_ATTRIBUTE (__collector_pthread_cond_wait_2_0,
+ pthread_cond_wait@GLIBC_2.0)
int
__collector_pthread_cond_wait_2_0 (pthread_cond_t *cond, pthread_mutex_t *mutex)
{
@@ -781,11 +783,10 @@ __collector_pthread_cond_wait_2_0 (pthread_cond_t *cond, pthread_mutex_t *mutex)
TprintfT (DBG_LTT, "linetrace: GLIBC: __collector_pthread_cond_wait_2_0@%p\n", CALL_REAL (pthread_cond_wait_2_0));
return __collector_pthread_cond_wait_symver (CALL_REAL (pthread_cond_wait_2_0), cond, mutex);
}
-
-__asm__(".symver __collector_pthread_cond_wait_2_0,pthread_cond_wait@GLIBC_2.0");
-
#else // WSIZE(64)
#if ARCH(Intel)
+SYMVER_ATTRIBUTE (__collector_pthread_cond_wait_2_2_5,
+ pthread_cond_wait@GLIBC_2.2.5)
int
__collector_pthread_cond_wait_2_2_5 (pthread_cond_t *cond, pthread_mutex_t *mutex)
{
@@ -794,10 +795,10 @@ __collector_pthread_cond_wait_2_2_5 (pthread_cond_t *cond, pthread_mutex_t *mute
TprintfT (DBG_LTT, "linetrace: GLIBC: __collector_pthread_cond_wait_2_2_5@%p\n", CALL_REAL (pthread_cond_wait_2_2_5));
return __collector_pthread_cond_wait_symver (CALL_REAL (pthread_cond_wait_2_2_5), cond, mutex);
}
-
-__asm__(".symver __collector_pthread_cond_wait_2_2_5,pthread_cond_wait@GLIBC_2.2.5");
#elif ARCH(SPARC)
+SYMVER_ATTRIBUTE (__collector_pthread_cond_wait_2_2,
+ pthread_cond_wait@GLIBC_2.2)
int
__collector_pthread_cond_wait_2_2 (pthread_cond_t *cond, pthread_mutex_t *mutex)
{
@@ -806,8 +807,6 @@ __collector_pthread_cond_wait_2_2 (pthread_cond_t *cond, pthread_mutex_t *mutex)
TprintfT (DBG_LTT, "linetrace: GLIBC: __collector_pthread_cond_wait_2_2@%p\n", CALL_REAL (pthread_cond_wait_2_2));
return __collector_pthread_cond_wait_symver (CALL_REAL (pthread_cond_wait_2_2), cond, mutex);
}
-
-__asm__(".symver __collector_pthread_cond_wait_2_2,pthread_cond_wait@GLIBC_2.2");
#endif // ARCH()
#endif // WSIZE()
@@ -852,6 +851,10 @@ __collector_pthread_cond_timedwait_symver (int(real_pthread_cond_timedwait) (),
pthread_mutex_t *mutex,
const struct timespec *abstime);
+#if ARCH(Intel) || ARCH(SPARC)
+SYMVER_ATTRIBUTE (__collector_pthread_cond_timedwait_2_3_2,
+ pthread_cond_timedwait@@GLIBC_2.3.2)
+#endif // ARCH()
int
__collector_pthread_cond_timedwait_2_3_2 (pthread_cond_t *cond,
pthread_mutex_t *mutex,
@@ -863,11 +866,9 @@ __collector_pthread_cond_timedwait_2_3_2 (pthread_cond_t *cond,
return __collector_pthread_cond_timedwait_symver (CALL_REAL (pthread_cond_timedwait_2_3_2), cond, mutex, abstime);
}
-#if ARCH(Intel) || ARCH(SPARC)
-__asm__(".symver __collector_pthread_cond_timedwait_2_3_2,pthread_cond_timedwait@@GLIBC_2.3.2");
-#endif // ARCH()
-
#if WSIZE(32)
+SYMVER_ATTRIBUTE (__collector_pthread_cond_timedwait_2_0,
+ pthread_cond_timedwait@GLIBC_2.0)
int
__collector_pthread_cond_timedwait_2_0 (pthread_cond_t *cond,
pthread_mutex_t *mutex,
@@ -878,11 +879,10 @@ __collector_pthread_cond_timedwait_2_0 (pthread_cond_t *cond,
TprintfT (DBG_LTT, "linetrace: GLIBC: __collector_pthread_cond_timedwait_2_0@%p\n", CALL_REAL (pthread_cond_timedwait_2_0));
return __collector_pthread_cond_timedwait_symver (CALL_REAL (pthread_cond_timedwait_2_0), cond, mutex, abstime);
}
-
-__asm__(".symver __collector_pthread_cond_timedwait_2_0,pthread_cond_timedwait@GLIBC_2.0");
-
#else // WSIZE(64)
#if ARCH(Intel)
+SYMVER_ATTRIBUTE (__collector_pthread_cond_timedwait_2_2_5,
+ pthread_cond_timedwait@GLIBC_2.2.5)
int
__collector_pthread_cond_timedwait_2_2_5 (pthread_cond_t *cond,
pthread_mutex_t *mutex,
@@ -893,10 +893,10 @@ __collector_pthread_cond_timedwait_2_2_5 (pthread_cond_t *cond,
TprintfT (DBG_LTT, "linetrace: GLIBC: __collector_pthread_cond_timedwait_2_2_5@%p\n", CALL_REAL (pthread_cond_timedwait_2_2_5));
return __collector_pthread_cond_timedwait_symver (CALL_REAL (pthread_cond_timedwait_2_2_5), cond, mutex, abstime);
}
-
-__asm__(".symver __collector_pthread_cond_timedwait_2_2_5,pthread_cond_timedwait@GLIBC_2.2.5");
#elif ARCH(SPARC)
+SYMVER_ATTRIBUTE (__collector_pthread_cond_timedwait_2_2,
+ pthread_cond_timedwait@GLIBC_2.2)
int
__collector_pthread_cond_timedwait_2_2 (pthread_cond_t *cond,
pthread_mutex_t *mutex,
@@ -907,8 +907,6 @@ __collector_pthread_cond_timedwait_2_2 (pthread_cond_t *cond,
TprintfT (DBG_LTT, "linetrace: GLIBC: __collector_pthread_cond_timedwait_2_2@%p\n", CALL_REAL (pthread_cond_timedwait_2_2));
return __collector_pthread_cond_timedwait_symver (CALL_REAL (pthread_cond_timedwait_2_2), cond, mutex, abstime);
}
-
-__asm__(".symver __collector_pthread_cond_timedwait_2_2,pthread_cond_timedwait@GLIBC_2.2");
#endif // ARCH()
#endif // WSIZE()
@@ -987,6 +985,7 @@ pthread_join (pthread_t target_thread, void **status)
static int
__collector_sem_wait_symver (int(real_sem_wait) (), sem_t *sp);
+SYMVER_ATTRIBUTE (__collector_sem_wait_2_1, sem_wait@@GLIBC_2.1)
int
__collector_sem_wait_2_1 (sem_t *sp)
{
@@ -996,6 +995,7 @@ __collector_sem_wait_2_1 (sem_t *sp)
return __collector_sem_wait_symver (CALL_REAL (sem_wait_2_1), sp);
}
+SYMVER_ATTRIBUTE (__collector_sem_wait_2_0, sem_wait@GLIBC_2.0)
int
__collector_sem_wait_2_0 (sem_t *sp)
{
@@ -1004,9 +1004,6 @@ __collector_sem_wait_2_0 (sem_t *sp)
TprintfT (DBG_LTT, "linetrace: GLIBC: __collector_sem_wait_2_0@%p\n", CALL_REAL (sem_wait_2_0));
return __collector_sem_wait_symver (CALL_REAL (sem_wait_2_0), sp);
}
-
-__asm__(".symver __collector_sem_wait_2_1,sem_wait@@GLIBC_2.1");
-__asm__(".symver __collector_sem_wait_2_0,sem_wait@GLIBC_2.0");
#endif
#if ARCH(Intel) && WSIZE(32)
diff --git a/gprofng/src/collector_module.h b/gprofng/src/collector_module.h
index 512af7a..f608dab 100644
--- a/gprofng/src/collector_module.h
+++ b/gprofng/src/collector_module.h
@@ -220,4 +220,15 @@ extern "C"
}
#endif
+#ifdef __has_attribute
+# if __has_attribute (__symver__)
+# define SYMVER_ATTRIBUTE(sym, symver) \
+ __attribute__ ((__symver__ (#symver)))
+# endif
+#endif
+#ifndef SYMVER_ATTRIBUTE
+# define SYMVER_ATTRIBUTE(sym, symver) \
+ __asm__(".symver " #sym "," #symver);
+#endif
+
#endif /* _COLLECTOR_MODULE_H */