summaryrefslogtreecommitdiff
path: root/usr/src/lib/libctf/common
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/lib/libctf/common')
-rw-r--r--usr/src/lib/libctf/common/ctf_convert.c2
-rw-r--r--usr/src/lib/libctf/common/ctf_lib.c22
-rw-r--r--usr/src/lib/libctf/common/libctf.h2
-rw-r--r--usr/src/lib/libctf/common/mapfile-vers1
4 files changed, 23 insertions, 4 deletions
diff --git a/usr/src/lib/libctf/common/ctf_convert.c b/usr/src/lib/libctf/common/ctf_convert.c
index 6dff7994f8..31b2ed429d 100644
--- a/usr/src/lib/libctf/common/ctf_convert.c
+++ b/usr/src/lib/libctf/common/ctf_convert.c
@@ -111,7 +111,7 @@ ctf_has_c_source(Elf *elf, char *errmsg, size_t errlen)
return (ret);
}
-static ctf_file_t *
+ctf_file_t *
ctf_elfconvert(ctf_convert_t *cch, int fd, Elf *elf, 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..f885b3d1c1 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,30 @@ _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,
+ * but since we don't allow build machines that are older that the
+ * notion of the native root anymore, we do it all the time anyway.
+ */
+ zroot = zone_get_nroot();
+
+ 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 9412143a91..05224b1cd7 100644
--- a/usr/src/lib/libctf/common/libctf.h
+++ b/usr/src/lib/libctf/common/libctf.h
@@ -120,6 +120,8 @@ extern int ctf_convert_set_label(ctf_convert_t *, const char *);
extern int ctf_convert_set_nthreads(ctf_convert_t *, uint_t);
extern int ctf_convert_add_ignore(ctf_convert_t *, const char *);
+extern ctf_file_t *ctf_elfconvert(ctf_convert_t *, int, Elf *, int *, char *,
+ size_t);
extern ctf_file_t *ctf_fdconvert(ctf_convert_t *, int, int *, char *, size_t);
diff --git a/usr/src/lib/libctf/common/mapfile-vers b/usr/src/lib/libctf/common/mapfile-vers
index 09d4b8f084..a0fee17cac 100644
--- a/usr/src/lib/libctf/common/mapfile-vers
+++ b/usr/src/lib/libctf/common/mapfile-vers
@@ -87,6 +87,7 @@ SYMBOL_VERSION SUNWprivate_1.2 {
ctf_diff_types;
ctf_discard;
ctf_dup;
+ ctf_elfconvert;
ctf_elffdwrite;
ctf_elfwrite;
ctf_enum_value;