* ld-mn10300/mn10300.exp: Fix the start address of the .bss section for the i1127740.s test.
* elf-m10300.c (mn10300_elf_check_relocs): Fix memory leak and check that bfd_elf_get_elf_syms is only called once.
This commit is contained in:
parent
124dfc8994
commit
62d7f7907a
@ -1,3 +1,8 @@
|
|||||||
|
2007-11-16 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
|
* elf-m10300.c (mn10300_elf_check_relocs): Fix memory leak and
|
||||||
|
check that bfd_elf_get_elf_syms is only called once.
|
||||||
|
|
||||||
2007-11-16 Ulrich Weigand <uweigand@de.ibm.com>
|
2007-11-16 Ulrich Weigand <uweigand@de.ibm.com>
|
||||||
|
|
||||||
* elf64-ppc.c (ppc64_elf_get_synthetic_symtab): Set udata.p of
|
* elf64-ppc.c (ppc64_elf_get_synthetic_symtab): Set udata.p of
|
||||||
|
@ -661,6 +661,7 @@ mn10300_elf_check_relocs (bfd *abfd,
|
|||||||
{
|
{
|
||||||
bfd_boolean sym_diff_reloc_seen;
|
bfd_boolean sym_diff_reloc_seen;
|
||||||
Elf_Internal_Shdr *symtab_hdr;
|
Elf_Internal_Shdr *symtab_hdr;
|
||||||
|
Elf_Internal_Sym * isymbuf = NULL;
|
||||||
struct elf_link_hash_entry **sym_hashes;
|
struct elf_link_hash_entry **sym_hashes;
|
||||||
const Elf_Internal_Rela *rel;
|
const Elf_Internal_Rela *rel;
|
||||||
const Elf_Internal_Rela *rel_end;
|
const Elf_Internal_Rela *rel_end;
|
||||||
@ -669,6 +670,7 @@ mn10300_elf_check_relocs (bfd *abfd,
|
|||||||
asection * sgot;
|
asection * sgot;
|
||||||
asection * srelgot;
|
asection * srelgot;
|
||||||
asection * sreloc;
|
asection * sreloc;
|
||||||
|
bfd_boolean result = FALSE;
|
||||||
|
|
||||||
sgot = NULL;
|
sgot = NULL;
|
||||||
srelgot = NULL;
|
srelgot = NULL;
|
||||||
@ -678,6 +680,7 @@ mn10300_elf_check_relocs (bfd *abfd,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
|
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
|
||||||
|
isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents;
|
||||||
sym_hashes = elf_sym_hashes (abfd);
|
sym_hashes = elf_sym_hashes (abfd);
|
||||||
|
|
||||||
dynobj = elf_hash_table (info)->dynobj;
|
dynobj = elf_hash_table (info)->dynobj;
|
||||||
@ -689,6 +692,7 @@ mn10300_elf_check_relocs (bfd *abfd,
|
|||||||
{
|
{
|
||||||
struct elf_link_hash_entry *h;
|
struct elf_link_hash_entry *h;
|
||||||
unsigned long r_symndx;
|
unsigned long r_symndx;
|
||||||
|
unsigned int r_type;
|
||||||
|
|
||||||
r_symndx = ELF32_R_SYM (rel->r_info);
|
r_symndx = ELF32_R_SYM (rel->r_info);
|
||||||
if (r_symndx < symtab_hdr->sh_info)
|
if (r_symndx < symtab_hdr->sh_info)
|
||||||
@ -701,10 +705,12 @@ mn10300_elf_check_relocs (bfd *abfd,
|
|||||||
h = (struct elf_link_hash_entry *) h->root.u.i.link;
|
h = (struct elf_link_hash_entry *) h->root.u.i.link;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
r_type = ELF32_R_TYPE (rel->r_info);
|
||||||
|
|
||||||
/* Some relocs require a global offset table. */
|
/* Some relocs require a global offset table. */
|
||||||
if (dynobj == NULL)
|
if (dynobj == NULL)
|
||||||
{
|
{
|
||||||
switch (ELF32_R_TYPE (rel->r_info))
|
switch (r_type)
|
||||||
{
|
{
|
||||||
case R_MN10300_GOT32:
|
case R_MN10300_GOT32:
|
||||||
case R_MN10300_GOT24:
|
case R_MN10300_GOT24:
|
||||||
@ -716,7 +722,7 @@ mn10300_elf_check_relocs (bfd *abfd,
|
|||||||
case R_MN10300_GOTPC16:
|
case R_MN10300_GOTPC16:
|
||||||
elf_hash_table (info)->dynobj = dynobj = abfd;
|
elf_hash_table (info)->dynobj = dynobj = abfd;
|
||||||
if (! _bfd_mn10300_elf_create_got_section (dynobj, info))
|
if (! _bfd_mn10300_elf_create_got_section (dynobj, info))
|
||||||
return FALSE;
|
goto fail;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -724,13 +730,13 @@ mn10300_elf_check_relocs (bfd *abfd,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (ELF32_R_TYPE (rel->r_info))
|
switch (r_type)
|
||||||
{
|
{
|
||||||
/* This relocation describes the C++ object vtable hierarchy.
|
/* This relocation describes the C++ object vtable hierarchy.
|
||||||
Reconstruct it for later use during GC. */
|
Reconstruct it for later use during GC. */
|
||||||
case R_MN10300_GNU_VTINHERIT:
|
case R_MN10300_GNU_VTINHERIT:
|
||||||
if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
|
if (!bfd_elf_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
|
||||||
return FALSE;
|
goto fail;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* This relocation describes which C++ vtable entries are actually
|
/* This relocation describes which C++ vtable entries are actually
|
||||||
@ -739,8 +745,9 @@ mn10300_elf_check_relocs (bfd *abfd,
|
|||||||
BFD_ASSERT (h != NULL);
|
BFD_ASSERT (h != NULL);
|
||||||
if (h != NULL
|
if (h != NULL
|
||||||
&& !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend))
|
&& !bfd_elf_gc_record_vtentry (abfd, sec, h, rel->r_addend))
|
||||||
return FALSE;
|
goto fail;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case R_MN10300_GOT32:
|
case R_MN10300_GOT32:
|
||||||
case R_MN10300_GOT24:
|
case R_MN10300_GOT24:
|
||||||
case R_MN10300_GOT16:
|
case R_MN10300_GOT16:
|
||||||
@ -768,7 +775,7 @@ mn10300_elf_check_relocs (bfd *abfd,
|
|||||||
| SEC_READONLY));
|
| SEC_READONLY));
|
||||||
if (srelgot == NULL
|
if (srelgot == NULL
|
||||||
|| ! bfd_set_section_alignment (dynobj, srelgot, 2))
|
|| ! bfd_set_section_alignment (dynobj, srelgot, 2))
|
||||||
return FALSE;
|
goto fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -784,7 +791,7 @@ mn10300_elf_check_relocs (bfd *abfd,
|
|||||||
if (h->dynindx == -1)
|
if (h->dynindx == -1)
|
||||||
{
|
{
|
||||||
if (! bfd_elf_link_record_dynamic_symbol (info, h))
|
if (! bfd_elf_link_record_dynamic_symbol (info, h))
|
||||||
return FALSE;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
srelgot->size += sizeof (Elf32_External_Rela);
|
srelgot->size += sizeof (Elf32_External_Rela);
|
||||||
@ -802,7 +809,8 @@ mn10300_elf_check_relocs (bfd *abfd,
|
|||||||
local_got_offsets = bfd_alloc (abfd, size);
|
local_got_offsets = bfd_alloc (abfd, size);
|
||||||
|
|
||||||
if (local_got_offsets == NULL)
|
if (local_got_offsets == NULL)
|
||||||
return FALSE;
|
goto fail;
|
||||||
|
|
||||||
elf_local_got_offsets (abfd) = local_got_offsets;
|
elf_local_got_offsets (abfd) = local_got_offsets;
|
||||||
|
|
||||||
for (i = 0; i < symtab_hdr->sh_info; i++)
|
for (i = 0; i < symtab_hdr->sh_info; i++)
|
||||||
@ -878,10 +886,8 @@ mn10300_elf_check_relocs (bfd *abfd,
|
|||||||
symbol involved in the relocation. */
|
symbol involved in the relocation. */
|
||||||
if (h == NULL)
|
if (h == NULL)
|
||||||
{
|
{
|
||||||
Elf_Internal_Sym * isymbuf;
|
|
||||||
Elf_Internal_Sym * isym;
|
Elf_Internal_Sym * isym;
|
||||||
|
|
||||||
isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents;
|
|
||||||
if (isymbuf == NULL)
|
if (isymbuf == NULL)
|
||||||
isymbuf = bfd_elf_get_elf_syms (abfd, symtab_hdr,
|
isymbuf = bfd_elf_get_elf_syms (abfd, symtab_hdr,
|
||||||
symtab_hdr->sh_info, 0,
|
symtab_hdr->sh_info, 0,
|
||||||
@ -918,7 +924,7 @@ mn10300_elf_check_relocs (bfd *abfd,
|
|||||||
elf_elfheader (abfd)->e_shstrndx,
|
elf_elfheader (abfd)->e_shstrndx,
|
||||||
elf_section_data (sec)->rel_hdr.sh_name));
|
elf_section_data (sec)->rel_hdr.sh_name));
|
||||||
if (name == NULL)
|
if (name == NULL)
|
||||||
return FALSE;
|
goto fail;
|
||||||
|
|
||||||
BFD_ASSERT (CONST_STRNEQ (name, ".rela")
|
BFD_ASSERT (CONST_STRNEQ (name, ".rela")
|
||||||
&& streq (bfd_get_section_name (abfd, sec), name + 5));
|
&& streq (bfd_get_section_name (abfd, sec), name + 5));
|
||||||
@ -935,7 +941,7 @@ mn10300_elf_check_relocs (bfd *abfd,
|
|||||||
sreloc = bfd_make_section_with_flags (dynobj, name, flags);
|
sreloc = bfd_make_section_with_flags (dynobj, name, flags);
|
||||||
if (sreloc == NULL
|
if (sreloc == NULL
|
||||||
|| ! bfd_set_section_alignment (dynobj, sreloc, 2))
|
|| ! bfd_set_section_alignment (dynobj, sreloc, 2))
|
||||||
return FALSE;
|
goto fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -950,7 +956,12 @@ mn10300_elf_check_relocs (bfd *abfd,
|
|||||||
sym_diff_reloc_seen = FALSE;
|
sym_diff_reloc_seen = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
result = TRUE;
|
||||||
|
fail:
|
||||||
|
if (isymbuf != NULL)
|
||||||
|
free (isymbuf);
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the section that should be marked against GC for a given
|
/* Return the section that should be marked against GC for a given
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2007-11-16 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
|
* ld-mn10300/mn10300.exp: Fix the start address of the .bss
|
||||||
|
section for the i1127740.s test.
|
||||||
|
|
||||||
2007-11-14 Richard Sandiford <richard@codesourcery.com>
|
2007-11-14 Richard Sandiford <richard@codesourcery.com>
|
||||||
Joseph Myers <joseph@codesourcery.com>
|
Joseph Myers <joseph@codesourcery.com>
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ set mn10300_tests {
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
"relaxation and alignment directives"
|
"relaxation and alignment directives"
|
||||||
"-relax -Ttext 100"
|
"-relax -Ttext 100 -Tbss 300"
|
||||||
""
|
""
|
||||||
{ "i127740.s" }
|
{ "i127740.s" }
|
||||||
{ {objdump -d i127740.d} }
|
{ {objdump -d i127740.d} }
|
||||||
|
Loading…
Reference in New Issue
Block a user