sunwmove.c revision 354507029a42e4bcb1ea64fc4685f2bfd4792db8
/*
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <string.h>
#include <debug.h>
#include "msg.h"
#include "_libld.h"
/*
*
*/
static uintptr_t
{
/*
* Compute the size of the output move section
*/
else
align_val = 8;
/*
* This global symbol goes to the special
* partial initialization .data section.
*/
if (align_val > align_parexpn)
} else {
}
}
if (mv_nums != 0) {
return (S_ERROR);
}
/*
* Add empty area for partially initialized symbols.
*
* A special .data section is created when the '-z nopartial'
* option is in effect in order to receive the expanded data.
*/
if (size_parexpn) {
/* LINTED */
align_parexpn) == S_ERROR)
return (S_ERROR);
}
return (1);
}
/*
* This function insert the Move_itm into the move list held by
* psymp.
*/
static uintptr_t
{
/*
* If there is error on this symbol already,
* don't go any further.
*/
return (1);
return (S_ERROR);
/*
* If this is the first, just update the
* head and tail.
*/
return (1);
}
/*
* Check overlapping
* If there is no overlapping so far,
* check overlapping.
*/
} else {
}
return (1);
}
/*
* If passed, insert
*/
} else
return (1);
}
/*
* If lnpc is the end, add
*/
return (1);
}
/*
* Go next
*/
}
return (1);
}
/*
* Install the mv entry into the Psym_info
*
* Count coverage size
* If the coverage size meets the symbol size,
* mark that the symbol should be expanded.
* psymp->psym_symd->sd_flags |= FLG_SY_PAREXPN;
*
* Check overlapping
* If overlapping occurs, mark it at psymp->psym_flags
*/
static uintptr_t
{
int i;
return (S_ERROR);
for (i = 0; i < cnt; i++) {
/* LINTED */
/*
* Insert the item
*/
return (S_ERROR);
mvitmp++;
}
return (1);
}
/*
* Insert the given psym_info
*/
static uintptr_t
{
int g1 = 0;
return (S_ERROR);
g1 = 1;
/*
* If this is the first, just update the
* head and tail.
*/
return (1);
}
g2 = 1;
else
g2 = 0;
/*
* Compute position
*/
else if (g1 == 0) {
/*
* p1 is a local symbol.
* p2 is a global, so p1 passed.
*/
cmp = -1;
} else {
/*
* p1 is global
* p2 is still local.
* so try the next one.
*
* If lnpc is the end, add
*/
break;
}
continue;
}
/*
* If same, just add after
*/
if (cmp == 0) {
break;
}
/*
* If passed, insert
*/
if (cmp < 0) {
} else
break;
}
/*
* If lnpc is the end, add
*/
break;
}
/*
* Go next
*/
}
return (1);
}
/*
* Mark the symbols
*
* Check only the symbols which came from the relocatable
* files.If partially initialized symbols come from
* shared objects, they can be ignored here because
* they are already processed when the shared object is
* created.
*
*/
{
int errcnt = 0;
return (S_ERROR);
}
for (i = 0; i < num; i++) {
(ndx == 0)) {
return (S_ERROR);
}
return (S_ERROR);
}
/*
* Check if this entry has a valid size of not
*/
/* LINTED */
case 1: case 2: case 4: case 8:
break;
default:
return (S_ERROR);
}
/*
* If this is a global symbol, adjust the visibility.
*/
/*
* Mark the symbol as partial, and install the
* symbol in the partial symbol list.
*/
if ((psym =
return (S_ERROR);
/*
* Even if the -zredlocsym is in effect, the
* local symbol used for partial initialization
* is kept.
*/
STB_LOCAL) &&
STT_OBJECT)) {
ofl->ofl_locscnt++;
return (S_ERROR);
}
return (S_ERROR);
/*
* Mark the input section which the partially
* initialized * symbol is defined.
* This is needed when the symbol
* the relocation entry uses symbol information
* not from the symbol entry.
*
* For executable, the following is
* needed only for expanded symbol. However,
* for shared object * any partially non
* expanded symbols are moved * from
* needed.
*/
libld_calloc(sizeof (Sym),
1)) == 0)
return (S_ERROR);
}
}
} else
return (S_ERROR);
errcnt++;
/*
* If this symbol is marked to be
* expanded, go to the next moveentry.
*/
mv++;
continue;
}
/*
* Decide whether this partial symbol is to be expanded
* or not.
*
* The symbol will be expanded if:
* a) '-z nopartial' is specified
* b) move entries covered entire symbol
*
* To expand an move entry, size of the symbol to be
* expanded need to be known to generate a file space.
* (see make_movesections().)
*
* Therefore the move entry can not be expanded
* if the partial symbol is a section symbol.
* (The size of the symbol may be unknown.)
* This may happen, for example, when a local symbol is
* reduced by the -zredlocsym.
*
* The following two if statements checks the
* if the move entry can be expanded or not.
*/
STT_SECTION) {
errcnt++;
} else {
}
STT_SECTION) {
} else {
}
} else if (
}
/*
* If a move section exists that references .bss, make
* sure a section symbol for .bss is introduced into
* the .dynsym.
*/
}
mv++;
}
}
if (errcnt != 0)
return (S_ERROR);
return (S_ERROR);
return (1);
}