xref: /titanic_50/usr/src/cmd/sgs/libld/common/ldmachdep.c (revision ba2be53024c0b999e74ba9adcd7d80fec5df8c57)
1*ba2be530Sab196087 /*
2*ba2be530Sab196087  * CDDL HEADER START
3*ba2be530Sab196087  *
4*ba2be530Sab196087  * The contents of this file are subject to the terms of the
5*ba2be530Sab196087  * Common Development and Distribution License (the "License").
6*ba2be530Sab196087  * You may not use this file except in compliance with the License.
7*ba2be530Sab196087  *
8*ba2be530Sab196087  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*ba2be530Sab196087  * or http://www.opensolaris.org/os/licensing.
10*ba2be530Sab196087  * See the License for the specific language governing permissions
11*ba2be530Sab196087  * and limitations under the License.
12*ba2be530Sab196087  *
13*ba2be530Sab196087  * When distributing Covered Code, include this CDDL HEADER in each
14*ba2be530Sab196087  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*ba2be530Sab196087  * If applicable, add the following below this CDDL HEADER, with the
16*ba2be530Sab196087  * fields enclosed by brackets "[]" replaced with your own identifying
17*ba2be530Sab196087  * information: Portions Copyright [yyyy] [name of copyright owner]
18*ba2be530Sab196087  *
19*ba2be530Sab196087  * CDDL HEADER END
20*ba2be530Sab196087  */
21*ba2be530Sab196087 
22*ba2be530Sab196087 /*
23*ba2be530Sab196087  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24*ba2be530Sab196087  * Use is subject to license terms.
25*ba2be530Sab196087  */
26*ba2be530Sab196087 #pragma ident	"%Z%%M%	%I%	%E% SMI"
27*ba2be530Sab196087 
28*ba2be530Sab196087 /*
29*ba2be530Sab196087  * Most of the source files in libld.so are not allowed to
30*ba2be530Sab196087  * include the machdep.h header, because it supplies machine
31*ba2be530Sab196087  * values that are specific to the platform running the linker,
32*ba2be530Sab196087  * instead of the target machine. This module is used to provide
33*ba2be530Sab196087  * information about the currently running host to the rest
34*ba2be530Sab196087  * of the linker code.
35*ba2be530Sab196087  */
36*ba2be530Sab196087 
37*ba2be530Sab196087 #include	<stdio.h>
38*ba2be530Sab196087 #include	<stdarg.h>
39*ba2be530Sab196087 #include	<_libld.h>
40*ba2be530Sab196087 #include	<machdep.h>
41*ba2be530Sab196087 
42*ba2be530Sab196087 /*
43*ba2be530Sab196087  * Return an ELF machine code that reflects the currently executing
44*ba2be530Sab196087  * linker. This information can be used in cross link situations to
45*ba2be530Sab196087  * know which platform the linker was running on, and whether the linker
46*ba2be530Sab196087  * itself was a 32 or 64-bit program.
47*ba2be530Sab196087  */
48*ba2be530Sab196087 Half
ld_sunw_ldmach(void)49*ba2be530Sab196087 ld_sunw_ldmach(void)
50*ba2be530Sab196087 {
51*ba2be530Sab196087 #ifdef _LP64
52*ba2be530Sab196087 	return (M_MACH_64);
53*ba2be530Sab196087 #else
54*ba2be530Sab196087 	return (M_MACH_32);
55*ba2be530Sab196087 #endif
56*ba2be530Sab196087 }
57