mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-29 08:24:05 +08:00
* elf64-alpha.c (elf64_alpha_relax_section): Ignore non-allocated
sections. (elf64_alpha_check_relocs): Likewise. (elf64_alpha_relocate_section): Don't emit dynamic relocations to non-allocated sections.
This commit is contained in:
@ -1,3 +1,11 @@
|
|||||||
|
2005-05-22 Richard Henderson <rth@redhat.com>
|
||||||
|
|
||||||
|
* elf64-alpha.c (elf64_alpha_relax_section): Ignore non-allocated
|
||||||
|
sections.
|
||||||
|
(elf64_alpha_check_relocs): Likewise.
|
||||||
|
(elf64_alpha_relocate_section): Don't emit dynamic relocations to
|
||||||
|
non-allocated sections.
|
||||||
|
|
||||||
2005-05-22 Richard Henderson <rth@redhat.com>
|
2005-05-22 Richard Henderson <rth@redhat.com>
|
||||||
|
|
||||||
* elf64-alpha.c (elf64_alpha_relax_with_lituse): Relax jsr to
|
* elf64-alpha.c (elf64_alpha_relax_with_lituse): Relax jsr to
|
||||||
|
@ -1993,7 +1993,8 @@ elf64_alpha_relax_section (abfd, sec, link_info, again)
|
|||||||
*again = FALSE;
|
*again = FALSE;
|
||||||
|
|
||||||
if (link_info->relocatable
|
if (link_info->relocatable
|
||||||
|| (sec->flags & (SEC_CODE | SEC_RELOC)) != (SEC_CODE | SEC_RELOC)
|
|| ((sec->flags & (SEC_CODE | SEC_RELOC | SEC_ALLOC))
|
||||||
|
!= (SEC_CODE | SEC_RELOC | SEC_ALLOC))
|
||||||
|| sec->reloc_count == 0)
|
|| sec->reloc_count == 0)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
@ -2988,6 +2989,15 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
|
|||||||
if (info->relocatable)
|
if (info->relocatable)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
/* Don't do anything special with non-loaded, non-alloced sections.
|
||||||
|
In particular, any relocs in such sections should not affect GOT
|
||||||
|
and PLT reference counting (ie. we don't allow them to create GOT
|
||||||
|
or PLT entries), there's no possibility or desire to optimize TLS
|
||||||
|
relocs, and there's not much point in propagating relocs to shared
|
||||||
|
libs that the dynamic linker won't relocate. */
|
||||||
|
if ((sec->flags & SEC_ALLOC) == 0)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
dynobj = elf_hash_table(info)->dynobj;
|
dynobj = elf_hash_table(info)->dynobj;
|
||||||
if (dynobj == NULL)
|
if (dynobj == NULL)
|
||||||
elf_hash_table(info)->dynobj = dynobj = abfd;
|
elf_hash_table(info)->dynobj = dynobj = abfd;
|
||||||
@ -3073,7 +3083,7 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
|
|||||||
|
|
||||||
case R_ALPHA_REFLONG:
|
case R_ALPHA_REFLONG:
|
||||||
case R_ALPHA_REFQUAD:
|
case R_ALPHA_REFQUAD:
|
||||||
if ((info->shared && (sec->flags & SEC_ALLOC)) || maybe_dynamic)
|
if (info->shared || maybe_dynamic)
|
||||||
need = NEED_DYNREL;
|
need = NEED_DYNREL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -3211,8 +3221,7 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
|
|||||||
rent->srel = sreloc;
|
rent->srel = sreloc;
|
||||||
rent->rtype = r_type;
|
rent->rtype = r_type;
|
||||||
rent->count = 1;
|
rent->count = 1;
|
||||||
rent->reltext = ((sec->flags & (SEC_READONLY | SEC_ALLOC))
|
rent->reltext = (sec->flags & SEC_READONLY) != 0;
|
||||||
== (SEC_READONLY | SEC_ALLOC));
|
|
||||||
|
|
||||||
rent->next = h->reloc_entries;
|
rent->next = h->reloc_entries;
|
||||||
h->reloc_entries = rent;
|
h->reloc_entries = rent;
|
||||||
@ -3225,8 +3234,7 @@ elf64_alpha_check_relocs (abfd, info, sec, relocs)
|
|||||||
/* If this is a shared library, and the section is to be
|
/* If this is a shared library, and the section is to be
|
||||||
loaded into memory, we need a RELATIVE reloc. */
|
loaded into memory, we need a RELATIVE reloc. */
|
||||||
sreloc->size += sizeof (Elf64_External_Rela);
|
sreloc->size += sizeof (Elf64_External_Rela);
|
||||||
if ((sec->flags & (SEC_READONLY | SEC_ALLOC))
|
if (sec->flags & SEC_READONLY)
|
||||||
== (SEC_READONLY | SEC_ALLOC))
|
|
||||||
info->flags |= DF_TEXTREL;
|
info->flags |= DF_TEXTREL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4265,7 +4273,6 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
|
|||||||
bfd_vma gp, tp_base, dtp_base;
|
bfd_vma gp, tp_base, dtp_base;
|
||||||
struct alpha_elf_got_entry **local_got_entries;
|
struct alpha_elf_got_entry **local_got_entries;
|
||||||
bfd_boolean ret_val;
|
bfd_boolean ret_val;
|
||||||
const char *section_name;
|
|
||||||
|
|
||||||
/* Handle relocatable links with a smaller loop. */
|
/* Handle relocatable links with a smaller loop. */
|
||||||
if (info->relocatable)
|
if (info->relocatable)
|
||||||
@ -4285,11 +4292,17 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
|
|||||||
else
|
else
|
||||||
srelgot = NULL;
|
srelgot = NULL;
|
||||||
|
|
||||||
section_name = (bfd_elf_string_from_elf_section
|
if (input_section->flags & SEC_ALLOC)
|
||||||
(input_bfd, elf_elfheader(input_bfd)->e_shstrndx,
|
{
|
||||||
elf_section_data(input_section)->rel_hdr.sh_name));
|
const char *section_name;
|
||||||
BFD_ASSERT(section_name != NULL);
|
section_name = (bfd_elf_string_from_elf_section
|
||||||
srel = bfd_get_section_by_name (dynobj, section_name);
|
(input_bfd, elf_elfheader(input_bfd)->e_shstrndx,
|
||||||
|
elf_section_data(input_section)->rel_hdr.sh_name));
|
||||||
|
BFD_ASSERT(section_name != NULL);
|
||||||
|
srel = bfd_get_section_by_name (dynobj, section_name);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
srel = NULL;
|
||||||
|
|
||||||
/* Find the gp value for this input bfd. */
|
/* Find the gp value for this input bfd. */
|
||||||
gotobj = alpha_elf_tdata (input_bfd)->gotobj;
|
gotobj = alpha_elf_tdata (input_bfd)->gotobj;
|
||||||
@ -4673,9 +4686,10 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
|
|||||||
else
|
else
|
||||||
goto default_reloc;
|
goto default_reloc;
|
||||||
|
|
||||||
elf64_alpha_emit_dynrel (output_bfd, info, input_section,
|
if (input_section->flags & SEC_ALLOC)
|
||||||
srel, rel->r_offset, dynindx,
|
elf64_alpha_emit_dynrel (output_bfd, info, input_section,
|
||||||
dyntype, dynaddend);
|
srel, rel->r_offset, dynindx,
|
||||||
|
dyntype, dynaddend);
|
||||||
}
|
}
|
||||||
goto default_reloc;
|
goto default_reloc;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user