mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-26 18:53:29 +08:00
* elf32-i386.c (elf_i386_adjust_dynamic_symbol): Correct
BFD_ASSERT to handle __start_SECNAME symbols automatically defined by the linker. * elf32-sparc.c (elf32_sparc_adjust_dynamic_symbol): Likewise. * elf32-m68k.c (elf_m68k_adjust_dynamic_symbol): Likewise.
This commit is contained in:
parent
d7ace3071e
commit
30dc85f1b8
@ -1,5 +1,11 @@
|
||||
Mon Jul 3 11:30:45 1995 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* elf32-i386.c (elf_i386_adjust_dynamic_symbol): Correct
|
||||
BFD_ASSERT to handle __start_SECNAME symbols automatically defined
|
||||
by the linker.
|
||||
* elf32-sparc.c (elf32_sparc_adjust_dynamic_symbol): Likewise.
|
||||
* elf32-m68k.c (elf_m68k_adjust_dynamic_symbol): Likewise.
|
||||
|
||||
* Makefile.in: Rebuild dependencies.
|
||||
(BFD32_BACKENDS): Add versados.o.
|
||||
(CFILES): Add pe-i386.c, pei-i386.c, and versados.c.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Intel 80386/80486-specific support for 32-bit ELF
|
||||
Copyright 1993 Free Software Foundation, Inc.
|
||||
Copyright 1993, 1994, 1995 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
@ -23,7 +23,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
#include "libbfd.h"
|
||||
#include "libelf.h"
|
||||
|
||||
static CONST struct reloc_howto_struct *elf_i386_reloc_type_lookup
|
||||
static reloc_howto_type *elf_i386_reloc_type_lookup
|
||||
PARAMS ((bfd *, bfd_reloc_code_real_type));
|
||||
static void elf_i386_info_to_howto
|
||||
PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
|
||||
@ -105,7 +105,7 @@ static reloc_howto_type elf_howto_table[]=
|
||||
#define TRACE(str)
|
||||
#endif
|
||||
|
||||
static CONST struct reloc_howto_struct *
|
||||
static reloc_howto_type *
|
||||
elf_i386_reloc_type_lookup (abfd, code)
|
||||
bfd *abfd;
|
||||
bfd_reloc_code_real_type code;
|
||||
@ -607,20 +607,22 @@ elf_i386_adjust_dynamic_symbol (info, h)
|
||||
dynobj = elf_hash_table (info)->dynobj;
|
||||
|
||||
/* Make sure we know what is going on here. */
|
||||
BFD_ASSERT (dynobj != NULL
|
||||
&& ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT)
|
||||
|| ((h->elf_link_hash_flags
|
||||
& ELF_LINK_HASH_DEF_DYNAMIC) != 0
|
||||
&& (h->elf_link_hash_flags
|
||||
& ELF_LINK_HASH_REF_REGULAR) != 0
|
||||
&& (h->elf_link_hash_flags
|
||||
& ELF_LINK_HASH_DEF_REGULAR) == 0
|
||||
&& (elf_elfheader (h->root.u.def.section->owner)->e_type
|
||||
== ET_DYN)
|
||||
&& h->root.type == bfd_link_hash_defined
|
||||
&& (bfd_get_flavour (h->root.u.def.section->owner)
|
||||
== bfd_target_elf_flavour)
|
||||
&& h->root.u.def.section->output_section == NULL)));
|
||||
BFD_ASSERT (dynobj != NULL);
|
||||
BFD_ASSERT ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT)
|
||||
|| ((h->elf_link_hash_flags
|
||||
& ELF_LINK_HASH_DEF_DYNAMIC) != 0
|
||||
&& (h->elf_link_hash_flags
|
||||
& ELF_LINK_HASH_REF_REGULAR) != 0
|
||||
&& (h->elf_link_hash_flags
|
||||
& ELF_LINK_HASH_DEF_REGULAR) == 0
|
||||
&& (h->root.type == bfd_link_hash_defined
|
||||
|| h->root.type == bfd_link_hash_defweak)
|
||||
&& (h->root.u.def.section->owner == NULL
|
||||
|| ((elf_elfheader (h->root.u.def.section->owner)->e_type
|
||||
== ET_DYN)
|
||||
&& (bfd_get_flavour (h->root.u.def.section->owner)
|
||||
== bfd_target_elf_flavour)
|
||||
&& h->root.u.def.section->output_section == NULL))));
|
||||
|
||||
/* If this is a function, put it in the procedure linkage table. We
|
||||
will fill in the contents of the procedure linkage table later,
|
||||
@ -685,7 +687,8 @@ elf_i386_adjust_dynamic_symbol (info, h)
|
||||
real definition first, and we can just use the same value. */
|
||||
if (h->weakdef != NULL)
|
||||
{
|
||||
BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined);
|
||||
BFD_ASSERT (h->weakdef->root.type == bfd_link_hash_defined
|
||||
|| h->weakdef->root.type == bfd_link_hash_defweak);
|
||||
h->root.u.def.section = h->weakdef->root.u.def.section;
|
||||
h->root.u.def.value = h->weakdef->root.u.def.value;
|
||||
return true;
|
||||
@ -980,6 +983,7 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||
asection *sec;
|
||||
bfd_vma relocation;
|
||||
bfd_reloc_status_type r;
|
||||
char *shared_name;
|
||||
|
||||
r_type = ELF32_R_TYPE (rel->r_info);
|
||||
if (r_type < 0 || r_type >= (int) R_386_max)
|
||||
@ -1018,6 +1022,8 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||
h = NULL;
|
||||
sym = NULL;
|
||||
sec = NULL;
|
||||
shared_name = NULL;
|
||||
|
||||
if (r_symndx < symtab_hdr->sh_info)
|
||||
{
|
||||
sym = local_syms + r_symndx;
|
||||
@ -1029,7 +1035,8 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||
else
|
||||
{
|
||||
h = sym_hashes[r_symndx - symtab_hdr->sh_info];
|
||||
if (h->root.type == bfd_link_hash_defined)
|
||||
if (h->root.type == bfd_link_hash_defined
|
||||
|| h->root.type == bfd_link_hash_defweak)
|
||||
{
|
||||
sec = h->root.u.def.section;
|
||||
if (r_type == R_386_GOTPC
|
||||
@ -1052,7 +1059,7 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||
+ sec->output_section->vma
|
||||
+ sec->output_offset);
|
||||
}
|
||||
else if (h->root.type == bfd_link_hash_weak)
|
||||
else if (h->root.type == bfd_link_hash_undefweak)
|
||||
relocation = 0;
|
||||
else if (info->shared)
|
||||
relocation = 0;
|
||||
@ -1225,21 +1232,19 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||
|
||||
if (sreloc == NULL)
|
||||
{
|
||||
const char *name;
|
||||
|
||||
name = (elf_string_from_elf_section
|
||||
shared_name = (elf_string_from_elf_section
|
||||
(input_bfd,
|
||||
elf_elfheader (input_bfd)->e_shstrndx,
|
||||
elf_section_data (input_section)->rel_hdr.sh_name));
|
||||
if (name == NULL)
|
||||
if (shared_name == NULL)
|
||||
return false;
|
||||
|
||||
BFD_ASSERT (strncmp (name, ".rel", 4) == 0
|
||||
BFD_ASSERT (strncmp (shared_name, ".rel", 4) == 0
|
||||
&& strcmp (bfd_get_section_name (input_bfd,
|
||||
input_section),
|
||||
name + 4) == 0);
|
||||
shared_name + 4) == 0);
|
||||
|
||||
sreloc = bfd_get_section_by_name (dynobj, name);
|
||||
sreloc = bfd_get_section_by_name (dynobj, shared_name);
|
||||
BFD_ASSERT (sreloc != NULL);
|
||||
}
|
||||
|
||||
@ -1248,8 +1253,18 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||
+ input_section->output_offset);
|
||||
if (r_type == R_386_PC32)
|
||||
{
|
||||
BFD_ASSERT (h != NULL && h->dynindx != -1);
|
||||
outrel.r_info = ELF32_R_INFO (h->dynindx, R_386_PC32);
|
||||
if (!h)
|
||||
{
|
||||
if (! ((*info->callbacks->undefined_symbol)
|
||||
(info, shared_name ? shared_name : sec->name, input_bfd,
|
||||
input_section, rel->r_offset)))
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
BFD_ASSERT (h->dynindx != -1);
|
||||
outrel.r_info = ELF32_R_INFO (h->dynindx, R_386_PC32);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1450,7 +1465,8 @@ elf_i386_finish_dynamic_symbol (output_bfd, info, h, sym)
|
||||
/* This symbol needs a copy reloc. Set it up. */
|
||||
|
||||
BFD_ASSERT (h->dynindx != -1
|
||||
&& h->root.type == bfd_link_hash_defined);
|
||||
&& (h->root.type == bfd_link_hash_defined
|
||||
|| h->root.type == bfd_link_hash_defweak));
|
||||
|
||||
s = bfd_get_section_by_name (h->root.u.def.section->owner,
|
||||
".rel.bss");
|
||||
|
1697
bfd/elf32-m68k.c
Normal file
1697
bfd/elf32-m68k.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -102,7 +102,7 @@ static reloc_howto_type elf_sparc_howto_table[] =
|
||||
HOWTO(R_SPARC_13, 0,2,13,false,0,complain_overflow_bitfield,bfd_elf_generic_reloc,"R_SPARC_13", false,0,0x00001fff,true),
|
||||
HOWTO(R_SPARC_LO10, 0,2,10,false,0,complain_overflow_dont, bfd_elf_generic_reloc,"R_SPARC_LO10", false,0,0x000003ff,true),
|
||||
HOWTO(R_SPARC_GOT10, 0,2,10,false,0,complain_overflow_dont, bfd_elf_generic_reloc,"R_SPARC_GOT10", false,0,0x000003ff,true),
|
||||
HOWTO(R_SPARC_GOT13, 0,2,13,false,0,complain_overflow_bitfield,bfd_elf_generic_reloc,"R_SPARC_GOT13", false,0,0x00001fff,true),
|
||||
HOWTO(R_SPARC_GOT13, 0,2,13,false,0,complain_overflow_signed, bfd_elf_generic_reloc,"R_SPARC_GOT13", false,0,0x00001fff,true),
|
||||
HOWTO(R_SPARC_GOT22, 10,2,22,false,0,complain_overflow_dont, bfd_elf_generic_reloc,"R_SPARC_GOT22", false,0,0x003fffff,true),
|
||||
HOWTO(R_SPARC_PC10, 0,2,10,true, 0,complain_overflow_dont, bfd_elf_generic_reloc,"R_SPARC_PC10", false,0,0x000003ff,true),
|
||||
HOWTO(R_SPARC_PC22, 10,2,22,true, 0,complain_overflow_bitfield,bfd_elf_generic_reloc,"R_SPARC_PC22", false,0,0x003fffff,true),
|
||||
@ -573,21 +573,22 @@ elf32_sparc_adjust_dynamic_symbol (info, h)
|
||||
dynobj = elf_hash_table (info)->dynobj;
|
||||
|
||||
/* Make sure we know what is going on here. */
|
||||
BFD_ASSERT (dynobj != NULL
|
||||
&& ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT)
|
||||
|| ((h->elf_link_hash_flags
|
||||
& ELF_LINK_HASH_DEF_DYNAMIC) != 0
|
||||
&& (h->elf_link_hash_flags
|
||||
& ELF_LINK_HASH_REF_REGULAR) != 0
|
||||
&& (h->elf_link_hash_flags
|
||||
& ELF_LINK_HASH_DEF_REGULAR) == 0
|
||||
&& (h->root.type == bfd_link_hash_defined
|
||||
|| h->root.type == bfd_link_hash_defweak)
|
||||
&& (bfd_get_flavour (h->root.u.def.section->owner)
|
||||
== bfd_target_elf_flavour)
|
||||
&& (elf_elfheader (h->root.u.def.section->owner)->e_type
|
||||
== ET_DYN)
|
||||
&& h->root.u.def.section->output_section == NULL)));
|
||||
BFD_ASSERT (dynobj != NULL);
|
||||
BFD_ASSERT ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT)
|
||||
|| ((h->elf_link_hash_flags
|
||||
& ELF_LINK_HASH_DEF_DYNAMIC) != 0
|
||||
&& (h->elf_link_hash_flags
|
||||
& ELF_LINK_HASH_REF_REGULAR) != 0
|
||||
&& (h->elf_link_hash_flags
|
||||
& ELF_LINK_HASH_DEF_REGULAR) == 0
|
||||
&& (h->root.type == bfd_link_hash_defined
|
||||
|| h->root.type == bfd_link_hash_defweak)
|
||||
&& (h->root.u.def.section->owner == NULL
|
||||
|| ((elf_elfheader (h->root.u.def.section->owner)->e_type
|
||||
== ET_DYN)
|
||||
&& (bfd_get_flavour (h->root.u.def.section->owner)
|
||||
== bfd_target_elf_flavour)
|
||||
&& h->root.u.def.section->output_section == NULL))));
|
||||
|
||||
/* If this is a function, put it in the procedure linkage table. We
|
||||
will fill in the contents of the procedure linkage table later
|
||||
|
Loading…
Reference in New Issue
Block a user