* elflink.h (elf_link_input_bfd): Back out 2002-01-07 change.

* elf.c (merge_sections_remove_hook): New function.
	(_bfd_elf_merge_sections): Pass it as 3rd argument to
	_bfd_merge_sections.
	* libbfd-in.h (_bfd_merge_sections): Add 3rd argument.
	* libbfd.h: Rebuilt.
	* merge.c (_bfd_merge_sections): Add remove_hook argument.
	Call remove_hook if a SEC_EXCLUDE section is encountered.
This commit is contained in:
Jakub Jelinek 2002-01-15 12:52:15 +00:00
parent 8b8c5dbda5
commit d3c456e950
6 changed files with 37 additions and 7 deletions

View File

@ -1,3 +1,14 @@
2002-01-15 Jakub Jelinek <jakub@redhat.com>
* elflink.h (elf_link_input_bfd): Back out 2002-01-07 change.
* elf.c (merge_sections_remove_hook): New function.
(_bfd_elf_merge_sections): Pass it as 3rd argument to
_bfd_merge_sections.
* libbfd-in.h (_bfd_merge_sections): Add 3rd argument.
* libbfd.h: Rebuilt.
* merge.c (_bfd_merge_sections): Add remove_hook argument.
Call remove_hook if a SEC_EXCLUDE section is encountered.
2002-01-15 Nick Clifton <nickc@cambridge.redhat.com>
* elf32-xstormy16.c (xstormy16_reloc_map): Add new field 'table'.

View File

@ -53,6 +53,7 @@ static boolean swap_out_syms PARAMS ((bfd *, struct bfd_strtab_hash **, int));
static boolean copy_private_bfd_data PARAMS ((bfd *, bfd *));
static char *elf_read PARAMS ((bfd *, file_ptr, bfd_size_type));
static boolean setup_group PARAMS ((bfd *, Elf_Internal_Shdr *, asection *));
static void merge_sections_remove_hook PARAMS ((bfd *, asection *));
static void elf_fake_sections PARAMS ((bfd *, asection *, PTR));
static void set_group_contents PARAMS ((bfd *, asection *, PTR));
static boolean assign_section_numbers PARAMS ((bfd *));
@ -770,6 +771,20 @@ bfd_elf_generic_reloc (abfd,
return bfd_reloc_continue;
}
/* Make sure sec_info_type is cleared if sec_info is cleared too. */
static void
merge_sections_remove_hook (abfd, sec)
bfd *abfd ATTRIBUTE_UNUSED;
asection *sec;
{
struct bfd_elf_section_data *sec_data;
sec_data = elf_section_data (sec);
BFD_ASSERT (sec_data->sec_info_type == ELF_INFO_TYPE_MERGE);
sec_data->sec_info_type = ELF_INFO_TYPE_NONE;
}
/* Finish SHF_MERGE section merging. */
boolean
@ -780,7 +795,8 @@ _bfd_elf_merge_sections (abfd, info)
if (!is_elf_hash_table (info))
return false;
if (elf_hash_table (info)->merge_info)
_bfd_merge_sections (abfd, elf_hash_table (info)->merge_info);
_bfd_merge_sections (abfd, elf_hash_table (info)->merge_info,
merge_sections_remove_hook);
return true;
}

View File

@ -6375,8 +6375,6 @@ elf_link_input_bfd (finfo, input_bfd)
isec = section_from_elf_index (input_bfd, isym->st_shndx);
if (isec
&& elf_section_data (isec)->sec_info_type == ELF_INFO_TYPE_MERGE
&& (finfo->info->relocateable
|| ! (isec->flags & SEC_EXCLUDE))
&& ELF_ST_TYPE (isym->st_info) != STT_SECTION)
isym->st_value =
_bfd_merged_section_offset (output_bfd, &isec,

View File

@ -478,7 +478,7 @@ extern boolean _bfd_merge_section
/* Attempt to merge SEC_MERGE sections. */
extern boolean _bfd_merge_sections
PARAMS ((bfd *, PTR));
PARAMS ((bfd *, PTR, void (*)(bfd *, asection *)));
/* Write out a merged section. */

View File

@ -483,7 +483,7 @@ extern boolean _bfd_merge_section
/* Attempt to merge SEC_MERGE sections. */
extern boolean _bfd_merge_sections
PARAMS ((bfd *, PTR));
PARAMS ((bfd *, PTR, void (*)(bfd *, asection *)));
/* Write out a merged section. */

View File

@ -771,9 +771,10 @@ alloc_failure:
with _bfd_merge_section. */
boolean
_bfd_merge_sections (abfd, xsinfo)
_bfd_merge_sections (abfd, xsinfo, remove_hook)
bfd *abfd ATTRIBUTE_UNUSED;
PTR xsinfo;
void (*remove_hook) PARAMS((bfd *, asection *));
{
struct sec_merge_info *sinfo;
@ -792,7 +793,11 @@ _bfd_merge_sections (abfd, xsinfo)
/* Record the sections into the hash table. */
for (secinfo = sinfo->chain; secinfo; secinfo = secinfo->next)
if (secinfo->sec->flags & SEC_EXCLUDE)
{
*secinfo->psecinfo = NULL;
if (remove_hook)
(*remove_hook) (abfd, secinfo->sec);
}
else if (! record_section (sinfo, secinfo))
break;