The branch stable/12 has been updated by markj:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=7f1032dff07a411bb2296ac2e13ac7e1752d25e1

commit 7f1032dff07a411bb2296ac2e13ac7e1752d25e1
Author:     Mark Johnston <[email protected]>
AuthorDate: 2021-01-10 22:46:32 +0000
Commit:     Mark Johnston <[email protected]>
CommitDate: 2021-01-18 17:00:40 +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
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit d00431a7bd0c4b4607943baed588e58ad5ae6150)
---
 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 d8448283b168..589b30aa8654 100644
--- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c
+++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c
@@ -1337,18 +1337,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) {
                                /*
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to