1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-16 10:20:30 +00:00

Respect the libdir option when linking drti.o, rather than hardcoding the

default path of /usr/lib(32)/dtrace.

MFC after:	3 weeks
This commit is contained in:
Mark Johnston 2015-05-17 23:08:01 +00:00
parent 45f8d9f9a8
commit 0fff3baa0b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=283038
2 changed files with 14 additions and 16 deletions

View File

@ -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;

View File

@ -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 @@ dt_vopen(int version, int flags, int *errp,
* 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);
}