mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-27 14:39:09 +08:00
* elf-bfd.h (struct bfd_elf_section_data): Rename "group" to
"group_name". (elf_group_name): Define. (elf_next_in_group): Define. * elf.c: Make use of elf_group_name and elf_next_in_group throughout. (setup_group): Don't use sec->lineno for SHT_GROUP section to store first member section; Instead use elf_next_in_group. (bfd_section_from_shdr): Likewise. (set_group_contents): Likewise. Use elf_section_syms, not sec->symbol.
This commit is contained in:
@ -1,3 +1,15 @@
|
|||||||
|
2001-10-09 Alan Modra <amodra@bigpond.net.au>
|
||||||
|
|
||||||
|
* elf-bfd.h (struct bfd_elf_section_data): Rename "group" to
|
||||||
|
"group_name".
|
||||||
|
(elf_group_name): Define.
|
||||||
|
(elf_next_in_group): Define.
|
||||||
|
* elf.c: Make use of elf_group_name and elf_next_in_group throughout.
|
||||||
|
(setup_group): Don't use sec->lineno for SHT_GROUP section to store
|
||||||
|
first member section; Instead use elf_next_in_group.
|
||||||
|
(bfd_section_from_shdr): Likewise.
|
||||||
|
(set_group_contents): Likewise. Use elf_section_syms, not sec->symbol.
|
||||||
|
|
||||||
2001-10-09 Alan Modra <amodra@bigpond.net.au>
|
2001-10-09 Alan Modra <amodra@bigpond.net.au>
|
||||||
|
|
||||||
* elf-bfd.h (struct bfd_elf_section_data): Add "group" and
|
* elf-bfd.h (struct bfd_elf_section_data): Add "group" and
|
||||||
@ -12,6 +24,7 @@
|
|||||||
(set_group_contents): New function.
|
(set_group_contents): New function.
|
||||||
(_bfd_elf_compute_section_file_positions): Call it.
|
(_bfd_elf_compute_section_file_positions): Call it.
|
||||||
(assign_section_numbers): Set sh_link for SHT_GROUP.
|
(assign_section_numbers): Set sh_link for SHT_GROUP.
|
||||||
|
|
||||||
* elflink.h (gc_mark_hook): Handle section groups.
|
* elflink.h (gc_mark_hook): Handle section groups.
|
||||||
* elfxx-target.h: Add SEC_GROUP to applicable_flags.
|
* elfxx-target.h: Add SEC_GROUP to applicable_flags.
|
||||||
* section.c (SEC_GROUP): Define.
|
* section.c (SEC_GROUP): Define.
|
||||||
|
@ -816,7 +816,7 @@ struct bfd_elf_section_data
|
|||||||
PTR merge_info;
|
PTR merge_info;
|
||||||
|
|
||||||
/* Group name, if this section is part of a group. */
|
/* Group name, if this section is part of a group. */
|
||||||
const char *group;
|
const char *group_name;
|
||||||
|
|
||||||
/* A linked list of sections in the group. Circular when used by
|
/* A linked list of sections in the group. Circular when used by
|
||||||
the linker. */
|
the linker. */
|
||||||
@ -830,6 +830,8 @@ struct bfd_elf_section_data
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define elf_section_data(sec) ((struct bfd_elf_section_data*)sec->used_by_bfd)
|
#define elf_section_data(sec) ((struct bfd_elf_section_data*)sec->used_by_bfd)
|
||||||
|
#define elf_group_name(sec) (elf_section_data(sec)->group_name)
|
||||||
|
#define elf_next_in_group(sec) (elf_section_data(sec)->next_in_group)
|
||||||
|
|
||||||
#define get_elf_backend_data(abfd) \
|
#define get_elf_backend_data(abfd) \
|
||||||
((struct elf_backend_data *) (abfd)->xvec->backend_data)
|
((struct elf_backend_data *) (abfd)->xvec->backend_data)
|
||||||
|
46
bfd/elf.c
46
bfd/elf.c
@ -475,20 +475,15 @@ setup_group (abfd, hdr, newsect)
|
|||||||
n_elt = shdr->sh_size / 4;
|
n_elt = shdr->sh_size / 4;
|
||||||
while (--n_elt != 0)
|
while (--n_elt != 0)
|
||||||
if ((s = (++idx)->shdr->bfd_section) != NULL
|
if ((s = (++idx)->shdr->bfd_section) != NULL
|
||||||
&& elf_section_data (s)->next_in_group != NULL)
|
&& elf_next_in_group (s) != NULL)
|
||||||
break;
|
break;
|
||||||
if (n_elt != 0)
|
if (n_elt != 0)
|
||||||
{
|
{
|
||||||
const char *gname;
|
|
||||||
asection *next;
|
|
||||||
|
|
||||||
/* Snarf the group name from other member, and
|
/* Snarf the group name from other member, and
|
||||||
insert current section in circular list. */
|
insert current section in circular list. */
|
||||||
gname = elf_section_data (s)->group;
|
elf_group_name (newsect) = elf_group_name (s);
|
||||||
elf_section_data (newsect)->group = gname;
|
elf_next_in_group (newsect) = elf_next_in_group (s);
|
||||||
next = elf_section_data (s)->next_in_group;
|
elf_next_in_group (s) = newsect;
|
||||||
elf_section_data (newsect)->next_in_group = next;
|
|
||||||
elf_section_data (s)->next_in_group = newsect;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -511,20 +506,20 @@ setup_group (abfd, hdr, newsect)
|
|||||||
return false;
|
return false;
|
||||||
iname = H_GET_32 (abfd, ename);
|
iname = H_GET_32 (abfd, ename);
|
||||||
gname = elf_string_from_elf_strtab (abfd, iname);
|
gname = elf_string_from_elf_strtab (abfd, iname);
|
||||||
elf_section_data (newsect)->group = gname;
|
elf_group_name (newsect) = gname;
|
||||||
|
|
||||||
/* Start a circular list with one element. */
|
/* Start a circular list with one element. */
|
||||||
elf_section_data (newsect)->next_in_group = newsect;
|
elf_next_in_group (newsect) = newsect;
|
||||||
}
|
}
|
||||||
if (shdr->bfd_section != NULL)
|
if (shdr->bfd_section != NULL)
|
||||||
shdr->bfd_section->lineno = (alent *) newsect;
|
elf_next_in_group (shdr->bfd_section) = newsect;
|
||||||
i = num_group - 1;
|
i = num_group - 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (elf_section_data (newsect)->group == NULL)
|
if (elf_group_name (newsect) == NULL)
|
||||||
{
|
{
|
||||||
(*_bfd_error_handler) (_("%s: no group info for section %s"),
|
(*_bfd_error_handler) (_("%s: no group info for section %s"),
|
||||||
bfd_archive_filename (abfd), newsect->name);
|
bfd_archive_filename (abfd), newsect->name);
|
||||||
@ -1718,9 +1713,9 @@ bfd_section_from_shdr (abfd, shindex)
|
|||||||
|
|
||||||
while (--n_elt != 0)
|
while (--n_elt != 0)
|
||||||
if ((s = (++idx)->shdr->bfd_section) != NULL
|
if ((s = (++idx)->shdr->bfd_section) != NULL
|
||||||
&& elf_section_data (s)->next_in_group != NULL)
|
&& elf_next_in_group (s) != NULL)
|
||||||
{
|
{
|
||||||
hdr->bfd_section->lineno = (alent *) s;
|
elf_next_in_group (hdr->bfd_section) = s;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2085,7 +2080,7 @@ elf_fake_sections (abfd, asect, failedptrarg)
|
|||||||
if ((asect->flags & SEC_STRINGS) != 0)
|
if ((asect->flags & SEC_STRINGS) != 0)
|
||||||
this_hdr->sh_flags |= SHF_STRINGS;
|
this_hdr->sh_flags |= SHF_STRINGS;
|
||||||
}
|
}
|
||||||
if (elf_section_data (asect)->group != NULL)
|
if (elf_group_name (asect) != NULL)
|
||||||
this_hdr->sh_flags |= SHF_GROUP;
|
this_hdr->sh_flags |= SHF_GROUP;
|
||||||
|
|
||||||
/* Check for processor-specific section types. */
|
/* Check for processor-specific section types. */
|
||||||
@ -2123,10 +2118,11 @@ set_group_contents (abfd, sec, failedptrarg)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/* If called from the assembler, swap_out_syms will have set up
|
/* If called from the assembler, swap_out_syms will have set up
|
||||||
udata.i; If called for "ld -r", the symbols won't yet be mapped,
|
elf_section_syms; If called for "ld -r", the symbols won't yet
|
||||||
so emulate elf_bfd_final_link. */
|
be mapped, so emulate elf_bfd_final_link. */
|
||||||
symindx = sec->symbol->udata.i;
|
if (elf_section_syms (abfd) != NULL)
|
||||||
if (symindx == 0)
|
symindx = elf_section_syms (abfd)[sec->index]->udata.i;
|
||||||
|
else
|
||||||
symindx = elf_section_data (sec)->this_idx;
|
symindx = elf_section_data (sec)->this_idx;
|
||||||
elf_section_data (sec)->this_hdr.sh_info = symindx;
|
elf_section_data (sec)->this_hdr.sh_info = symindx;
|
||||||
|
|
||||||
@ -2145,7 +2141,7 @@ set_group_contents (abfd, sec, failedptrarg)
|
|||||||
|
|
||||||
/* Get the pointer to the first section in the group that we
|
/* Get the pointer to the first section in the group that we
|
||||||
squirreled away here. */
|
squirreled away here. */
|
||||||
elt = (asection *) sec->lineno;
|
elt = elf_next_in_group (sec);
|
||||||
|
|
||||||
/* First element is a flag word. Rest of section is elf section
|
/* First element is a flag word. Rest of section is elf section
|
||||||
indices for all the sections of the group. Write them backwards
|
indices for all the sections of the group. Write them backwards
|
||||||
@ -2155,7 +2151,7 @@ set_group_contents (abfd, sec, failedptrarg)
|
|||||||
{
|
{
|
||||||
loc -= 4;
|
loc -= 4;
|
||||||
H_PUT_32 (abfd, elf_section_data (elt)->this_idx, loc);
|
H_PUT_32 (abfd, elf_section_data (elt)->this_idx, loc);
|
||||||
elt = elf_section_data (elt)->next_in_group;
|
elt = elf_next_in_group (elt);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If this is a relocatable link, then the above did nothing because
|
/* If this is a relocatable link, then the above did nothing because
|
||||||
@ -2163,16 +2159,16 @@ set_group_contents (abfd, sec, failedptrarg)
|
|||||||
instead. */
|
instead. */
|
||||||
for (l = sec->link_order_head; l != NULL; l = l->next)
|
for (l = sec->link_order_head; l != NULL; l = l->next)
|
||||||
if (l->type == bfd_indirect_link_order
|
if (l->type == bfd_indirect_link_order
|
||||||
&& (elt = (asection *) l->u.indirect.section->lineno) != NULL)
|
&& (elt = elf_next_in_group (l->u.indirect.section)) != NULL)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
loc -= 4;
|
loc -= 4;
|
||||||
H_PUT_32 (abfd,
|
H_PUT_32 (abfd,
|
||||||
elf_section_data (elt->output_section)->this_idx, loc);
|
elf_section_data (elt->output_section)->this_idx, loc);
|
||||||
elt = elf_section_data (elt)->next_in_group;
|
elt = elf_next_in_group (elt);
|
||||||
/* During a relocatable link, the lists are circular. */
|
/* During a relocatable link, the lists are circular. */
|
||||||
}
|
}
|
||||||
while (elt != (asection *) l->u.indirect.section->lineno);
|
while (elt != elf_next_in_group (l->u.indirect.section));
|
||||||
|
|
||||||
loc -= 4;
|
loc -= 4;
|
||||||
H_PUT_32 (abfd, 0, loc);
|
H_PUT_32 (abfd, 0, loc);
|
||||||
|
Reference in New Issue
Block a user