From ad1633b34b3043f9527d5af2eb833f3043bf1c2d Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Thu, 16 Nov 2017 07:14:29 +0000 Subject: Take r313504 into account when recomputing the string table length. When we encounter a USDT probe in a weak symbol, we emit an alias for the probe function symbol. Such aliases are named differently from the aliases we emit for probes in local functions, so make sure to take that difference into account when resizing the output object file's string table. Otherwise, we underrun the string table buffer. PR: 223680 --- cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'cddl/contrib/opensolaris/lib/libdtrace') diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c index e5d30f0e037d..0184ec23a3ed 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c @@ -1416,8 +1416,15 @@ process_obj(dtrace_hdl_t *dtp, const char *obj, int *eprobesp) "expected %s to be of type function", s)); } - len = snprintf(NULL, 0, dt_symfmt, dt_symprefix, - objkey, s) + 1; + /* + * Aliases of weak symbols don't get a uniquifier. + */ + if (GELF_ST_BIND(fsym.st_info) == STB_WEAK) + len = snprintf(NULL, 0, dt_weaksymfmt, + dt_symprefix, s) + 1; + 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; -- cgit v1.2.3