1999-09-04 Steve Chamberlain <sac@pobox.com>
* cpu-pj.c: New file. * elf32-pj.c: New file. * config.bfd (pj*): New cpu. (pj-*-*, pjl-*-*): New targets. * configure.in (bfd_elf32_pj_vec): New target vector. (bfd_elf32_pjl_vec): New target vector. * archures.c (bfd_arch_pj): Define. * elf.c (prep_headers): Handle bfd_arch_pj. * reloc.c: Define BFD_RELOC_PJ_* relocations. * targets.c (bfd_elf32_pj_vec, bfd_elf32_pjl_vec): Declare and add to target vector list. * Makefile.am: Rebuild dependencies. (ALL_MACHINES): Add cpu-pj.lo. (ALL_MACHINES_CFILES): Add cpu-pj.c. (BFD32_BACKENDS): Add elf32-pj.lo. (BFD32_BACKENDS_CFILES): Add elf32-pj.c. * configure, Makefile.in, bfd-in2.h, libbfd.h: Rebuild.
This commit is contained in:
parent
ef14edc44e
commit
0bcb993b9f
14 changed files with 536 additions and 12 deletions
|
@ -1,3 +1,23 @@
|
|||
1999-09-04 Steve Chamberlain <sac@pobox.com>
|
||||
|
||||
* cpu-pj.c: New file.
|
||||
* elf32-pj.c: New file.
|
||||
* config.bfd (pj*): New cpu.
|
||||
(pj-*-*, pjl-*-*): New targets.
|
||||
* configure.in (bfd_elf32_pj_vec): New target vector.
|
||||
(bfd_elf32_pjl_vec): New target vector.
|
||||
* archures.c (bfd_arch_pj): Define.
|
||||
* elf.c (prep_headers): Handle bfd_arch_pj.
|
||||
* reloc.c: Define BFD_RELOC_PJ_* relocations.
|
||||
* targets.c (bfd_elf32_pj_vec, bfd_elf32_pjl_vec): Declare and add
|
||||
to target vector list.
|
||||
* Makefile.am: Rebuild dependencies.
|
||||
(ALL_MACHINES): Add cpu-pj.lo.
|
||||
(ALL_MACHINES_CFILES): Add cpu-pj.c.
|
||||
(BFD32_BACKENDS): Add elf32-pj.lo.
|
||||
(BFD32_BACKENDS_CFILES): Add elf32-pj.c.
|
||||
* configure, Makefile.in, bfd-in2.h, libbfd.h: Rebuild.
|
||||
|
||||
1999-09-04 Ian Lance Taylor <ian@zembu.com>
|
||||
|
||||
* elf-bfd.h (ELF_LINK_NON_GOT_REF): Define.
|
||||
|
|
|
@ -58,6 +58,7 @@ ALL_MACHINES = \
|
|||
cpu-mcore.lo \
|
||||
cpu-mips.lo \
|
||||
cpu-ns32k.lo \
|
||||
cpu-pj.lo \
|
||||
cpu-powerpc.lo \
|
||||
cpu-rs6000.lo \
|
||||
cpu-sh.lo \
|
||||
|
@ -92,6 +93,7 @@ ALL_MACHINES_CFILES = \
|
|||
cpu-mcore.c \
|
||||
cpu-mips.c \
|
||||
cpu-ns32k.c \
|
||||
cpu-pj.c \
|
||||
cpu-powerpc.c \
|
||||
cpu-rs6000.c \
|
||||
cpu-sh.c \
|
||||
|
@ -168,6 +170,7 @@ BFD32_BACKENDS = \
|
|||
elf-m10300.lo \
|
||||
elf32-mcore.lo \
|
||||
elf32-mips.lo \
|
||||
elf32-pj.lo \
|
||||
elf32-ppc.lo \
|
||||
elf32-sh.lo \
|
||||
elf32-sparc.lo \
|
||||
|
@ -291,6 +294,7 @@ BFD32_BACKENDS_CFILES = \
|
|||
elf-m10300.c \
|
||||
elf32-mcore.c \
|
||||
elf32-mips.c \
|
||||
elf32-pj.c \
|
||||
elf32-ppc.c \
|
||||
elf32-sh.c \
|
||||
elf32-sparc.c \
|
||||
|
@ -693,6 +697,7 @@ cpu-m10300.lo: cpu-m10300.c
|
|||
cpu-mcore.lo: cpu-mcore.c
|
||||
cpu-mips.lo: cpu-mips.c
|
||||
cpu-ns32k.lo: cpu-ns32k.c ns32k.h
|
||||
cpu-pj.lo: cpu-pj.c
|
||||
cpu-powerpc.lo: cpu-powerpc.c
|
||||
cpu-rs6000.lo: cpu-rs6000.c
|
||||
cpu-sh.lo: cpu-sh.c
|
||||
|
@ -884,6 +889,9 @@ elf32-mips.lo: elf32-mips.c $(INCDIR)/bfdlink.h genlink.h \
|
|||
$(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \
|
||||
$(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h ecoffswap.h \
|
||||
elf32-target.h
|
||||
elf32-pj.lo: elf32-pj.c $(INCDIR)/bfdlink.h elf-bfd.h \
|
||||
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
|
||||
$(INCDIR)/elf/pj.h $(INCDIR)/elf/reloc-macros.h elf32-target.h
|
||||
elf32-ppc.lo: elf32-ppc.c $(INCDIR)/bfdlink.h elf-bfd.h \
|
||||
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
|
||||
$(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h elf32-target.h
|
||||
|
|
|
@ -175,6 +175,7 @@ ALL_MACHINES = \
|
|||
cpu-mcore.lo \
|
||||
cpu-mips.lo \
|
||||
cpu-ns32k.lo \
|
||||
cpu-pj.lo \
|
||||
cpu-powerpc.lo \
|
||||
cpu-rs6000.lo \
|
||||
cpu-sh.lo \
|
||||
|
@ -210,6 +211,7 @@ ALL_MACHINES_CFILES = \
|
|||
cpu-mcore.c \
|
||||
cpu-mips.c \
|
||||
cpu-ns32k.c \
|
||||
cpu-pj.c \
|
||||
cpu-powerpc.c \
|
||||
cpu-rs6000.c \
|
||||
cpu-sh.c \
|
||||
|
@ -287,6 +289,7 @@ BFD32_BACKENDS = \
|
|||
elf-m10300.lo \
|
||||
elf32-mcore.lo \
|
||||
elf32-mips.lo \
|
||||
elf32-pj.lo \
|
||||
elf32-ppc.lo \
|
||||
elf32-sh.lo \
|
||||
elf32-sparc.lo \
|
||||
|
@ -411,6 +414,7 @@ BFD32_BACKENDS_CFILES = \
|
|||
elf-m10300.c \
|
||||
elf32-mcore.c \
|
||||
elf32-mips.c \
|
||||
elf32-pj.c \
|
||||
elf32-ppc.c \
|
||||
elf32-sh.c \
|
||||
elf32-sparc.c \
|
||||
|
@ -1223,6 +1227,7 @@ cpu-m10300.lo: cpu-m10300.c
|
|||
cpu-mcore.lo: cpu-mcore.c
|
||||
cpu-mips.lo: cpu-mips.c
|
||||
cpu-ns32k.lo: cpu-ns32k.c ns32k.h
|
||||
cpu-pj.lo: cpu-pj.c
|
||||
cpu-powerpc.lo: cpu-powerpc.c
|
||||
cpu-rs6000.lo: cpu-rs6000.c
|
||||
cpu-sh.lo: cpu-sh.c
|
||||
|
@ -1414,6 +1419,9 @@ elf32-mips.lo: elf32-mips.c $(INCDIR)/bfdlink.h genlink.h \
|
|||
$(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \
|
||||
$(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h ecoffswap.h \
|
||||
elf32-target.h
|
||||
elf32-pj.lo: elf32-pj.c $(INCDIR)/bfdlink.h elf-bfd.h \
|
||||
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
|
||||
$(INCDIR)/elf/pj.h $(INCDIR)/elf/reloc-macros.h elf32-target.h
|
||||
elf32-ppc.lo: elf32-ppc.c $(INCDIR)/bfdlink.h elf-bfd.h \
|
||||
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
|
||||
$(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h elf32-target.h
|
||||
|
|
|
@ -187,6 +187,7 @@ DESCRIPTION
|
|||
. bfd_arch_fr30,
|
||||
.#define bfd_mach_fr30 0x46523330
|
||||
. bfd_arch_mcore,
|
||||
. bfd_arch_pj,
|
||||
. bfd_arch_last
|
||||
. };
|
||||
|
||||
|
@ -245,6 +246,7 @@ extern const bfd_arch_info_type bfd_mn10200_arch;
|
|||
extern const bfd_arch_info_type bfd_mn10300_arch;
|
||||
extern const bfd_arch_info_type bfd_powerpc_arch;
|
||||
extern const bfd_arch_info_type bfd_rs6000_arch;
|
||||
extern const bfd_arch_info_type bfd_pj_arch;
|
||||
extern const bfd_arch_info_type bfd_sh_arch;
|
||||
extern const bfd_arch_info_type bfd_sparc_arch;
|
||||
extern const bfd_arch_info_type bfd_tic30_arch;
|
||||
|
|
|
@ -1350,6 +1350,7 @@ enum bfd_architecture
|
|||
bfd_arch_fr30,
|
||||
#define bfd_mach_fr30 0x46523330
|
||||
bfd_arch_mcore,
|
||||
bfd_arch_pj,
|
||||
bfd_arch_last
|
||||
};
|
||||
|
||||
|
@ -1885,6 +1886,14 @@ to compensate for the borrow when the low bits are added. */
|
|||
BFD_RELOC_NS32K_DISP_16_PCREL,
|
||||
BFD_RELOC_NS32K_DISP_32_PCREL,
|
||||
|
||||
/* Picojava relocs. Not all of these appear in object files. */
|
||||
BFD_RELOC_PJ_CODE_HI16,
|
||||
BFD_RELOC_PJ_CODE_LO16,
|
||||
BFD_RELOC_PJ_CODE_DIR16,
|
||||
BFD_RELOC_PJ_CODE_DIR32,
|
||||
BFD_RELOC_PJ_CODE_REL16,
|
||||
BFD_RELOC_PJ_CODE_REL32,
|
||||
|
||||
/* Power(rs6000) and PowerPC relocations. */
|
||||
BFD_RELOC_PPC_B26,
|
||||
BFD_RELOC_PPC_BA26,
|
||||
|
|
|
@ -38,6 +38,7 @@ i[3456]86) targ_archs=bfd_i386_arch ;;
|
|||
m68*) targ_archs=bfd_m68k_arch ;;
|
||||
m88*) targ_archs=bfd_m88k_arch ;;
|
||||
mips*) targ_archs=bfd_mips_arch ;;
|
||||
pj*) targ_archs="bfd_pj_arch bfd_i386_arch";;
|
||||
powerpc*) targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;;
|
||||
rs6000) targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;;
|
||||
sparc*) targ_archs=bfd_sparc_arch ;;
|
||||
|
@ -562,6 +563,16 @@ case "${targ}" in
|
|||
targ_underscore=yes
|
||||
;;
|
||||
|
||||
pj-*-*)
|
||||
targ_defvec=bfd_elf32_pj_vec
|
||||
targ_selvecs="bfd_elf32_pj_vec bfd_elf32_pjl_vec"
|
||||
;;
|
||||
|
||||
pjl-*-*)
|
||||
targ_defvec=bfd_elf32_pjl_vec
|
||||
targ_selvecs="bfd_elf32_pjl_vec bfd_elf32_pj_vec bfd_elf32_i386_vec"
|
||||
;;
|
||||
|
||||
powerpc-*-aix* | powerpc-*-beos*)
|
||||
targ_defvec=rs6000coff_vec
|
||||
;;
|
||||
|
|
26
bfd/configure
vendored
26
bfd/configure
vendored
|
@ -5413,6 +5413,8 @@ do
|
|||
bfd_elf32_mcore_little_vec) tb="$tb elf32-mcore.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_mn10200_vec) tb="$tb elf-m10200.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_mn10300_vec) tb="$tb elf-m10300.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_pj_vec) tb="$tb elf32-pj.lo elf32.lo $elf";;
|
||||
bfd_elf32_pjl_vec) tb="$tb elf32-pj.lo elf32.lo $elf";;
|
||||
bfd_elf32_powerpc_vec) tb="$tb elf32-ppc.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_powerpcle_vec) tb="$tb elf32-ppc.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_sh_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;;
|
||||
|
@ -5594,17 +5596,17 @@ for ac_hdr in unistd.h
|
|||
do
|
||||
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
|
||||
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
|
||||
echo "configure:5598: checking for $ac_hdr" >&5
|
||||
echo "configure:5600: checking for $ac_hdr" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 5603 "configure"
|
||||
#line 5605 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <$ac_hdr>
|
||||
EOF
|
||||
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||
{ (eval echo configure:5608: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
{ (eval echo configure:5610: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
|
||||
if test -z "$ac_err"; then
|
||||
rm -rf conftest*
|
||||
|
@ -5633,12 +5635,12 @@ done
|
|||
for ac_func in getpagesize
|
||||
do
|
||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||
echo "configure:5637: checking for $ac_func" >&5
|
||||
echo "configure:5639: checking for $ac_func" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 5642 "configure"
|
||||
#line 5644 "configure"
|
||||
#include "confdefs.h"
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char $ac_func(); below. */
|
||||
|
@ -5661,7 +5663,7 @@ $ac_func();
|
|||
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:5665: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:5667: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_func_$ac_func=yes"
|
||||
else
|
||||
|
@ -5686,7 +5688,7 @@ fi
|
|||
done
|
||||
|
||||
echo $ac_n "checking for working mmap""... $ac_c" 1>&6
|
||||
echo "configure:5690: checking for working mmap" >&5
|
||||
echo "configure:5692: checking for working mmap" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
|
@ -5694,7 +5696,7 @@ else
|
|||
ac_cv_func_mmap_fixed_mapped=no
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 5698 "configure"
|
||||
#line 5700 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
/* Thanks to Mike Haertel and Jim Avera for this test.
|
||||
|
@ -5834,7 +5836,7 @@ main()
|
|||
}
|
||||
|
||||
EOF
|
||||
if { (eval echo configure:5838: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
|
||||
if { (eval echo configure:5840: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
|
||||
then
|
||||
ac_cv_func_mmap_fixed_mapped=yes
|
||||
else
|
||||
|
@ -5859,12 +5861,12 @@ fi
|
|||
for ac_func in madvise mprotect
|
||||
do
|
||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||
echo "configure:5863: checking for $ac_func" >&5
|
||||
echo "configure:5865: checking for $ac_func" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 5868 "configure"
|
||||
#line 5870 "configure"
|
||||
#include "confdefs.h"
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char $ac_func(); below. */
|
||||
|
@ -5887,7 +5889,7 @@ $ac_func();
|
|||
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:5891: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:5893: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_func_$ac_func=yes"
|
||||
else
|
||||
|
|
|
@ -461,6 +461,8 @@ do
|
|||
bfd_elf32_mcore_little_vec) tb="$tb elf32-mcore.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_mn10200_vec) tb="$tb elf-m10200.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_mn10300_vec) tb="$tb elf-m10300.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_pj_vec) tb="$tb elf32-pj.lo elf32.lo $elf";;
|
||||
bfd_elf32_pjl_vec) tb="$tb elf32-pj.lo elf32.lo $elf";;
|
||||
bfd_elf32_powerpc_vec) tb="$tb elf32-ppc.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_powerpcle_vec) tb="$tb elf32-ppc.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_sh_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;;
|
||||
|
|
85
bfd/cpu-pj.c
Normal file
85
bfd/cpu-pj.c
Normal file
|
@ -0,0 +1,85 @@
|
|||
/* BFD library support routines for the Pico Java architecture.
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
Hacked by Steve Chamberlain of Transmeta. sac@pobox.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"
|
||||
|
||||
|
||||
static boolean
|
||||
scan_mach (info, string)
|
||||
const struct bfd_arch_info *info;
|
||||
const char *string;
|
||||
{
|
||||
if (strcasecmp (info->printable_name, string) == 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
/* This routine is provided two arch_infos and returns whether
|
||||
they'd be compatible */
|
||||
|
||||
static const bfd_arch_info_type *
|
||||
compatible (a,b)
|
||||
const bfd_arch_info_type *a;
|
||||
const bfd_arch_info_type *b;
|
||||
{
|
||||
if (a->arch != b->arch || a->mach != b->mach)
|
||||
return NULL;
|
||||
return a;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static const bfd_arch_info_type arch_info_struct[] =
|
||||
{
|
||||
{
|
||||
32, /* 32 bits in a word */
|
||||
32, /* 32 bits in an address */
|
||||
8, /* 8 bits in a byte */
|
||||
bfd_arch_pj,
|
||||
0,
|
||||
"pj", /* arch_name */
|
||||
"pj", /* printable name */
|
||||
1,
|
||||
false, /* not the default */
|
||||
bfd_default_compatible,
|
||||
scan_mach,
|
||||
0,
|
||||
},
|
||||
};
|
||||
|
||||
const bfd_arch_info_type bfd_pj_arch =
|
||||
{
|
||||
32, /* 32 bits in a word */
|
||||
32, /* 32 bits in an address */
|
||||
8, /* 8 bits in a byte */
|
||||
bfd_arch_pj,
|
||||
0,
|
||||
"pj", /* arch_name */
|
||||
"pj", /* printable name */
|
||||
1,
|
||||
true, /* the default machine */
|
||||
bfd_default_compatible,
|
||||
scan_mach,
|
||||
&arch_info_struct [0]
|
||||
};
|
|
@ -3185,6 +3185,9 @@ prep_headers (abfd)
|
|||
case bfd_arch_mn10300:
|
||||
i_ehdrp->e_machine = EM_CYGNUS_MN10300;
|
||||
break;
|
||||
case bfd_arch_pj:
|
||||
i_ehdrp->e_machine = EM_PJ;
|
||||
break;
|
||||
/* also note that EM_M32, AT&T WE32100 is unknown to bfd */
|
||||
default:
|
||||
i_ehdrp->e_machine = EM_NONE;
|
||||
|
|
349
bfd/elf32-pj.c
Normal file
349
bfd/elf32-pj.c
Normal file
|
@ -0,0 +1,349 @@
|
|||
/* picoJava specific support for 32-bit ELF
|
||||
Copyright 1999 Free Software Foundation, Inc.
|
||||
Contributed by Steve Chamberlan of Transmeta (sac@pobox.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 "bfdlink.h"
|
||||
#include "libbfd.h"
|
||||
#include "elf-bfd.h"
|
||||
#include "elf/pj.h"
|
||||
|
||||
static bfd_reloc_status_type pj_elf_reloc
|
||||
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
|
||||
static reloc_howto_type *pj_elf_reloc_type_lookup
|
||||
PARAMS ((bfd *, bfd_reloc_code_real_type));
|
||||
static void pj_elf_info_to_howto
|
||||
PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
|
||||
|
||||
static reloc_howto_type pj_elf_howto_table[] =
|
||||
{
|
||||
/* No relocation. */
|
||||
HOWTO (R_PJ_NONE, /* type */
|
||||
0, /* rightshift */
|
||||
0, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
0, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
pj_elf_reloc, /* special_function */
|
||||
"R_PJ_NONE", /* name */
|
||||
false, /* partial_inplace */
|
||||
0, /* src_mask */
|
||||
0, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
/* 32 bit absolute relocation. Setting partial_inplace to true and
|
||||
src_mask to a non-zero value is similar to the COFF toolchain. */
|
||||
HOWTO (R_PJ_DATA_DIR32, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
32, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield, /* complain_on_overflow */
|
||||
pj_elf_reloc, /* special_function */
|
||||
"R_PJ_DIR32", /* name */
|
||||
true, /* partial_inplace */
|
||||
0xffffffff, /* src_mask */
|
||||
0xffffffff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
/* 32 bit PC relative relocation. */
|
||||
HOWTO (R_PJ_CODE_REL32, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
32, /* bitsize */
|
||||
true, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_signed, /* complain_on_overflow */
|
||||
pj_elf_reloc, /* special_function */
|
||||
"R_PJ_REL32", /* name */
|
||||
false, /* partial_inplace */
|
||||
0, /* src_mask */
|
||||
0xffffffff, /* dst_mask */
|
||||
true), /* pcrel_offset */
|
||||
|
||||
/* 16 bit PC relative relocation. */
|
||||
HOWTO (R_PJ_CODE_REL16, /* type */
|
||||
0, /* rightshift */
|
||||
1, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
16, /* bitsize */
|
||||
true, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_signed, /* complain_on_overf6w */
|
||||
pj_elf_reloc, /* special_function */
|
||||
"R_PJ_REL16", /* name */
|
||||
false, /* partial_inplace */
|
||||
0xffff, /* src_mask */
|
||||
0xffff, /* dst_mask */
|
||||
true), /* pcrel_offset */
|
||||
EMPTY_HOWTO (4),
|
||||
EMPTY_HOWTO (5),
|
||||
HOWTO (R_PJ_CODE_DIR32, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
32, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield, /* complain_on_overflow */
|
||||
pj_elf_reloc, /* special_function */
|
||||
"R_PJ_CODE_DIR32", /* name */
|
||||
true, /* partial_inplace */
|
||||
0xffffffff, /* src_mask */
|
||||
0xffffffff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
EMPTY_HOWTO (7),
|
||||
EMPTY_HOWTO (8),
|
||||
EMPTY_HOWTO (9),
|
||||
EMPTY_HOWTO (10),
|
||||
EMPTY_HOWTO (11),
|
||||
EMPTY_HOWTO (12),
|
||||
|
||||
HOWTO (R_PJ_CODE_LO16, /* type */
|
||||
0, /* rightshift */
|
||||
1, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
16, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_unsigned, /* complain_on_overflow */
|
||||
pj_elf_reloc, /* special_function */
|
||||
"R_PJ_LO16", /* name */
|
||||
false, /* partial_inplace */
|
||||
0xffff, /* src_mask */
|
||||
0xffff, /* dst_mask */
|
||||
true), /* pcrel_offset */
|
||||
|
||||
|
||||
HOWTO (R_PJ_CODE_HI16, /* type */
|
||||
16, /* rightshift */
|
||||
1, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
16, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_unsigned, /* complain_on_overflow */
|
||||
pj_elf_reloc, /* special_function */
|
||||
"R_PJ_HI16", /* name */
|
||||
false, /* partial_inplace */
|
||||
0xffff, /* src_mask */
|
||||
0xffff, /* dst_mask */
|
||||
true), /* pcrel_offset */
|
||||
|
||||
/* GNU extension to record C++ vtable hierarchy */
|
||||
HOWTO (R_PJ_GNU_VTINHERIT, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
0, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
NULL, /* special_function */
|
||||
"R_PJ_GNU_VTINHERIT", /* name */
|
||||
false, /* partial_inplace */
|
||||
0, /* src_mask */
|
||||
0, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
/* GNU extension to record C++ vtable member usage */
|
||||
HOWTO (R_PJ_GNU_VTENTRY, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
0, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
_bfd_elf_rel_vtable_reloc_fn, /* special_function */
|
||||
"R_PJ_GNU_VTENTRY", /* name */
|
||||
false, /* partial_inplace */
|
||||
0, /* src_mask */
|
||||
0, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
|
||||
};
|
||||
|
||||
/* This function is used for normal relocs. This is like the COFF
|
||||
function, and is almost certainly incorrect for other ELF targets. */
|
||||
|
||||
static bfd_reloc_status_type
|
||||
pj_elf_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
|
||||
error_message)
|
||||
bfd *abfd;
|
||||
arelent *reloc_entry;
|
||||
asymbol *symbol_in;
|
||||
PTR data;
|
||||
asection *input_section;
|
||||
bfd *output_bfd;
|
||||
char **error_message ATTRIBUTE_UNUSED;
|
||||
{
|
||||
unsigned long insn;
|
||||
bfd_vma sym_value;
|
||||
enum elf_pj_reloc_type r_type;
|
||||
bfd_vma addr = reloc_entry->address;
|
||||
bfd_byte *hit_data = addr + (bfd_byte *) data;
|
||||
|
||||
r_type = (enum elf_pj_reloc_type) reloc_entry->howto->type;
|
||||
|
||||
if (output_bfd != NULL)
|
||||
{
|
||||
/* Partial linking--do nothing. */
|
||||
reloc_entry->address += input_section->output_offset;
|
||||
return bfd_reloc_ok;
|
||||
}
|
||||
|
||||
if (symbol_in != NULL
|
||||
&& bfd_is_und_section (symbol_in->section))
|
||||
return bfd_reloc_undefined;
|
||||
|
||||
if (bfd_is_com_section (symbol_in->section))
|
||||
sym_value = 0;
|
||||
else
|
||||
sym_value = (symbol_in->value +
|
||||
symbol_in->section->output_section->vma +
|
||||
symbol_in->section->output_offset);
|
||||
|
||||
switch (r_type)
|
||||
{
|
||||
case R_PJ_DATA_DIR32:
|
||||
insn = bfd_get_32 (abfd, hit_data);
|
||||
insn += sym_value + reloc_entry->addend;
|
||||
bfd_put_32 (abfd, insn, hit_data);
|
||||
break;
|
||||
|
||||
/* Relocations in code are always bigendian, no matter what the
|
||||
data endianness is. */
|
||||
|
||||
case R_PJ_CODE_DIR32:
|
||||
insn = bfd_getb32 (hit_data);
|
||||
insn += sym_value + reloc_entry->addend;
|
||||
bfd_putb32 (insn, hit_data);
|
||||
break;
|
||||
|
||||
case R_PJ_CODE_REL16:
|
||||
insn = bfd_getb16 (hit_data);
|
||||
insn += sym_value + reloc_entry->addend
|
||||
- (input_section->output_section->vma
|
||||
+ input_section->output_offset);
|
||||
bfd_putb16 (insn, hit_data);
|
||||
break;
|
||||
case R_PJ_CODE_LO16:
|
||||
insn = bfd_getb16 (hit_data);
|
||||
insn += sym_value + reloc_entry->addend;
|
||||
bfd_putb16 (insn, hit_data);
|
||||
break;
|
||||
|
||||
case R_PJ_CODE_HI16:
|
||||
insn = bfd_getb16 (hit_data);
|
||||
insn += (sym_value + reloc_entry->addend) >> 16;
|
||||
bfd_putb16 (insn, hit_data);
|
||||
break;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
break;
|
||||
}
|
||||
|
||||
return bfd_reloc_ok;
|
||||
}
|
||||
|
||||
/* This structure is used to map BFD reloc codes to PJ ELF relocs. */
|
||||
|
||||
struct elf_reloc_map
|
||||
{
|
||||
bfd_reloc_code_real_type bfd_reloc_val;
|
||||
unsigned char elf_reloc_val;
|
||||
};
|
||||
|
||||
/* An array mapping BFD reloc codes to PJ ELF relocs. */
|
||||
|
||||
static const struct elf_reloc_map pj_reloc_map[] =
|
||||
{
|
||||
{ BFD_RELOC_NONE, R_PJ_NONE },
|
||||
{ BFD_RELOC_32, R_PJ_DATA_DIR32 },
|
||||
{ BFD_RELOC_PJ_CODE_DIR16, R_PJ_CODE_DIR16 },
|
||||
{ BFD_RELOC_PJ_CODE_DIR32, R_PJ_CODE_DIR32 },
|
||||
{ BFD_RELOC_PJ_CODE_LO16, R_PJ_CODE_LO16 },
|
||||
{ BFD_RELOC_PJ_CODE_HI16, R_PJ_CODE_HI16 },
|
||||
{ BFD_RELOC_PJ_CODE_REL32, R_PJ_CODE_REL32 },
|
||||
{ BFD_RELOC_PJ_CODE_REL16, R_PJ_CODE_REL16 },
|
||||
{ BFD_RELOC_VTABLE_INHERIT, R_PJ_GNU_VTINHERIT },
|
||||
{ BFD_RELOC_VTABLE_ENTRY, R_PJ_GNU_VTENTRY },
|
||||
};
|
||||
|
||||
/* Given a BFD reloc code, return the howto structure for the
|
||||
corresponding PJ ELf reloc. */
|
||||
|
||||
static reloc_howto_type *
|
||||
pj_elf_reloc_type_lookup (abfd, code)
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
bfd_reloc_code_real_type code;
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < sizeof (pj_reloc_map) / sizeof (struct elf_reloc_map); i++)
|
||||
{
|
||||
if (pj_reloc_map[i].bfd_reloc_val == code)
|
||||
return &pj_elf_howto_table[(int) pj_reloc_map[i].elf_reloc_val];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Given an ELF reloc, fill in the howto field of a relent. */
|
||||
|
||||
static void
|
||||
pj_elf_info_to_howto (abfd, cache_ptr, dst)
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
arelent *cache_ptr;
|
||||
Elf_Internal_Rela *dst;
|
||||
{
|
||||
unsigned int r;
|
||||
|
||||
r = ELF32_R_TYPE (dst->r_info);
|
||||
|
||||
BFD_ASSERT (r < (unsigned int) R_PJ_max);
|
||||
|
||||
cache_ptr->howto = &pj_elf_howto_table[r];
|
||||
}
|
||||
|
||||
/* Take this moment to fill in the special picoJava bits in the
|
||||
e_flags field. */
|
||||
|
||||
static void
|
||||
pj_elf_final_write_processing (abfd, linker)
|
||||
bfd *abfd;
|
||||
boolean linker ATTRIBUTE_UNUSED;
|
||||
{
|
||||
elf_elfheader (abfd)->e_flags |= EF_PICOJAVA_ARCH;
|
||||
elf_elfheader (abfd)->e_flags |= EF_PICOJAVA_GNUCALLS;
|
||||
}
|
||||
|
||||
#define TARGET_BIG_SYM bfd_elf32_pj_vec
|
||||
#define TARGET_BIG_NAME "elf32-pj"
|
||||
#define TARGET_LITTLE_SYM bfd_elf32_pjl_vec
|
||||
#define TARGET_LITTLE_NAME "elf32-pjl"
|
||||
#define ELF_ARCH bfd_arch_pj
|
||||
#define ELF_MACHINE_CODE EM_PJ
|
||||
#define ELF_MAXPAGESIZE 0x1000
|
||||
#define bfd_elf32_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
|
||||
#define bfd_elf32_bfd_reloc_type_lookup pj_elf_reloc_type_lookup
|
||||
#define elf_backend_final_write_processing pj_elf_final_write_processing
|
||||
#define elf_info_to_howto pj_elf_info_to_howto
|
||||
#include "elf32-target.h"
|
|
@ -708,6 +708,12 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
|
|||
"BFD_RELOC_NS32K_DISP_8_PCREL",
|
||||
"BFD_RELOC_NS32K_DISP_16_PCREL",
|
||||
"BFD_RELOC_NS32K_DISP_32_PCREL",
|
||||
"BFD_RELOC_PJ_CODE_HI16",
|
||||
"BFD_RELOC_PJ_CODE_LO16",
|
||||
"BFD_RELOC_PJ_CODE_DIR16",
|
||||
"BFD_RELOC_PJ_CODE_DIR32",
|
||||
"BFD_RELOC_PJ_CODE_REL16",
|
||||
"BFD_RELOC_PJ_CODE_REL32",
|
||||
"BFD_RELOC_PPC_B26",
|
||||
"BFD_RELOC_PPC_BA26",
|
||||
"BFD_RELOC_PPC_TOC16",
|
||||
|
|
15
bfd/reloc.c
15
bfd/reloc.c
|
@ -2105,6 +2105,21 @@ ENUMX
|
|||
ENUMDOC
|
||||
ns32k relocations
|
||||
|
||||
ENUM
|
||||
BFD_RELOC_PJ_CODE_HI16
|
||||
ENUMX
|
||||
BFD_RELOC_PJ_CODE_LO16
|
||||
ENUMX
|
||||
BFD_RELOC_PJ_CODE_DIR16
|
||||
ENUMX
|
||||
BFD_RELOC_PJ_CODE_DIR32
|
||||
ENUMX
|
||||
BFD_RELOC_PJ_CODE_REL16
|
||||
ENUMX
|
||||
BFD_RELOC_PJ_CODE_REL32
|
||||
ENUMDOC
|
||||
Picojava relocs. Not all of these appear in object files.
|
||||
|
||||
ENUM
|
||||
BFD_RELOC_PPC_B26
|
||||
ENUMX
|
||||
|
|
|
@ -529,6 +529,8 @@ extern const bfd_target bfd_elf32_m68k_vec;
|
|||
extern const bfd_target bfd_elf32_m88k_vec;
|
||||
extern const bfd_target bfd_elf32_mn10200_vec;
|
||||
extern const bfd_target bfd_elf32_mn10300_vec;
|
||||
extern const bfd_target bfd_elf32_pj_vec;
|
||||
extern const bfd_target bfd_elf32_pjl_vec;
|
||||
extern const bfd_target bfd_elf32_powerpc_vec;
|
||||
extern const bfd_target bfd_elf32_powerpcle_vec;
|
||||
extern const bfd_target bfd_elf32_sh_vec;
|
||||
|
@ -709,6 +711,8 @@ const bfd_target * const bfd_target_vector[] = {
|
|||
&bfd_elf32_m68k_vec,
|
||||
&bfd_elf32_m88k_vec,
|
||||
&bfd_elf32_sparc_vec,
|
||||
&bfd_elf32_pj_vec,
|
||||
&bfd_elf32_pjl_vec,
|
||||
&bfd_elf32_powerpc_vec,
|
||||
&bfd_elf32_powerpcle_vec,
|
||||
&bfd_elf32_v850_vec,
|
||||
|
|
Loading…
Reference in a new issue