svn commit: r325886 - head/cddl/contrib/opensolaris/lib/libdtrace/common

Mark Johnston markj at FreeBSD.org
Thu Nov 16 07:14:30 UTC 2017


Author: markj
Date: Thu Nov 16 07:14:29 2017
New Revision: 325886
URL: https://svnweb.freebsd.org/changeset/base/325886

Log:
  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

Modified:
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c

Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c
==============================================================================
--- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c	Thu Nov 16 06:55:57 2017	(r325885)
+++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c	Thu Nov 16 07:14:29 2017	(r325886)
@@ -1416,8 +1416,15 @@ process_obj(dtrace_hdl_t *dtp, const char *obj, int *e
 				    "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;


More information about the svn-src-all mailing list