Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Nov 2017 07:14:29 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r325886 - head/cddl/contrib/opensolaris/lib/libdtrace/common
Message-ID:  <201711160714.vAG7ETkZ025834@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201711160714.vAG7ETkZ025834>