* 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 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'.
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 *));
return bfd_reloc_continue;
}
\f
+/* 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
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;
}
\f
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,
/* 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. */
/* 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. */
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;
/* Record the sections into the hash table. */
for (secinfo = sinfo->chain; secinfo; secinfo = secinfo->next)
if (secinfo->sec->flags & SEC_EXCLUDE)
- *secinfo->psecinfo = NULL;
+ {
+ *secinfo->psecinfo = NULL;
+ if (remove_hook)
+ (*remove_hook) (abfd, secinfo->sec);
+ }
else if (! record_section (sinfo, secinfo))
break;