xref: /illumos-gate/usr/src/cmd/sgs/rtld/common/debugdata.c (revision d48be21240dfd051b689384ce2b23479d757f2d8)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 2001 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #include "_rtld.h"
28 
29 
30 /*
31  * Note: for initialization of librtld_db - it's required that
32  * the r_debug & rtlddb_priv structures be the *only data item*
33  * in the .data section, this is the only way we can gain
34  * full control over where it is placed.  This section is in turn
35  * placed at the beginning of ld.so.1's data segment (which
36  * AT_SUN_LDDATA points to :)).
37  */
38 
39 /*
40  * Private structure for passing of information between librltd_db
41  * and rtld.
42  *
43  * Note:  Any data that's being 'exported' to librtld_db must not
44  *	  require any 'relocations' before it can be examined.  That's
45  *	  because librtld_db will examine this structure before rtld has
46  *	  started to execute (and before it's relocated itself).  So - all
47  *	  data in this structure must be available at that point.
48  */
49 struct rtld_db_priv r_debug = {
50 	{
51 		R_DEBUG_VERSION,			/* version no. */
52 		0,					/* r_map */
53 		(unsigned long)rtld_db_dlactivity,	/* r_brk */
54 		RT_CONSISTENT,				/* r_state */
55 		0,					/* r_ldbase */
56 		0,					/* r_ldsomap */
57 		RD_NONE,				/* r_rdevent */
58 		RD_FL_NONE				/* r_flags */
59 	},
60 	R_RTLDDB_VERSION,		/* rtd_version */
61 	0,				/* rtd_objpad */
62 	0				/* rtd_dynlmlst */
63 };
64