Home | History | Annotate | Download | only in common
      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 (c) 1988 AT&T
     24  *	  All Rights Reserved
     25  *
     26  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
     27  * Use is subject to license terms.
     28  */
     29 
     30 /*
     31  * Global variables
     32  */
     33 #include	<sys/elf.h>
     34 #include	"msg.h"
     35 #include	"_libld.h"
     36 
     37 Ld_heap		*ld_heap;	/* list of allocated blocks for */
     38 				/* 	link-edit dynamic allocations */
     39 APlist		*lib_support;	/* list of support libraries specified */
     40 				/*	(-S option) */
     41 int		demangle_flag;	/* symbol demangling required */
     42 
     43 /*
     44  * Paths and directories for library searches.  These are used to set up
     45  * linked lists of directories which are maintained in the ofl structure.
     46  */
     47 char		*Plibpath;	/* User specified -YP or defaults to LIBPATH */
     48 char		*Llibdir;	/* User specified -YL */
     49 char		*Ulibdir;	/* User specified -YU */
     50 
     51 /*
     52  * A default library search path is used if one was not supplied on the command
     53  * line.  Note: these strings can not use MSG_ORIG() since they are modified as
     54  * part of the path processing.
     55  */
     56 char		def64_Plibpath[] = "/lib/64:/usr/lib/64";
     57 char		def32_Plibpath[] = "/usr/ccs/lib:/lib:/usr/lib";
     58 
     59 /*
     60  * Rejected file error messages (indexed to match FLG_RJC_ values).
     61  */
     62 const Msg
     63 reject[] = {
     64 		MSG_STR_EMPTY,
     65 		MSG_REJ_MACH,		/* MSG_INTL(MSG_REJ_MACH) */
     66 		MSG_REJ_CLASS,		/* MSG_INTL(MSG_REJ_CLASS) */
     67 		MSG_REJ_DATA,		/* MSG_INTL(MSG_REJ_DATA) */
     68 		MSG_REJ_TYPE,		/* MSG_INTL(MSG_REJ_TYPE) */
     69 		MSG_REJ_BADFLAG,	/* MSG_INTL(MSG_REJ_BADFLAG) */
     70 		MSG_REJ_MISFLAG,	/* MSG_INTL(MSG_REJ_MISFLAG) */
     71 		MSG_REJ_VERSION,	/* MSG_INTL(MSG_REJ_VERSION) */
     72 		MSG_REJ_HAL,		/* MSG_INTL(MSG_REJ_HAL) */
     73 		MSG_REJ_US3,		/* MSG_INTL(MSG_REJ_US3) */
     74 		MSG_REJ_STR,		/* MSG_INTL(MSG_REJ_STR) */
     75 		MSG_REJ_UNKFILE,	/* MSG_INTL(MSG_REJ_UNKFILE) */
     76 		MSG_REJ_HWCAP_1,	/* MSG_INTL(MSG_REJ_HWCAP_1) */
     77 	};
     78 
     79 /*
     80  * Symbol types that we include in .SUNW_ldynsym sections
     81  * (indexed by STT_ values).
     82  */
     83 const int
     84 ldynsym_symtype[] = {
     85 		0,			/* STT_NOTYPE (not counting 1st slot) */
     86 		0,			/* STT_OBJECT */
     87 		1,			/* STT_FUNC */
     88 		0,			/* STT_SECTION */
     89 		1,			/* STT_FILE */
     90 		0,			/* STT_COMMON */
     91 		0,			/* STT_TLS */
     92 		0,			/* 7 */
     93 		0,			/* 8 */
     94 		0,			/* 9 */
     95 		0,			/* 10 */
     96 		0,			/* 11 */
     97 		0,			/* 12 */
     98 		0,			/* STT_SPARC_REGISTER */
     99 		0,			/* 14 */
    100 		0,			/* 15 */
    101 };
    102 #if STT_NUM != (STT_TLS + 1)
    103 #error "STT_NUM has grown. Update ldynsym_symtype[]."
    104 #endif
    105 
    106 /*
    107  * Symbol types that we include in .SUNW_dynsymsort sections
    108  * (indexed by STT_ values).
    109  */
    110 const int
    111 dynsymsort_symtype[] = {
    112 		0,			/* STT_NOTYPE */
    113 		1,			/* STT_OBJECT */
    114 		1,			/* STT_FUNC */
    115 		0,			/* STT_SECTION */
    116 		0,			/* STT_FILE */
    117 		1,			/* STT_COMMON */
    118 		0,			/* STT_TLS */
    119 		0,			/* 7 */
    120 		0,			/* 8 */
    121 		0,			/* 9 */
    122 		0,			/* 10 */
    123 		0,			/* 11 */
    124 		0,			/* 12 */
    125 		0,			/* STT_SPARC_REGISTER */
    126 		0,			/* 14 */
    127 		0,			/* 15 */
    128 };
    129 #if STT_NUM != (STT_TLS + 1)
    130 #error "STT_NUM has grown. Update dynsymsort_symtype[]."
    131 #endif
    132