git: d00431a7bd0c - main - libdtrace: Format USDT symbols correctly based on symbol binding
Mark Johnston
markj at FreeBSD.org
Sun Jan 10 23:00:02 UTC 2021
The branch main has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=d00431a7bd0c4b4607943baed588e58ad5ae6150
commit d00431a7bd0c4b4607943baed588e58ad5ae6150
Author: Mark Johnston <markj at FreeBSD.org>
AuthorDate: 2021-01-10 22:46:32 +0000
Commit: Mark Johnston <markj at FreeBSD.org>
CommitDate: 2021-01-10 22:58:38 +0000
libdtrace: Format USDT symbols correctly based on symbol binding
Before we did not handle weak symbols correctly, sometimes resulting in
link errors from dtrace -G when processing object files where functions
with weak aliases contain USDT probes.
Reported by: rlibby
Tested by: rlibby
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
---
cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c
index 8f32890057f0..0b3dac0224f9 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c
@@ -1344,18 +1344,24 @@ process_obj(dtrace_hdl_t *dtp, const char *obj, int *eprobesp)
/*
* Aliases of weak symbols don't get a uniquifier.
*/
- if (GELF_ST_BIND(fsym.st_info) == STB_WEAK)
+ if (GELF_ST_BIND(fsym.st_info) == STB_WEAK) {
len = snprintf(NULL, 0, dt_weaksymfmt,
dt_symprefix, s) + 1;
- else
+ } else {
len = snprintf(NULL, 0, dt_symfmt, dt_symprefix,
objkey, s) + 1;
+ }
if ((p = dt_alloc(dtp, len)) == NULL) {
dt_strtab_destroy(strtab);
goto err;
}
- (void) snprintf(p, len, dt_symfmt, dt_symprefix,
- objkey, s);
+ if (GELF_ST_BIND(fsym.st_info) == STB_WEAK) {
+ (void) snprintf(p, len, dt_weaksymfmt,
+ dt_symprefix, s);
+ } else {
+ (void) snprintf(p, len, dt_symfmt, dt_symprefix,
+ objkey, s);
+ }
if (dt_strtab_index(strtab, p) == -1) {
/*
More information about the dev-commits-src-main
mailing list