diff options
author | markj <markj@FreeBSD.org> | 2015-05-17 23:08:01 +0000 |
---|---|---|
committer | markj <markj@FreeBSD.org> | 2015-05-17 23:08:01 +0000 |
commit | 78dbee31006a8fcbf453c24a21d6bb767e0ac43c (patch) | |
tree | 26da3c46ef83bbcbf573551658c42a61549656bb /cddl | |
parent | 164d3b3865b79a769a09ae8cea4137a49f662609 (diff) | |
download | FreeBSD-src-78dbee31006a8fcbf453c24a21d6bb767e0ac43c.zip FreeBSD-src-78dbee31006a8fcbf453c24a21d6bb767e0ac43c.tar.gz |
Respect the libdir option when linking drti.o, rather than hardcoding the
default path of /usr/lib(32)/dtrace.
MFC after: 3 weeks
Diffstat (limited to 'cddl')
-rw-r--r-- | cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c | 18 | ||||
-rw-r--r-- | cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c | 12 |
2 files changed, 14 insertions, 16 deletions
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c index af57e39..3bb14f7 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c @@ -1862,23 +1862,9 @@ dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t dflags, (void) snprintf(cmd, len, fmt, dtp->dt_ld_path, file, fd, drti); #else const char *fmt = "%s -o %s -r %s %s"; + dt_dirpath_t *dp = dt_list_next(&dtp->dt_lib_path); -#if defined(__amd64__) - /* - * Arches which default to 64-bit need to explicitly use - * the 32-bit library path. - */ - int use_32 = (dtp->dt_oflags & DTRACE_O_ILP32); -#else - /* - * Arches which are 32-bit only just use the normal - * library path. - */ - int use_32 = 0; -#endif - - (void) snprintf(drti, sizeof (drti), "/usr/lib%s/dtrace/drti.o", - use_32 ? "32" : ""); + (void) snprintf(drti, sizeof (drti), "%s/drti.o", dp->dir_path); len = snprintf(&tmp, 1, fmt, dtp->dt_ld_path, file, tfile, drti) + 1; diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c index c952243..80e4be9 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c @@ -792,6 +792,7 @@ const char *_dtrace_libdir = "/usr/lib/dtrace"; /* default library directory */ #ifdef illumos const char *_dtrace_provdir = "/dev/dtrace/provider"; /* provider directory */ #else +const char *_dtrace_libdir32 = "/usr/lib32/dtrace"; const char *_dtrace_provdir = "/dev/dtrace"; /* provider directory */ #endif @@ -1581,8 +1582,19 @@ alloc: * compile, and to provide better error reporting (because the full * reporting of compiler errors requires dtrace_open() to succeed). */ +#ifdef __FreeBSD__ +#ifdef __LP64__ + if ((dtp->dt_oflags & DTRACE_O_ILP32) != 0) { + if (dtrace_setopt(dtp, "libdir", _dtrace_libdir32) != 0) + return (set_open_errno(dtp, errp, dtp->dt_errno)); + } +#endif if (dtrace_setopt(dtp, "libdir", _dtrace_libdir) != 0) return (set_open_errno(dtp, errp, dtp->dt_errno)); +#else + if (dtrace_setopt(dtp, "libdir", _dtrace_libdir) != 0) + return (set_open_errno(dtp, errp, dtp->dt_errno)); +#endif return (dtp); } |