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 (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 22 /* 23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #include <_elfwrap.h> 28 29 #if defined(lint) 30 #include <machdep.h> 31 #else 32 #if defined(ELFWRAP_X86) 33 #include <i386/machdep_x86.h> 34 #if defined(_ELF64) 35 #define target_init target_init_amd64 36 #else 37 #define target_init target_init_i386 38 #endif 39 #endif 40 #if defined(ELFWRAP_SPARC) 41 #include <sparc/machdep_sparc.h> 42 #if defined(_ELF64) 43 #define target_init target_init_sparcv9 44 #else 45 #define target_init target_init_sparc 46 #endif 47 #endif 48 #endif 49 50 /* 51 * Establish any target specific data. This module is compiled using the 52 * defines shown above, to provide data for each target machine elfwrap(1) 53 * supports - each target module being assigned a unique interface name. 54 */ 55 void 56 target_init(TargDesc_t *tdp) 57 { 58 /* 59 * ELF header information. 60 */ 61 tdp->td_class = M_CLASS; /* e_ident[EI_CLASS] */ 62 tdp->td_data = M_DATA; /* e_ident[EI_DATA] */ 63 tdp->td_mach = M_MACH; /* e_machine */ 64 65 /* 66 * Default data buffer alignment. 67 */ 68 tdp->td_align = M_WORD_ALIGN; /* d_align */ 69 70 /* 71 * Symbol table entry size. 72 */ 73 tdp->td_symsz = sizeof (Sym); /* d_size */ 74 } 75