diff options
Diffstat (limited to 'usr/src/lib/libctf')
-rw-r--r-- | usr/src/lib/libctf/common/ctf_convert.c | 2 | ||||
-rw-r--r-- | usr/src/lib/libctf/common/ctf_lib.c | 28 | ||||
-rw-r--r-- | usr/src/lib/libctf/common/libctf.h | 2 | ||||
-rw-r--r-- | usr/src/lib/libctf/common/mapfile-vers | 1 |
4 files changed, 29 insertions, 4 deletions
diff --git a/usr/src/lib/libctf/common/ctf_convert.c b/usr/src/lib/libctf/common/ctf_convert.c index 06f4135593..9441aa6ed7 100644 --- a/usr/src/lib/libctf/common/ctf_convert.c +++ b/usr/src/lib/libctf/common/ctf_convert.c @@ -99,7 +99,7 @@ ctf_has_c_source(Elf *elf, char *errmsg, size_t errlen) return (ret); } -static ctf_file_t * +ctf_file_t * ctf_elfconvert(int fd, Elf *elf, const char *label, uint_t nthrs, uint_t flags, int *errp, char *errbuf, size_t errlen) { diff --git a/usr/src/lib/libctf/common/ctf_lib.c b/usr/src/lib/libctf/common/ctf_lib.c index 4cb5ce0ac5..5177409200 100644 --- a/usr/src/lib/libctf/common/ctf_lib.c +++ b/usr/src/lib/libctf/common/ctf_lib.c @@ -37,6 +37,7 @@ #include <dlfcn.h> #include <gelf.h> #include <zlib.h> +#include <zone.h> #include <sys/debug.h> #ifdef _LP64 @@ -92,15 +93,36 @@ _libctf_init(void) void * ctf_zopen(int *errp) { - ctf_dprintf("decompressing CTF data using %s\n", _libctf_zlib); + char buf[MAXPATHLEN]; + const char *path = _libctf_zlib, *zroot; if (zlib.z_dlp != NULL) return (zlib.z_dlp); /* library is already loaded */ - if (access(_libctf_zlib, R_OK) == -1) + /* + * Get the zone native root. For the tools build, we don't need + * this (it seems fair to impose that we always build the system in + * a native zone), and we want to allow build machines that are older + * that the notion of the native root, so we only actually make this + * call if we're not the tools build. + */ +#ifndef CTF_TOOLS_BUILD + zroot = zone_get_nroot(); +#else + zroot = NULL; +#endif + + if (zroot != NULL) { + (void) snprintf(buf, MAXPATHLEN, "%s/%s", zroot, _libctf_zlib); + path = buf; + } + + ctf_dprintf("decompressing CTF data using %s\n", path); + + if (access(path, R_OK) == -1) return (ctf_set_open_errno(errp, ECTF_ZMISSING)); - if ((zlib.z_dlp = dlopen(_libctf_zlib, RTLD_LAZY | RTLD_LOCAL)) == NULL) + if ((zlib.z_dlp = dlopen(path, RTLD_LAZY | RTLD_LOCAL)) == NULL) return (ctf_set_open_errno(errp, ECTF_ZINIT)); zlib.z_uncompress = (int (*)()) dlsym(zlib.z_dlp, "uncompress"); diff --git a/usr/src/lib/libctf/common/libctf.h b/usr/src/lib/libctf/common/libctf.h index 57b8376eed..78b0a7a786 100644 --- a/usr/src/lib/libctf/common/libctf.h +++ b/usr/src/lib/libctf/common/libctf.h @@ -81,6 +81,8 @@ extern void ctf_diff_fini(ctf_diff_t *); */ #define CTF_ALLOW_MISSING_DEBUG 0x01 +extern ctf_file_t *ctf_elfconvert(int, Elf *, const char *, uint_t, uint_t, + int *, char *, size_t); extern ctf_file_t *ctf_fdconvert(int, const char *, uint_t, uint_t, int *, char *, size_t); diff --git a/usr/src/lib/libctf/common/mapfile-vers b/usr/src/lib/libctf/common/mapfile-vers index 37ef440ab3..9281bbfff5 100644 --- a/usr/src/lib/libctf/common/mapfile-vers +++ b/usr/src/lib/libctf/common/mapfile-vers @@ -78,6 +78,7 @@ SYMBOL_VERSION SUNWprivate_1.2 { ctf_diff_types; ctf_discard; ctf_dup; + ctf_elfconvert; ctf_elffdwrite; ctf_elfwrite; ctf_enum_value; |