mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-27 06:17:47 +08:00
Optimize linking of stabs in sections as used in ELF and COFF.
* stabs.c: New file. * libbfd-in.h (_bfd_link_section_stabs): Declare. (_bfd_write_section_stabs): Declare. (_bfd_write_stab_strings): Declare. * libbfd.h: Rebuild. * libcoff-in.h (struct coff_section_tdata): Add stab_info field. (struct coff_link_hash_table): Add stab_info field. * libcoff.h: Rebuild. * cofflink.c (_bfd_coff_link_hash_table_init): Initialize stab_info field. (coff_link_add_symbols): Call _bfd_link_section_stabs if appropriate. (_bfd_coff_final_link): Write out stab strings hash table. (_bfd_coff_link_input_bfd): Handle optimized stabs sections. * coff-ppc.c (ppc_bfd_coff_final_link): Write out stab strings hash table. * elf-bfd.h (struct elf_link_hash_table): Add stab_info field. (struct bfd_elf_section_data): Add stab_info field. * elf.c (_bfd_elf_link_hash_table_init): Initialize stab_info field. * elflink.h (elf_link_add_object_symbols): If appropriate, call _bfd_link_section_stabs. (elf_bfd_final_link): Write out stab strings hash table. (elf_link_input_bfd): Handle optimized stabs sections. * reloc.c (_bfd_final_link_relocate): Check address against _raw_size rather than _cooked_size. * Makefile.in: Rebuild dependencies. (BFD_LIBS): Add stabs.o (BFD_LIBS_CFILES): Add stabs.c.
This commit is contained in:
@ -240,6 +240,7 @@ som.h
|
|||||||
sparclynx.c
|
sparclynx.c
|
||||||
sparcnetbsd.c
|
sparcnetbsd.c
|
||||||
srec.c
|
srec.c
|
||||||
|
stabs.c
|
||||||
stab-syms.c
|
stab-syms.c
|
||||||
sunos.c
|
sunos.c
|
||||||
syms.c
|
syms.c
|
||||||
|
@ -1,5 +1,38 @@
|
|||||||
Mon Apr 22 15:07:24 1996 Ian Lance Taylor <ian@cygnus.com>
|
Mon Apr 22 15:07:24 1996 Ian Lance Taylor <ian@cygnus.com>
|
||||||
|
|
||||||
|
Optimize linking of stabs in sections as used in ELF and COFF.
|
||||||
|
* stabs.c: New file.
|
||||||
|
* libbfd-in.h (_bfd_link_section_stabs): Declare.
|
||||||
|
(_bfd_write_section_stabs): Declare.
|
||||||
|
(_bfd_write_stab_strings): Declare.
|
||||||
|
* libbfd.h: Rebuild.
|
||||||
|
* libcoff-in.h (struct coff_section_tdata): Add stab_info field.
|
||||||
|
(struct coff_link_hash_table): Add stab_info field.
|
||||||
|
* libcoff.h: Rebuild.
|
||||||
|
* cofflink.c (_bfd_coff_link_hash_table_init): Initialize
|
||||||
|
stab_info field.
|
||||||
|
(coff_link_add_symbols): Call _bfd_link_section_stabs if
|
||||||
|
appropriate.
|
||||||
|
(_bfd_coff_final_link): Write out stab strings hash table.
|
||||||
|
(_bfd_coff_link_input_bfd): Handle optimized stabs sections.
|
||||||
|
* coff-ppc.c (ppc_bfd_coff_final_link): Write out stab strings
|
||||||
|
hash table.
|
||||||
|
* elf-bfd.h (struct elf_link_hash_table): Add stab_info field.
|
||||||
|
(struct bfd_elf_section_data): Add stab_info field.
|
||||||
|
* elf.c (_bfd_elf_link_hash_table_init): Initialize stab_info
|
||||||
|
field.
|
||||||
|
* elflink.h (elf_link_add_object_symbols): If appropriate, call
|
||||||
|
_bfd_link_section_stabs.
|
||||||
|
(elf_bfd_final_link): Write out stab strings hash table.
|
||||||
|
(elf_link_input_bfd): Handle optimized stabs sections.
|
||||||
|
* reloc.c (_bfd_final_link_relocate): Check address against
|
||||||
|
_raw_size rather than _cooked_size.
|
||||||
|
* Makefile.in: Rebuild dependencies.
|
||||||
|
(BFD_LIBS): Add stabs.o
|
||||||
|
(BFD_LIBS_CFILES): Add stabs.c.
|
||||||
|
|
||||||
|
* VERSION: Increment for bfdlink.h change.
|
||||||
|
|
||||||
* coffgen.c (coff_renumber_symbols): Correct handling of
|
* coffgen.c (coff_renumber_symbols): Correct handling of
|
||||||
BSF_NOT_AT_END common symbols.
|
BSF_NOT_AT_END common symbols.
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
cygnus-2.6.1
|
cygnus-2.6.2
|
||||||
|
@ -964,6 +964,35 @@ elf_link_add_object_symbols (abfd, info)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If this is a non-traditional, non-relocateable link, try to
|
||||||
|
optimize the handling of the .stab/.stabstr sections. */
|
||||||
|
if (! dynamic
|
||||||
|
&& ! info->relocateable
|
||||||
|
&& ! info->traditional_format
|
||||||
|
&& info->hash->creator->flavour == bfd_target_elf_flavour
|
||||||
|
&& (info->strip != strip_all && info->strip != strip_debugger))
|
||||||
|
{
|
||||||
|
asection *stab, *stabstr;
|
||||||
|
|
||||||
|
stab = bfd_get_section_by_name (abfd, ".stab");
|
||||||
|
if (stab != NULL)
|
||||||
|
{
|
||||||
|
stabstr = bfd_get_section_by_name (abfd, ".stabstr");
|
||||||
|
|
||||||
|
if (stabstr != NULL)
|
||||||
|
{
|
||||||
|
struct bfd_elf_section_data *secdata;
|
||||||
|
|
||||||
|
secdata = elf_section_data (stab);
|
||||||
|
if (! _bfd_link_section_stabs (abfd,
|
||||||
|
&elf_hash_table (info)->stab_info,
|
||||||
|
stab, stabstr,
|
||||||
|
&secdata->stab_info))
|
||||||
|
goto error_return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
error_return:
|
error_return:
|
||||||
@ -2329,6 +2358,13 @@ elf_bfd_final_link (abfd, info)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If we have optimized stabs strings, output them. */
|
||||||
|
if (elf_hash_table (info)->stab_info != NULL)
|
||||||
|
{
|
||||||
|
if (! _bfd_write_stab_strings (abfd, &elf_hash_table (info)->stab_info))
|
||||||
|
goto error_return;
|
||||||
|
}
|
||||||
|
|
||||||
if (finfo.symstrtab != NULL)
|
if (finfo.symstrtab != NULL)
|
||||||
_bfd_stringtab_free (finfo.symstrtab);
|
_bfd_stringtab_free (finfo.symstrtab);
|
||||||
if (finfo.contents != NULL)
|
if (finfo.contents != NULL)
|
||||||
@ -2829,7 +2865,8 @@ elf_link_input_bfd (finfo, input_bfd)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((o->flags & SEC_HAS_CONTENTS) == 0)
|
if ((o->flags & SEC_HAS_CONTENTS) == 0
|
||||||
|
|| (o->_raw_size == 0 && (o->flags & SEC_RELOC) == 0))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ((o->flags & SEC_IN_MEMORY) != 0
|
if ((o->flags & SEC_IN_MEMORY) != 0
|
||||||
@ -3050,12 +3087,22 @@ elf_link_input_bfd (finfo, input_bfd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Write out the modified section contents. */
|
/* Write out the modified section contents. */
|
||||||
if (! bfd_set_section_contents (output_bfd, o->output_section,
|
if (elf_section_data (o)->stab_info == NULL)
|
||||||
finfo->contents, o->output_offset,
|
{
|
||||||
(o->_cooked_size != 0
|
if (! bfd_set_section_contents (output_bfd, o->output_section,
|
||||||
? o->_cooked_size
|
finfo->contents, o->output_offset,
|
||||||
: o->_raw_size)))
|
(o->_cooked_size != 0
|
||||||
return false;
|
? o->_cooked_size
|
||||||
|
: o->_raw_size)))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (! _bfd_write_section_stabs (output_bfd, o,
|
||||||
|
&elf_section_data (o)->stab_info,
|
||||||
|
finfo->contents))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Reference in New Issue
Block a user