diff options
author | Jakub Jelinek <jakub@redhat.com> | 2002-01-15 12:52:15 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2002-01-15 12:52:15 +0000 |
commit | d3c456e9506b08668419af641c7b14be84ec73ac (patch) | |
tree | b952ee6248ac6bb1f2cbde9d72ef7ea589137a8c | |
parent | 8b8c5dbda54c48219d5e6dbba8ff9ab3594689c1 (diff) | |
download | gdb-d3c456e9506b08668419af641c7b14be84ec73ac.zip gdb-d3c456e9506b08668419af641c7b14be84ec73ac.tar.gz gdb-d3c456e9506b08668419af641c7b14be84ec73ac.tar.bz2 |
* 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.
-rw-r--r-- | bfd/ChangeLog | 11 | ||||
-rw-r--r-- | bfd/elf.c | 18 | ||||
-rw-r--r-- | bfd/elflink.h | 2 | ||||
-rw-r--r-- | bfd/libbfd-in.h | 2 | ||||
-rw-r--r-- | bfd/libbfd.h | 2 | ||||
-rw-r--r-- | bfd/merge.c | 9 |
6 files changed, 37 insertions, 7 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 080765c..677069f 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -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'. @@ -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; } diff --git a/bfd/elflink.h b/bfd/elflink.h index d465bcc..9a3bfd3 100644 --- a/bfd/elflink.h +++ b/bfd/elflink.h @@ -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, diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h index cc5be3f..ed417ca 100644 --- a/bfd/libbfd-in.h +++ b/bfd/libbfd-in.h @@ -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. */ diff --git a/bfd/libbfd.h b/bfd/libbfd.h index b9ad623..d055651 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -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. */ diff --git a/bfd/merge.c b/bfd/merge.c index d3586fe..7b06c10 100644 --- a/bfd/merge.c +++ b/bfd/merge.c @@ -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; + { + *secinfo->psecinfo = NULL; + if (remove_hook) + (*remove_hook) (abfd, secinfo->sec); + } else if (! record_section (sinfo, secinfo)) break; |