View | Details | Raw Unified | Return to bug 142258
Collapse All | Expand All

(-)rtld.1 (+5 lines)
Lines 154-159 Link Here
154
will be searched first
154
will be searched first
155
followed by the set of built-in standard directories.
155
followed by the set of built-in standard directories.
156
This variable is unset for set-user-ID and set-group-ID programs.
156
This variable is unset for set-user-ID and set-group-ID programs.
157
.It Ev LD_PRINT_ERROR
158
When set to a nonempty string, causes
159
.Nm
160
to print any error messages that would be available to the application via
161
.Xr dlopen 3 .
157
.It Ev LD_BIND_NOW
162
.It Ev LD_BIND_NOW
158
When set to a nonempty string, causes
163
When set to a nonempty string, causes
159
.Nm
164
.Nm
(-)rtld.c (+10 lines)
Lines 164-169 Link Here
164
static char *ld_elf_hints_path;	/* Environment variable for alternative hints path */
164
static char *ld_elf_hints_path;	/* Environment variable for alternative hints path */
165
static char *ld_tracing;	/* Called from ldd to print libs */
165
static char *ld_tracing;	/* Called from ldd to print libs */
166
static char *ld_utrace;		/* Use utrace() to log events. */
166
static char *ld_utrace;		/* Use utrace() to log events. */
167
static char *ld_printerror;	/* Report _rtld_error() messages to stdout */
167
static Obj_Entry *obj_list;	/* Head of linked list of shared objects */
168
static Obj_Entry *obj_list;	/* Head of linked list of shared objects */
168
static Obj_Entry **obj_tail;	/* Link field of last object in list */
169
static Obj_Entry **obj_tail;	/* Link field of last object in list */
169
static Obj_Entry *obj_main;	/* The main program shared object */
170
static Obj_Entry *obj_main;	/* The main program shared object */
Lines 244-249 Link Here
244
    (dlp)->num_alloc = obj_count,				\
245
    (dlp)->num_alloc = obj_count,				\
245
    (dlp)->num_used = 0)
246
    (dlp)->num_used = 0)
246
247
248
/*
249
 * The following macros and struct utrace_rtld must be kept aligned with
250
 * the equivalent code in kdump.c
251
 */
247
#define	UTRACE_DLOPEN_START		1
252
#define	UTRACE_DLOPEN_START		1
248
#define	UTRACE_DLOPEN_STOP		2
253
#define	UTRACE_DLOPEN_STOP		2
249
#define	UTRACE_DLCLOSE_START		3
254
#define	UTRACE_DLCLOSE_START		3
Lines 254-259 Link Here
254
#define	UTRACE_PRELOAD_FINISHED		8
259
#define	UTRACE_PRELOAD_FINISHED		8
255
#define	UTRACE_INIT_CALL		9
260
#define	UTRACE_INIT_CALL		9
256
#define	UTRACE_FINI_CALL		10
261
#define	UTRACE_FINI_CALL		10
262
#define	UTRACE_RTLD_ERROR		11
257
263
258
struct utrace_rtld {
264
struct utrace_rtld {
259
	char sig[4];			/* 'RTLD' */
265
	char sig[4];			/* 'RTLD' */
Lines 384-389 Link Here
384
	(ld_elf_hints_path != NULL);
390
	(ld_elf_hints_path != NULL);
385
    ld_tracing = getenv(LD_ "TRACE_LOADED_OBJECTS");
391
    ld_tracing = getenv(LD_ "TRACE_LOADED_OBJECTS");
386
    ld_utrace = getenv(LD_ "UTRACE");
392
    ld_utrace = getenv(LD_ "UTRACE");
393
    ld_printerror = getenv(LD_ "PRINT_ERROR");
387
394
388
    if ((ld_elf_hints_path == NULL) || strlen(ld_elf_hints_path) == 0)
395
    if ((ld_elf_hints_path == NULL) || strlen(ld_elf_hints_path) == 0)
389
	ld_elf_hints_path = _PATH_ELF_HINTS;
396
	ld_elf_hints_path = _PATH_ELF_HINTS;
Lines 612-617 Link Here
612
    vsnprintf(buf, sizeof buf, fmt, ap);
619
    vsnprintf(buf, sizeof buf, fmt, ap);
613
    error_message = buf;
620
    error_message = buf;
614
    va_end(ap);
621
    va_end(ap);
622
    if (ld_printerror != NULL && ld_printerror != '\0')
623
	printf("RTLD Error: %s\n", error_message);
624
    LD_UTRACE(UTRACE_RTLD_ERROR, NULL, NULL, 0, 0, error_message);
615
}
625
}
616
626
617
/*
627
/*
(-)kdump.c (+9 lines)
Lines 1009-1014 Link Here
1009
		cs->user ? "user" : "kernel");
1009
		cs->user ? "user" : "kernel");
1010
}
1010
}
1011
1011
1012
/*
1013
 * The following macros and struct utrace_rtld must be kept aligned with
1014
 * the equivalent code in rtld.c
1015
 */
1012
#define	UTRACE_DLOPEN_START		1
1016
#define	UTRACE_DLOPEN_START		1
1013
#define	UTRACE_DLOPEN_STOP		2
1017
#define	UTRACE_DLOPEN_STOP		2
1014
#define	UTRACE_DLCLOSE_START		3
1018
#define	UTRACE_DLCLOSE_START		3
Lines 1019-1024 Link Here
1019
#define	UTRACE_PRELOAD_FINISHED		8
1023
#define	UTRACE_PRELOAD_FINISHED		8
1020
#define	UTRACE_INIT_CALL		9
1024
#define	UTRACE_INIT_CALL		9
1021
#define	UTRACE_FINI_CALL		10
1025
#define	UTRACE_FINI_CALL		10
1026
#define	UTRACE_RTLD_ERROR		11
1022
1027
1023
struct utrace_rtld {
1028
struct utrace_rtld {
1024
	char sig[4];				/* 'RTLD' */
1029
	char sig[4];				/* 'RTLD' */
Lines 1097-1102 Link Here
1097
		printf("RTLD: fini %p for %p (%s)\n", ut->mapbase, ut->handle,
1102
		printf("RTLD: fini %p for %p (%s)\n", ut->mapbase, ut->handle,
1098
		    ut->name);
1103
		    ut->name);
1099
		break;
1104
		break;
1105
	case UTRACE_RTLD_ERROR:
1106
		printf("RTLD: error: %s\n", ut->name);
1107
		break;
1108
1100
	default:
1109
	default:
1101
		p += 4;
1110
		p += 4;
1102
		len -= 4;
1111
		len -= 4;

Return to bug 142258