Update the backends to go with the top-level ld changes. The non-i386

changes are for completeness, I don't think they work.  There are changes
to deal with the new include files.

Obtained from: NetBSD (mostly)
This commit is contained in:
Peter Wemm 1996-10-01 01:28:10 +00:00
parent d0a184df5d
commit b186571cf6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=18596
8 changed files with 81 additions and 25 deletions

View file

@ -1,16 +1,17 @@
/*
* $Id: md-static-funcs.c,v 1.2 1994/02/13 20:42:06 jkh Exp $
* $Id: md-static-funcs.c,v 1.3 1995/11/02 18:47:55 nate Exp $
*
* Called by ld.so when onanating.
* This *must* be a static function, so it is not called through a jmpslot.
*/
static inline void
static void
md_relocate_simple(r, relocation, addr)
struct relocation_info *r;
long relocation;
char *addr;
{
*(long *)addr += relocation;
if (r->r_relative)
*(long *)addr += relocation;
}

View file

@ -27,7 +27,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: md.c,v 1.11 1994/12/23 22:31:12 nate Exp $
* $Id: md.c,v 1.12 1995/03/04 17:46:20 nate Exp $
*/
#include <sys/param.h>
@ -40,7 +40,13 @@
#include <stab.h>
#include <string.h>
#include "ld.h"
#include "dynamic.h"
#if defined(RTLD) && defined(SUN_COMPAT)
#define REL_SIZE(r) (2) /* !!!!! Sun BUG compatible */
#else
#define REL_SIZE(r) ((r)->r_length)
#endif
/*
* Get relocation addend corresponding to relocation record RP
@ -51,7 +57,7 @@ md_get_addend(rp, addr)
struct relocation_info *rp;
unsigned char *addr;
{
switch (RELOC_TARGET_SIZE(rp)) {
switch (REL_SIZE(rp)) {
case 0:
return get_byte(addr);
case 1:
@ -60,7 +66,7 @@ unsigned char *addr;
return get_long(addr);
default:
errx(1, "Unsupported relocation size: %x",
RELOC_TARGET_SIZE(rp));
REL_SIZE(rp));
}
}
@ -74,7 +80,7 @@ long relocation;
unsigned char *addr;
int relocatable_output;
{
switch (RELOC_TARGET_SIZE(rp)) {
switch (REL_SIZE(rp)) {
case 0:
put_byte(addr, relocation);
break;
@ -86,7 +92,7 @@ int relocatable_output;
break;
default:
errx(1, "Unsupported relocation size: %x",
RELOC_TARGET_SIZE(rp));
REL_SIZE(rp));
}
}
@ -102,7 +108,7 @@ int type;
/* Relocation size */
r->r_length = rp->r_length;
if (RELOC_PCREL_P(rp))
if (rp->r_pcrel)
r->r_pcrel = 1;
if (type & RELTYPE_RELATIVE)

View file

@ -27,9 +27,11 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: md.h,v 1.11 1994/12/23 22:31:14 nate Exp $
* $Id: md.h,v 1.12 1995/03/04 17:46:21 nate Exp $
*/
#ifndef __MD_H__
#define __MD_H__
#if defined(CROSS_LINKER) && defined(XHOST) && XHOST==sparc
#define NEED_SWAP
@ -224,3 +226,17 @@ void md_swapout_jmpslot __P((jmpslot_t *, int));
#define put_long(where,what) (*(long *)(where) = (what))
#endif /* CROSS_LINKER */
void md_init_header __P((struct exec *, int, int));
long md_get_addend __P((struct relocation_info *, unsigned char *));
void md_relocate __P((struct relocation_info *, long, unsigned char *, int));
void md_make_jmpslot __P((jmpslot_t *, long, long));
void md_fix_jmpslot __P((jmpslot_t *, long, u_long));
int md_make_reloc __P((struct relocation_info *, struct relocation_info *, int));
void md_make_jmpreloc __P((struct relocation_info *, struct relocation_info *, int));
void md_make_gotreloc __P((struct relocation_info *, struct relocation_info *, int));
void md_make_copyreloc __P((struct relocation_info *, struct relocation_info *));
void md_set_breakpoint __P((long, long *));
#endif /* __MD_H__ */

View file

@ -27,7 +27,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: md.c,v 1.7 1994/02/13 20:43:03 jkh Exp $
* $Id: md.c,v 1.8 1994/06/15 22:41:19 rich Exp $
*/
#include <sys/param.h>
@ -40,7 +40,7 @@
#include <stab.h>
#include <string.h>
#include "ld.h"
#include "dynamic.h"
/*
* Relocation masks and sizes for the Sparc architecture.

View file

@ -27,7 +27,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: md.h,v 1.6 1994/02/13 20:43:07 jkh Exp $
* $Id: md.h,v 1.7 1995/03/04 17:46:25 nate Exp $
*/
/*
@ -290,3 +290,13 @@ void md_swapout_jmpslot __P((jmpslot_t *, int));
#endif /* CROSS_LINKER */
void md_init_header __P((struct exec *, int, int));
long md_get_addend __P((struct relocation_info *, unsigned char *));
void md_relocate __P((struct relocation_info *, long, unsigned char *, int));
void md_make_jmpslot __P((jmpslot_t *, long, long));
void md_fix_jmpslot __P((jmpslot_t *, long, u_long));
int md_make_reloc __P((struct relocation_info *, struct relocation_info *, int));
void md_make_jmpreloc __P((struct relocation_info *, struct relocation_info *, int));
void md_make_gotreloc __P((struct relocation_info *, struct relocation_info *, int));
void md_make_copyreloc __P((struct relocation_info *, struct relocation_info *));
void md_set_breakpoint __P((long, long *));

View file

@ -1,16 +1,17 @@
/*
* $Id: md-static-funcs.c,v 1.2 1994/02/13 20:42:06 jkh Exp $
* $Id: md-static-funcs.c,v 1.3 1995/11/02 18:47:55 nate Exp $
*
* Called by ld.so when onanating.
* This *must* be a static function, so it is not called through a jmpslot.
*/
static inline void
static void
md_relocate_simple(r, relocation, addr)
struct relocation_info *r;
long relocation;
char *addr;
{
*(long *)addr += relocation;
if (r->r_relative)
*(long *)addr += relocation;
}

View file

@ -27,7 +27,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: md.c,v 1.11 1994/12/23 22:31:12 nate Exp $
* $Id: md.c,v 1.12 1995/03/04 17:46:20 nate Exp $
*/
#include <sys/param.h>
@ -40,7 +40,13 @@
#include <stab.h>
#include <string.h>
#include "ld.h"
#include "dynamic.h"
#if defined(RTLD) && defined(SUN_COMPAT)
#define REL_SIZE(r) (2) /* !!!!! Sun BUG compatible */
#else
#define REL_SIZE(r) ((r)->r_length)
#endif
/*
* Get relocation addend corresponding to relocation record RP
@ -51,7 +57,7 @@ md_get_addend(rp, addr)
struct relocation_info *rp;
unsigned char *addr;
{
switch (RELOC_TARGET_SIZE(rp)) {
switch (REL_SIZE(rp)) {
case 0:
return get_byte(addr);
case 1:
@ -60,7 +66,7 @@ unsigned char *addr;
return get_long(addr);
default:
errx(1, "Unsupported relocation size: %x",
RELOC_TARGET_SIZE(rp));
REL_SIZE(rp));
}
}
@ -74,7 +80,7 @@ long relocation;
unsigned char *addr;
int relocatable_output;
{
switch (RELOC_TARGET_SIZE(rp)) {
switch (REL_SIZE(rp)) {
case 0:
put_byte(addr, relocation);
break;
@ -86,7 +92,7 @@ int relocatable_output;
break;
default:
errx(1, "Unsupported relocation size: %x",
RELOC_TARGET_SIZE(rp));
REL_SIZE(rp));
}
}
@ -102,7 +108,7 @@ int type;
/* Relocation size */
r->r_length = rp->r_length;
if (RELOC_PCREL_P(rp))
if (rp->r_pcrel)
r->r_pcrel = 1;
if (type & RELTYPE_RELATIVE)

View file

@ -27,9 +27,11 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: md.h,v 1.11 1994/12/23 22:31:14 nate Exp $
* $Id: md.h,v 1.12 1995/03/04 17:46:21 nate Exp $
*/
#ifndef __MD_H__
#define __MD_H__
#if defined(CROSS_LINKER) && defined(XHOST) && XHOST==sparc
#define NEED_SWAP
@ -224,3 +226,17 @@ void md_swapout_jmpslot __P((jmpslot_t *, int));
#define put_long(where,what) (*(long *)(where) = (what))
#endif /* CROSS_LINKER */
void md_init_header __P((struct exec *, int, int));
long md_get_addend __P((struct relocation_info *, unsigned char *));
void md_relocate __P((struct relocation_info *, long, unsigned char *, int));
void md_make_jmpslot __P((jmpslot_t *, long, long));
void md_fix_jmpslot __P((jmpslot_t *, long, u_long));
int md_make_reloc __P((struct relocation_info *, struct relocation_info *, int));
void md_make_jmpreloc __P((struct relocation_info *, struct relocation_info *, int));
void md_make_gotreloc __P((struct relocation_info *, struct relocation_info *, int));
void md_make_copyreloc __P((struct relocation_info *, struct relocation_info *));
void md_set_breakpoint __P((long, long *));
#endif /* __MD_H__ */