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 * 26dc0f59e5SAli Bahrami * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved. 27*56726c7eSRobert Mustacchi * Copyright 2022 Oxide Computer Company 287c478bd9Sstevel@tonic-gate */ 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate /* 317c478bd9Sstevel@tonic-gate * Global variables 327c478bd9Sstevel@tonic-gate */ 337c478bd9Sstevel@tonic-gate #include <sys/elf.h> 347c478bd9Sstevel@tonic-gate #include "msg.h" 357c478bd9Sstevel@tonic-gate #include "_libld.h" 367c478bd9Sstevel@tonic-gate 3757ef7aa9SRod Evans APlist *lib_support; /* list of support libraries specified */ 387c478bd9Sstevel@tonic-gate /* (-S option) */ 395aefb655Srie int demangle_flag; /* symbol demangling required */ 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gate /* 427c478bd9Sstevel@tonic-gate * Paths and directories for library searches. These are used to set up 437c478bd9Sstevel@tonic-gate * linked lists of directories which are maintained in the ofl structure. 447c478bd9Sstevel@tonic-gate */ 457c478bd9Sstevel@tonic-gate char *Plibpath; /* User specified -YP or defaults to LIBPATH */ 467c478bd9Sstevel@tonic-gate char *Llibdir; /* User specified -YL */ 477c478bd9Sstevel@tonic-gate char *Ulibdir; /* User specified -YU */ 487c478bd9Sstevel@tonic-gate 497c478bd9Sstevel@tonic-gate /* 505aefb655Srie * A default library search path is used if one was not supplied on the command 515aefb655Srie * line. Note: these strings can not use MSG_ORIG() since they are modified as 525aefb655Srie * part of the path processing. 537c478bd9Sstevel@tonic-gate */ 545aefb655Srie char def64_Plibpath[] = "/lib/64:/usr/lib/64"; 555aefb655Srie char def32_Plibpath[] = "/usr/ccs/lib:/lib:/usr/lib"; 567c478bd9Sstevel@tonic-gate 577c478bd9Sstevel@tonic-gate /* 58dc0f59e5SAli Bahrami * Rejected file error messages (indexed to match SGS_REJ_ values). 597c478bd9Sstevel@tonic-gate */ 607c478bd9Sstevel@tonic-gate const Msg 61dc0f59e5SAli Bahrami reject[SGS_REJ_NUM] = { 627c478bd9Sstevel@tonic-gate MSG_STR_EMPTY, 637c478bd9Sstevel@tonic-gate MSG_REJ_MACH, /* MSG_INTL(MSG_REJ_MACH) */ 647c478bd9Sstevel@tonic-gate MSG_REJ_CLASS, /* MSG_INTL(MSG_REJ_CLASS) */ 657c478bd9Sstevel@tonic-gate MSG_REJ_DATA, /* MSG_INTL(MSG_REJ_DATA) */ 667c478bd9Sstevel@tonic-gate MSG_REJ_TYPE, /* MSG_INTL(MSG_REJ_TYPE) */ 677c478bd9Sstevel@tonic-gate MSG_REJ_BADFLAG, /* MSG_INTL(MSG_REJ_BADFLAG) */ 687c478bd9Sstevel@tonic-gate MSG_REJ_MISFLAG, /* MSG_INTL(MSG_REJ_MISFLAG) */ 697c478bd9Sstevel@tonic-gate MSG_REJ_VERSION, /* MSG_INTL(MSG_REJ_VERSION) */ 707c478bd9Sstevel@tonic-gate MSG_REJ_HAL, /* MSG_INTL(MSG_REJ_HAL) */ 717c478bd9Sstevel@tonic-gate MSG_REJ_US3, /* MSG_INTL(MSG_REJ_US3) */ 727c478bd9Sstevel@tonic-gate MSG_REJ_STR, /* MSG_INTL(MSG_REJ_STR) */ 737c478bd9Sstevel@tonic-gate MSG_REJ_UNKFILE, /* MSG_INTL(MSG_REJ_UNKFILE) */ 7408278a5eSRod Evans MSG_REJ_UNKCAP, /* MSG_INTL(MSG_REJ_UNKCAP) */ 757c478bd9Sstevel@tonic-gate MSG_REJ_HWCAP_1, /* MSG_INTL(MSG_REJ_HWCAP_1) */ 7608278a5eSRod Evans MSG_REJ_SFCAP_1, /* MSG_INTL(MSG_REJ_SFCAP_1) */ 7708278a5eSRod Evans MSG_REJ_MACHCAP, /* MSG_INTL(MSG_REJ_MACHCAP) */ 7808278a5eSRod Evans MSG_REJ_PLATCAP, /* MSG_INTL(MSG_REJ_PLATCAP) */ 79dc0f59e5SAli Bahrami MSG_REJ_HWCAP_2, /* MSG_INTL(MSG_REJ_HWCAP_2) */ 80b6a0e2cdSRichard Lowe MSG_REJ_ARCHIVE, /* MSG_INTL(MSG_REJ_ARCHIVE) */ 81*56726c7eSRobert Mustacchi MSG_REJ_KMOD, /* MSG_INTL(MSG_REJ_KMOD) */ 82*56726c7eSRobert Mustacchi MSG_REJ_HWCAP_3 /* MSG_INTL(MSG_REJ_HWCAP_3) */ 837c478bd9Sstevel@tonic-gate }; 84*56726c7eSRobert Mustacchi #if SGS_REJ_NUM != (SGS_REJ_HWCAP_3 + 1) 85dc0f59e5SAli Bahrami #error SGS_REJ_NUM has changed 86dc0f59e5SAli Bahrami #endif 8775e45495Sab 8875e45495Sab /* 89d579eb63Sab * Symbol types that we include in .SUNW_ldynsym sections 9075e45495Sab * (indexed by STT_ values). 9175e45495Sab */ 9275e45495Sab const int 931da7e599SAli Bahrami ldynsym_symtype[] = { 94d579eb63Sab 0, /* STT_NOTYPE (not counting 1st slot) */ 95d579eb63Sab 0, /* STT_OBJECT */ 96d579eb63Sab 1, /* STT_FUNC */ 97d579eb63Sab 0, /* STT_SECTION */ 98d579eb63Sab 1, /* STT_FILE */ 99d579eb63Sab 0, /* STT_COMMON */ 100d579eb63Sab 0, /* STT_TLS */ 10162b628a6SAli Bahrami 0, /* 7 */ 1021da7e599SAli Bahrami 0, /* 8 */ 1031da7e599SAli Bahrami 0, /* 9 */ 1041da7e599SAli Bahrami 0, /* 10 */ 1051da7e599SAli Bahrami 0, /* 11 */ 1061da7e599SAli Bahrami 0, /* 12 */ 1071da7e599SAli Bahrami 0, /* STT_SPARC_REGISTER */ 1081da7e599SAli Bahrami 0, /* 14 */ 1091da7e599SAli Bahrami 0, /* 15 */ 110d579eb63Sab }; 11162b628a6SAli Bahrami #if STT_NUM != (STT_TLS + 1) 112d579eb63Sab #error "STT_NUM has grown. Update ldynsym_symtype[]." 113d579eb63Sab #endif 114d579eb63Sab 115d579eb63Sab /* 116d579eb63Sab * Symbol types that we include in .SUNW_dynsymsort sections 117d579eb63Sab * (indexed by STT_ values). 118d579eb63Sab */ 119d579eb63Sab const int 1201da7e599SAli Bahrami dynsymsort_symtype[] = { 12175e45495Sab 0, /* STT_NOTYPE */ 12275e45495Sab 1, /* STT_OBJECT */ 12375e45495Sab 1, /* STT_FUNC */ 12475e45495Sab 0, /* STT_SECTION */ 12575e45495Sab 0, /* STT_FILE */ 12675e45495Sab 1, /* STT_COMMON */ 12775e45495Sab 0, /* STT_TLS */ 12862b628a6SAli Bahrami 0, /* 7 */ 1291da7e599SAli Bahrami 0, /* 8 */ 1301da7e599SAli Bahrami 0, /* 9 */ 1311da7e599SAli Bahrami 0, /* 10 */ 1321da7e599SAli Bahrami 0, /* 11 */ 1331da7e599SAli Bahrami 0, /* 12 */ 1341da7e599SAli Bahrami 0, /* STT_SPARC_REGISTER */ 1351da7e599SAli Bahrami 0, /* 14 */ 1361da7e599SAli Bahrami 0, /* 15 */ 13775e45495Sab }; 13862b628a6SAli Bahrami #if STT_NUM != (STT_TLS + 1) 139d579eb63Sab #error "STT_NUM has grown. Update dynsymsort_symtype[]." 14075e45495Sab #endif 141