_setup.c revision 41072f3cdbe3949252c173e744eb182ef4cc525f
3980fec332f0cc3d65051ce86f11c357686ed784Daniel Calegari * CDDL HEADER START
3980fec332f0cc3d65051ce86f11c357686ed784Daniel Calegari * The contents of this file are subject to the terms of the
3980fec332f0cc3d65051ce86f11c357686ed784Daniel Calegari * Common Development and Distribution License, Version 1.0 only
3980fec332f0cc3d65051ce86f11c357686ed784Daniel Calegari * (the "License"). You may not use this file except in compliance
3980fec332f0cc3d65051ce86f11c357686ed784Daniel Calegari * with the License.
3980fec332f0cc3d65051ce86f11c357686ed784Daniel Calegari * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
3980fec332f0cc3d65051ce86f11c357686ed784Daniel Calegari * or http://www.opensolaris.org/os/licensing.
3980fec332f0cc3d65051ce86f11c357686ed784Daniel Calegari * See the License for the specific language governing permissions
3980fec332f0cc3d65051ce86f11c357686ed784Daniel Calegari * and limitations under the License.
3980fec332f0cc3d65051ce86f11c357686ed784Daniel Calegari * When distributing Covered Code, include this CDDL HEADER in each
3980fec332f0cc3d65051ce86f11c357686ed784Daniel Calegari * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
3980fec332f0cc3d65051ce86f11c357686ed784Daniel Calegari * If applicable, add the following below this CDDL HEADER, with the
3980fec332f0cc3d65051ce86f11c357686ed784Daniel Calegari * fields enclosed by brackets "[]" replaced with your own identifying
3980fec332f0cc3d65051ce86f11c357686ed784Daniel Calegari * information: Portions Copyright [yyyy] [name of copyright owner]
3980fec332f0cc3d65051ce86f11c357686ed784Daniel Calegari * CDDL HEADER END
3980fec332f0cc3d65051ce86f11c357686ed784Daniel Calegari * Copyright (c) 1988 AT&T
3980fec332f0cc3d65051ce86f11c357686ed784Daniel Calegari * All Rights Reserved
3980fec332f0cc3d65051ce86f11c357686ed784Daniel Calegari * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
3980fec332f0cc3d65051ce86f11c357686ed784Daniel Calegari * Use is subject to license terms.
248bb54ca63b42c56eba7c6ccb11f92e9ff04f57Daniel Calegari#pragma ident "%Z%%M% %I% %E% SMI"
248bb54ca63b42c56eba7c6ccb11f92e9ff04f57Daniel Calegari * SPARC specific setup routine - relocate ld.so's symbols, setup its
248bb54ca63b42c56eba7c6ccb11f92e9ff04f57Daniel Calegari * environment, map in loadable sections of the executable.
248bb54ca63b42c56eba7c6ccb11f92e9ff04f57Daniel Calegari * Takes base address ld.so was loaded at, address of ld.so's dynamic
3980fec332f0cc3d65051ce86f11c357686ed784Daniel Calegari * structure, address of process environment pointers, address of auxiliary
3980fec332f0cc3d65051ce86f11c357686ed784Daniel Calegari * vector and * argv[0] (process name).
3980fec332f0cc3d65051ce86f11c357686ed784Daniel Calegari * If errors occur, send process signal - otherwise
3980fec332f0cc3d65051ce86f11c357686ed784Daniel Calegari * return executable's entry point to the bootstrap routine.
#include <link.h>
#include <dlfcn.h>
#include "_rtld.h"
#include "_audit.h"
#include "msg.h"
#ifdef A_OUT
#include "_a.out.h"
#include "debug.h"
extern int _end;
extern int _etext;
extern void _init(void);
unsigned long relaent = 0;
#ifdef A_OUT
void * aoutdyn = 0;
case EB_DYNAMIC:
#ifdef A_OUT
case EB_LDSO_BASE:
case EB_ARGV:
case EB_ENVP:
case EB_AUXV:
case EB_DEVZERO:
case EB_PAGESIZE:
case AT_EXECFD:
case AT_FLAGS:
case AT_PAGESZ:
case AT_PHDR:
case AT_BASE:
if (ld_base == 0)
case AT_SUN_UID:
case AT_SUN_RUID:
case AT_SUN_GID:
case AT_SUN_RGID:
case AT_SUN_PLATFORM:
case AT_SUN_EXECNAME:
case AT_SUN_AUXFLAGS:
case AT_SUN_HWCAP:
* Get needed info from ld.so's dynamic structure.
case DT_RELA:
case DT_RELACOUNT:
case DT_RELAENT:
case DT_STRTAB:
case DT_SONAME:
if (relaent == 0)
* Because ld.so.1 is built with -Bsymbolic there should only be
#ifdef A_OUT