== get_elf_backend_data (obfd)->s->elfclass))
for (sec = ibfd->sections; sec != NULL; sec = sec->next)
if ((sec->flags & SEC_MERGE) != 0
- && !bfd_is_abs_section (sec->output_section))
- {
- if (! _bfd_add_merge_section (obfd,
- &info->hash->merge_info,
- sec, &sec->sec_info))
+ && !bfd_is_abs_section (sec->output_section)
+ && !_bfd_add_merge_section (obfd,
+ &info->hash->merge_info,
+ sec))
return false;
- else if (sec->sec_info)
- sec->sec_info_type = SEC_INFO_TYPE_MERGE;
- }
if (info->hash->merge_info != NULL)
return _bfd_merge_sections (obfd, info, info->hash->merge_info,
return false;
break;
case SEC_INFO_TYPE_MERGE:
- if (! _bfd_write_merged_section (output_bfd, o, o->sec_info))
+ if (! _bfd_write_merged_section (output_bfd, o))
return false;
break;
case SEC_INFO_TYPE_EH_FRAME:
/* Register a SEC_MERGE section as a candidate for merging. */
extern bool _bfd_add_merge_section
- (bfd *, void **, asection *, void **) ATTRIBUTE_HIDDEN;
+ (bfd *, void **, asection *) ATTRIBUTE_HIDDEN;
/* Attempt to merge SEC_MERGE sections. */
/* Write out a merged section. */
extern bool _bfd_write_merged_section
- (bfd *, asection *, void *) ATTRIBUTE_HIDDEN;
+ (bfd *, asection *) ATTRIBUTE_HIDDEN;
/* Find an offset within a modified SEC_MERGE section. */
/* Register a SEC_MERGE section as a candidate for merging. */
extern bool _bfd_add_merge_section
- (bfd *, void **, asection *, void **) ATTRIBUTE_HIDDEN;
+ (bfd *, void **, asection *) ATTRIBUTE_HIDDEN;
/* Attempt to merge SEC_MERGE sections. */
/* Write out a merged section. */
extern bool _bfd_write_merged_section
- (bfd *, asection *, void *) ATTRIBUTE_HIDDEN;
+ (bfd *, asection *) ATTRIBUTE_HIDDEN;
/* Find an offset within a modified SEC_MERGE section. */
struct sec_merge_sec_info *next;
/* The corresponding section. */
asection *sec;
- /* Pointer to merge_info pointing to us. */
- void **psecinfo;
/* The merge entity this is a part of. */
struct sec_merge_info *sinfo;
/* The section associated with sinfo (i.e. the representative section).
This function is called for all non-dynamic SEC_MERGE input sections. */
bool
-_bfd_add_merge_section (bfd *abfd, void **psinfo, asection *sec,
- void **psecinfo)
+_bfd_add_merge_section (bfd *abfd, void **psinfo, asection *sec)
{
struct sec_merge_info *sinfo;
struct sec_merge_sec_info *secinfo;
/* Initialize the descriptor for this input section. */
- *psecinfo = secinfo = bfd_zalloc (abfd, sizeof (*secinfo));
- if (*psecinfo == NULL)
+ sec->sec_info = secinfo = bfd_zalloc (abfd, sizeof (*secinfo));
+ if (sec->sec_info == NULL)
goto error_return;
secinfo->sec = sec;
- secinfo->psecinfo = psecinfo;
/* Search for a matching output merged section. */
for (sinfo = (struct sec_merge_info *) *psinfo; sinfo; sinfo = sinfo->next)
secinfo->sinfo = sinfo;
secinfo->reprsec = sinfo->chain->sec;
+ sec->sec_info_type = SEC_INFO_TYPE_MERGE;
+
return true;
error_return:
- *psecinfo = NULL;
+ sec->sec_info = NULL;
return false;
}
if (secinfo->sec->flags & SEC_EXCLUDE
|| !record_section (sinfo, secinfo))
{
- *secinfo->psecinfo = NULL;
+ secinfo->sec->sec_info = NULL;
if (remove_hook)
(*remove_hook) (abfd, secinfo->sec);
}
/* Write out the merged section. */
bool
-_bfd_write_merged_section (bfd *output_bfd, asection *sec, void *psecinfo)
+_bfd_write_merged_section (bfd *output_bfd, asection *sec)
{
- struct sec_merge_sec_info *secinfo;
+ struct sec_merge_sec_info *secinfo = sec->sec_info;
file_ptr pos;
unsigned char *contents;
Elf_Internal_Shdr *hdr;
- secinfo = (struct sec_merge_sec_info *) psecinfo;
-
if (!secinfo)
return false;