* elflink.h (elf_bfd_final_link): Don't output initial dummy
symbol or section symbols if stripping all symbols and this is not a relocateable link. Don't output the symbol string table if there are no symbols. (elf_link_flush_output_syms): Don't do anything if there are no symbols to flush.
This commit is contained in:
parent
44e9f3b3d3
commit
28c16b5525
|
@ -1,3 +1,12 @@
|
||||||
|
Wed Jan 31 16:16:53 1996 Ian Lance Taylor <ian@cygnus.com>
|
||||||
|
|
||||||
|
* elflink.h (elf_bfd_final_link): Don't output initial dummy
|
||||||
|
symbol or section symbols if stripping all symbols and this is not
|
||||||
|
a relocateable link. Don't output the symbol string table if
|
||||||
|
there are no symbols.
|
||||||
|
(elf_link_flush_output_syms): Don't do anything if there are no
|
||||||
|
symbols to flush.
|
||||||
|
|
||||||
Wed Jan 31 12:55:49 1996 Richard Henderson <rth@tamu.edu>
|
Wed Jan 31 12:55:49 1996 Richard Henderson <rth@tamu.edu>
|
||||||
|
|
||||||
* coff-aux.c: New file.
|
* coff-aux.c: New file.
|
||||||
|
|
|
@ -1888,6 +1888,8 @@ elf_bfd_final_link (abfd, info)
|
||||||
|
|
||||||
/* Start writing out the symbol table. The first symbol is always a
|
/* Start writing out the symbol table. The first symbol is always a
|
||||||
dummy symbol. */
|
dummy symbol. */
|
||||||
|
if (info->strip != strip_all || info->relocateable)
|
||||||
|
{
|
||||||
elfsym.st_value = 0;
|
elfsym.st_value = 0;
|
||||||
elfsym.st_size = 0;
|
elfsym.st_size = 0;
|
||||||
elfsym.st_info = 0;
|
elfsym.st_info = 0;
|
||||||
|
@ -1896,6 +1898,7 @@ elf_bfd_final_link (abfd, info)
|
||||||
if (! elf_link_output_sym (&finfo, (const char *) NULL,
|
if (! elf_link_output_sym (&finfo, (const char *) NULL,
|
||||||
&elfsym, bfd_und_section_ptr))
|
&elfsym, bfd_und_section_ptr))
|
||||||
goto error_return;
|
goto error_return;
|
||||||
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* Some standard ELF linkers do this, but we don't because it causes
|
/* Some standard ELF linkers do this, but we don't because it causes
|
||||||
|
@ -1918,6 +1921,8 @@ elf_bfd_final_link (abfd, info)
|
||||||
symbols have no names. We store the index of each one in the
|
symbols have no names. We store the index of each one in the
|
||||||
index field of the section, so that we can find it again when
|
index field of the section, so that we can find it again when
|
||||||
outputting relocs. */
|
outputting relocs. */
|
||||||
|
if (info->strip != strip_all || info->relocateable)
|
||||||
|
{
|
||||||
elfsym.st_value = 0;
|
elfsym.st_value = 0;
|
||||||
elfsym.st_size = 0;
|
elfsym.st_size = 0;
|
||||||
elfsym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION);
|
elfsym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION);
|
||||||
|
@ -1932,6 +1937,7 @@ elf_bfd_final_link (abfd, info)
|
||||||
&elfsym, o))
|
&elfsym, o))
|
||||||
goto error_return;
|
goto error_return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Allocate some memory to hold information read in from the input
|
/* Allocate some memory to hold information read in from the input
|
||||||
files. */
|
files. */
|
||||||
|
@ -2051,9 +2057,12 @@ elf_bfd_final_link (abfd, info)
|
||||||
off = _bfd_elf_assign_file_position_for_section (symstrtab_hdr, off, true);
|
off = _bfd_elf_assign_file_position_for_section (symstrtab_hdr, off, true);
|
||||||
elf_tdata (abfd)->next_file_pos = off;
|
elf_tdata (abfd)->next_file_pos = off;
|
||||||
|
|
||||||
|
if (abfd->symcount > 0)
|
||||||
|
{
|
||||||
if (bfd_seek (abfd, symstrtab_hdr->sh_offset, SEEK_SET) != 0
|
if (bfd_seek (abfd, symstrtab_hdr->sh_offset, SEEK_SET) != 0
|
||||||
|| ! _bfd_stringtab_emit (abfd, finfo.symstrtab))
|
|| ! _bfd_stringtab_emit (abfd, finfo.symstrtab))
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/* Adjust the relocs to have the correct symbol indices. */
|
/* Adjust the relocs to have the correct symbol indices. */
|
||||||
for (o = abfd->sections; o != NULL; o = o->next)
|
for (o = abfd->sections; o != NULL; o = o->next)
|
||||||
|
@ -2369,6 +2378,8 @@ static boolean
|
||||||
elf_link_flush_output_syms (finfo)
|
elf_link_flush_output_syms (finfo)
|
||||||
struct elf_final_link_info *finfo;
|
struct elf_final_link_info *finfo;
|
||||||
{
|
{
|
||||||
|
if (finfo->symbuf_count > 0)
|
||||||
|
{
|
||||||
Elf_Internal_Shdr *symtab;
|
Elf_Internal_Shdr *symtab;
|
||||||
|
|
||||||
symtab = &elf_tdata (finfo->output_bfd)->symtab_hdr;
|
symtab = &elf_tdata (finfo->output_bfd)->symtab_hdr;
|
||||||
|
@ -2383,6 +2394,7 @@ elf_link_flush_output_syms (finfo)
|
||||||
symtab->sh_size += finfo->symbuf_count * sizeof (Elf_External_Sym);
|
symtab->sh_size += finfo->symbuf_count * sizeof (Elf_External_Sym);
|
||||||
|
|
||||||
finfo->symbuf_count = 0;
|
finfo->symbuf_count = 0;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue