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