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;
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)
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;
}
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))
{
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)
{
/* 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;
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;
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);
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;
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;
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;
->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;
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)
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;
.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). */
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);
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);
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);
}
}
&& 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)
{
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);
}
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);
free (native_relocs);
/* Store the internal relocs. */
- elf_section_data (relsec)->sec_info = internal_relocs;
+ relsec->sec_info = internal_relocs;
}
}
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)
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
{
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;
{
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)
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;
}
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;
}
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
&& !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++)
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. */
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);
}
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
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;
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);
}
&& (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;
}
}
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;
}
&& 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);
}
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:
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);
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;
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)
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;
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;
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;
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
/* 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 \
\
}
. 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;
.
. {* 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 \
. \
. }
.