xref: /titanic_52/usr/src/tools/ctf/common/ctf_headers.h (revision 4b22b9337f359bfd063322244f5336cc7c6ffcfa)
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 2003 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _CTF_HEADERS_H
28 #define	_CTF_HEADERS_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 /*
33  * Because the ON tools are executed on the system where they are built,
34  * the tools need to include the headers installed on the build system,
35  * rather than those in the ON source tree. However, some of the headers
36  * required by the tools are part of the ON source tree, but not delivered
37  * as part of Solaris.  These include the following:
38  *
39  * $(SRC)/lib/libctf/common/libctf.h
40  * $(SRC)/uts/common/sys/ctf_api.h
41  * $(SRC)/uts/common/sys/ctf.h
42  *
43  * These headers get installed in the proto area in the build environment
44  * under $(ROOT)/usr/include and $(ROOT)/usr/include/sys. Though these
45  * headers are not part of the release, in releases including and prior to
46  * Solaris 9, they did get installed on the build system via bfu. Therefore,
47  * we can not simply force the order of inclusion with -I/usr/include first
48  * in Makefile.ctf because we might actually get downlevel versions of the
49  * ctf headers. Depending on the order of the -I includes, we can also have
50  * a problem with mismatched headers when building the ctf tools with some
51  * headers getting pulled in from /usr/include and others from
52  * $(SRC)/uts/common/sys.
53  *
54  * To address the problem, we have done two things:
55  * 1) Created this header with a specific order of inclusion for the
56  *    ctf headers.  Because the <libctf.h> header includes <sys/ctf_api.h>
57  *    which in turn includes <sys/ctf.h> we need to include these in
58  *    reverse order to guarantee that we get the correct versions of
59  *    the headers.
60  * 2) In $(SRC)/tools/ctf/Makefile.ctf, we order the -I includes such
61  *    that we first search the directories where the ctf headers
62  *    live, followed by /usr/include, followed by $(SRC)/uts/common.
63  *    This last -I include is needed in order to prevent a build failure
64  *    when <sys/ctf_api.h> is included via a nested #include rather than
65  *    an explicit path #include.
66  */
67 
68 #include <uts/common/sys/ctf.h>
69 #include <uts/common/sys/ctf_api.h>
70 #include <lib/libctf/common/libctf.h>
71 
72 #endif /* _CTF_HEADERS_H */
73