object.c revision 9039eeaf76678a41be39feb97b4f724272ef7e18
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Object file dependent suport for ELF objects.
*/
#include "_synonyms.h"
#include <stdio.h>
#include <unistd.h>
#include <libelf.h>
#include <string.h>
#include <dlfcn.h>
#include <debug.h>
#include <libld.h>
#include "_rtld.h"
#include "_audit.h"
#include "_elf.h"
/*
* Process a relocatable object. The static object link map pointer is used as
* a flag to determine whether a concatenation is already in progress (ie. an
* LD_PRELOAD may specify a list of objects). The link map returned simply
* specifies an `object' flag which the caller can interpret and thus call
* elf_obj_fini() to complete the concatenation.
*/
static Rt_map *
{
/*
* Initialize an output file descriptor and the entrance criteria.
*/
return (0);
/*
* As ent_setup() will effectively lazy load the necessary support
* libraries, make sure ld.so.1 is initialized for plt relocations.
*/
if (elf_rtld_load() == 0)
return (0);
/*
* Obtain a generic set of entrance criteria (this is the first call to
* libld.so, which will effectively lazyload it).
*/
return (0);
/*
* Generate a link map place holder and use the `rt_priv' element to
* maintain the output file descriptor.
*/
return (0);
/*
* Initialize string tables.
*/
return (0);
/*
* Assign the output file name to be the initial object that got us
* here. This name is being used for diagnostic purposes only as we
* don't actually generate an output file unless debugging is enabled.
*/
return (olmp);
}
/*
* Initial processing of a relocatable object. If this is the first object
* encountered we need to initialize some structures, then simply call the
* link-edit functionality to provide the initial processing of the file (ie.
* reads in sections and symbols, performs symbol resolution if more that one
* object file have been specified, and assigns input sections to output
* sections).
*/
Rt_map *
{
/*
* If this is the first relocatable object (LD_PRELOAD could provide a
* list of objects), initialize an input file descriptor and a link map.
*/
if (!olmp) {
/*
* Load the link-editor library.
*/
return (0);
}
/*
* Proceed to process the input file.
*/
return (0);
return (olmp);
}
/*
* Finish relocatable object processing. Having already initially processed one
* or more objects, complete the generation of a shared object image by calling
*/
Rt_map *
{
return (0);
return (0);
return (0);
return (0);
return (0);
return (0);
/*
* At this point we have a memory image of the shared object. The link
* editor would normally simply write this to the required output file.
* If we're debugging generate a standard temporary output file.
*/
/*
* Allocate a mapping array to retain mapped segment information.
*/
return (0);
continue;
mmapcnt++;
}
/*
* Generate a new link map representing the memory image created.
*/
return (0);
/*
* Remove this link map from the end of the link map list and copy its
* contents into the link map originally created for this file (we copy
* the contents rather than manipulate the link map pointers as parts
* of the dlopen code have remembered the original link map address).
*/
/* LINTED */
olmp = 0;
/*
* Now that we've allocated our permanent Rt_map structure, expand the
* PATHNAME() and insert it into the FullpathNode AVL tree
*/
return (0);
/*
* If we're being audited tell the audit library of the file we've just
* opened.
*/
return (0);
}
return (nlmp);
}