Tue Feb 18 17:22:59 1997 Martin M. Hunt <hunt@pizza.cygnus.com>

* Makefile.in, archures.c, config.bfd, configure.in, elf.c,
	reloc.c, targets.c: New target, elf-*-D30V.

	* bfd-in2.h, configure, libbfd.h: Rebuilt.

	* cpu-d30v.c, elf32-d30v.c: New files.
This commit is contained in:
Martin Hunt 1997-02-19 01:29:29 +00:00
parent 49d1bbbef2
commit fd8d7c31c0
14 changed files with 829 additions and 436 deletions

View File

@ -31,6 +31,14 @@ else
lose_these_too="${d10v_files} ${lose_these_too}"
fi
d30v_files="cpu-d30v.c elf32-d30v.c"
if ( echo $* | grep keep\-d30v > /dev/null ) ; then
keep_these_too="${d30v_files} ${keep_these_too}"
else
lose_these_too="${d30v_files} ${lose_these_too}"
fi
m32r_files="cpu-m32r.c elf32-m32r.c"
if ( echo $* | grep keep\-m32r > /dev/null ) ; then
@ -355,6 +363,34 @@ else
done
fi
d30v_files="ChangeLog ChangeLog.2 Makefile.in archures.c reloc.c targets.c config.bfd configure.in configure bfd-in2.h elf.c libbfd.h"
if ( echo $* | grep keep\-d30v > /dev/null ) ; then
for i in $d30v_files ; do
if test ! -d $i && (grep sanitize-d30v $i > /dev/null) ; then
if [ -n "${verbose}" ] ; then
echo Keeping d30v stuff in $i
fi
fi
done
else
for i in $d30v_files ; do
if test ! -d $i && (grep sanitize-d30v $i > /dev/null) ; then
if [ -n "${verbose}" ] ; then
echo Removing traces of \"d30v\" from $i...
fi
cp $i new
sed '/start\-sanitize\-d30v/,/end-\sanitize\-d30v/d' < $i > new
if [ -n "${safe}" -a ! -f .Recover/$i ] ; then
if [ -n "${verbose}" ] ; then
echo Caching $i in .Recover...
fi
mv $i .Recover
fi
mv new $i
fi
done
fi
m32r_files="ChangeLog Makefile.in config.bfd configure.in configure elf.c archures.c reloc.c targets.c bfd-in2.h libbfd.h"
if ( echo $* | grep keep\-m32r > /dev/null ) ; then
for i in $m32r_files ; do

View File

@ -1,3 +1,14 @@
start-sanitize-d30v
Tue Feb 18 17:22:59 1997 Martin M. Hunt <hunt@pizza.cygnus.com>
* Makefile.in, archures.c, config.bfd, configure.in, elf.c,
reloc.c, targets.c: New target, elf-*-D30V.
* bfd-in2.h, configure, libbfd.h: Rebuilt.
* cpu-d30v.c, elf32-d30v.c: New files.
end-sanitize-d30v
Tue Feb 18 15:31:48 1997 Fred Fish <fnf@cygnus.com>
* reloc.c (struct reloc_howto_struct): Fix typo in comment.

View File

@ -119,6 +119,9 @@ ALL_MACHINES = \
$(start-sanitize-d10v) \
cpu-d10v.o \
$(end-sanitize-d10v) \
$(start-sanitize-d30v) \
cpu-d30v.o \
$(end-sanitize-d30v) \
cpu-h8300.o \
cpu-h8500.o \
cpu-hppa.o \
@ -220,6 +223,9 @@ BFD32_BACKENDS = \
$(start-sanitize-d10v) \
elf32-d10v.o \
$(end-sanitize-d10v) \
$(start-sanitize-d30v) \
elf32-d30v.o \
$(end-sanitize-d30v) \
elf32-gen.o \
elf32-hppa.o \
elf32-i386.o \
@ -857,6 +863,12 @@ elf32-d10v.o: elf32-d10v.c elf-bfd.h $(INCDIR)/elf/common.h \
elf32-target.h
end-sanitize-d10v:
start-sanitize-d30v:
elf32-d30v.o: elf32-d30v.c elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
elf32-target.h
end-sanitize-d30v:
start-sanitize-m32r:
elf32-m32r.o: elf32-m32r.c elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
@ -873,7 +885,7 @@ end-sanitize-v850:
start-sanitize-tic80:
cpu-tic80.o: cpu-tic80.c
coff-tic80.o: coff-tic80.c $(INCDIR)/bfdlink.h elf-bfd.h \
$(INCDIR)/coff/internal.h
$(INCDIR)/coff/internal.h coffcode.h
end-sanitize-tic80:
$(OFILES): stamp-picdir

View File

@ -1,5 +1,5 @@
/* BFD library support routines for architectures.
Copyright (C) 1990, 91, 92, 93, 94, 95, 1996 Free Software Foundation, Inc.
Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
Hacked by John Gilmore and Steve Chamberlain of Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@ -124,6 +124,9 @@ DESCRIPTION
. {* start-sanitize-d10v *}
. bfd_arch_d10v, {* Mitsubishi D10V *}
. {* end-sanitize-d10v *}
. {* start-sanitize-d30v *}
. bfd_arch_d30v, {* Mitsubishi D30V *}
. {* end-sanitize-d30v *}
. bfd_arch_z8k, {* Zilog Z8000 *}
.#define bfd_mach_z8001 1
.#define bfd_mach_z8002 2
@ -133,6 +136,9 @@ DESCRIPTION
. bfd_arch_arm, {* Advanced Risc Machines ARM *}
. bfd_arch_ns32k, {* National Semiconductors ns32000 *}
. bfd_arch_w65, {* WDC 65816 *}
. {* start-sanitize-tic80 *}
. bfd_arch_tic80, {* TI TMS320c80 (MVP) *}
. {* end-sanitize-tic80 *}
. {* start-sanitize-v850 *}
. bfd_arch_v850, {* NEC V850 *}
. {* end-sanitize-v850 *}
@ -195,6 +201,9 @@ extern const bfd_arch_info_type bfd_arm_arch;
/* start-sanitize-d10v */
extern const bfd_arch_info_type bfd_d10v_arch;
/* end-sanitize-d10v */
/* start-sanitize-d30v */
extern const bfd_arch_info_type bfd_d30v_arch;
/* end-sanitize-d30v */
extern const bfd_arch_info_type bfd_h8300_arch;
extern const bfd_arch_info_type bfd_h8500_arch;
extern const bfd_arch_info_type bfd_hppa_arch;
@ -239,6 +248,9 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
/* start-sanitize-d10v */
&bfd_d10v_arch,
/* end-sanitize-d10v */
/* start-sanitize-d30v */
&bfd_d30v_arch,
/* end-sanitize-d30v */
&bfd_h8300_arch,
&bfd_h8500_arch,
&bfd_hppa_arch,
@ -257,6 +269,9 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
&bfd_rs6000_arch,
&bfd_sh_arch,
&bfd_sparc_arch,
/* start-sanitize-tic80 */
&bfd_tic80_arch,
/* end-sanitize-tic80 */
&bfd_vax_arch,
&bfd_we32k_arch,
&bfd_z8k_arch,

View File

@ -1213,6 +1213,9 @@ enum bfd_architecture
/* start-sanitize-d10v */
bfd_arch_d10v, /* Mitsubishi D10V */
/* end-sanitize-d10v */
/* start-sanitize-d30v */
bfd_arch_d30v, /* Mitsubishi D30V */
/* end-sanitize-d30v */
bfd_arch_z8k, /* Zilog Z8000 */
#define bfd_mach_z8001 1
#define bfd_mach_z8002 2
@ -1861,6 +1864,37 @@ assumed to be 0. */
BFD_RELOC_D10V_18_PCREL,
/* end-sanitize-d10v */
/* start-sanitize-d30v */
/* Mitsubishi D30V relocs.
This is a 6-bit absolute reloc. */
BFD_RELOC_D30V_6,
/* Mitsubishi D30V relocs.
This is a 12-bit absolute reloc with the
right 3 bitsassumed to be 0. */
BFD_RELOC_D30V_15,
/* Mitsubishi D30V relocs.
This is a 12-bit pc-relative reloc with
the right 3 bits assumed to be 0. */
BFD_RELOC_D30V_15_PCREL,
/* This is an 18-bit absolute reloc with
the right 3 bits assumed to be 0. */
BFD_RELOC_D30V_21,
/* This is an 18-bit pc-relative reloc with
the right 3 bits assumed to be 0. */
BFD_RELOC_D30V_21_PCREL,
/* This is a 32-bit absolute reloc. */
BFD_RELOC_D30V_32,
/* This is a 32-bit pc-relative reloc. */
BFD_RELOC_D30V_32_PCREL,
/* end-sanitize-d30v */
/* start-sanitize-m32r */
/* Mitsubishi M32R relocs.

View File

@ -114,6 +114,12 @@ case "${targ}" in
;;
# end-sanitize-d10v
# start-sanitize-d30v
d30v-*-*)
targ_defvec=bfd_elf32_d30v_vec
;;
# end-sanitize-d30v
h8300*-*-*)
targ_defvec=h8300coff_vec
targ_underscore=yes
@ -401,6 +407,10 @@ case "${targ}" in
targ_defvec=bfd_elf32_bigmips_vec
targ_selvecs="bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec"
;;
mips*-*-none)
targ_defvec=bfd_elf32_bigmips_vec
targ_selvecs="bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec"
;;
mips*el*-*-linux*)
targ_defvec=bfd_elf32_littlemips_vec
targ_selvecs="bfd_elf32_bigmips_vec ecoff_little_vec ecoff_big_vec"
@ -518,7 +528,7 @@ case "${targ}" in
#endif
# start-sanitize-tic80
tic80*-*-coff*)
tic80*-*-*)
targ_defvec=tic80coff_vec
;;

604
bfd/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -446,6 +446,9 @@ do
# start-sanitize-d10v
bfd_elf32_d10v_vec) tb="$tb elf32-d10v.o elf32.o $elf" ;;
# end-sanitize-d10v
# start-sanitize-d30v
bfd_elf32_d30v_vec) tb="$tb elf32-d30v.o elf32.o $elf" ;;
# end-sanitize-d30v
bfd_elf32_hppa_vec) tb="$tb elf32-hppa.o elf32.o $elf" ;;
bfd_elf32_i386_vec) tb="$tb elf32-i386.o elf32.o $elf" ;;
bfd_elf32_i860_vec) tb="$tb elf32-i860.o elf32.o $elf" ;;
@ -628,7 +631,7 @@ AC_SUBST(tdefaults)
dnl AC_CHECK_HEADERS(sys/mman.h)
AC_FUNC_MMAP
AC_CHECK_FUNCS(madvise mprotect)
case ${want_mmap}+${ac_cv_func_mmap} in
case ${want_mmap}+${ac_cv_func_mmap_fixed_mapped} in
true+yes ) AC_DEFINE(USE_MMAP) ;;
esac

39
bfd/cpu-d30v.c Normal file
View File

@ -0,0 +1,39 @@
/* BFD support for the Mitsubishi D30V processor
Copyright 1997 Free Software Foundation, Inc.
Contributed by Martin Hunt (hunt@cygnus.com).
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
const bfd_arch_info_type bfd_d30v_arch =
{
32, /* bits in a word */
32, /* bits in an address */
8, /* bits in a byte */
bfd_arch_d30v,
0,
"d30v",
"d30v",
4, /* section alignment power */
true,
bfd_default_compatible,
bfd_default_scan,
0,
};

View File

@ -1,5 +1,5 @@
/* ELF executable support for BFD.
Copyright 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
Copyright 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@ -2518,6 +2518,11 @@ prep_headers (abfd)
i_ehdrp->e_machine = EM_CYGNUS_D10V;
break;
/* end-sanitize-d10v */
/* start-sanitize-d30v */
case bfd_arch_d30v:
i_ehdrp->e_machine = EM_CYGNUS_D30V;
break;
/* end-sanitize-d30v */
/* start-sanitize-v850 */
case bfd_arch_v850:
i_ehdrp->e_machine = EM_CYGNUS_V850;

348
bfd/elf32-d30v.c Normal file
View File

@ -0,0 +1,348 @@
/* D30V-specific support for 32-bit ELF
Copyright (C) 1997 Free Software Foundation, Inc.
Contributed by Martin Hunt (hunt@cygnus.com).
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
#include "elf-bfd.h"
static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup
PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
static void d30v_info_to_howto_rel
PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *));
static bfd_reloc_status_type bfd_elf_d30v_reloc PARAMS ((
bfd *abfd,
arelent *reloc_entry,
asymbol *symbol,
PTR data,
asection *input_section,
bfd *output_bfd,
char **error_message));
/* Use REL instead of RELA to save space */
#define USE_REL
enum reloc_type
{
R_D30V_NONE = 0,
R_D30V_6,
R_D30V_15,
R_D30V_15_PCREL,
R_D30V_21,
R_D30V_21_PCREL,
R_D30V_32,
R_D30V_32_PCREL,
R_D30V_32_NORMAL,
R_D30V_max
};
static reloc_howto_type elf_d30v_howto_table[] =
{
/* This reloc does nothing. */
HOWTO (R_D30V_NONE, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_D30V_NONE", /* name */
false, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
false), /* pcrel_offset */
/* A 6 bit absolute relocation */
HOWTO (R_D30V_6, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
6, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_D30V_6", /* name */
false, /* partial_inplace */
0x3f, /* src_mask */
0x3f, /* dst_mask */
false), /* pcrel_offset */
/* An absolute 15 bit relocation, right shifted by 3 */
HOWTO (R_D30V_15, /* type */
3, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
15, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_D30V_15", /* name */
false, /* partial_inplace */
0xfff, /* src_mask */
0xfff, /* dst_mask */
false), /* pcrel_offset */
/* A relative 15 bit relocation, right shifted by 3 */
HOWTO (R_D30V_15_PCREL, /* type */
3, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
15, /* bitsize */
true, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_D30V_15_PCREL", /* name */
false, /* partial_inplace */
0xfff, /* src_mask */
0xfff, /* dst_mask */
true), /* pcrel_offset */
/* An absolute 21 bit relocation, right shifted by 3 */
HOWTO (R_D30V_21_PCREL, /* type */
3, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
21, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_D30V_21", /* name */
false, /* partial_inplace */
0x3ffff, /* src_mask */
0x3ffff, /* dst_mask */
false), /* pcrel_offset */
/* A relative 21 bit relocation, right shifted by 3 */
HOWTO (R_D30V_21_PCREL, /* type */
3, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
21, /* bitsize */
true, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_D30V_21_PCREL", /* name */
false, /* partial_inplace */
0x3ffff, /* src_mask */
0x3ffff, /* dst_mask */
true), /* pcrel_offset */
/* A D30V 32 bit absolute relocation */
HOWTO (R_D30V_32, /* type */
0, /* rightshift */
4, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_d30v_reloc, /* special_function */
"R_D30V_32", /* name */
false, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
false), /* pcrel_offset */
/* A relative 32 bit relocation */
HOWTO (R_D30V_32_PCREL, /* type */
0, /* rightshift */
4, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
true, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
bfd_elf_d30v_reloc, /* special_function */
"R_D30V_32_PCREL", /* name */
false, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
true), /* pcrel_offset */
/* A regular 32 bit absolute relocation */
HOWTO (R_D30V_32_NORMAL, /* type */
0, /* rightshift */
4, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
bfd_elf_generic_reloc, /* special_function */
"R_D30V_32_NORMAL", /* name */
false, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
false), /* pcrel_offset */
};
static bfd_reloc_status_type
bfd_elf_d30v_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd, error_message)
bfd *abfd;
arelent *reloc_entry;
asymbol *symbol;
PTR data;
asection *input_section;
bfd *output_bfd;
char **error_message;
{
bfd_vma relocation;
bfd_vma in1, in2;
bfd_reloc_status_type r;
asection *reloc_target_output_section;
bfd_size_type addr = reloc_entry->address;
bfd_reloc_status_type flag = bfd_reloc_ok;
bfd_vma output_base = 0;
reloc_howto_type *howto = reloc_entry->howto;
r = bfd_elf_generic_reloc (abfd, reloc_entry, symbol, data,
input_section, output_bfd, error_message);
if (r != bfd_reloc_continue)
return r;
/* a hacked-up version of bfd_perform_reloc() follows */
/* Is the address of the relocation really within the section? */
if (reloc_entry->address > input_section->_cooked_size)
return bfd_reloc_outofrange;
/* Work out which section the relocation is targetted at and the
initial relocation command value. */
/* Get symbol value. (Common symbols are special.) */
if (bfd_is_com_section (symbol->section))
relocation = 0;
else
relocation = symbol->value;
reloc_target_output_section = symbol->section->output_section;
/* Convert input-section-relative symbol value to absolute. */
if (output_bfd)
output_base = 0;
else
output_base = reloc_target_output_section->vma;
relocation += output_base + symbol->section->output_offset;
/* Add in supplied addend. */
relocation += reloc_entry->addend;
/* Here the variable relocation holds the final address of the
symbol we are relocating against, plus any addend. */
if (howto->pc_relative == true)
{
relocation -= input_section->output_section->vma + input_section->output_offset;
if (howto->pcrel_offset == true)
relocation -= reloc_entry->address;
}
if (output_bfd != (bfd *) NULL)
{
/* This is a partial relocation, and we want to apply the relocation
to the reloc entry rather than the raw data. Modify the reloc
inplace to reflect what we now know. */
reloc_entry->addend = relocation;
reloc_entry->address += input_section->output_offset;
return flag;
}
else
reloc_entry->addend = 0;
in1 = bfd_get_32 (abfd, (bfd_byte *) data + addr);
in2 = bfd_get_32 (abfd, (bfd_byte *) data + addr + 4);
printf("D30V 32-bit reloc at addr 0x%lx insn=0x%08x%08x\n",(long)relocation, (int)in1, (int)in2);
bfd_put_32 (abfd, in1, (bfd_byte *) data + addr);
bfd_put_32 (abfd, in2, (bfd_byte *) data + addr + 4);
return flag;
}
/* Map BFD reloc types to D30V ELF reloc types. */
struct d30v_reloc_map
{
unsigned char bfd_reloc_val;
unsigned char elf_reloc_val;
};
static const struct d30v_reloc_map d30v_reloc_map[] =
{
{ BFD_RELOC_NONE, R_D30V_NONE, },
{ BFD_RELOC_D30V_6, R_D30V_6 },
{ BFD_RELOC_D30V_15, R_D30V_15 },
{ BFD_RELOC_D30V_15_PCREL, R_D30V_15_PCREL },
{ BFD_RELOC_D30V_21, R_D30V_21 },
{ BFD_RELOC_D30V_21_PCREL, R_D30V_21_PCREL },
{ BFD_RELOC_D30V_32, R_D30V_32 },
{ BFD_RELOC_D30V_32_PCREL, R_D30V_32_PCREL },
{ BFD_RELOC_32, R_D30V_32_NORMAL },
};
static reloc_howto_type *
bfd_elf32_bfd_reloc_type_lookup (abfd, code)
bfd *abfd;
bfd_reloc_code_real_type code;
{
unsigned int i;
for (i = 0;
i < sizeof (d30v_reloc_map) / sizeof (struct d30v_reloc_map);
i++)
{
if (d30v_reloc_map[i].bfd_reloc_val == code)
return &elf_d30v_howto_table[d30v_reloc_map[i].elf_reloc_val];
}
return NULL;
}
/* Set the howto pointer for an D30V ELF reloc. */
static void
d30v_info_to_howto_rel (abfd, cache_ptr, dst)
bfd *abfd;
arelent *cache_ptr;
Elf32_Internal_Rel *dst;
{
unsigned int r_type;
r_type = ELF32_R_TYPE (dst->r_info);
BFD_ASSERT (r_type < (unsigned int) R_D30V_max);
cache_ptr->howto = &elf_d30v_howto_table[r_type];
}
#define ELF_ARCH bfd_arch_d30v
#define ELF_MACHINE_CODE EM_CYGNUS_D30V
#define ELF_MAXPAGESIZE 0x1000
#define TARGET_BIG_SYM bfd_elf32_d30v_vec
#define TARGET_BIG_NAME "elf32-d30v"
#define elf_info_to_howto 0
#define elf_info_to_howto_rel d30v_info_to_howto_rel
#define elf_backend_object_p 0
#define elf_backend_final_write_processing 0
#include "elf32-target.h"

View File

@ -636,6 +636,7 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_ALPHA_LITUSE",
"BFD_RELOC_ALPHA_HINT",
"BFD_RELOC_ALPHA_LINKAGE",
"BFD_RELOC_ALPHA_CODEADDR",
"BFD_RELOC_MIPS_JMP",
"BFD_RELOC_MIPS16_JMP",
"BFD_RELOC_MIPS16_GPREL",
@ -749,6 +750,16 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
"BFD_RELOC_D10V_18_PCREL",
/* end-sanitize-d10v */
/* start-sanitize-d30v */
"BFD_RELOC_D30V_6",
"BFD_RELOC_D30V_15",
"BFD_RELOC_D30V_15_PCREL",
"BFD_RELOC_D30V_21",
"BFD_RELOC_D30V_21_PCREL",
"BFD_RELOC_D30V_32",
"BFD_RELOC_D30V_32_PCREL",
/* end-sanitize-d30v */
/* start-sanitize-m32r */
"BFD_RELOC_M32R_24",
"BFD_RELOC_M32R_10_PCREL",

View File

@ -2268,6 +2268,46 @@ ENUMDOC
COMMENT
{* end-sanitize-d10v *}
COMMENT
{* start-sanitize-d30v *}
ENUM
BFD_RELOC_D30V_6
ENUMDOC
Mitsubishi D30V relocs.
This is a 6-bit absolute reloc.
ENUM
BFD_RELOC_D30V_15
ENUMDOC
Mitsubishi D30V relocs.
This is a 12-bit absolute reloc with the
right 3 bitsassumed to be 0.
ENUM
BFD_RELOC_D30V_15_PCREL
ENUMDOC
Mitsubishi D30V relocs.
This is a 12-bit pc-relative reloc with
the right 3 bits assumed to be 0.
ENUM
BFD_RELOC_D30V_21
ENUMDOC
This is an 18-bit absolute reloc with
the right 3 bits assumed to be 0.
ENUM
BFD_RELOC_D30V_21_PCREL
ENUMDOC
This is an 18-bit pc-relative reloc with
the right 3 bits assumed to be 0.
ENUM
BFD_RELOC_D30V_32
ENUMDOC
This is a 32-bit absolute reloc.
ENUM
BFD_RELOC_D30V_32_PCREL
ENUMDOC
This is a 32-bit pc-relative reloc.
COMMENT
{* end-sanitize-d30v *}
COMMENT
{* start-sanitize-m32r *}
ENUM

View File

@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
#include "fnmatch.h"
/*
SECTION
@ -492,6 +493,9 @@ extern const bfd_target bfd_elf64_bigmips_vec;
/* start-sanitize-d10v */
extern const bfd_target bfd_elf32_d10v_vec;
/* end-sanitize-d10v */
/* start-sanitize-d30v */
extern const bfd_target bfd_elf32_d30v_vec;
/* end-sanitize-d30v */
extern const bfd_target bfd_elf32_hppa_vec;
extern const bfd_target bfd_elf32_i386_vec;
extern const bfd_target bfd_elf32_i860_vec;
@ -581,6 +585,9 @@ 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;
/* start-sanitize-tic80 */
extern const bfd_target tic80coff_vec;
/* end-sanitize-tic80 */
extern const bfd_target versados_vec;
extern const bfd_target we32kcoff_vec;
extern const bfd_target w65_vec;
@ -651,6 +658,9 @@ const bfd_target * const bfd_target_vector[] = {
/* start-sanitize-d10v */
&bfd_elf32_d10v_vec,
/* end-sanitize-d10v */
/* start-sanitize-d30v */
&bfd_elf32_d30v_vec,
/* end-sanitize-d30v */
&bfd_elf32_hppa_vec,
&bfd_elf32_i386_vec,
&bfd_elf32_i860_vec,
@ -791,6 +801,9 @@ const bfd_target * const bfd_target_vector[] = {
&sunos_big_vec,
&aout0_big_vec,
&tekhex_vec,
/* start-sanitize-tic80 */
&tic80coff_vec,
/* end-sanitize-tic80 */
&we32kcoff_vec,
&versados_vec,
&z8kcoff_vec,
@ -850,6 +863,27 @@ const bfd_target * const bfd_default_vector[] = {
number of entries that the array could possibly need. */
const size_t _bfd_target_vector_entries = sizeof(bfd_target_vector)/sizeof(*bfd_target_vector);
/* This array maps configuration triplets onto BFD vectors. */
struct targmatch
{
/* The configuration triplet. */
const char *triplet;
/* The BFD vector. If this is NULL, then the vector is found by
searching forward for the next structure with a non NULL vector
field. If this is UNSUPPORTED_TARGET, then the target is not
supported. */
const bfd_target *vector;
};
#define UNSUPPORTED_TARGET ((const bfd_target *) 1)
/* targmatch.h is built by Makefile out of config.bfd. */
static const struct targmatch bfd_target_match[] = {
#include "targmatch.h"
{ NULL, NULL }
};
/*
FUNCTION
bfd_find_target
@ -871,28 +905,57 @@ DESCRIPTION
const bfd_target *
bfd_find_target (target_name, abfd)
CONST char *target_name;
const char *target_name;
bfd *abfd;
{
const bfd_target * const *target;
extern char *getenv ();
CONST char *targname = (target_name ? target_name :
(CONST char *) getenv ("GNUTARGET"));
const char *targname;
const struct targmatch *match;
if (target_name != NULL)
targname = target_name;
else
targname = getenv ("GNUTARGET");
/* This is safe; the vector cannot be null */
if (targname == NULL || !strcmp (targname, "default")) {
abfd->target_defaulted = true;
return abfd->xvec = bfd_target_vector[0];
}
if (targname == NULL || strcmp (targname, "default") == 0)
{
abfd->target_defaulted = true;
abfd->xvec = bfd_target_vector[0];
return bfd_target_vector[0];
}
abfd->target_defaulted = false;
for (target = &bfd_target_vector[0]; *target != NULL; target++) {
if (!strcmp (targname, (*target)->name))
return abfd->xvec = *target;
}
for (target = &bfd_target_vector[0]; *target != NULL; target++)
{
if (strcmp (targname, (*target)->name) == 0)
{
abfd->xvec = *target;
return *target;
}
}
/* If we couldn't match on the exact name, try matching on the
configuration triplet. FIXME: We should run the triplet through
config.sub first, but that is hard. */
for (match = &bfd_target_match[0]; match->triplet != NULL; match++)
{
if (fnmatch (match->triplet, targname, 0) == 0)
{
while (match->vector == NULL)
++match;
if (match->vector != UNSUPPORTED_TARGET)
{
abfd->xvec = match->vector;
return match->vector;
}
break;
}
}
bfd_set_error (bfd_error_invalid_target);
return NULL;
}