17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 55aefb655Srie * Common Development and Distribution License (the "License"). 65aefb655Srie * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 215aefb655Srie 227c478bd9Sstevel@tonic-gate /* 237c478bd9Sstevel@tonic-gate * Copyright (c) 1988 AT&T 247c478bd9Sstevel@tonic-gate * All Rights Reserved 257c478bd9Sstevel@tonic-gate * 26*dc0f59e5SAli Bahrami * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved. 277c478bd9Sstevel@tonic-gate */ 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate /* 307c478bd9Sstevel@tonic-gate * Global variables 317c478bd9Sstevel@tonic-gate */ 327c478bd9Sstevel@tonic-gate #include <sys/elf.h> 337c478bd9Sstevel@tonic-gate #include "msg.h" 347c478bd9Sstevel@tonic-gate #include "_libld.h" 357c478bd9Sstevel@tonic-gate 367c478bd9Sstevel@tonic-gate Ld_heap *ld_heap; /* list of allocated blocks for */ 377c478bd9Sstevel@tonic-gate /* link-edit dynamic allocations */ 3857ef7aa9SRod Evans APlist *lib_support; /* list of support libraries specified */ 397c478bd9Sstevel@tonic-gate /* (-S option) */ 405aefb655Srie int demangle_flag; /* symbol demangling required */ 417c478bd9Sstevel@tonic-gate 427c478bd9Sstevel@tonic-gate /* 437c478bd9Sstevel@tonic-gate * Paths and directories for library searches. These are used to set up 447c478bd9Sstevel@tonic-gate * linked lists of directories which are maintained in the ofl structure. 457c478bd9Sstevel@tonic-gate */ 467c478bd9Sstevel@tonic-gate char *Plibpath; /* User specified -YP or defaults to LIBPATH */ 477c478bd9Sstevel@tonic-gate char *Llibdir; /* User specified -YL */ 487c478bd9Sstevel@tonic-gate char *Ulibdir; /* User specified -YU */ 497c478bd9Sstevel@tonic-gate 507c478bd9Sstevel@tonic-gate /* 515aefb655Srie * A default library search path is used if one was not supplied on the command 525aefb655Srie * line. Note: these strings can not use MSG_ORIG() since they are modified as 535aefb655Srie * part of the path processing. 547c478bd9Sstevel@tonic-gate */ 555aefb655Srie char def64_Plibpath[] = "/lib/64:/usr/lib/64"; 565aefb655Srie char def32_Plibpath[] = "/usr/ccs/lib:/lib:/usr/lib"; 577c478bd9Sstevel@tonic-gate 587c478bd9Sstevel@tonic-gate /* 59*dc0f59e5SAli Bahrami * Rejected file error messages (indexed to match SGS_REJ_ values). 607c478bd9Sstevel@tonic-gate */ 617c478bd9Sstevel@tonic-gate const Msg 62*dc0f59e5SAli Bahrami reject[SGS_REJ_NUM] = { 637c478bd9Sstevel@tonic-gate MSG_STR_EMPTY, 647c478bd9Sstevel@tonic-gate MSG_REJ_MACH, /* MSG_INTL(MSG_REJ_MACH) */ 657c478bd9Sstevel@tonic-gate MSG_REJ_CLASS, /* MSG_INTL(MSG_REJ_CLASS) */ 667c478bd9Sstevel@tonic-gate MSG_REJ_DATA, /* MSG_INTL(MSG_REJ_DATA) */ 677c478bd9Sstevel@tonic-gate MSG_REJ_TYPE, /* MSG_INTL(MSG_REJ_TYPE) */ 687c478bd9Sstevel@tonic-gate MSG_REJ_BADFLAG, /* MSG_INTL(MSG_REJ_BADFLAG) */ 697c478bd9Sstevel@tonic-gate MSG_REJ_MISFLAG, /* MSG_INTL(MSG_REJ_MISFLAG) */ 707c478bd9Sstevel@tonic-gate MSG_REJ_VERSION, /* MSG_INTL(MSG_REJ_VERSION) */ 717c478bd9Sstevel@tonic-gate MSG_REJ_HAL, /* MSG_INTL(MSG_REJ_HAL) */ 727c478bd9Sstevel@tonic-gate MSG_REJ_US3, /* MSG_INTL(MSG_REJ_US3) */ 737c478bd9Sstevel@tonic-gate MSG_REJ_STR, /* MSG_INTL(MSG_REJ_STR) */ 747c478bd9Sstevel@tonic-gate MSG_REJ_UNKFILE, /* MSG_INTL(MSG_REJ_UNKFILE) */ 7508278a5eSRod Evans MSG_REJ_UNKCAP, /* MSG_INTL(MSG_REJ_UNKCAP) */ 767c478bd9Sstevel@tonic-gate MSG_REJ_HWCAP_1, /* MSG_INTL(MSG_REJ_HWCAP_1) */ 7708278a5eSRod Evans MSG_REJ_SFCAP_1, /* MSG_INTL(MSG_REJ_SFCAP_1) */ 7808278a5eSRod Evans MSG_REJ_MACHCAP, /* MSG_INTL(MSG_REJ_MACHCAP) */ 7908278a5eSRod Evans MSG_REJ_PLATCAP, /* MSG_INTL(MSG_REJ_PLATCAP) */ 80*dc0f59e5SAli Bahrami MSG_REJ_HWCAP_2, /* MSG_INTL(MSG_REJ_HWCAP_2) */ 81*dc0f59e5SAli Bahrami MSG_REJ_ARCHIVE /* MSG_INTL(MSG_REJ_ARCHIVE) */ 827c478bd9Sstevel@tonic-gate }; 83*dc0f59e5SAli Bahrami #if SGS_REJ_NUM != (SGS_REJ_ARCHIVE + 1) 84*dc0f59e5SAli Bahrami #error SGS_REJ_NUM has changed 85*dc0f59e5SAli Bahrami #endif 8675e45495Sab196087 8775e45495Sab196087 /* 88d579eb63Sab196087 * Symbol types that we include in .SUNW_ldynsym sections 8975e45495Sab196087 * (indexed by STT_ values). 9075e45495Sab196087 */ 9175e45495Sab196087 const int 921da7e599SAli Bahrami ldynsym_symtype[] = { 93d579eb63Sab196087 0, /* STT_NOTYPE (not counting 1st slot) */ 94d579eb63Sab196087 0, /* STT_OBJECT */ 95d579eb63Sab196087 1, /* STT_FUNC */ 96d579eb63Sab196087 0, /* STT_SECTION */ 97d579eb63Sab196087 1, /* STT_FILE */ 98d579eb63Sab196087 0, /* STT_COMMON */ 99d579eb63Sab196087 0, /* STT_TLS */ 10062b628a6SAli Bahrami 0, /* 7 */ 1011da7e599SAli Bahrami 0, /* 8 */ 1021da7e599SAli Bahrami 0, /* 9 */ 1031da7e599SAli Bahrami 0, /* 10 */ 1041da7e599SAli Bahrami 0, /* 11 */ 1051da7e599SAli Bahrami 0, /* 12 */ 1061da7e599SAli Bahrami 0, /* STT_SPARC_REGISTER */ 1071da7e599SAli Bahrami 0, /* 14 */ 1081da7e599SAli Bahrami 0, /* 15 */ 109d579eb63Sab196087 }; 11062b628a6SAli Bahrami #if STT_NUM != (STT_TLS + 1) 111d579eb63Sab196087 #error "STT_NUM has grown. Update ldynsym_symtype[]." 112d579eb63Sab196087 #endif 113d579eb63Sab196087 114d579eb63Sab196087 /* 115d579eb63Sab196087 * Symbol types that we include in .SUNW_dynsymsort sections 116d579eb63Sab196087 * (indexed by STT_ values). 117d579eb63Sab196087 */ 118d579eb63Sab196087 const int 1191da7e599SAli Bahrami dynsymsort_symtype[] = { 12075e45495Sab196087 0, /* STT_NOTYPE */ 12175e45495Sab196087 1, /* STT_OBJECT */ 12275e45495Sab196087 1, /* STT_FUNC */ 12375e45495Sab196087 0, /* STT_SECTION */ 12475e45495Sab196087 0, /* STT_FILE */ 12575e45495Sab196087 1, /* STT_COMMON */ 12675e45495Sab196087 0, /* STT_TLS */ 12762b628a6SAli Bahrami 0, /* 7 */ 1281da7e599SAli Bahrami 0, /* 8 */ 1291da7e599SAli Bahrami 0, /* 9 */ 1301da7e599SAli Bahrami 0, /* 10 */ 1311da7e599SAli Bahrami 0, /* 11 */ 1321da7e599SAli Bahrami 0, /* 12 */ 1331da7e599SAli Bahrami 0, /* STT_SPARC_REGISTER */ 1341da7e599SAli Bahrami 0, /* 14 */ 1351da7e599SAli Bahrami 0, /* 15 */ 13675e45495Sab196087 }; 13762b628a6SAli Bahrami #if STT_NUM != (STT_TLS + 1) 138d579eb63Sab196087 #error "STT_NUM has grown. Update dynsymsort_symtype[]." 13975e45495Sab196087 #endif 140