Line 1... |
Line 1... |
/* M16C/M32C specific support for 32-bit ELF.
|
/* M16C/M32C specific support for 32-bit ELF.
|
Copyright (C) 2005, 2006, 2007
|
Copyright (C) 2005, 2006, 2007, 2008, 2009
|
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
|
|
This file is part of BFD, the Binary File Descriptor library.
|
This file is part of BFD, the Binary File Descriptor library.
|
|
|
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
Line 845... |
Line 845... |
|
|
/* Print normal ELF private data. */
|
/* Print normal ELF private data. */
|
_bfd_elf_print_private_bfd_data (abfd, ptr);
|
_bfd_elf_print_private_bfd_data (abfd, ptr);
|
|
|
flags = elf_elfheader (abfd)->e_flags;
|
flags = elf_elfheader (abfd)->e_flags;
|
fprintf (file, _("private flags = 0x%lx:"), (long)flags);
|
fprintf (file, _("private flags = 0x%lx:"), (unsigned long) flags);
|
|
|
switch (flags & EF_M32C_CPU_MASK)
|
switch (flags & EF_M32C_CPU_MASK)
|
{
|
{
|
default: break;
|
default: break;
|
case EF_M32C_CPU_M16C: fprintf (file, " -m16c"); break;
|
case EF_M32C_CPU_M16C: fprintf (file, " -m16c"); break;
|
Line 1949... |
Line 1949... |
shndx_buf = (Elf_External_Sym_Shndx *) shndx_hdr->contents;
|
shndx_buf = (Elf_External_Sym_Shndx *) shndx_hdr->contents;
|
shndx = shndx_buf;
|
shndx = shndx_buf;
|
|
|
for (; isym < isymend; isym++, shndx = (shndx ? shndx + 1 : NULL))
|
for (; isym < isymend; isym++, shndx = (shndx ? shndx + 1 : NULL))
|
{
|
{
|
|
/* If the symbol is in the range of memory we just moved, we
|
|
have to adjust its value. */
|
if ((int) isym->st_shndx == sec_shndx
|
if ((int) isym->st_shndx == sec_shndx
|
&& isym->st_value > addr
|
&& isym->st_value > addr
|
&& isym->st_value < toaddr)
|
&& isym->st_value < toaddr)
|
{
|
{
|
isym->st_value -= count;
|
isym->st_value -= count;
|
}
|
}
|
|
/* If the symbol *spans* the bytes we just deleted (i.e. it's
|
|
*end* is in the moved bytes but it's *start* isn't), then we
|
|
must adjust its size. */
|
|
if ((int) isym->st_shndx == sec_shndx
|
|
&& isym->st_value < addr
|
|
&& isym->st_value + isym->st_size > addr
|
|
&& isym->st_value + isym->st_size < toaddr)
|
|
{
|
|
isym->st_size -= count;
|
|
}
|
}
|
}
|
|
|
/* Now adjust the global symbols defined in this section. */
|
/* Now adjust the global symbols defined in this section. */
|
symcount = (symtab_hdr->sh_size / sizeof (Elf32_External_Sym)
|
symcount = (symtab_hdr->sh_size / sizeof (Elf32_External_Sym)
|
- symtab_hdr->sh_info);
|
- symtab_hdr->sh_info);
|
Line 1972... |
Line 1983... |
struct elf_link_hash_entry * sym_hash = * sym_hashes;
|
struct elf_link_hash_entry * sym_hash = * sym_hashes;
|
|
|
if (sym_hash &&
|
if (sym_hash &&
|
( sym_hash->root.type == bfd_link_hash_defined
|
( sym_hash->root.type == bfd_link_hash_defined
|
|| sym_hash->root.type == bfd_link_hash_defweak)
|
|| sym_hash->root.type == bfd_link_hash_defweak)
|
&& sym_hash->root.u.def.section == sec
|
&& sym_hash->root.u.def.section == sec)
|
&& sym_hash->root.u.def.value > addr
|
{
|
|
if (sym_hash->root.u.def.value > addr
|
&& sym_hash->root.u.def.value < toaddr)
|
&& sym_hash->root.u.def.value < toaddr)
|
{
|
{
|
sym_hash->root.u.def.value -= count;
|
sym_hash->root.u.def.value -= count;
|
}
|
}
|
|
if (sym_hash->root.u.def.value < addr
|
|
&& sym_hash->root.u.def.value + sym_hash->size > addr
|
|
&& sym_hash->root.u.def.value + sym_hash->size < toaddr)
|
|
{
|
|
sym_hash->size -= count;
|
|
}
|
|
}
|
}
|
}
|
|
|
return TRUE;
|
return TRUE;
|
}
|
}
|
|
|
Line 1996... |
Line 2015... |
|
|
|
|
|
|
#define ELF_ARCH bfd_arch_m32c
|
#define ELF_ARCH bfd_arch_m32c
|
#define ELF_MACHINE_CODE EM_M32C
|
#define ELF_MACHINE_CODE EM_M32C
|
|
#define ELF_MACHINE_ALT1 EM_M32C_OLD
|
#define ELF_MAXPAGESIZE 0x1000
|
#define ELF_MAXPAGESIZE 0x1000
|
|
|
#if 0
|
#if 0
|
#define TARGET_BIG_SYM bfd_elf32_m32c_vec
|
#define TARGET_BIG_SYM bfd_elf32_m32c_vec
|
#define TARGET_BIG_NAME "elf32-m32c"
|
#define TARGET_BIG_NAME "elf32-m32c"
|