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 * Copyright 2018 Joyent, Inc. 26 */ 27 28 #ifndef _CTF_HEADERS_H 29 #define _CTF_HEADERS_H 30 31 /* 32 * Because the ON tools are executed on the system where they are built, 33 * the tools need to include the headers installed on the build system, 34 * rather than those in the ON source tree. However, some of the headers 35 * required by the tools are part of the ON source tree, but not delivered 36 * as part of illumos. These include the following: 37 * 38 * $(SRC)/lib/libctf/common/libctf.h 39 * $(SRC)/lib/libctf/common/libctf_impl.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 * We'll also include the local ccompile.h - older build systems often lack 68 * useful definitions like __unused. Finally, we'll also define ARRAY_SIZE: 69 * unfortunately, older systems sysmacros.h only have this defined for the 70 * kernel, and we can't easily pick it up otherwise. 71 */ 72 73 #include <uts/common/sys/ccompile.h> 74 #include <uts/common/sys/ctf.h> 75 #include <uts/common/sys/ctf_api.h> 76 #include <common/ctf/ctf_impl.h> 77 #include <lib/libctf/common/libctf.h> 78 #include <lib/libctf/common/libctf_impl.h> 79 80 #if !defined(ARRAY_SIZE) 81 #define ARRAY_SIZE(x) (sizeof (x) / sizeof (x[0])) 82 #endif 83 84 #endif /* _CTF_HEADERS_H */ 85