* elf-bfd.h (struct elf_backend_data): Reorder collect and

type_change_ok; add sign_extend_vma.
        * elf32-mips.c (elf_backend_sign_extend_vma): Define.
        * elfcode.h (elf_swap_symbol_in): Mind be->sign_extend_vma.
        (elf_swap_shdr_in, elf_swap_phdr_in): Likewise.
        * elfxx-target.h (elf_backend_sign_extend_vma): Default.
        (elfNN_bed): Follow struture changes.
This commit is contained in:
Richard Henderson 1999-11-18 01:06:45 +00:00
parent 22b3e891f0
commit 86dc0f79f5
5 changed files with 58 additions and 18 deletions

View file

@ -1,3 +1,13 @@
1999-11-17 Richard Henderson <rth@cygnus.com>
* elf-bfd.h (struct elf_backend_data): Reorder collect and
type_change_ok; add sign_extend_vma.
* elf32-mips.c (elf_backend_sign_extend_vma): Define.
* elfcode.h (elf_swap_symbol_in): Mind be->sign_extend_vma.
(elf_swap_shdr_in, elf_swap_phdr_in): Likewise.
* elfxx-target.h (elf_backend_sign_extend_vma): Default.
(elfNN_bed): Follow struture changes.
1999-11-09 Ian Lance Taylor <ian@zembu.com> 1999-11-09 Ian Lance Taylor <ian@zembu.com>
* libbfd.c (bfd_read): Check result of read against desired result * libbfd.c (bfd_read): Check result of read against desired result

View file

@ -332,18 +332,6 @@ struct elf_backend_data
/* The maximum page size for this backend. */ /* The maximum page size for this backend. */
bfd_vma maxpagesize; bfd_vma maxpagesize;
/* This is true if the linker should act like collect and gather
global constructors and destructors by name. This is true for
MIPS ELF because the Irix 5 tools can not handle the .init
section. */
boolean collect;
/* This is true if the linker should ignore changes to the type of a
symbol. This is true for MIPS ELF because some Irix 5 objects
record undefined functions as STT_OBJECT although the definitions
are STT_FUNC. */
boolean type_change_ok;
/* A function to translate an ELF RELA relocation to a BFD arelent /* A function to translate an ELF RELA relocation to a BFD arelent
structure. */ structure. */
void (*elf_info_to_howto) PARAMS ((bfd *, arelent *, void (*elf_info_to_howto) PARAMS ((bfd *, arelent *,
@ -618,6 +606,18 @@ struct elf_backend_data
bfd_vma got_header_size; bfd_vma got_header_size;
bfd_vma plt_header_size; bfd_vma plt_header_size;
/* This is true if the linker should act like collect and gather
global constructors and destructors by name. This is true for
MIPS ELF because the Irix 5 tools can not handle the .init
section. */
unsigned collect : 1;
/* This is true if the linker should ignore changes to the type of a
symbol. This is true for MIPS ELF because some Irix 5 objects
record undefined functions as STT_OBJECT although the definitions
are STT_FUNC. */
unsigned type_change_ok : 1;
/* Whether the backend may use REL relocations. (Some backends use /* Whether the backend may use REL relocations. (Some backends use
both REL and RELA relocations, and this flag is set for those both REL and RELA relocations, and this flag is set for those
backends.) */ backends.) */
@ -635,6 +635,10 @@ struct elf_backend_data
section. */ section. */
unsigned default_use_rela_p : 1; unsigned default_use_rela_p : 1;
/* True if addresses "naturally" sign extend. This is used when
swapping in from Elf32 when BFD64. */
unsigned sign_extend_vma : 1;
unsigned want_got_plt : 1; unsigned want_got_plt : 1;
unsigned plt_readonly : 1; unsigned plt_readonly : 1;
unsigned want_plt_sym : 1; unsigned want_plt_sym : 1;

View file

@ -8809,6 +8809,7 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap =
#define elf_backend_collect true #define elf_backend_collect true
#define elf_backend_type_change_ok true #define elf_backend_type_change_ok true
#define elf_backend_can_gc_sections true #define elf_backend_can_gc_sections true
#define elf_backend_sign_extend_vma true
#define elf_info_to_howto mips_info_to_howto_rela #define elf_info_to_howto mips_info_to_howto_rela
#define elf_info_to_howto_rel mips_info_to_howto_rel #define elf_info_to_howto_rel mips_info_to_howto_rel
#define elf_backend_sym_is_global mips_elf_sym_is_global #define elf_backend_sym_is_global mips_elf_sym_is_global

View file

@ -207,8 +207,13 @@ elf_swap_symbol_in (abfd, src, dst)
const Elf_External_Sym *src; const Elf_External_Sym *src;
Elf_Internal_Sym *dst; Elf_Internal_Sym *dst;
{ {
int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma;
dst->st_name = bfd_h_get_32 (abfd, (bfd_byte *) src->st_name); dst->st_name = bfd_h_get_32 (abfd, (bfd_byte *) src->st_name);
dst->st_value = get_word (abfd, (bfd_byte *) src->st_value); if (signed_vma)
dst->st_value = get_signed_word (abfd, (bfd_byte *) src->st_value);
else
dst->st_value = get_word (abfd, (bfd_byte *) src->st_value);
dst->st_size = get_word (abfd, (bfd_byte *) src->st_size); dst->st_size = get_word (abfd, (bfd_byte *) src->st_size);
dst->st_info = bfd_h_get_8 (abfd, (bfd_byte *) src->st_info); dst->st_info = bfd_h_get_8 (abfd, (bfd_byte *) src->st_info);
dst->st_other = bfd_h_get_8 (abfd, (bfd_byte *) src->st_other); dst->st_other = bfd_h_get_8 (abfd, (bfd_byte *) src->st_other);
@ -295,10 +300,15 @@ elf_swap_shdr_in (abfd, src, dst)
const Elf_External_Shdr *src; const Elf_External_Shdr *src;
Elf_Internal_Shdr *dst; Elf_Internal_Shdr *dst;
{ {
int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma;
dst->sh_name = bfd_h_get_32 (abfd, (bfd_byte *) src->sh_name); dst->sh_name = bfd_h_get_32 (abfd, (bfd_byte *) src->sh_name);
dst->sh_type = bfd_h_get_32 (abfd, (bfd_byte *) src->sh_type); dst->sh_type = bfd_h_get_32 (abfd, (bfd_byte *) src->sh_type);
dst->sh_flags = get_word (abfd, (bfd_byte *) src->sh_flags); dst->sh_flags = get_word (abfd, (bfd_byte *) src->sh_flags);
dst->sh_addr = get_word (abfd, (bfd_byte *) src->sh_addr); if (signed_vma)
dst->sh_addr = get_signed_word (abfd, (bfd_byte *) src->sh_addr);
else
dst->sh_addr = get_word (abfd, (bfd_byte *) src->sh_addr);
dst->sh_offset = get_word (abfd, (bfd_byte *) src->sh_offset); dst->sh_offset = get_word (abfd, (bfd_byte *) src->sh_offset);
dst->sh_size = get_word (abfd, (bfd_byte *) src->sh_size); dst->sh_size = get_word (abfd, (bfd_byte *) src->sh_size);
dst->sh_link = bfd_h_get_32 (abfd, (bfd_byte *) src->sh_link); dst->sh_link = bfd_h_get_32 (abfd, (bfd_byte *) src->sh_link);
@ -341,11 +351,21 @@ elf_swap_phdr_in (abfd, src, dst)
const Elf_External_Phdr *src; const Elf_External_Phdr *src;
Elf_Internal_Phdr *dst; Elf_Internal_Phdr *dst;
{ {
int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma;
dst->p_type = bfd_h_get_32 (abfd, (bfd_byte *) src->p_type); dst->p_type = bfd_h_get_32 (abfd, (bfd_byte *) src->p_type);
dst->p_flags = bfd_h_get_32 (abfd, (bfd_byte *) src->p_flags); dst->p_flags = bfd_h_get_32 (abfd, (bfd_byte *) src->p_flags);
dst->p_offset = get_word (abfd, (bfd_byte *) src->p_offset); dst->p_offset = get_word (abfd, (bfd_byte *) src->p_offset);
dst->p_vaddr = get_word (abfd, (bfd_byte *) src->p_vaddr); if (signed_vma)
dst->p_paddr = get_word (abfd, (bfd_byte *) src->p_paddr); {
dst->p_vaddr = get_signed_word (abfd, (bfd_byte *) src->p_vaddr);
dst->p_paddr = get_signed_word (abfd, (bfd_byte *) src->p_paddr);
}
else
{
dst->p_vaddr = get_word (abfd, (bfd_byte *) src->p_vaddr);
dst->p_paddr = get_word (abfd, (bfd_byte *) src->p_paddr);
}
dst->p_filesz = get_word (abfd, (bfd_byte *) src->p_filesz); dst->p_filesz = get_word (abfd, (bfd_byte *) src->p_filesz);
dst->p_memsz = get_word (abfd, (bfd_byte *) src->p_memsz); dst->p_memsz = get_word (abfd, (bfd_byte *) src->p_memsz);
dst->p_align = get_word (abfd, (bfd_byte *) src->p_align); dst->p_align = get_word (abfd, (bfd_byte *) src->p_align);

View file

@ -338,6 +338,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define elf_backend_size_info _bfd_elfNN_size_info #define elf_backend_size_info _bfd_elfNN_size_info
#endif #endif
#ifndef elf_backend_sign_extend_vma
#define elf_backend_sign_extend_vma 0
#endif
extern const struct elf_size_info _bfd_elfNN_size_info; extern const struct elf_size_info _bfd_elfNN_size_info;
static CONST struct elf_backend_data elfNN_bed = static CONST struct elf_backend_data elfNN_bed =
@ -345,8 +349,6 @@ static CONST struct elf_backend_data elfNN_bed =
ELF_ARCH, /* arch */ ELF_ARCH, /* arch */
ELF_MACHINE_CODE, /* elf_machine_code */ ELF_MACHINE_CODE, /* elf_machine_code */
ELF_MAXPAGESIZE, /* maxpagesize */ ELF_MAXPAGESIZE, /* maxpagesize */
elf_backend_collect,
elf_backend_type_change_ok,
elf_info_to_howto, elf_info_to_howto,
elf_info_to_howto_rel, elf_info_to_howto_rel,
elf_backend_sym_is_global, elf_backend_sym_is_global,
@ -384,9 +386,12 @@ static CONST struct elf_backend_data elfNN_bed =
elf_backend_got_symbol_offset, elf_backend_got_symbol_offset,
elf_backend_got_header_size, elf_backend_got_header_size,
elf_backend_plt_header_size, elf_backend_plt_header_size,
elf_backend_collect,
elf_backend_type_change_ok,
elf_backend_may_use_rel_p, elf_backend_may_use_rel_p,
elf_backend_may_use_rela_p, elf_backend_may_use_rela_p,
elf_backend_default_use_rela_p, elf_backend_default_use_rela_p,
elf_backend_sign_extend_vma,
elf_backend_want_got_plt, elf_backend_want_got_plt,
elf_backend_plt_readonly, elf_backend_plt_readonly,
elf_backend_want_plt_sym, elf_backend_want_plt_sym,