sparc_a.out.c revision 75e7992ad4e186443b61dab39f79c9d79802f295
/*
* 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 (c) 1988 AT&T
* All Rights Reserved
*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* SPARC machine dependent and a.out format file class dependent functions.
* Contains routines for performing function binding and symbol relocations.
*/
#include "_synonyms.h"
#include <stdio.h>
#include <synch.h>
#include <dlfcn.h>
#include <debug.h>
#include "_a.out.h"
#include "_rtld.h"
#include "_audit.h"
#include "msg.h"
/*
* Function binding routine - invoked on the first call to a function through
* the procedure linkage table;
* passes first through an assembly language interface.
*
* Takes the address of the PLT entry where the call originated,
* the offset into the relocation table of the associated
* relocation entry and the address of the link map (rt_private_map struct)
* for the entry.
*
* Returns the address of the function referenced after re-writing the PLT
* entry to invoke the function directly.
*
* On error, causes process to terminate with a signal.
*/
{
struct relocation_info *rp;
char *name;
/*
* For compatibility with libthread (TI_VERSION 1) we track the entry
* value. A zero value indicates we have recursed into ld.so.1 to
* further process a locking request (see comments in completion()).
* Under this recursion we disable tsort and cleanup activities.
*/
break;
}
}
}
#define LAST22BITS 0x3fffff
/* LINTED */
/*
* Determine the last link-map of this list, this'll be the starting
* point for any tsort() processing.
*/
/*
* Find definition for symbol. Initialize the symbol lookup data
* structure.
*/
}
/*
* Record that this new link map is now bound to the caller.
*/
}
/*
* Print binding information and rebuild PLT entry.
*/
if (!(rtld_flags & RT_FL_NOBIND))
/*
* Complete any processing for newly loaded objects. Note we don't
* know exactly where any new objects are loaded (we know the object
* that supplied the symbol, but others may have been loaded lazily as
* we searched for the symbol), so sorting starts from the last
* link-map know on entry to this routine.
*/
if (entry)
/*
* If the object we've bound to is in the process of being initialized
* by another thread, determine whether we should block.
*/
/*
* Make sure the object to which we've bound has had it's .init fired.
* Cleanup before return to user code.
*/
if (entry) {
}
return (symval);
}
static const uchar_t pc_rel_type[] = {
0, /* RELOC_8 */
0, /* RELOC_16 */
0, /* RELOC_32 */
1, /* RELOC_DISP8 */
1, /* RELOC_DISP16 */
1, /* RELOC_DISP32 */
1, /* RELOC_WDISP30 */
1, /* RELOC_WDISP22 */
0, /* RELOC_HI22 */
0, /* RELOC_22 */
0, /* RELOC_13 */
0, /* RELOC_LO10 */
0, /* RELOC_SFA_BASE */
0, /* RELOC_SFA_OFF13 */
0, /* RELOC_BASE10 */
0, /* RELOC_BASE13 */
0, /* RELOC_BASE22 */
0, /* RELOC_PC10 */
0, /* RELOC_PC22 */
0, /* RELOC_JMP_TBL */
0, /* RELOC_SEGOFF16 */
0, /* RELOC_GLOB_DAT */
0, /* RELOC_JMP_SLOT */
0 /* RELOC_RELATIVE */
};
int
{
int k; /* loop temporary */
int nr; /* number of relocations */
char *name; /* symbol being searched for */
long *et; /* cached _etext of object */
long value; /* relocation temporary */
long *ra; /* cached relocation address */
/*
* If we've been called upon to promote an RTLD_LAZY object to an
* RTLD_NOW don't bother to do anything - a.out's are bound as if
* RTLD_NOW regardless.
*/
if (plt)
return (1);
/*
* Initialize _PLT_, if any.
*/
/*
* Loop through relocations.
*/
/* LINTED */
/*
* Check to see if we're relocating in the text segment
* and turn off the write protect if necessary.
*/
ret = 0;
break;
}
textrel = 1;
}
/*
* Perform the relocation.
*/
name = (char *)0;
} else {
continue;
/*
* Locate symbol. Initialize the symbol lookup data
* structure.
*/
(void)
continue;
} else {
ret = 0;
break;
}
}
/*
* If symbol was found in an object other than the
* referencing object then record the binding.
*/
AL_CNT_RELBIND) == 0) {
ret = 0;
break;
}
}
}
/*
* Perform a specific relocation operation.
*/
case RELOC_RELATIVE:
ra++;
break;
case RELOC_8:
case RELOC_DISP8:
}
break;
case RELOC_LO10:
case RELOC_BASE10:
break;
case RELOC_BASE13:
case RELOC_13:
break;
case RELOC_16:
case RELOC_DISP16:
}
break;
case RELOC_22:
case RELOC_BASE22:
}
break;
case RELOC_HI22:
break;
case RELOC_WDISP22:
value >>= 2;
}
break;
case RELOC_WDISP30:
value >>= 2;
break;
case RELOC_32:
case RELOC_GLOB_DAT:
case RELOC_DISP32:
break;
default:
ret = 0;
break;
}
/*
* If this relocation is against a text segment we must make
* sure that the instruction cache is flushed.
*/
if (textrel) {
else
}
}
}