Subject: (Politically) Correct fix for ld.aout_so/arch/ns32k/md.c
To: None <port-pc532@netbsd.org>
From: Phil Budne <phil@ultimate.com>
List: port-pc532
Date: 12/24/1998 00:04:55
Here is a better patch for the ns32k ld.so md.c;
No undue ansi function declarations (just __P'd forwards),
made fall-thru in md_get_addend a fatal internal error, like in putdisp.
-phil
*** md.c.0 Fri Dec 18 07:15:25 1998
--- md.c Thu Dec 24 00:00:23 1998
***************
*** 44,49 ****
--- 44,50 ----
#include <a.out.h>
#include <stab.h>
#include <string.h>
+ #include <err.h>
#include "ld.h"
#ifndef RTLD
***************
*** 51,56 ****
--- 52,65 ----
#include "ld_i.h"
#endif
+ static void put_num __P((unsigned char *, long, char));
+ static void put_imm __P((unsigned char *, unsigned long, char));
+ static void put_disp __P((unsigned char *, long, char));
+ static unsigned long get_num __P((unsigned char *, int));
+ static unsigned long get_imm __P((unsigned char *, int));
+ static unsigned long get_disp __P((unsigned char *, int));
+ static long sign_extend __P((int, int));
+
/*
* Put little endian VAL of size N at ADDR
*/
***************
*** 150,162 ****
switch (n) {
case 1:
if (val < -64 || val > 63)
! warnx("Byte displacement %d, out of range.", val);
val &= 0x7f;
*addr++ = val;
break;
case 2:
if (val < -8192 || val > 8191)
! warnx("Word displacement %d, out of range.", val);
val &= 0x3fff;
val |= 0x8000;
*addr++ = (val >> 8);
--- 159,171 ----
switch (n) {
case 1:
if (val < -64 || val > 63)
! warnx("Byte displacement %ld, out of range.", val);
val &= 0x7f;
*addr++ = val;
break;
case 2:
if (val < -8192 || val > 8191)
! warnx("Word displacement %ld, out of range.", val);
val &= 0x3fff;
val |= 0x8000;
*addr++ = (val >> 8);
***************
*** 168,174 ****
#else
if (val < -0x20000000 || val >= 0x20000000)
#endif
! warnx("Double word displacement %d, out of range", val);
val |= 0xc0000000;
*addr++ = (val >> 24);
*addr++ = (val >> 16);
--- 177,183 ----
#else
if (val < -0x20000000 || val >= 0x20000000)
#endif
! warnx("Double word displacement %ld, out of range", val);
val |= 0xc0000000;
*addr++ = (val >> 24);
*addr++ = (val >> 16);
***************
*** 240,245 ****
--- 249,255 ----
case 2:
return get_num(addr, bytes);
}
+ errx(1, "internal error: md_get_addend: disp = %d", rp->r_disp);
}
/*