support.c revision 1007fd6fd24227460e77ce89f5ca85641a85a576
/*
* 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
*/
/*
*/
#include <stdio.h>
#include <dlfcn.h>
#include <libelf.h>
#include <link.h>
#include <debug.h>
#include "msg.h"
#include "_libld.h"
/*
* Table which defines the default functions to be called by the library
* SUPPORT (-S <libname>). These functions can be redefined by the
* ld_support_loadso() routine.
*/
#if defined(_ELF64)
#else /* Elf32 */
#endif
};
/*
* Loads in a support shared object specified using the SGS_SUPPORT environment
* variable or the -S ld option, and determines which interface functions are
* provided by that object.
*/
{
/*
* Load the required support library. If we are unable to load it fail
* with a fatal error.
*/
return (S_ERROR);
}
continue;
if (interface == LDS_VERSION) {
/*
* If version is LD_SUP_VNONE, unload the support
* library and act as if it was never requested.
* This provides the support library with a mechanism
* for opting out of the process.
*
* Note that this depends on LDS_VERSION being the
* first item in support[]. If this were not true,
* then other functions from the library might be
* entered into the function lists, and unloading
* the object would cause corruption.
*/
assert(LDS_VERSION == 0);
if (version == LD_SUP_VNONE) {
obj));
return (1);
}
/*
* If the support library has a version higher
* than we support, we are unable to accept it.
*/
if (version > LD_SUP_VCURRENT) {
return (S_ERROR);
}
}
return (S_ERROR);
}
return (1);
}
/*
* Wrapper routines for the ld support library calls.
*/
void
{
}
}
void
{
}
}
void
{
int _flags = 0;
/*
* This interface was introduced in VERSION3. Only call this
* function for libraries reporting support for version 3 or
* above.
*/
continue;
if (!(flags & FLG_IF_CMDLINE))
_flags |= LD_SUP_DERIVED;
if (!(flags & FLG_IF_NEEDED))
if (flags & FLG_IF_EXTRACT)
/*
* If the present object is an extracted archive member, make
* sure the archive offset is reset so that the caller can
* obtain an ELF descriptor to the same member (an elf_begin()
* moves the offset to the next member).
*/
if (flags & FLG_IF_EXTRACT)
ekind);
/*
* If the file descriptor, ELF descriptor, or file names have
* been modified, then diagnose the differences and return the
* new data. As a basic test, make sure the support library
* hasn't nulled out data ld(1) will try and dereference.
*/
if (npath)
if (nfile)
}
}
}
void
{
int _flags = 0;
if (!(flags & FLG_IF_CMDLINE))
_flags |= LD_SUP_DERIVED;
if (!(flags & FLG_IF_NEEDED))
if (flags & FLG_IF_EXTRACT)
}
}
{
/*
* This interface was introduced in VERSION2. Only call this
* function for libraries reporting support for version 2 or
* above.
*/
continue;
return (S_ERROR);
}
/*
* If the section header has been re-allocated (known to occur
* with libCCexcept.so), then diagnose the section header
* difference and return the new section header.
*/
}
}
return (0);
}
void
{
}
}
void
{
/*
* This interface was introduced in VERSION2. Only call this
* function for libraries reporting support for version 2 or
* above.
*/
continue;
}
}