aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/.Sanitize6
-rw-r--r--bfd/ChangeLog22
-rw-r--r--bfd/Makefile.in12
-rw-r--r--bfd/configure.in5
-rw-r--r--bfd/hosts/.Sanitize14
-rw-r--r--bfd/hosts/i386nbsd.h14
-rw-r--r--bfd/hosts/nbsd.h34
-rw-r--r--bfd/hosts/ns32knbsd.h13
-rw-r--r--bfd/hosts/sparcnbsd.h19
-rw-r--r--bfd/netbsd386.c115
-rw-r--r--bfd/netbsd532.c196
-rw-r--r--bfd/ns32knetbsd.c38
-rw-r--r--bfd/targets.c209
13 files changed, 276 insertions, 421 deletions
diff --git a/bfd/.Sanitize b/bfd/.Sanitize
index 0c88a70..da3d301 100644
--- a/bfd/.Sanitize
+++ b/bfd/.Sanitize
@@ -145,6 +145,7 @@ i386aout.c
i386bsd.c
i386dynix.c
i386linux.c
+i386netbsd.c
i386lynx.c
i386mach3.c
i386os9k.c
@@ -170,8 +171,7 @@ m88kmach3.c
makefile.dos
mipsbsd.c
newsos3.c
-netbsd386.c
-netbsd532.c
+netbsd.h
nlm-target.h
nlm.c
nlm32-alpha.c
@@ -182,6 +182,7 @@ nlm32.c
nlm64.c
nlmcode.h
nlmswap.h
+ns32knetbsd.c
oasys.c
opncls.c
osf-core.c
@@ -195,6 +196,7 @@ section.c
som.c
som.h
sparclynx.c
+sparcnetbsd.c
srec.c
stab-syms.c
sunos.c
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index c521bf2..4b9a159 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,24 @@
+Tue Sep 13 11:09:39 1994 J.T. Conklin (jtc@rtl.cygnus.com)
+
+ * configure.host (sparc-*-netbsd): use sparcnbsd.
+ (ns32k-*-netbsd): use ns32knbsd.
+
+ * hosts/{nbsd,i386nbsd,ns32knbsd,sparcnbsd}.h: New files, NetBSD
+ host support.
+
+ * sparcnetbsd.c: New file, adds support for NetBSD/sparc.
+ * config/sparc-nbsd.mt: Likewise.
+
+ * netbsd.h: New file, definitions common to all netbsd ports.
+ * i386netbsd.c: Use it.
+ * ns32knetbsd.c: Use it.
+
+ * Makefile.in, configure.in, targets.c, config/i386-nbsd.mt,
+ config/ns32k-nbsd.mt: canonicalize netbsd targets to conform to
+ file/variable naming conventions.
+ * i386netbsd.c: New file, renamed from netbsd386.c.
+ * ns32knetbsd.c: New file, renamed from netbsd532.c.
+
Mon Sep 12 21:56:20 1994 Jeff Law (law@snake.cs.utah.edu)
* som.c (som_reloc_skip): Correct off-by-one error for 4-byte
@@ -287,7 +308,6 @@ Wed Aug 24 11:49:19 1994 Ian Lance Taylor (ian@sanguine.cygnus.com)
bytes in bits2.
* configure.host, config.bfd: Change i[34]86 to i[345]86.
-
* coffgen.c (coff_real_object_p): Set obj_conv_table_size here,
rather than waiting until coff_slurp_symbol_table.
(coff_write_alien_symbol): Just ignore BSF_DEBUGGING symbols.
diff --git a/bfd/Makefile.in b/bfd/Makefile.in
index 12c2a22..3bfac41 100644
--- a/bfd/Makefile.in
+++ b/bfd/Makefile.in
@@ -157,8 +157,7 @@ BFD32_BACKENDS = \
i386bsd.o \
i386linux.o \
i386lynx.o \
- netbsd386.o \
- netbsd532.o \
+ i386netbsd.o \
i386mach3.o \
i386os9k.o \
ieee.o \
@@ -171,6 +170,7 @@ BFD32_BACKENDS = \
nlm32-sparc.o \
nlm32-ppc.o \
nlm32.o \
+ ns32knetbsd.o \
oasys.o \
pc532-mach.o \
reloc16.o \
@@ -237,7 +237,7 @@ CFILES = libbfd.c opncls.c bfd.c archive.c targets.c cache.c \
coff-a29k.c coff-rs6000.c coff-sparc.c coffgen.c format.c \
section.c core.c syms.c stab-syms.c reloc.c init.c \
coff-m88k.c coff-mips.c coff-sh.c trad-core.c cisco-core.c newsos3.c \
- i386aout.c i386linux.c netbsd386.c i386mach3.c i386os9k.c \
+ i386aout.c i386linux.c i386mach3.c i386netbsd.c i386os9k.c \
bout.c aout-adobe.c coff-we32k.c \
i386bsd.c i386dynix.c cpu-h8300.c cpu-i960.c cpu-sparc.c cpu-m68k.c \
cpu-m88k.c cpu-vax.c cpu-mips.c cpu-a29k.c cpu-i386.c cpu-powerpc.c \
@@ -614,12 +614,12 @@ i386aout.o: i386aout.c libaout.h $(INCDIR)/bfdlink.h \
i386linux.o: i386linux.c $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \
$(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h libaout.h \
$(INCDIR)/bfdlink.h aout-target.h
-netbsd386.o: netbsd386.c libaout.h $(INCDIR)/bfdlink.h \
- aout-target.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \
- $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
i386mach3.o: i386mach3.c $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \
$(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h libaout.h \
$(INCDIR)/bfdlink.h aout-target.h
+i386netbsd.o: i386netbsd.c libaout.h $(INCDIR)/bfdlink.h \
+ aout-target.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \
+ $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
i386os9k.o: i386os9k.c $(INCDIR)/bfdlink.h libaout.h \
$(INCDIR)/os9k.h
bout.o: bout.c $(INCDIR)/bfdlink.h genlink.h $(INCDIR)/bout.h \
diff --git a/bfd/configure.in b/bfd/configure.in
index db68772..fdcc6b5 100644
--- a/bfd/configure.in
+++ b/bfd/configure.in
@@ -180,6 +180,7 @@ do
i386lynx_aout_vec) tb="$tb i386lynx.o lynx-core.o aout32.o stab-syms.o" ;;
i386lynx_coff_vec) tb="$tb cf-i386lynx.o cofflink.o lynx-core.o stab-syms.o" ;;
i386mach3_vec) tb="$tb i386mach3.o aout32.o stab-syms.o" ;;
+ i386netbsd_vec) tb="$tb i386netbsd.o aout32.o stab-syms.o" ;;
i386os9k_vec) tb="$tb i386os9k.o aout32.o stab-syms.o" ;;
icoff_big_vec) tb="$tb coff-i960.o" ;;
icoff_little_vec) tb="$tb coff-i960.o" ;;
@@ -189,8 +190,6 @@ do
m68klynx_aout_vec) tb="$tb m68klynx.o lynx-core.o aout32.o stab-syms.o" ;;
m68klynx_coff_vec) tb="$tb cf-m68klynx.o coff-m68k.o cofflink.o lynx-core.o stab-syms.o" ;;
m88kbcs_vec) tb="$tb coff-m88k.o" ;;
- netbsd386_vec) tb="$tb netbsd386.o aout32.o stab-syms.o" ;;
- netbsd532_vec) tb="$tb netbsd532.o aout-ns32k.o stab-syms.o" ;;
newsos3_vec) tb="$tb newsos3.o aout32.o stab-syms.o" ;;
nlm32_i386_vec) tb="$tb nlm32-i386.o nlm32.o nlm.o" ;;
nlm32_sparc_vec) tb="$tb nlm32-sparc.o nlm32.o nlm.o" ;;
@@ -198,12 +197,14 @@ do
target64=true ;;
riscix_vec) tb="$tb aout32.o riscix.o stab-syms.o" ;;
nlm32_powerpc_vec) tb="$tb nlm32-ppc.o nlm32.o nlm.o" ;;
+ ns32knetbsd_vec) tb="$tb ns32knetbsd.o aout-ns32k.o stab-syms.o" ;;
pc532machaout_vec) tb="$tb pc532-mach.o aout-ns32k.o stab-syms.o" ;;
rs6000coff_vec) tb="$tb coff-rs6000.o" ;;
shcoff_vec) tb="$tb coff-sh.o reloc16.o" ;;
som_vec) tb="$tb som.o" ;;
sparclynx_aout_vec) tb="$tb sparclynx.o lynx-core.o aout32.o stab-syms.o" ;;
sparclynx_coff_vec) tb="$tb cf-sparclynx.o lynx-core.o stab-syms.o" ;;
+ sparcnetbsd_vec) tb="$tb sparcnetbsd.o aout32.o stab-syms.o" ;;
sparccoff_vec) tb="$tb coff-sparc.o" ;;
srec_vec) tb="$tb srec.o" ;;
sunos_big_vec) tb="$tb sunos.o aout32.o stab-syms.o" ;;
diff --git a/bfd/hosts/.Sanitize b/bfd/hosts/.Sanitize
index 5c23108..e4c8e2f 100644
--- a/bfd/hosts/.Sanitize
+++ b/bfd/hosts/.Sanitize
@@ -33,16 +33,16 @@ alphaosf.h
apollo68.h
apollov68.h
decstation.h
-dgux.h
delta68.h
delta88.h
delta88v4.h
+dgux.h
dose.h
dpx2.h
go32.h
harris.h
-hp300bsd.h
hp300.h
+hp300bsd.h
hppabsd.h
hppahpux.h
hppaosf.h
@@ -51,6 +51,7 @@ i386bsd.h
i386linux.h
i386lynx.h
i386mach3.h
+i386nbsd.h
i386osf1mk.h
i386sco.h
i386v.h
@@ -64,9 +65,12 @@ m88kmach3.h
miniframe.h
mipsbsd.h
mipsmach3.h
-news.h
-news-mips.h
+nbsd.h
ncr3000.h
+news-mips.h
+news.h
+ns32knbsd.h
+ns32knetbsd.h
pc532mach.h
riscos.h
rs6000.h
@@ -76,6 +80,8 @@ solaris2.h
sparc-ll.h
sparc.h
sparclynx.h
+sparcnbsd.h
+sparcnetbsd.h
std-host.h
stratus.h
sun3.h
diff --git a/bfd/hosts/i386nbsd.h b/bfd/hosts/i386nbsd.h
new file mode 100644
index 0000000..1fd3bed
--- /dev/null
+++ b/bfd/hosts/i386nbsd.h
@@ -0,0 +1,14 @@
+/* Intel 386 running NetBSD */
+
+#ifndef hosts_i386bsd_H
+#define hosts_i386bsd_H
+
+#include "hosts/nbsd.h"
+
+#define HOST_MACHINE_ARCH bfd_arch_i386
+
+#define TRAD_UNIX_CORE_FILE_FAILING_SIGNAL(core_bfd) \
+ ((core_bfd)->tdata.trad_core_data->u.u_sig)
+#define u_comm u_kproc.kp_proc.p_comm
+#endif
+
diff --git a/bfd/hosts/nbsd.h b/bfd/hosts/nbsd.h
new file mode 100644
index 0000000..1c7a779
--- /dev/null
+++ b/bfd/hosts/nbsd.h
@@ -0,0 +1,34 @@
+/* Architecture independant NetBSD host support */
+
+#ifndef hosts_nbsd_H_
+#define hosts_nbsd_H__
+
+#include <fcntl.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <ctype.h>
+#include <string.h>
+#include <sys/file.h>
+#include <machine/param.h>
+#include <machine/vmparam.h>
+#include <machine/reg.h>
+
+#ifndef O_ACCMODE
+#define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
+#endif
+
+#define SEEK_SET 0
+#define SEEK_CUR 1
+
+#define POSIX_UTIME
+
+#include "fopen-same.h"
+
+#define HOST_PAGE_SIZE NBPG
+#define HOST_TEXT_START_ADDR USRTEXT
+#define HOST_STACK_END_ADDR USRSTACK
+
+#endif
diff --git a/bfd/hosts/ns32knbsd.h b/bfd/hosts/ns32knbsd.h
new file mode 100644
index 0000000..d072d6d
--- /dev/null
+++ b/bfd/hosts/ns32knbsd.h
@@ -0,0 +1,13 @@
+/* ns32k running NetBSD */
+
+#ifndef hosts_ns32knbsd_h
+#define hosts_ns32knbsd_h
+
+#include "hosts/nbsd.h"
+
+#define HOST_MACHINE_ARCH bfd_arch_ns32k
+
+#define TRAD_UNIX_CORE_FILE_FAILING_SIGNAL(core_bfd) \
+ ((core_bfd)->tdata.trad_core_data->u.u_sig)
+#define u_comm u_kproc.kp_proc.p_comm
+#endif
diff --git a/bfd/hosts/sparcnbsd.h b/bfd/hosts/sparcnbsd.h
new file mode 100644
index 0000000..d5ae6d9
--- /dev/null
+++ b/bfd/hosts/sparcnbsd.h
@@ -0,0 +1,19 @@
+/* Sparc running NetBSD */
+
+#ifndef hosts_sparcnbsd_h
+#define hosts_sparcnbsd_h
+
+#include "hosts/nbsd.h"
+
+#define HOST_MACHINE_ARCH bfd_arch_sparc
+#define HOST_BIG_ENDIAN_P
+
+#define TRAD_UNIX_CORE_FILE_FAILING_SIGNAL(core_bfd) \
+ ((core_bfd)->tdata.trad_core_data->u.u_sig)
+#define u_comm u_kproc.kp_proc.p_comm
+#define TRAD_CORE_REGPOS(core_bfd) \
+ ((bfd_vma)(core_bfd)->tdata.trad_core_data->u.u_kproc.kp_proc.p_md.md_tf)
+
+#define CORE_FPU_OFFSET (sizeof(struct trapframe))
+
+#endif
diff --git a/bfd/netbsd386.c b/bfd/netbsd386.c
deleted file mode 100644
index 1f72c7a..0000000
--- a/bfd/netbsd386.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/* BFD back-end for NetBSD/386 a.out-ish binaries.
- Copyright (C) 1990, 1991, 1992 Free Software Foundation, Inc.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#define BYTES_IN_WORD 4
-
-/* ZMAGIC files never have the header in the text. */
-#define N_HEADER_IN_TEXT(x) 0
-
-/* ZMAGIC files start at address 0. This does not apply to QMAGIC. */
-#define TEXT_START_ADDR 0
-#define N_SHARED_LIB(x) 0
-
-#define PAGE_SIZE 4096
-#define SEGMENT_SIZE PAGE_SIZE
-
-#define DEFAULT_ARCH bfd_arch_i386
-#define MACHTYPE_OK(mtype) ((mtype) == M_386 || (mtype) == M_386_NETBSD || (mtype) == M_UNKNOWN)
-
-#define MY(OP) CAT(netbsd386_,OP)
-/* This needs to start with a.out so GDB knows it is an a.out variant. */
-#define TARGETNAME "a.out-netbsd-386"
-
-#define N_MAGIC(ex) \
- ( (((ex).a_info)&0xffff0000) ? ((((ex).a_info))&0xffff) : ((ex).a_info))
-#define N_MACHTYPE(ex) \
- ( (((ex).a_info)&0xffff0000) ? (((((ex).a_info))>>16)&0x03ff) : 0 )
-# define N_FLAGS(ex) \
- ( (((ex).a_info)&0xffff0000) ? ((((ex).a_info)>>26)&0x3f) : 0 )
-#define N_SET_INFO(ex, mag,mid,flag) \
- ( (ex).a_info = htonl( (((flag)&0x3f)<<26) | (((mid)&0x03ff)<<16) | \
- (((mag)&0xffff)) ) )
-#define N_SET_MAGIC(exec,magic) \
- ((exec).a_info = (((exec).a_info & ~0xffff) | ((magic) & 0xffff)))
-#define N_SET_MACHTYPE(exec,machtype) \
- ((exec).a_info = \
- (((exec).a_info & ~(0x3ff<<16)) | (((machtype)&0xff) << 16)))
-#define N_SET_FLAGS(exec, flags) \
- ((exec).a_info = \
- (((exec).a_info & ~(0x3f<<26)) | (((flags)&0x3f) << 26)))
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "libaout.h"
-
-#define N_GETMAGIC2(ex) \
- ( (((ex).a_info)&0xffff0000) ? ((((ex).a_info))&0xffff) : \
- (((ex).a_info) | 0x10000) )
-
-#define N_TXTADDR(ex) (N_GETMAGIC2(ex) == (ZMAGIC|0x10000) ? 0 : 4096)
-#define N_TXTOFF(ex) \
- ( N_GETMAGIC2(ex)==ZMAGIC || N_GETMAGIC2(ex)==(QMAGIC|0x10000) ? \
- 0 : (N_GETMAGIC2(ex)==(ZMAGIC|0x10000) ? 4096 : EXEC_BYTES_SIZE ))
-#define N_ALIGN(ex,x) \
- (N_MAGIC(ex) == ZMAGIC || N_MAGIC(ex) == QMAGIC ? \
- ((x) + 4096 - 1) & ~(4096 - 1) : (x))
-#define N_DATADDR(ex) \
- N_ALIGN(ex, N_TXTADDR(ex) + (ex).a_text)
-/* Data segment offset. */
-#define N_DATOFF(ex) \
- N_ALIGN(ex, N_TXTOFF(ex) + (ex).a_text)
-
-/* #define N_BADMAG(x) n_badmag(N_MAGIC(x)) */
-
-/* On NetBSD, the magic number is always in ntohl's "network" (big-endian)
- format. */
-#define SWAP_MAGIC(ext) bfd_getb32 (ext)
-
-#include "aout-target.h"
-
-#if 0
-int
-n_badmag(x)
-unsigned long x; {
- union {
- unsigned long l;
- unsigned char c[sizeof(unsigned long)];
- } l;
- unsigned char temp;
-
- printf ("x = %o, OMAGIC = %o, NMAGIC = %o, ZMAGIC = %o, QMAGIC = %o\n",
- x, OMAGIC, NMAGIC, ZMAGIC, QMAGIC);
-
- l.l = x;
- temp = l.c[0];
- l.c[0] = l.c[3];
- l.c[3] = temp;
- temp = l.c[2];
- l.c[2] = l.c[1];
- l.c[1] = temp;
- printf ("\tbyte-swapped(x) = %o\n", l.l);
-
- return (x != OMAGIC
- && x != NMAGIC
- && x != ZMAGIC
- && x != QMAGIC);
-}
-#endif
-
diff --git a/bfd/netbsd532.c b/bfd/netbsd532.c
deleted file mode 100644
index 12ba065..0000000
--- a/bfd/netbsd532.c
+++ /dev/null
@@ -1,196 +0,0 @@
-/* BFD back-end for NetBSD/532 a.out-ish binaries.
- Copyright (C) 1990, 1991, 1992, 1994 Free Software Foundation, Inc.
-
-This file is part of BFD, the Binary File Descriptor library.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-/*
- * Created by Ian Dall
- * 5-Jun-94
- *
- * Largely a copy of netbsd386.c plus some code from aout-pc532-mach.c
- */
-
-#define BYTES_IN_WORD 4
-
-/* ZMAGIC files never include the header in the text. */
-#define N_HEADER_IN_TEXT(x) 1
-
-#define PAGE_SIZE 0x1000
-
- /* ZMAGIC files start at address 0. This does not apply to QMAGIC. */
-#define TEXT_START_ADDR PAGE_SIZE
-#define N_SHARED_LIB(x) 0
-
- /* Use a_entry of 0 to distinguish object files from OMAGIC executables */
-#define N_TXTADDR(x) \
- ((N_MAGIC(x) == OMAGIC) && \
- ((x).a_entry < TEXT_START_ADDR) ? 0 : /* object file or NMAGIC */\
- N_SHARED_LIB(x) ? 0 : \
- N_HEADER_IN_TEXT(x) ? \
- TEXT_START_ADDR + EXEC_BYTES_SIZE : /* no padding */\
- TEXT_START_ADDR /* a page of padding */\
- )
-
-#define SEGMENT_SIZE PAGE_SIZE
-
-#define DEFAULT_ARCH bfd_arch_ns32k
-
-#define MY(OP) CAT(netbsd532_,OP)
-/* This needs to start with a.out so GDB knows it is an a.out variant. */
-#define TARGETNAME "a.out-netbsd-532"
-#define MACHTYPE_OK(mtype) ((mtype) == M_532_NETBSD)
-
-#define N_MAGIC(ex) \
- ( (((ex).a_info)&0xffff0000) ? ((((ex).a_info))&0xffff) : ((ex).a_info))
-#define N_MACHTYPE(ex) \
- ( (((ex).a_info)&0xffff0000) ? (((((ex).a_info))>>16)&0x03ff) : 0 )
-#define N_FLAGS(ex) \
- ( (((ex).a_info)&0xffff0000) ? ((((ex).a_info)>>26)&0x3f) : 0 )
-#define N_SET_INFO(ex, mag,mid,flag) \
- ( (ex).a_info = htonl( (((flag)&0x3f)<<26) | (((mid)&0x03ff)<<16) | \
- (((mag)&0xffff)) ) )
-#define N_SET_MAGIC(exec,magic) \
- ((exec).a_info = (((exec).a_info & ~0xffff) | ((magic) & 0xffff)))
-#define N_SET_MACHTYPE(exec,machtype) \
- ((exec).a_info = \
- (((exec).a_info & ~(0x3ff<<16)) | (((machtype)&0xff) << 16)))
-#define N_SET_FLAGS(exec, flags) \
- ((exec).a_info = \
- (((exec).a_info & ~(0x3f<<26)) | (((flags)&0x3f) << 26)))
-
-#define N_MAG(MAG) ((MAG) == o_magic? OMAGIC: ((MAG) == z_magic? ZMAGIC: ((MAG) == n_magic? NMAGIC: 0)))
-
-#define WRITE_HEADERS(abfd, execp) \
-{ \
- bfd_size_type text_size; /* dummy vars */ \
- int mag; \
- file_ptr text_end; \
- if (adata(abfd).magic == undecided_magic) \
- NAME(aout,adjust_sizes_and_vmas) (abfd, &text_size, &text_end); \
- mag = adata(abfd).magic; \
- N_SET_INFO(*execp, N_MAG(mag), M_532_NETBSD, aout_backend_info (abfd)->exec_hdr_flags); \
- \
- execp->a_syms = bfd_get_symcount (abfd) * EXTERNAL_NLIST_SIZE; \
- execp->a_entry = bfd_get_start_address (abfd); \
- \
- execp->a_trsize = ((obj_textsec (abfd)->reloc_count) * \
- obj_reloc_entry_size (abfd)); \
- execp->a_drsize = ((obj_datasec (abfd)->reloc_count) * \
- obj_reloc_entry_size (abfd)); \
- NAME(aout,swap_exec_header_out) (abfd, execp, &exec_bytes); \
- \
- if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) return false; \
- if (bfd_write ((PTR) &exec_bytes, 1, EXEC_BYTES_SIZE, abfd) \
- != EXEC_BYTES_SIZE) \
- return false; \
- /* Now write out reloc info, followed by syms and strings */ \
- \
- if (bfd_get_outsymbols (abfd) != (asymbol **) NULL \
- && bfd_get_symcount (abfd) != 0) \
- { \
- if (bfd_seek (abfd, (file_ptr)(N_SYMOFF(*execp)), SEEK_SET) \
- != 0) \
- return false; \
- \
- if (! NAME(aout,write_syms)(abfd)) return false; \
- \
- if (bfd_seek (abfd, (file_ptr)(N_TRELOFF(*execp)), SEEK_SET) \
- != 0) \
- return false; \
- \
- if (!NAME(aout,squirt_out_relocs) (abfd, obj_textsec (abfd))) \
- return false; \
- if (bfd_seek (abfd, (file_ptr)(N_DRELOFF(*execp)), SEEK_SET) \
- != 0) \
- return false; \
- \
- if (!NAME(aout,squirt_out_relocs)(abfd, obj_datasec (abfd))) \
- return false; \
- } \
-}
-
-#include "bfd.h"
-#include "sysdep.h"
-#include "libbfd.h"
-#include "libaout.h"
-
-
-/* On NetBSD, the magic number is always in ntohl's "network" (big-endian)
- format. */
-#define SWAP_MAGIC(ext) bfd_getb32 (ext)
-
-#include "aout/aout64.h"
-
-/* Forward declaration. Defined in aout-target.h */
-
-static boolean MY(set_sizes)();
-
-static CONST struct aout_backend_data MY(backend_data) = {
- 0, /* zmagic contiguous */
- 1, /* text incl header */
- 0,
- 0, /* text vma? */
- MY(set_sizes),
- 0, /* exec header is counted */
-};
-
-#define MY_backend_data &MY(backend_data)
-
-/* We can`t use the MYNS macro here for cpp reasons too subtle
- * for me -- IWD
- */
-#define MY_bfd_reloc_type_lookup ns32kaout_bfd_reloc_type_lookup
-
-/* libaout doesn't use NAME for these ... */
-#define MY_get_section_contents aout_32_get_section_contents
-
-#define MYNSX(OP) CAT(ns32kaout_,OP)
-CONST struct reloc_howto_struct *
-MYNSX(bfd_reloc_type_lookup)
- PARAMS((bfd *abfd AND
- bfd_reloc_code_real_type code));
-
-boolean
-MYNSX(write_object_contents)
- PARAMS((bfd *abfd));
-
-static boolean
-MY(write_object_contents) (abfd)
- bfd *abfd;
-{
- struct external_exec exec_bytes;
- struct internal_exec *execp = exec_hdr (abfd);
-
-#if CHOOSE_RELOC_SIZE
- CHOOSE_RELOC_SIZE(abfd);
-#else
- obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
-#endif
-
- BFD_ASSERT(bfd_get_arch(abfd) == bfd_arch_ns32k);
- BFD_ASSERT(bfd_get_mach(abfd) == 32532);
- N_SET_MACHTYPE (*execp, M_532_NETBSD);
-
- N_SET_FLAGS (*execp, aout_backend_info (abfd)->exec_hdr_flags);
-
- WRITE_HEADERS(abfd, execp);
-
- return true;
-}
-
-#define MY_write_object_contents MY(write_object_contents)
-
-#include "aout-target.h"
diff --git a/bfd/ns32knetbsd.c b/bfd/ns32knetbsd.c
new file mode 100644
index 0000000..25a4ef9
--- /dev/null
+++ b/bfd/ns32knetbsd.c
@@ -0,0 +1,38 @@
+/* BFD back-end for NetBSD/ns32k a.out-ish binaries.
+ Copyright (C) 1990, 1991, 1992 Free Software Foundation, Inc.
+
+This file is part of BFD, the Binary File Descriptor library.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ $Id$
+*/
+
+#define BYTES_IN_WORD 4
+#undef TARGET_IS_BIG_ENDIAN_P
+
+#define PAGE_SIZE 4096
+#define SEGMENT_SIZE PAGE_SIZE
+#define __LDPGSZ 4096
+
+#define DEFAULT_ARCH bfd_arch_ns32k
+#define MACHTYPE_OK(mtype) ((mtype) == M_NS32K_NETBSD || (mtype) == M_UNKNOWN)
+
+#define MY(OP) CAT(pc532netbsd_,OP)
+/* This needs to start with a.out so GDB knows it is an a.out variant. */
+#define TARGETNAME "a.out-ns32k-netbsd"
+
+#include "netbsd.h"
+
diff --git a/bfd/targets.c b/bfd/targets.c
index 0d7c31e..f73b3ce 100644
--- a/bfd/targets.c
+++ b/bfd/targets.c
@@ -229,7 +229,7 @@ within the target vector structure, one for each format to check.
Check the format of a file being read. Return a <<bfd_target *>> or zero.
-. struct bfd_target * (*_bfd_check_format[bfd_type_end]) PARAMS ((bfd *));
+. const struct bfd_target *(*_bfd_check_format[bfd_type_end]) PARAMS ((bfd *));
Set the format of a file being written.
@@ -286,7 +286,8 @@ The general target vector.
.CAT(NAME,_truncate_arname),\
.CAT(NAME,_write_armap),\
.CAT(NAME,_openr_next_archived_file),\
-.CAT(NAME,_generic_stat_arch_elt)
+.CAT(NAME,_generic_stat_arch_elt),\
+.CAT(NAME,_update_armap_timestamp)
. boolean (*_bfd_slurp_armap) PARAMS ((bfd *));
. boolean (*_bfd_slurp_extended_name_table) PARAMS ((bfd *));
. void (*_bfd_truncate_arname) PARAMS ((bfd *, CONST char *, char *));
@@ -295,9 +296,10 @@ The general target vector.
. struct orl *map,
. unsigned int orl_count,
. int stridx));
-. bfd * (*openr_next_archived_file) PARAMS ((bfd *arch, bfd *prev));
-. int (*_bfd_stat_arch_elt) PARAMS ((bfd *, struct stat *));
-.
+. bfd * (*openr_next_archived_file) PARAMS ((bfd *arch, bfd *prev));
+. int (*_bfd_stat_arch_elt) PARAMS ((bfd *, struct stat *));
+. boolean (*_bfd_update_armap_timestamp) PARAMS ((bfd *));
+.
. {* Entry points used for symbols. *}
.#define BFD_JUMP_TABLE_SYMBOLS(NAME)\
.CAT(NAME,_get_symtab_upper_bound),\
@@ -417,89 +419,94 @@ in this structure.
Alphabetized for easy reference.
They are listed a second time below, since
we can't intermix extern's and initializers. */
-extern bfd_target a29kcoff_big_vec;
-extern bfd_target a_out_adobe_vec;
-extern bfd_target aout_mips_big_vec;
-extern bfd_target aout_mips_little_vec;
-extern bfd_target aout0_big_vec;
-extern bfd_target apollocoff_vec;
-extern bfd_target b_out_vec_big_host;
-extern bfd_target b_out_vec_little_host;
-extern bfd_target bfd_elf32_big_generic_vec;
-extern bfd_target bfd_elf32_bigmips_vec;
-extern bfd_target bfd_elf32_hppa_vec;
-extern bfd_target bfd_elf32_i386_vec;
-extern bfd_target bfd_elf32_i860_vec;
-extern bfd_target bfd_elf32_little_generic_vec;
-extern bfd_target bfd_elf32_littlemips_vec;
-extern bfd_target bfd_elf32_m68k_vec;
-extern bfd_target bfd_elf32_m88k_vec;
-extern bfd_target bfd_elf32_powerpc_vec;
-extern bfd_target bfd_elf32_sparc_vec;
-extern bfd_target bfd_elf64_big_generic_vec;
-extern bfd_target bfd_elf64_little_generic_vec;
-extern bfd_target bfd_elf64_sparc_vec;
-extern bfd_target demo_64_vec;
-extern bfd_target ecoff_big_vec;
-extern bfd_target ecoff_little_vec;
-extern bfd_target ecoffalpha_little_vec;
-extern bfd_target h8300coff_vec;
-extern bfd_target h8500coff_vec;
-extern bfd_target host_aout_vec;
-extern bfd_target hp300bsd_vec;
-extern bfd_target hp300hpux_vec;
-extern bfd_target som_vec;
-extern bfd_target i386aout_vec;
-extern bfd_target i386bsd_vec;
-extern bfd_target i386dynix_vec;
-extern bfd_target i386os9k_vec;
-extern bfd_target netbsd386_vec;
-extern bfd_target i386coff_vec;
-extern bfd_target go32coff_vec;
-extern bfd_target i386linux_vec;
-extern bfd_target i386lynx_aout_vec;
-extern bfd_target i386lynx_coff_vec;
-extern bfd_target i386mach3_vec;
-extern bfd_target icoff_big_vec;
-extern bfd_target icoff_little_vec;
-extern bfd_target ieee_vec;
-extern bfd_target m68kcoff_vec;
-extern bfd_target m68kcoffun_vec;
-extern bfd_target m68klynx_aout_vec;
-extern bfd_target m68klynx_coff_vec;
-extern bfd_target m88kbcs_vec;
-extern bfd_target newsos3_vec;
-extern bfd_target nlm32_i386_vec;
-extern bfd_target nlm32_sparc_vec;
-extern bfd_target nlm32_alpha_vec;
-extern bfd_target nlm32_powerpc_vec;
-extern bfd_target oasys_vec;
-extern bfd_target rs6000coff_vec;
-extern bfd_target shcoff_vec;
-extern bfd_target sparclynx_aout_vec;
-extern bfd_target sparclynx_coff_vec;
-extern bfd_target sparccoff_vec;
-extern bfd_target sunos_big_vec;
-extern bfd_target tekhex_vec;
-extern bfd_target we32kcoff_vec;
-extern bfd_target z8kcoff_vec;
+extern const bfd_target a29kcoff_big_vec;
+extern const bfd_target a_out_adobe_vec;
+extern const bfd_target aout_mips_big_vec;
+extern const bfd_target aout_mips_little_vec;
+extern const bfd_target aout0_big_vec;
+extern const bfd_target apollocoff_vec;
+extern const bfd_target b_out_vec_big_host;
+extern const bfd_target b_out_vec_little_host;
+extern const bfd_target bfd_elf32_big_generic_vec;
+extern const bfd_target bfd_elf32_bigmips_vec;
+extern const bfd_target bfd_elf32_hppa_vec;
+extern const bfd_target bfd_elf32_i386_vec;
+extern const bfd_target bfd_elf32_i860_vec;
+extern const bfd_target bfd_elf32_little_generic_vec;
+extern const bfd_target bfd_elf32_littlemips_vec;
+extern const bfd_target bfd_elf32_m68k_vec;
+extern const bfd_target bfd_elf32_m88k_vec;
+extern const bfd_target bfd_elf32_powerpc_vec;
+extern const bfd_target bfd_elf32_sparc_vec;
+extern const bfd_target bfd_elf64_big_generic_vec;
+extern const bfd_target bfd_elf64_little_generic_vec;
+extern const bfd_target bfd_elf64_sparc_vec;
+extern const bfd_target demo_64_vec;
+extern const bfd_target ecoff_big_vec;
+extern const bfd_target ecoff_little_vec;
+extern const bfd_target ecoffalpha_little_vec;
+extern const bfd_target h8300coff_vec;
+extern const bfd_target h8500coff_vec;
+extern const bfd_target host_aout_vec;
+extern const bfd_target hp300bsd_vec;
+extern const bfd_target hp300hpux_vec;
+extern const bfd_target som_vec;
+extern const bfd_target i386aout_vec;
+extern const bfd_target i386bsd_vec;
+extern const bfd_target i386dynix_vec;
+extern const bfd_target i386os9k_vec;
+extern const bfd_target i386coff_vec;
+extern const bfd_target go32coff_vec;
+extern const bfd_target i386linux_vec;
+extern const bfd_target i386lynx_aout_vec;
+extern const bfd_target i386lynx_coff_vec;
+extern const bfd_target i386mach3_vec;
+extern const bfd_target i386netbsd_vec;
+extern const bfd_target icoff_big_vec;
+extern const bfd_target icoff_little_vec;
+extern const bfd_target ieee_vec;
+extern const bfd_target m68kcoff_vec;
+extern const bfd_target m68kcoffun_vec;
+extern const bfd_target m68klynx_aout_vec;
+extern const bfd_target m68klynx_coff_vec;
+extern const bfd_target m88kbcs_vec;
+extern const bfd_target m88kmach3_vec;
+extern const bfd_target newsos3_vec;
+extern const bfd_target nlm32_i386_vec;
+extern const bfd_target nlm32_sparc_vec;
+extern const bfd_target nlm32_alpha_vec;
+extern const bfd_target nlm32_powerpc_vec;
+extern const bfd_target ns32knetbsd_vec;
+extern const bfd_target oasys_vec;
+extern const bfd_target pc532machaout_vec;
+extern const bfd_target riscix_vec;
+extern const bfd_target rs6000coff_vec;
+extern const bfd_target shcoff_vec;
+extern const bfd_target sparclynx_aout_vec;
+extern const bfd_target sparclynx_coff_vec;
+extern const bfd_target sparcnetbsd_vec;
+extern const bfd_target sparccoff_vec;
+extern const bfd_target sunos_big_vec;
+extern const bfd_target tekhex_vec;
+extern const bfd_target we32kcoff_vec;
+extern const bfd_target z8kcoff_vec;
/* srec is always included. */
-extern bfd_target srec_vec;
-extern bfd_target symbolsrec_vec;
+extern const bfd_target srec_vec;
+extern const bfd_target symbolsrec_vec;
/* All of the xvecs for core files. */
-extern bfd_target aix386_core_vec;
-extern bfd_target cisco_core_vec;
-extern bfd_target hpux_core_vec;
-extern bfd_target hppabsd_core_vec;
-extern bfd_target irix_core_vec;
-extern bfd_target osf_core_vec;
-extern bfd_target sco_core_vec;
-extern bfd_target trad_core_vec;
-extern bfd_target ptrace_core_vec;
-
-bfd_target *bfd_target_vector[] = {
+extern const bfd_target aix386_core_vec;
+extern const bfd_target cisco_core_vec;
+extern const bfd_target hpux_core_vec;
+extern const bfd_target hppabsd_core_vec;
+extern const bfd_target irix_core_vec;
+extern const bfd_target osf_core_vec;
+extern const bfd_target sco_core_vec;
+extern const bfd_target trad_core_vec;
+extern const bfd_target ptrace_core_vec;
+
+const bfd_target * const bfd_target_vector[] = {
#ifdef SELECT_VECS
@@ -526,8 +533,8 @@ bfd_target *bfd_target_vector[] = {
&b_out_vec_little_host,
/* This, and other vectors, may not be used in any *.mt configuration.
- But that does not mean they are unnecessary. If configured
- --with-targets=all, objdump or gdb should be able to examine
+ But that does not mean they are unnecessary. If configured with
+ --enable-targets=all, objdump or gdb should be able to examine
the file even if we don't recognize the machine type. */
&bfd_elf32_big_generic_vec,
&bfd_elf32_bigmips_vec,
@@ -574,7 +581,6 @@ bfd_target *bfd_target_vector[] = {
#endif
&i386aout_vec,
&i386bsd_vec,
- &netbsd386_vec,
&i386coff_vec,
&go32coff_vec,
#if 0
@@ -584,6 +590,11 @@ bfd_target *bfd_target_vector[] = {
#endif
&i386lynx_aout_vec,
&i386lynx_coff_vec,
+#if 0
+ /* No distinguishing features for Mach 3 executables. */
+ &i386mach3_vec,
+#endif
+ &i386netbsd_vec,
&i386os9k_vec,
&icoff_big_vec,
&icoff_little_vec,
@@ -593,12 +604,14 @@ bfd_target *bfd_target_vector[] = {
&m68klynx_aout_vec,
&m68klynx_coff_vec,
&m88kbcs_vec,
+ &m88kmach3_vec,
&newsos3_vec,
&nlm32_i386_vec,
&nlm32_sparc_vec,
#ifdef BFD64
&nlm32_alpha_vec,
#endif
+ &ns32knetbsd_vec,
#if 0
/* We have no oasys tools anymore, so we can't test any of this
anymore. If you want to test the stuff yourself, go ahead...
@@ -607,10 +620,16 @@ bfd_target *bfd_target_vector[] = {
can be annoying target mis-matches. */
&oasys_vec,
#endif
+ &pc532machaout_vec,
+#if 0
+ /* We have no way of distinguishing this from other a.out variants */
+ &riscix_vec,
+#endif
&rs6000coff_vec,
&shcoff_vec,
&sparclynx_aout_vec,
&sparclynx_coff_vec,
+ &sparcnetbsd_vec,
&sunos_big_vec,
&aout0_big_vec,
#if 0
@@ -656,7 +675,7 @@ bfd_target *bfd_target_vector[] = {
/* bfd_default_vector[0] contains either the address of the default vector,
if there is one, or zero if there isn't. */
-bfd_target *bfd_default_vector[] = {
+const bfd_target * const bfd_default_vector[] = {
#ifdef DEFAULT_VECTOR
&DEFAULT_VECTOR,
#endif
@@ -666,14 +685,14 @@ bfd_target *bfd_default_vector[] = {
/* When there is an ambiguous match, bfd_check_format_matches puts the
names of the matching targets in an array. This variable is the maximum
number of entries that the array could possibly need. */
-CONST size_t _bfd_target_vector_entries = sizeof(bfd_target_vector)/sizeof(*bfd_target_vector);
+const size_t _bfd_target_vector_entries = sizeof(bfd_target_vector)/sizeof(*bfd_target_vector);
/*
FUNCTION
bfd_find_target
SYNOPSIS
- bfd_target *bfd_find_target(CONST char *target_name, bfd *abfd);
+ const bfd_target *bfd_find_target(CONST char *target_name, bfd *abfd);
DESCRIPTION
Return a pointer to the transfer vector for the object target
@@ -687,12 +706,12 @@ DESCRIPTION
targets to find the one that matches the file being read.
*/
-bfd_target *
+const bfd_target *
bfd_find_target (target_name, abfd)
CONST char *target_name;
bfd *abfd;
{
- bfd_target **target;
+ const bfd_target * const *target;
extern char *getenv ();
CONST char *targname = (target_name ? target_name :
(CONST char *) getenv ("GNUTARGET"));
@@ -720,7 +739,7 @@ FUNCTION
bfd_target_list
SYNOPSIS
- CONST char **bfd_target_list(void);
+ const char **bfd_target_list(void);
DESCRIPTION
Return a freshly malloced NULL-terminated
@@ -729,7 +748,7 @@ DESCRIPTION
*/
-CONST char **
+const char **
bfd_target_list ()
{
int vec_length= 0;
@@ -738,7 +757,7 @@ bfd_target_list ()
to loop endlessly when compiling this file. This avoids it. */
volatile
#endif
- bfd_target **target;
+ const bfd_target * const *target;
CONST char **name_list, **name_ptr;
for (target = &bfd_target_vector[0]; *target != NULL; target++)