/*
* 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 <strings.h>
#include <sys/elf_SPARC.h>
#include <alloca.h>
#include "_rtld.h"
#include "_elf.h"
#include "msg.h"
#include "conv.h"
/*
*
* Matrix of legal combinations of usage of a given register:
*
* Obj1\Obj2 Scratch Named
* Scratch OK NO
* Named NO *
*
* * OK if the symbols are identical, NO if they are not. Two symbols
* are identical if and only if one of the following is true:
* A. They are both global and have the same name.
* B. They are both local, have the same name, and are defined in
* the same object. (Note that a local symbol in one object is
* never identical to a local symbol in another object, even if the
* name is the same.)
*
* Matrix of legal combinations of st_shndx for the same register symbol:
*
* Obj1\Obj2 UNDEF ABS
* UNDEF OK OK
* ABS OK NO
*/
/*
* Test the compatiblity of two register symbols, 0 pass, >0 fail
*/
static uintptr_t
{
return (0); /* scratches are always compatible */
return (1); /* local symbol incompat */
return (0); /* no other prob from locals */
}
/* NOTE this just avoids strcmp */
return (2); /* can't match scratch to named */
return (4); /* diff name, same register value */
return (3); /* multiply defined */
return (5); /* same name, diff register value */
return (0);
}
int
{
/*
* Scan through the .dynamic section of this object looking for all
* DT_REGISTER entries. For each DT_REGISTER entry found identify the
* register symbol it identifies and confirm that it doesn't conflict
* with any other register symbols.
*/
continue;
/*
* Get the local symbol table entry.
*/
/*
* Same symbol definition - everything is a-ok.
*/
return (1);
}
continue;
}
} else {
return (0);
}
}
return (0);
}
return (1);
}