aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorJim Kingdon <jkingdon@engr.sgi.com>1993-07-11 23:23:20 +0000
committerJim Kingdon <jkingdon@engr.sgi.com>1993-07-11 23:23:20 +0000
commit4d09e8acfb68cfbdef55b4569cdc8cb0eeb48ab9 (patch)
tree429bf3aa89b31181827f57c1923568a747ed4fca /bfd
parent6f4d6543da2b56e114ed45559a424b60f17559fc (diff)
downloadgdb-4d09e8acfb68cfbdef55b4569cdc8cb0eeb48ab9.zip
gdb-4d09e8acfb68cfbdef55b4569cdc8cb0eeb48ab9.tar.gz
gdb-4d09e8acfb68cfbdef55b4569cdc8cb0eeb48ab9.tar.bz2
* elfcode.h: Use memset not bzero.
* trad-core.c: Don't include <sys/file.h>. * i386linux.h: Include <sys/file.h>. * coff-m68k-un.c: new file to handle names with underscores on svr3 machines. * coff-m68k.c (m68k_rtype2howto): added #ifdef ONLY_DECLARE_RELOCS to not duplicate the function in the executable. (TARGET_SYM, TARGET_NAME, NAMES_HAVE_UNDERSCORE): new macros needed by coff-m68k-un.c. * coffcode.h (MC68KBCSMAGIC): case added. * targets.c: Add m68kcoffun_vec. * configure.host: added support for Bull dpx/2. * config/dpx2.mh, hosts/dpx2.h: new files. * Makefile.in: added target coff-m68k-un.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog18
-rw-r--r--bfd/Makefile.in6
-rw-r--r--bfd/coff-m68k-un.c35
-rw-r--r--bfd/coff-m68k.c80
-rw-r--r--bfd/coffcode.h36
-rw-r--r--bfd/configure.host2
-rw-r--r--bfd/elfcode.h2
-rw-r--r--bfd/hosts/.Sanitize1
-rw-r--r--bfd/targets.c2
-rw-r--r--bfd/trad-core.c29
10 files changed, 179 insertions, 32 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index e51b048..0eefe52 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,21 @@
+Thu Jul 1 14:52:47 1993 Frederic Pierresteguy (F.Pierresteguy@frcl.bull.fr)
+ and Jim Kingdon (kingdon@cygnus.com)
+
+ * elfcode.h: Use memset not bzero.
+ * trad-core.c: Don't include <sys/file.h>.
+ * i386linux.h: Include <sys/file.h>.
+ * coff-m68k-un.c: new file to handle names with underscores on
+ svr3 machines.
+ * coff-m68k.c (m68k_rtype2howto): added #ifdef ONLY_DECLARE_RELOCS
+ to not duplicate the function in the executable.
+ (TARGET_SYM, TARGET_NAME, NAMES_HAVE_UNDERSCORE): new macros needed
+ by coff-m68k-un.c.
+ * coffcode.h (MC68KBCSMAGIC): case added.
+ * targets.c: Add m68kcoffun_vec.
+ * configure.host: added support for Bull dpx/2.
+ * config/dpx2.mh, hosts/dpx2.h: new files.
+ * Makefile.in: added target coff-m68k-un.
+
Fri Jul 9 00:43:06 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* aoutf1.h: Add definition of MACHTYPE_OK.
diff --git a/bfd/Makefile.in b/bfd/Makefile.in
index aa4c10f..541f0d4 100644
--- a/bfd/Makefile.in
+++ b/bfd/Makefile.in
@@ -84,7 +84,8 @@ BFD32_BACKENDS = \
aout32.o sunos.o newsos3.o mipsbsd.o aout-adobe.o \
i386aout.o i386bsd.o i386linux.o i386lynx.o \
hp300hpux.o bout.o \
- coff-i960.o coff-a29k.o coff-m68k.o coff-i386.o coff-m88k.o \
+ coff-i960.o coff-a29k.o coff-m68k.o coff-m68k-un.o \
+ coff-i386.o coff-m88k.o \
coff-rs6000.o coff-h8300.o coff-h8500.o coff-z8k.o coff-we32k.o \
coff-mips.o coff-msym.o coff-alpha.o coff-sh.o \
hppa.o oasys.o ieee.o srec.o \
@@ -130,7 +131,8 @@ FLAGS_TO_PASS = \
# C source files that correspond to .o's.
CFILES = libbfd.c opncls.c bfd.c archive.c targets.c cache.c \
archures.c coff-i386.c aout64.c aout32.c sunos.c demo64.c \
- coff-i960.c srec.c tekhex.c oasys.c ieee.c coff-m68k.c \
+ coff-i960.c srec.c tekhex.c oasys.c ieee.c \
+ coff-m68k.c coff-m68k-un.c \
coff-a29k.c coff-rs6000.c coff-msym.c coffgen.c format.c \
section.c core.c syms.c stab-syms.c reloc.c init.c ctor.c \
seclet.c coff-m88k.c coff-mips.c coff-sh.c trad-core.c newsos3.c \
diff --git a/bfd/coff-m68k-un.c b/bfd/coff-m68k-un.c
index e69de29..399de96 100644
--- a/bfd/coff-m68k-un.c
+++ b/bfd/coff-m68k-un.c
@@ -0,0 +1,35 @@
+/* BFD back-end for Motorola 68000 COFF binaries having underscore with name.
+ Copyright 1990, 1991, 1992 Free Software Foundation, Inc.
+ Written by Cygnus Support.
+
+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 TARGET_SYM m68kcoffun_vec
+#define TARGET_NAME "coff-m68k-un"
+
+#define NAMES_HAVE_UNDERSCORE
+
+/* define this to not have multiple copy of m68k_rtype2howto
+ in the executable file */
+#define ONLY_DECLARE_RELOCS
+
+/* This magic number indicates that the names have underscores.
+ Other 68k magic numbers indicate that the names do not have
+ underscores. */
+#define BADMAG(x) ((x).f_magic != MC68KBCSMAGIC)
+
+#include "coff-m68k.c"
diff --git a/bfd/coff-m68k.c b/bfd/coff-m68k.c
index f357fea..fc2f8c5 100644
--- a/bfd/coff-m68k.c
+++ b/bfd/coff-m68k.c
@@ -1,5 +1,5 @@
-/* Motorola 68000 COFF back-end for BFD.
- Copyright (C) 1990-1991 Free Software Foundation, Inc.
+/* BFD back-end for Motorola 68000 COFF binaries.
+ Copyright 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -26,7 +26,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "coff/internal.h"
#include "libcoff.h"
- reloc_howto_type m68kcoff_howto_table[] =
+#ifdef ONLY_DECLARE_RELOCS
+extern reloc_howto_type m68kcoff_howto_table[];
+#else
+reloc_howto_type m68kcoff_howto_table[] =
{
HOWTO(R_RELBYTE, 0, 0, 8, false, 0, true, true,0,"8", true, 0x000000ff,0x000000ff, false),
HOWTO(R_RELWORD, 0, 1, 16, false, 0, true, true,0,"16", true, 0x0000ffff,0x0000ffff, false),
@@ -36,14 +39,19 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
HOWTO(R_PCRLONG, 0, 2, 32, true, 0, false, true,0,"DISP32", true, 0xffffffff,0xffffffff, false),
HOWTO(R_RELLONG_NEG, 0, -2, 32, false, 0, true, true,0,"-32", true, 0xffffffff,0xffffffff, false),
};
+#endif /* not ONLY_DECLARE_RELOCS */
-
-/* Turn a howto into a reloc number */
-
-
+#ifndef BADMAG
#define BADMAG(x) M68KBADMAG(x)
+#endif
#define M68 1 /* Customize coffcode.h */
+/* Turn a howto into a reloc number */
+
+#ifdef ONLY_DECLARE_RELOCS
+extern void m68k_rtype2howto PARAMS ((arelent *internal, int relocentry));
+extern int m68k_howto2rtype PARAMS ((struct reloc_howto_struct *));
+#else
void
m68k_rtype2howto(internal, relocentry)
arelent *internal;
@@ -61,14 +69,52 @@ m68k_rtype2howto(internal, relocentry)
}
}
-#define RTYPE2HOWTO(internal, relocentry) m68k_rtype2howto(internal, (relocentry)->r_type)
+int
+m68k_howto2rtype (internal)
+ struct reloc_howto_struct *internal;
+{
+ if (internal->pc_relative)
+ {
+ switch (internal->bitsize)
+ {
+ case 32: return R_PCRLONG;
+ case 16: return R_PCRWORD;
+ case 8: return R_PCRBYTE;
+ }
+ }
+ else
+ {
+ switch (internal->bitsize)
+ {
+ case 32: return R_RELLONG;
+ case 16: return R_RELWORD;
+ case 8: return R_RELBYTE;
+ }
+ }
+ return R_RELLONG;
+}
+#endif /* not ONLY_DECLARE_RELOCS */
-#include "coffcode.h"
+#define RTYPE2HOWTO(internal, relocentry) \
+ m68k_rtype2howto(internal, (relocentry)->r_type)
+
+#define SELECT_RELOC(external, internal) \
+ external = m68k_howto2rtype(internal);
+#include "coffcode.h"
-bfd_target m68kcoff_vec =
+bfd_target
+#ifdef TARGET_SYM
+ TARGET_SYM =
+#else
+ m68kcoff_vec =
+#endif
{
+#ifdef TARGET_NAME
+ TARGET_NAME,
+#else
"coff-m68k", /* name */
+#endif
bfd_target_coff_flavour,
true, /* data byte order is big */
true, /* header byte order is big */
@@ -78,12 +124,20 @@ bfd_target m68kcoff_vec =
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
+#ifdef NAMES_HAVE_UNDERSCORE
+ '_',
+#else
0, /* leading underscore */
+#endif
'/', /* ar_pad_char */
15, /* ar_max_namelen */
- 3, /* minimum section alignment */
- _do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* data */
- _do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* hdrs */
+ 1, /* minimum section alignment */
+ _do_getb64, _do_getb_signed_64, _do_putb64,
+ _do_getb32, _do_getb_signed_32, _do_putb32,
+ _do_getb16, _do_getb_signed_16, _do_putb16, /* data */
+ _do_getb64, _do_getb_signed_64, _do_putb64,
+ _do_getb32, _do_getb_signed_32, _do_putb32,
+ _do_getb16, _do_getb_signed_16, _do_putb16, /* hdrs */
{_bfd_dummy_target, coff_object_p, /* bfd_check_format */
bfd_generic_archive_p, _bfd_dummy_target},
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index c554276..721a7e9 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -451,7 +451,7 @@ DEFUN(styp_to_sec_flags, (abfd, hdr),
return(sec_flags);
}
-#define get_index(symbol) ((int) (symbol)->udata)
+#define get_index(symbol) ((long) (symbol)->udata)
/*
INTERNAL_DEFINITION
@@ -806,9 +806,9 @@ DEFUN(coff_mkobject_hook,(abfd, filehdr, aouthdr),
at linking together COFF files for different architectures. */
static boolean
-DEFUN (coff_set_arch_mach_hook, (abfd, filehdr),
- bfd *abfd AND
- PTR filehdr)
+coff_set_arch_mach_hook(abfd, filehdr)
+ bfd *abfd;
+ PTR filehdr;
{
long machine;
enum bfd_architecture arch;
@@ -837,6 +837,7 @@ DEFUN (coff_set_arch_mach_hook, (abfd, filehdr),
#ifdef MC68MAGIC
case MC68MAGIC:
case M68MAGIC:
+ case MC68KBCSMAGIC:
arch = bfd_arch_m68k;
machine = 68020;
break;
@@ -915,7 +916,16 @@ DEFUN (coff_set_arch_mach_hook, (abfd, filehdr),
#ifdef H8300MAGIC
case H8300MAGIC:
arch = bfd_arch_h8300;
- machine = 0;
+ machine = bfd_mach_h8300;
+ /* !! FIXME this probably isn't the right place for this */
+ abfd->flags |= BFD_IS_RELAXABLE;
+ break;
+#endif
+
+#ifdef H8300HMAGIC
+ case H8300HMAGIC:
+ arch = bfd_arch_h8300;
+ machine = bfd_mach_h8300h;
/* !! FIXME this probably isn't the right place for this */
abfd->flags |= BFD_IS_RELAXABLE;
break;
@@ -1120,8 +1130,15 @@ DEFUN(coff_set_flags,(abfd, magicp, flagsp),
#endif
#ifdef H8300MAGIC
case bfd_arch_h8300:
- *magicp = H8300MAGIC;
- return true;
+ switch (bfd_get_mach (abfd))
+ {
+ case bfd_mach_h8300:
+ *magicp = H8300MAGIC;
+ return true;
+ case bfd_mach_h8300h:
+ *magicp = H8300HMAGIC;
+ return true;
+ }
break;
#endif
@@ -1857,7 +1874,7 @@ DEFUN(coff_slurp_symbol_table,(abfd),
/*
We use the native name field to point to the cached field
*/
- src->u.syment._n._n_n._n_zeroes = (int) dst;
+ src->u.syment._n._n_n._n_zeroes = (long) dst;
dst->symbol.section = coff_section_from_bfd_index(abfd,
src->u.syment.n_scnum);
dst->symbol.flags = 0;
@@ -2225,7 +2242,7 @@ bfd *abfd;
#ifndef coff_reloc16_extra_cases
#define coff_reloc16_extra_cases dummy_reloc16_extra_cases
/* This works even if abort is not declared in any header file. */
-void
+static void
dummy_reloc16_extra_cases (abfd, seclet, reloc, data, src_ptr, dst_ptr)
bfd *abfd;
struct bfd_seclet *seclet;
@@ -2234,6 +2251,7 @@ dummy_reloc16_extra_cases (abfd, seclet, reloc, data, src_ptr, dst_ptr)
unsigned int *src_ptr;
unsigned int *dst_ptr;
{
+ printf("%s\n", reloc->howto->name);
abort ();
}
#endif
diff --git a/bfd/configure.host b/bfd/configure.host
index 61b4f73..0c2faeb 100644
--- a/bfd/configure.host
+++ b/bfd/configure.host
@@ -44,9 +44,11 @@ mips-dec-*) my_host=decstation ;;
mips-sgi-irix3*) my_host=irix3 ;;
mips-sgi-irix4*) my_host=irix4 ;;
mips-*-sysv*) my_host=riscos ;;
+mips-*-riscos*) my_host=riscos ;;
m68*-apollo*-sysv*) my_host=apollov68 ;;
m68*-apollo*-bsd*) my_host=apollo68 ;;
+m68*-bull*-sysv*) my_host=dpx2 ;;
m68*-convergent-sysv*) my_host=miniframe ;;
m68*-cbm-amigados) my_host=amigados ;;
m68*-cbm-sysv4*) my_host=amix ;;
diff --git a/bfd/elfcode.h b/bfd/elfcode.h
index 09f52cb..581200b 100644
--- a/bfd/elfcode.h
+++ b/bfd/elfcode.h
@@ -2264,7 +2264,7 @@ DEFUN (elf_build_phdrs, (abfd, i_ehdrp, i_shdrp, phdr_cnt),
/* F. Set up the "end of program header table" sentinel. */
- bzero ((char *) (phdr_buf + idx), sizeof (Elf_Internal_Phdr));
+ memset ((char *) (phdr_buf + idx), 0, sizeof (Elf_Internal_Phdr));
idx++;
BFD_ASSERT (idx - 1 == *phdr_cnt);
diff --git a/bfd/hosts/.Sanitize b/bfd/hosts/.Sanitize
index cad2505..bf1e17d 100644
--- a/bfd/hosts/.Sanitize
+++ b/bfd/hosts/.Sanitize
@@ -34,6 +34,7 @@ dgux.h
delta68.h
delta88.h
dose.h
+dpx2.h
go32.h
harris.h
hp300bsd.h
diff --git a/bfd/targets.c b/bfd/targets.c
index c0b3820..cb97a0f 100644
--- a/bfd/targets.c
+++ b/bfd/targets.c
@@ -372,6 +372,7 @@ extern bfd_target ieee_vec;
extern bfd_target oasys_vec;
extern bfd_target m88kbcs_vec;
extern bfd_target m68kcoff_vec;
+extern bfd_target m68kcoffun_vec;
extern bfd_target i386coff_vec;
extern bfd_target i386aout_vec;
extern bfd_target i386linux_vec;
@@ -452,6 +453,7 @@ bfd_target *target_vector[] = {
&b_out_vec_little_host,
&b_out_vec_big_host,
&m68kcoff_vec,
+ &m68kcoffun_vec,
&a29kcoff_big_vec,
&rs6000coff_vec,
#if defined (HOST_HPPAHPUX) || defined (HOST_HPPABSD)
diff --git a/bfd/trad-core.c b/bfd/trad-core.c
index e3af10d..d3e5fdd 100644
--- a/bfd/trad-core.c
+++ b/bfd/trad-core.c
@@ -38,7 +38,13 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <signal.h>
#include <sys/user.h> /* After a.out.h */
+#if 0
+/* file.h is included by std-host.h. So we better not try to include it
+ twice; on some systems (dpx2) it is not protected against multiple
+ inclusion. I have checked that all the hosts which use this file
+ include sys/file.h in the hosts file. */
#include <sys/file.h>
+#endif
#include <errno.h>
@@ -110,7 +116,12 @@ trad_unix_core_file_p (abfd)
bfd_error = file_truncated;
return 0;
}
- if (NBPG * (UPAGES + u.u_dsize + u.u_ssize) < statbuf.st_size)
+ if (NBPG * (UPAGES + u.u_dsize + u.u_ssize)
+#ifdef TRAD_CORE_EXTRA_SIZE_ALLOWED
+ /* Some systems write the file too big. */
+ + TRAD_CORE_EXTRA_SIZE_ALLOWED
+#endif
+ < statbuf.st_size)
{
/* The file is too big. Maybe it's not a core file
or we otherwise have bad values for u_dsize and u_ssize). */
@@ -272,6 +283,9 @@ trad_unix_core_file_matches_executable_p (core_bfd, exec_bfd)
#define trad_unix_print_symbol (void (*) PARAMS \
((bfd *, PTR, struct symbol_cache_entry *, \
bfd_print_symbol_type))) bfd_false
+#define trad_unix_get_symbol_info (void (*) PARAMS \
+ ((bfd *, struct symbol_cache_entry *, \
+ symbol_info *))) bfd_false
#define trad_unix_get_lineno (alent * (*) PARAMS \
((bfd *, struct symbol_cache_entry *))) bfd_nullvoidptr
#define trad_unix_set_arch_mach (boolean (*) PARAMS \
@@ -304,6 +318,7 @@ swap_abort()
}
#define NO_GET ((bfd_vma (*) PARAMS (( bfd_byte *))) swap_abort )
#define NO_PUT ((void (*) PARAMS ((bfd_vma, bfd_byte *))) swap_abort )
+#define NO_SIGNED_GET ((bfd_signed_vma (*) PARAMS ((bfd_byte *))) swap_abort )
bfd_target trad_core_vec =
{
@@ -319,12 +334,12 @@ bfd_target trad_core_vec =
' ', /* ar_pad_char */
16, /* ar_max_namelen */
3, /* minimum alignment power */
- NO_GET, NO_GET, NO_PUT, /* 64 bit data */
- NO_GET, NO_GET, NO_PUT, /* 32 bit data */
- NO_GET, NO_GET, NO_PUT, /* 16 bit data */
- NO_GET, NO_GET, NO_PUT, /* 64 bit hdrs */
- NO_GET, NO_GET, NO_PUT, /* 32 bit hdrs */
- NO_GET, NO_GET, NO_PUT, /* 16 bit hdrs */
+ NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit data */
+ NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit data */
+ NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit data */
+ NO_GET, NO_SIGNED_GET, NO_PUT, /* 64 bit hdrs */
+ NO_GET, NO_SIGNED_GET, NO_PUT, /* 32 bit hdrs */
+ NO_GET, NO_SIGNED_GET, NO_PUT, /* 16 bit hdrs */
{ /* bfd_check_format */
_bfd_dummy_target, /* unknown format */