From eb92a17c47ea497e3e1e11c33a290860a8b1f6a2 Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Fri, 24 Oct 2025 15:09:11 +0200 Subject: [PATCH] bfd: move sec_info from ELF to general section struct This is in preparation of supporting section merging also when the output isn't ELF (or not of the same class). Note that it's also more consistent this way, as the related sec_info_type field also live in the same struct. --- bfd/bfd-in2.h | 4 ++++ bfd/elf-bfd.h | 3 --- bfd/elf-eh-frame.c | 25 ++++++++++++------------- bfd/elf-m10300.c | 2 +- bfd/elf-sframe.c | 8 ++++---- bfd/elf.c | 22 +++++++++------------- bfd/elf32-nds32.c | 13 ++++++------- bfd/elf32-ppc.c | 13 ++++++------- bfd/elf32-rl78.c | 3 +-- bfd/elf32-rx.c | 2 +- bfd/elf64-alpha.c | 3 +-- bfd/elf64-ia64-vms.c | 3 +-- bfd/elflink.c | 28 ++++++++++------------------ bfd/elfnn-ia64.c | 6 ++---- bfd/elfnn-loongarch.c | 4 ++-- bfd/elfnn-riscv.c | 3 +-- bfd/elfxx-mips.c | 7 ++----- bfd/libbfd.h | 4 ++-- bfd/section.c | 8 ++++++-- 19 files changed, 71 insertions(+), 90 deletions(-) diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 5e7c6ddf1ee..ad6077f093a 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -839,6 +839,10 @@ typedef struct bfd_section regions is enabled. */ struct bfd_section *already_assigned; + /* A pointer used for various section optimizations. .sec_info_type + qualifies which one it is. */ + void *sec_info; + /* Explicitly specified section type, if non-zero. */ unsigned int type; diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index 48e877f8a11..4ed71095ea6 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -1893,9 +1893,6 @@ struct bfd_elf_section_data FIXME: In the future it might be better to change this into a list of secondary reloc sections, making lookup easier and faster. */ bool has_secondary_relocs; - - /* A pointer used for various section optimizations. */ - void *sec_info; }; #define elf_section_data(sec) ((struct bfd_elf_section_data*)(sec)->used_by_bfd) diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c index 62cba84f458..5ba8c9c1262 100644 --- a/bfd/elf-eh-frame.c +++ b/bfd/elf-eh-frame.c @@ -566,7 +566,7 @@ _bfd_elf_parse_eh_frame_entry (struct bfd_link_info *info, sec->flags |= SEC_EXCLUDE; sec->sec_info_type = SEC_INFO_TYPE_EH_FRAME_ENTRY; - elf_section_data (sec)->sec_info = text_sec; + sec->sec_info = text_sec; bfd_elf_record_eh_frame_entry (hdr_info, sec); return true; } @@ -1046,7 +1046,7 @@ _bfd_elf_parse_eh_frame (bfd *abfd, struct bfd_link_info *info, BFD_ASSERT (sec_info->count == num_entries); BFD_ASSERT (cie_count == num_cies); - elf_section_data (sec)->sec_info = sec_info; + sec->sec_info = sec_info; sec->sec_info_type = SEC_INFO_TYPE_EH_FRAME; if (!bfd_link_relocatable (info)) { @@ -1078,10 +1078,10 @@ cmp_eh_frame_hdr (const void *a, const void *b) asection *sec; sec = *(asection *const *)a; - sec = (asection *) elf_section_data (sec)->sec_info; + sec = sec->sec_info; text_a = sec->output_section->vma + sec->output_offset; sec = *(asection *const *)b; - sec = (asection *) elf_section_data (sec)->sec_info; + sec = sec->sec_info; text_b = sec->output_section->vma + sec->output_offset; if (text_a < text_b) @@ -1105,10 +1105,10 @@ add_eh_frame_hdr_terminator (asection *sec, { /* See if there is a gap (presumably a text section without unwind info) between these two entries. */ - text_sec = (asection *) elf_section_data (sec)->sec_info; + text_sec = sec->sec_info; end = text_sec->output_section->vma + text_sec->output_offset + text_sec->size; - text_sec = (asection *) elf_section_data (next)->sec_info; + text_sec = next->sec_info; next_start = text_sec->output_section->vma + text_sec->output_offset; if (end == next_start) return; @@ -1343,8 +1343,7 @@ find_merged_cie (bfd *abfd, struct bfd_link_info *info, asection *sec, static bfd_signed_vma offset_adjust (bfd_vma offset, const asection *sec) { - struct eh_frame_sec_info *sec_info - = (struct eh_frame_sec_info *) elf_section_data (sec)->sec_info; + struct eh_frame_sec_info *sec_info = sec->sec_info; unsigned int lo, hi, mid; struct eh_cie_fde *ent = NULL; bfd_signed_vma delta; @@ -1436,7 +1435,7 @@ _bfd_elf_adjust_eh_frame_global_symbol (struct elf_link_hash_entry *h, sym_sec = h->root.u.def.section; if (sym_sec->sec_info_type != SEC_INFO_TYPE_EH_FRAME - || elf_section_data (sym_sec)->sec_info == NULL) + || sym_sec->sec_info == NULL) return true; delta = offset_adjust (h->root.u.def.value, sym_sec); @@ -1496,7 +1495,7 @@ _bfd_elf_discard_section_eh_frame if (sec->sec_info_type != SEC_INFO_TYPE_EH_FRAME) return false; - sec_info = (struct eh_frame_sec_info *) elf_section_data (sec)->sec_info; + sec_info = sec->sec_info; if (sec_info == NULL) return false; @@ -1771,7 +1770,7 @@ _bfd_elf_eh_frame_section_offset (bfd *output_bfd ATTRIBUTE_UNUSED, if (sec->sec_info_type != SEC_INFO_TYPE_EH_FRAME) return offset; - sec_info = (struct eh_frame_sec_info *) elf_section_data (sec)->sec_info; + sec_info = sec->sec_info; if (offset >= sec->rawsize) return offset - sec->rawsize + sec->size; @@ -1854,7 +1853,7 @@ _bfd_elf_write_section_eh_frame_entry (bfd *abfd, struct bfd_link_info *info, bfd_vma addr; bfd_vma last_addr; bfd_vma offset; - asection *text_sec = (asection *) elf_section_data (sec)->sec_info; + asection *text_sec = sec->sec_info; if (!sec->rawsize) sec->rawsize = sec->size; @@ -1946,7 +1945,7 @@ _bfd_elf_write_section_eh_frame (bfd *abfd, ->elf_backend_eh_frame_address_size (abfd, sec)); BFD_ASSERT (ptr_size != 0); - sec_info = (struct eh_frame_sec_info *) elf_section_data (sec)->sec_info; + sec_info = sec->sec_info; htab = elf_hash_table (info); hdr_info = &htab->eh_info; diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c index b381bb9037c..86b91822a32 100644 --- a/bfd/elf-m10300.c +++ b/bfd/elf-m10300.c @@ -3393,7 +3393,7 @@ mn10300_elf_relax_section (bfd *abfd, symval += irel->r_addend; symval = _bfd_merged_section_offset (abfd, & sym_sec, - elf_section_data (sym_sec)->sec_info, + sym_sec->sec_info, symval); if (ELF_ST_TYPE (isym->st_info) != STT_SECTION) diff --git a/bfd/elf-sframe.c b/bfd/elf-sframe.c index 2cb732c3016..8e4cfdd73d3 100644 --- a/bfd/elf-sframe.c +++ b/bfd/elf-sframe.c @@ -249,7 +249,7 @@ _bfd_elf_parse_sframe (bfd *abfd, goto fail_no_free; } - elf_section_data (sec)->sec_info = sfd_info; + sec->sec_info = sfd_info; sec->sec_info_type = SEC_INFO_TYPE_SFRAME; goto success; @@ -288,7 +288,7 @@ _bfd_elf_discard_section_sframe .rela.sframe get updated ?. */ keep = false; - sfd_info = (struct sframe_dec_info *) elf_section_data (sec)->sec_info; + sfd_info = sec->sec_info; /* Skip checking for the linker created .sframe sections (for PLT sections). */ @@ -360,7 +360,7 @@ _bfd_elf_merge_section_sframe (bfd *abfd, if (sec->sec_info_type != SEC_INFO_TYPE_SFRAME) return false; - sfd_info = (struct sframe_dec_info *) elf_section_data (sec)->sec_info; + sfd_info = sec->sec_info; sfd_ctx = sfd_info->sfd_ctx; htab = elf_hash_table (info); @@ -600,7 +600,7 @@ _bfd_elf_sframe_section_offset (bfd *output_bfd ATTRIBUTE_UNUSED, if (sec->sec_info_type != SEC_INFO_TYPE_SFRAME) return offset; - sfd_info = elf_section_data (sec)->sec_info; + sfd_info = sec->sec_info; sfd_ctx = sfd_info->sfd_ctx; sfd_num_fdes = sframe_decoder_get_num_fidx (sfd_ctx); diff --git a/bfd/elf.c b/bfd/elf.c index bde7414ee21..9ad2cf8e216 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -10234,8 +10234,7 @@ _bfd_elf_free_cached_info (bfd *abfd) elf_section_data (sec)->relocs = NULL; if (sec->sec_info_type == SEC_INFO_TYPE_EH_FRAME) { - struct eh_frame_sec_info *sec_info - = elf_section_data (sec)->sec_info; + struct eh_frame_sec_info *sec_info = sec->sec_info; free (sec_info->cies); } } @@ -13260,8 +13259,7 @@ _bfd_elf_rela_local_sym (bfd *abfd, && sec->sec_info_type == SEC_INFO_TYPE_MERGE) { rel->r_addend = - _bfd_merged_section_offset (abfd, psec, - elf_section_data (sec)->sec_info, + _bfd_merged_section_offset (abfd, psec, sec->sec_info, sym->st_value + rel->r_addend); if (sec != *psec) { @@ -13291,8 +13289,7 @@ _bfd_elf_rel_local_sym (bfd *abfd, if (sec->sec_info_type != SEC_INFO_TYPE_MERGE) return sym->st_value + addend; - return _bfd_merged_section_offset (abfd, psec, - elf_section_data (sec)->sec_info, + return _bfd_merged_section_offset (abfd, psec, sec->sec_info, sym->st_value + addend); } @@ -13311,8 +13308,8 @@ _bfd_elf_section_offset (bfd *abfd, switch (sec->sec_info_type) { case SEC_INFO_TYPE_STABS: - return _bfd_stab_section_offset (sec, elf_section_data (sec)->sec_info, - offset); + return _bfd_stab_section_offset (sec, sec->sec_info, offset); + case SEC_INFO_TYPE_EH_FRAME: return _bfd_elf_eh_frame_section_offset (abfd, info, sec, offset); @@ -13740,7 +13737,7 @@ _bfd_elf_slurp_secondary_reloc_section (bfd * abfd, free (native_relocs); /* Store the internal relocs. */ - elf_section_data (relsec)->sec_info = internal_relocs; + relsec->sec_info = internal_relocs; } } @@ -13773,9 +13770,8 @@ _bfd_elf_copy_special_section_fields (const bfd *ibfd ATTRIBUTE_UNUSED, if (osec == NULL) return false; - esd = elf_section_data (osec); - BFD_ASSERT (esd->sec_info == NULL); - esd->sec_info = elf_section_data (isec)->sec_info; + BFD_ASSERT (osec->sec_info == NULL); + osec->sec_info = isec->sec_info; osection->sh_type = SHT_RELA; osection->sh_link = elf_onesymtab (obfd); if (osection->sh_link == 0) @@ -13944,7 +13940,7 @@ _bfd_elf_write_secondary_reloc_section (bfd *abfd, asection *sec) last_sym = NULL; last_sym_idx = 0; dst_rela = hdr->contents; - src_irel = (arelent *) esd->sec_info; + src_irel = sec->sec_info; if (src_irel == NULL) { _bfd_error_handler diff --git a/bfd/elf32-nds32.c b/bfd/elf32-nds32.c index e22b58c4ea8..29e4fbc8dce 100644 --- a/bfd/elf32-nds32.c +++ b/bfd/elf32-nds32.c @@ -7489,7 +7489,7 @@ calculate_offset (bfd *abfd, asection *sec, Elf_Internal_Rela *irel, { sym_sec = h->root.u.def.section; symval = _bfd_merged_section_offset (abfd, &sym_sec, - elf_section_data (sym_sec)->sec_info, + sym_sec->sec_info, h->root.u.def.value); symval = symval + sym_sec->output_section->vma + sym_sec->output_offset; @@ -8629,13 +8629,11 @@ nds32_elf_rela_local_sym (bfd *abfd, Elf_Internal_Sym *sym, { if (ELF_ST_TYPE (sym->st_info) == STT_SECTION) rel->r_addend = - _bfd_merged_section_offset (abfd, psec, - elf_section_data (sec)->sec_info, + _bfd_merged_section_offset (abfd, psec, sec->sec_info, sym->st_value + rel->r_addend); else rel->r_addend = - _bfd_merged_section_offset (abfd, psec, - elf_section_data (sec)->sec_info, + _bfd_merged_section_offset (abfd, psec, sec->sec_info, sym->st_value) + rel->r_addend; if (sec != *psec) @@ -8708,8 +8706,9 @@ calculate_memory_address (bfd *abfd, Elf_Internal_Rela *irel, if (h->root.u.def.section->flags & SEC_MERGE) { sym_sec = h->root.u.def.section; - symval = _bfd_merged_section_offset (abfd, &sym_sec, elf_section_data - (sym_sec)->sec_info, h->root.u.def.value); + symval = _bfd_merged_section_offset (abfd, &sym_sec, + sym_sec->sec_info, + h->root.u.def.value); symval = symval + sym_sec->output_section->vma + sym_sec->output_offset; } diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index a3adcf8430e..ef38202ca76 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -6115,14 +6115,14 @@ ppc_elf_relax_section (bfd *abfd, if (htab->params->ppc476_workaround || htab->params->pic_fixup > 0) { - if (elf_section_data (isec)->sec_info == NULL) + if (isec->sec_info == NULL) { - elf_section_data (isec)->sec_info + isec->sec_info = bfd_zalloc (abfd, sizeof (struct ppc_elf_relax_info)); - if (elf_section_data (isec)->sec_info == NULL) + if (isec->sec_info == NULL) return false; } - relax_info = elf_section_data (isec)->sec_info; + relax_info = isec->sec_info; trampbase -= relax_info->workaround_size; } @@ -6382,8 +6382,7 @@ ppc_elf_relax_section (bfd *abfd, toff += irel->r_addend; toff - = _bfd_merged_section_offset (abfd, &tsec, - elf_section_data (tsec)->sec_info, + = _bfd_merged_section_offset (abfd, &tsec, tsec->sec_info, toff); if (sym_type != STT_SECTION @@ -7019,7 +7018,7 @@ ppc_elf_relocate_section (bfd *output_bfd, && !strcmp (input_section->output_section->name, ".tls_vars")); if (input_section->sec_info_type == SEC_INFO_TYPE_TARGET) - relax_info = elf_section_data (input_section)->sec_info; + relax_info = input_section->sec_info; rel = wrel = relocs; relend = relocs + input_section->reloc_count; for (; rel < relend; wrel++, rel++) diff --git a/bfd/elf32-rl78.c b/bfd/elf32-rl78.c index e2ea6b1d15f..b32cbd39f76 100644 --- a/bfd/elf32-rl78.c +++ b/bfd/elf32-rl78.c @@ -1891,8 +1891,7 @@ rl78_offset_for_reloc (bfd * abfd, if ((ssec->flags & SEC_MERGE) && ssec->sec_info_type == SEC_INFO_TYPE_MERGE) symval = _bfd_merged_section_offset (abfd, & ssec, - elf_section_data (ssec)->sec_info, - symval); + ssec->sec_info, symval); } /* Now make the offset relative to where the linker is putting it. */ diff --git a/bfd/elf32-rx.c b/bfd/elf32-rx.c index d8a2236a233..83f6984e3e2 100644 --- a/bfd/elf32-rx.c +++ b/bfd/elf32-rx.c @@ -1808,7 +1808,7 @@ rx_offset_for_reloc (bfd * abfd, if ((ssec->flags & SEC_MERGE) && ssec->sec_info_type == SEC_INFO_TYPE_MERGE) symval = _bfd_merged_section_offset (abfd, & ssec, - elf_section_data (ssec)->sec_info, + ssec->sec_info, symval); } diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c index b13c99e4958..fc8c18dfe8c 100644 --- a/bfd/elf64-alpha.c +++ b/bfd/elf64-alpha.c @@ -4261,8 +4261,7 @@ elf64_alpha_relocate_section (bfd *output_bfd, struct bfd_link_info *info, msec = sec; ent->addend = _bfd_merged_section_offset (output_bfd, &msec, - elf_section_data (sec)-> - sec_info, + sec->sec_info, sym->st_value + ent->addend); ent->addend -= sym->st_value; ent->addend += msec->output_section->vma diff --git a/bfd/elf64-ia64-vms.c b/bfd/elf64-ia64-vms.c index 822b263ae2c..79bf2ee60a3 100644 --- a/bfd/elf64-ia64-vms.c +++ b/bfd/elf64-ia64-vms.c @@ -3472,8 +3472,7 @@ elf64_ia64_relocate_section (bfd *output_bfd, msec = sym_sec; dynent->addend = _bfd_merged_section_offset (output_bfd, &msec, - elf_section_data (msec)-> - sec_info, + msec->sec_info, sym->st_value + dynent->addend); dynent->addend -= sym->st_value; diff --git a/bfd/elflink.c b/bfd/elflink.c index b06d07c18b3..17d6e389c2d 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -3438,7 +3438,7 @@ _bfd_elf_link_sec_merge_syms (struct elf_link_hash_entry *h, void *data) h->root.u.def.value = _bfd_merged_section_offset (output_bfd, &h->root.u.def.section, - elf_section_data (sec)->sec_info, + sec->sec_info, h->root.u.def.value); } @@ -6116,14 +6116,11 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) && (stab->flags & SEC_MERGE) == 0 && !bfd_is_abs_section (stab->output_section)) { - struct bfd_elf_section_data *secdata; - - secdata = elf_section_data (stab); if (! _bfd_link_section_stabs (abfd, &htab->stab_info, stab, - stabstr, &secdata->sec_info, + stabstr, &stab->sec_info, &string_offset)) goto error_return; - if (secdata->sec_info) + if (stab->sec_info) stab->sec_info_type = SEC_INFO_TYPE_STABS; } } @@ -8197,14 +8194,11 @@ _bfd_elf_merge_sections (bfd *obfd, struct bfd_link_info *info) if ((sec->flags & SEC_MERGE) != 0 && !bfd_is_abs_section (sec->output_section)) { - struct bfd_elf_section_data *secdata; - - secdata = elf_section_data (sec); if (! _bfd_add_merge_section (obfd, &info->hash->merge_info, - sec, &secdata->sec_info)) + sec, &sec->sec_info)) return false; - else if (secdata->sec_info) + else if (sec->sec_info) sec->sec_info_type = SEC_INFO_TYPE_MERGE; } @@ -11496,7 +11490,7 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd) && ELF_ST_TYPE (isym->st_info) != STT_SECTION) isym->st_value = _bfd_merged_section_offset (output_bfd, &isec, - elf_section_data (isec)->sec_info, + isec->sec_info, isym->st_value); } @@ -12231,12 +12225,11 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd) if (! (_bfd_write_section_stabs (output_bfd, &elf_hash_table (flinfo->info)->stab_info, - o, &elf_section_data (o)->sec_info, contents))) + o, &o->sec_info, contents))) return false; break; case SEC_INFO_TYPE_MERGE: - if (! _bfd_write_merged_section (output_bfd, o, - elf_section_data (o)->sec_info)) + if (! _bfd_write_merged_section (output_bfd, o, o->sec_info)) return false; break; case SEC_INFO_TYPE_EH_FRAME: @@ -14706,7 +14699,7 @@ bfd_elf_gc_sections (bfd *abfd, struct bfd_link_info *info) false)) { _bfd_elf_parse_eh_frame (sub, info, sec, &cookie); - if (elf_section_data (sec)->sec_info + if (sec->sec_info && (sec->flags & SEC_LINKER_CREATED) == 0) elf_eh_frame_section (sub) = sec; fini_reloc_cookie_for_section (&cookie, sec); @@ -15218,8 +15211,7 @@ bfd_elf_discard_info (bfd *output_bfd, struct bfd_link_info *info) if (!init_reloc_cookie_for_section (&cookie, info, i, false)) return -1; - if (_bfd_discard_section_stabs (abfd, i, - elf_section_data (i)->sec_info, + if (_bfd_discard_section_stabs (abfd, i, i->sec_info, bfd_elf_reloc_symbol_deleted_p, &cookie)) changed = 1; diff --git a/bfd/elfnn-ia64.c b/bfd/elfnn-ia64.c index 528b1dcdcc3..849946d65f9 100644 --- a/bfd/elfnn-ia64.c +++ b/bfd/elfnn-ia64.c @@ -557,8 +557,7 @@ elfNN_ia64_relax_section (bfd *abfd, asection *sec, if (symtype == STT_SECTION) toff += irel->r_addend; - toff = _bfd_merged_section_offset (abfd, &tsec, - elf_section_data (tsec)->sec_info, + toff = _bfd_merged_section_offset (abfd, &tsec, tsec->sec_info, toff); if (symtype != STT_SECTION) @@ -3868,8 +3867,7 @@ elfNN_ia64_relocate_section (bfd *output_bfd, msec = sym_sec; dynent->addend = _bfd_merged_section_offset (output_bfd, &msec, - elf_section_data (msec)-> - sec_info, + msec->sec_info, sym->st_value + dynent->addend); dynent->addend -= sym->st_value; diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c index 53cdb783859..7cdf006e2aa 100644 --- a/bfd/elfnn-loongarch.c +++ b/bfd/elfnn-loongarch.c @@ -6017,8 +6017,8 @@ loongarch_elf_relax_section (bfd *abfd, asection *sec, symval += rel->r_addend; symval = _bfd_merged_section_offset (abfd, &sym_sec, - elf_section_data (sym_sec)->sec_info, - symval); + sym_sec->sec_info, + symval); if (symtype != STT_SECTION) symval += rel->r_addend; diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c index 09cf7076733..76618942103 100644 --- a/bfd/elfnn-riscv.c +++ b/bfd/elfnn-riscv.c @@ -5622,8 +5622,7 @@ _bfd_riscv_relax_section (bfd *abfd, asection *sec, symval += rel->r_addend; symval = _bfd_merged_section_offset (abfd, &sym_sec, - elf_section_data (sym_sec)->sec_info, - symval); + sym_sec->sec_info, symval); if (symtype != STT_SECTION) symval += rel->r_addend; diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index 00ef0663728..d8a66db769d 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -4545,14 +4545,11 @@ mips_elf_resolve_got_page_ref (void **refp, void *data) specifies the offset _from_ the first byte. */ if (sec->flags & SEC_MERGE) { - void *secinfo; - - secinfo = elf_section_data (sec)->sec_info; if (ELF_ST_TYPE (isym->st_info) == STT_SECTION) - addend = _bfd_merged_section_offset (ref->u.abfd, &sec, secinfo, + addend = _bfd_merged_section_offset (ref->u.abfd, &sec, sec->sec_info, isym->st_value + ref->addend); else - addend = _bfd_merged_section_offset (ref->u.abfd, &sec, secinfo, + addend = _bfd_merged_section_offset (ref->u.abfd, &sec, sec->sec_info, isym->st_value) + ref->addend; } else diff --git a/bfd/libbfd.h b/bfd/libbfd.h index f2485d99078..ca8eef50b1c 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -3694,8 +3694,8 @@ bool _bfd_unrecognized_reloc /* symbol, */ \ (struct bfd_symbol *) SYM, \ \ - /* map_head, map_tail, already_assigned, type */ \ - { NULL }, { NULL }, NULL, 0 \ + /* map_head, map_tail, already_assigned, sec_info, type */ \ + { NULL }, { NULL }, NULL, NULL, 0 \ \ } diff --git a/bfd/section.c b/bfd/section.c index 5f0cf6e71cb..5c6089d6919 100644 --- a/bfd/section.c +++ b/bfd/section.c @@ -565,6 +565,10 @@ CODE_FRAGMENT . regions is enabled. *} . struct bfd_section *already_assigned; . +. {* A pointer used for various section optimizations. sec_info_type +´. qualifies which one it is. *} +. void *sec_info; +. . {* Explicitly specified section type, if non-zero. *} . unsigned int type; . @@ -747,8 +751,8 @@ INTERNAL . {* symbol, *} \ . (struct bfd_symbol *) SYM, \ . \ -. {* map_head, map_tail, already_assigned, type *} \ -. { NULL }, { NULL }, NULL, 0 \ +. {* map_head, map_tail, already_assigned, sec_info, type *} \ +. { NULL }, { NULL }, NULL, NULL, 0 \ . \ . } . -- 2.47.3