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