mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-08-05 21:50:21 +08:00
* cpu-h8300.c (h8300_scan, compatible): Prototype.
(h8300_scan): Handle architecture:machine encodings typically found in linker scripts. * elf.c (prep_headers): Do not try to do H8 machine recognition here. * elf32-h8300.c: Add some missing prototypes. (elf32_h8_mach, elf32_h8_final_write_processing): New functions. (elf32_h8_object_p): Similarly.
This commit is contained in:
@ -1,4 +1,15 @@
|
||||
2001-08-29 Alan Modra <amodra@bigpond.net.au>
|
||||
2000-08-29 Jeff Law <law@redhat.com>
|
||||
|
||||
* cpu-h8300.c (h8300_scan, compatible): Prototype.
|
||||
(h8300_scan): Handle architecture:machine encodings typically
|
||||
found in linker scripts.
|
||||
* elf.c (prep_headers): Do not try to do H8 machine recognition
|
||||
here.
|
||||
* elf32-h8300.c: Add some missing prototypes.
|
||||
(elf32_h8_mach, elf32_h8_final_write_processing): New functions.
|
||||
(elf32_h8_object_p): Similarly.
|
||||
|
||||
2000-08-29 Alan Modra <amodra@bigpond.net.au>
|
||||
|
||||
* targmatch.sed: Delete case statements.
|
||||
* config.bfd <powerpc-*-aix* entry>: Select 64 bit xcoff for
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* BFD library support routines for the Hitachi H8/300 architecture.
|
||||
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 2000
|
||||
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 2000, 2001
|
||||
Free Software Foundation, Inc.
|
||||
Hacked by Steve Chamberlain of Cygnus Support.
|
||||
|
||||
@ -25,6 +25,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
int bfd_default_scan_num_mach ();
|
||||
|
||||
static boolean h8300_scan
|
||||
PARAMS ((const struct bfd_arch_info *, const char *));
|
||||
static const bfd_arch_info_type * compatible
|
||||
PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *));
|
||||
|
||||
static boolean
|
||||
h8300_scan (info, string)
|
||||
const struct bfd_arch_info *info;
|
||||
@ -52,6 +57,18 @@ h8300_scan (info, string)
|
||||
string++;
|
||||
if (*string == '-')
|
||||
string++;
|
||||
|
||||
/* In ELF linker scripts, we typically express the architecture/machine
|
||||
as architecture:machine.
|
||||
|
||||
So if we've matched so far and encounter a colon, try to match the
|
||||
string following the colon. */
|
||||
if (*string == ':')
|
||||
{
|
||||
string++;
|
||||
h8300_scan (info, string);
|
||||
}
|
||||
|
||||
if (*string == 'h' || *string == 'H')
|
||||
{
|
||||
return (info->mach == bfd_mach_h8300h);
|
||||
|
14
bfd/elf.c
14
bfd/elf.c
@ -3452,19 +3452,7 @@ prep_headers (abfd)
|
||||
break;
|
||||
/* Also note that EM_M32, AT&T WE32100 is unknown to bfd. */
|
||||
case bfd_arch_h8300:
|
||||
switch (bfd_get_mach (abfd))
|
||||
{
|
||||
default:
|
||||
case bfd_mach_h8300:
|
||||
i_ehdrp->e_machine = EM_H8_300;
|
||||
break;
|
||||
case bfd_mach_h8300h:
|
||||
i_ehdrp->e_machine = EM_H8_300H;
|
||||
break;
|
||||
case bfd_mach_h8300s:
|
||||
i_ehdrp->e_machine = EM_H8S;
|
||||
break;
|
||||
}
|
||||
i_ehdrp->e_machine = EM_H8_300;
|
||||
break;
|
||||
case bfd_arch_h8500:
|
||||
i_ehdrp->e_machine = EM_H8_500;
|
||||
|
@ -184,6 +184,15 @@ static const struct elf_reloc_map h8_reloc_map[] =
|
||||
{ BFD_RELOC_H8_DIR32A16, R_H8_DIR32A16_X },
|
||||
};
|
||||
|
||||
static reloc_howto_type *elf32_h8_reloc_type_lookup
|
||||
PARAMS ((bfd *, bfd_reloc_code_real_type));
|
||||
static void elf32_h8_info_to_howto
|
||||
PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
|
||||
static void elf32_h8_info_to_howto_rel
|
||||
PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *));
|
||||
static int elf32_h8_mach
|
||||
PARAMS ((flagword));
|
||||
|
||||
static reloc_howto_type *
|
||||
elf32_h8_reloc_type_lookup (abfd, code)
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
@ -231,6 +240,97 @@ elf32_h8_info_to_howto_rel (abfd, bfd_reloc, elf_reloc)
|
||||
bfd_reloc->howto = &h8_elf_howto_table[r];
|
||||
}
|
||||
|
||||
/* Object files encode the specific H8 model they were compiled
|
||||
for in the ELF flags field.
|
||||
|
||||
Examine that field and return the proper BFD machine type for
|
||||
the object file. */
|
||||
static int
|
||||
elf32_h8_mach (flags)
|
||||
flagword flags;
|
||||
{
|
||||
switch (flags & EF_H8_MACH)
|
||||
{
|
||||
case E_H8_MACH_H8300:
|
||||
default:
|
||||
return bfd_mach_h8300;
|
||||
|
||||
case E_H8_MACH_H8300H:
|
||||
return bfd_mach_h8300h;
|
||||
|
||||
case E_H8_MACH_H8300S:
|
||||
return bfd_mach_h8300s;
|
||||
}
|
||||
}
|
||||
|
||||
/* The final processing done just before writing out a H8 ELF object
|
||||
file. We use this opportunity to encode the BFD machine type
|
||||
into the flags field in the object file. */
|
||||
|
||||
void
|
||||
elf32_h8_final_write_processing (abfd, linker)
|
||||
bfd *abfd;
|
||||
boolean linker ATTRIBUTE_UNUSED;
|
||||
{
|
||||
unsigned long val;
|
||||
|
||||
switch (bfd_get_mach (abfd))
|
||||
{
|
||||
default:
|
||||
case bfd_mach_h8300:
|
||||
val = E_H8_MACH_H8300;
|
||||
break;
|
||||
|
||||
case bfd_mach_h8300h:
|
||||
val = E_H8_MACH_H8300H;
|
||||
break;
|
||||
|
||||
case bfd_mach_h8300s:
|
||||
val = E_H8_MACH_H8300S;
|
||||
break;
|
||||
}
|
||||
|
||||
elf_elfheader (abfd)->e_flags &= ~ (EF_H8_MACH);
|
||||
elf_elfheader (abfd)->e_flags |= val;
|
||||
}
|
||||
|
||||
/* Return nonzero if ABFD represents a valid H8 ELF object file; also
|
||||
record the encoded machine type found in the ELF flags. */
|
||||
|
||||
boolean
|
||||
elf32_h8_object_p (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
bfd_default_set_arch_mach (abfd, bfd_arch_h8300,
|
||||
elf32_h8_mach (elf_elfheader (abfd)->e_flags));
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Merge backend specific data from an object file to the output
|
||||
object file when linking. The only data we need to copy at this
|
||||
time is the architecture/machine information. */
|
||||
|
||||
boolean
|
||||
elf32_h8_merge_private_bfd_data (ibfd, obfd)
|
||||
bfd *ibfd;
|
||||
bfd *obfd;
|
||||
{
|
||||
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
|
||||
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour)
|
||||
return true;
|
||||
|
||||
if (bfd_get_arch (obfd) == bfd_get_arch (ibfd)
|
||||
&& bfd_get_mach (obfd) < bfd_get_mach (ibfd))
|
||||
{
|
||||
if (! bfd_set_arch_mach (obfd, bfd_get_arch (ibfd),
|
||||
bfd_get_mach (ibfd)))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
#define TARGET_BIG_SYM bfd_elf32_h8300_vec
|
||||
#define TARGET_BIG_NAME "elf32-h8300"
|
||||
#define ELF_ARCH bfd_arch_h8300
|
||||
@ -240,6 +340,15 @@ elf32_h8_info_to_howto_rel (abfd, bfd_reloc, elf_reloc)
|
||||
#define elf_info_to_howto elf32_h8_info_to_howto
|
||||
#define elf_info_to_howto_rel elf32_h8_info_to_howto_rel
|
||||
|
||||
/* So we can set/examine bits in e_flags to get the specific
|
||||
H8 architecture in use. */
|
||||
#define elf_backend_final_write_processing \
|
||||
elf32_h8_final_write_processing
|
||||
#define elf_backend_object_p \
|
||||
elf32_h8_object_p
|
||||
#define bfd_elf32_bfd_merge_private_bfd_data \
|
||||
elf32_h8_merge_private_bfd_data
|
||||
|
||||
/* ??? when elf_backend_relocate_section is not defined, elf32-target.h
|
||||
defaults to using _bfd_generic_link_hash_table_create, but
|
||||
elflink.h:bfd_elf32_size_dynamic_sections uses
|
||||
|
Reference in New Issue
Block a user