* coffgen.c (coff_renumber_symbols): Sort defined symbols that are
neither BSF_FUNCTION not BSF_NOT_AT_END just before undefined symbols. * coffcode.h (coff_slurp_symbol_table): Set BSF_FUNCTION as well as BSF_NOT_AT_END. PR 5491.
This commit is contained in:
parent
5375150754
commit
c7e76b5eea
@ -1,3 +1,11 @@
|
||||
Fri Jul 7 17:36:44 1995 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* coffgen.c (coff_renumber_symbols): Sort defined symbols that are
|
||||
neither BSF_FUNCTION not BSF_NOT_AT_END just before undefined
|
||||
symbols.
|
||||
* coffcode.h (coff_slurp_symbol_table): Set BSF_FUNCTION as well
|
||||
as BSF_NOT_AT_END.
|
||||
|
||||
Fri Jul 7 17:16:15 1995 Ken Raeburn <raeburn@cygnus.com>
|
||||
|
||||
* Makefile.in (do_mostlyclean): Remove config.log.
|
||||
@ -332,7 +340,7 @@ Tue Jun 6 17:29:32 1995 Steve Chamberlain <sac@slash.cygnus.com>
|
||||
Mon Jun 5 09:07:13 1995 Steve Chamberlain <sac@slash.cygnus.com>
|
||||
|
||||
* coff-a29k.c (coff_a29k_adjust_symndx): Completely parenthesize
|
||||
macro. (pr ld/7127)
|
||||
macro.
|
||||
|
||||
Mon Jun 5 02:15:20 1995 Ken Raeburn <raeburn@kr-laptop.cygnus.com>
|
||||
|
||||
@ -477,8 +485,6 @@ Thu May 11 16:43:14 1995 Steve Chamberlain <sac@slash.cygnus.com>
|
||||
|
||||
Thu May 11 16:43:14 1995 Steve Chamberlain <sac@slash.cygnus.com>
|
||||
|
||||
pr ld/6840
|
||||
|
||||
* coff-i960.c (optcall_callback): don't try and optimize
|
||||
undefined refs.
|
||||
(coff_write_relocs): Search for broken relocs on the way
|
||||
|
@ -2449,7 +2449,7 @@ coff_slurp_symbol_table (abfd)
|
||||
#if 0
|
||||
dst->symbol.value = src->u.syment.n_value - dst->symbol.section->vma;
|
||||
dst->symbol.flags = BSF_EXPORT | BSF_GLOBAL;
|
||||
dst->symbol.flags |= BSF_NOT_AT_END;
|
||||
dst->symbol.flags |= BSF_NOT_AT_END | BSF_FUNCTION;
|
||||
#endif
|
||||
/* Fall through to next case */
|
||||
|
||||
@ -2491,7 +2491,7 @@ coff_slurp_symbol_table (abfd)
|
||||
/*
|
||||
A function ext does not go at the end of a file
|
||||
*/
|
||||
dst->symbol.flags |= BSF_NOT_AT_END;
|
||||
dst->symbol.flags |= BSF_NOT_AT_END | BSF_FUNCTION;
|
||||
}
|
||||
}
|
||||
|
||||
|
109
bfd/coffgen.c
109
bfd/coffgen.c
@ -88,6 +88,7 @@ make_a_section_from_file (abfd, hdr, target_index)
|
||||
/* s_paddr is presumed to be = to s_vaddr */
|
||||
|
||||
return_section->vma = hdr->s_vaddr;
|
||||
return_section->lma = return_section->vma;
|
||||
return_section->_raw_size = hdr->s_size;
|
||||
return_section->filepos = hdr->s_scnptr;
|
||||
return_section->rel_filepos = hdr->s_relptr;
|
||||
@ -127,46 +128,13 @@ coff_real_object_p (abfd, nscns, internal_f, internal_a)
|
||||
struct internal_filehdr *internal_f;
|
||||
struct internal_aouthdr *internal_a;
|
||||
{
|
||||
flagword oflags = abfd->flags;
|
||||
bfd_vma ostart = bfd_get_start_address (abfd);
|
||||
PTR tdata;
|
||||
size_t readsize; /* length of file_info */
|
||||
unsigned int scnhsz;
|
||||
char *external_sections;
|
||||
|
||||
/* Build a play area */
|
||||
tdata = bfd_coff_mkobject_hook (abfd, (PTR) internal_f, (PTR) internal_a);
|
||||
if (tdata == NULL)
|
||||
return 0;
|
||||
|
||||
scnhsz = bfd_coff_scnhsz (abfd);
|
||||
readsize = nscns * scnhsz;
|
||||
external_sections = (char *) bfd_alloc (abfd, readsize);
|
||||
if (!external_sections)
|
||||
{
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (bfd_read ((PTR) external_sections, 1, readsize, abfd) != readsize)
|
||||
goto fail;
|
||||
|
||||
/* Now copy data as required; construct all asections etc */
|
||||
if (nscns != 0)
|
||||
{
|
||||
unsigned int i;
|
||||
for (i = 0; i < nscns; i++)
|
||||
{
|
||||
struct internal_scnhdr tmp;
|
||||
bfd_coff_swap_scnhdr_in (abfd, (PTR) (external_sections + i * scnhsz),
|
||||
(PTR) & tmp);
|
||||
make_a_section_from_file (abfd, &tmp, i + 1);
|
||||
}
|
||||
}
|
||||
|
||||
/* make_abs_section (abfd); */
|
||||
|
||||
if (bfd_coff_set_arch_mach_hook (abfd, (PTR) internal_f) == false)
|
||||
goto fail;
|
||||
|
||||
if (!(internal_f->f_flags & F_RELFLG))
|
||||
abfd->flags |= HAS_RELOC;
|
||||
if ((internal_f->f_flags & F_EXEC))
|
||||
@ -189,9 +157,49 @@ coff_real_object_p (abfd, nscns, internal_f, internal_a)
|
||||
else
|
||||
bfd_get_start_address (abfd) = 0;
|
||||
|
||||
/* Set up the tdata area. ECOFF uses its own routine, and overrides
|
||||
abfd->flags. */
|
||||
tdata = bfd_coff_mkobject_hook (abfd, (PTR) internal_f, (PTR) internal_a);
|
||||
if (tdata == NULL)
|
||||
return 0;
|
||||
|
||||
scnhsz = bfd_coff_scnhsz (abfd);
|
||||
readsize = nscns * scnhsz;
|
||||
external_sections = (char *) bfd_alloc (abfd, readsize);
|
||||
if (!external_sections)
|
||||
{
|
||||
bfd_set_error (bfd_error_no_memory);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (bfd_read ((PTR) external_sections, 1, readsize, abfd) != readsize)
|
||||
goto fail;
|
||||
|
||||
/* Now copy data as required; construct all asections etc */
|
||||
if (nscns != 0)
|
||||
{
|
||||
unsigned int i;
|
||||
for (i = 0; i < nscns; i++)
|
||||
{
|
||||
struct internal_scnhdr tmp;
|
||||
bfd_coff_swap_scnhdr_in (abfd,
|
||||
(PTR) (external_sections + i * scnhsz),
|
||||
(PTR) & tmp);
|
||||
make_a_section_from_file (abfd, &tmp, i + 1);
|
||||
}
|
||||
}
|
||||
|
||||
/* make_abs_section (abfd); */
|
||||
|
||||
if (bfd_coff_set_arch_mach_hook (abfd, (PTR) internal_f) == false)
|
||||
goto fail;
|
||||
|
||||
return abfd->xvec;
|
||||
|
||||
fail:
|
||||
bfd_release (abfd, tdata);
|
||||
abfd->flags = oflags;
|
||||
bfd_get_start_address (abfd) = ostart;
|
||||
return (const bfd_target *) NULL;
|
||||
}
|
||||
|
||||
@ -446,8 +454,9 @@ fixup_symbol_value (coff_symbol_ptr, syment)
|
||||
do that here too. */
|
||||
|
||||
boolean
|
||||
coff_renumber_symbols (bfd_ptr)
|
||||
coff_renumber_symbols (bfd_ptr, first_undef)
|
||||
bfd *bfd_ptr;
|
||||
int *first_undef;
|
||||
{
|
||||
unsigned int symbol_count = bfd_get_symcount (bfd_ptr);
|
||||
asymbol **symbol_ptr_ptr = bfd_ptr->outsymbols;
|
||||
@ -456,9 +465,12 @@ coff_renumber_symbols (bfd_ptr)
|
||||
unsigned int symbol_index;
|
||||
|
||||
/* COFF demands that undefined symbols come after all other symbols.
|
||||
Since we don't need to impose this extra knowledge on all our client
|
||||
programs, deal with that here. Sort the symbol table; just move the
|
||||
undefined symbols to the end, leaving the rest alone. */
|
||||
Since we don't need to impose this extra knowledge on all our
|
||||
client programs, deal with that here. Sort the symbol table;
|
||||
just move the undefined symbols to the end, leaving the rest
|
||||
alone. The O'Reilly book says that defined global symbols come
|
||||
at the end before the undefined symbols, so we do that here as
|
||||
well. */
|
||||
/* @@ Do we have some condition we could test for, so we don't always
|
||||
have to do this? I don't think relocatability is quite right, but
|
||||
I'm not certain. [raeburn:19920508.1711EST] */
|
||||
@ -476,8 +488,23 @@ coff_renumber_symbols (bfd_ptr)
|
||||
}
|
||||
bfd_ptr->outsymbols = newsyms;
|
||||
for (i = 0; i < symbol_count; i++)
|
||||
if (!bfd_is_und_section (symbol_ptr_ptr[i]->section))
|
||||
if (!bfd_is_und_section (symbol_ptr_ptr[i]->section)
|
||||
&& ((symbol_ptr_ptr[i]->flags & (BSF_GLOBAL
|
||||
| BSF_NOT_AT_END
|
||||
| BSF_FUNCTION))
|
||||
!= BSF_GLOBAL))
|
||||
*newsyms++ = symbol_ptr_ptr[i];
|
||||
|
||||
for (i = 0; i < symbol_count; i++)
|
||||
if (!bfd_is_und_section (symbol_ptr_ptr[i]->section)
|
||||
&& ((symbol_ptr_ptr[i]->flags & (BSF_GLOBAL
|
||||
| BSF_NOT_AT_END
|
||||
| BSF_FUNCTION))
|
||||
== BSF_GLOBAL))
|
||||
*newsyms++ = symbol_ptr_ptr[i];
|
||||
|
||||
*first_undef = newsyms - bfd_ptr->outsymbols;
|
||||
|
||||
for (i = 0; i < symbol_count; i++)
|
||||
if (bfd_is_und_section (symbol_ptr_ptr[i]->section))
|
||||
*newsyms++ = symbol_ptr_ptr[i];
|
||||
@ -488,6 +515,7 @@ coff_renumber_symbols (bfd_ptr)
|
||||
for (symbol_index = 0; symbol_index < symbol_count; symbol_index++)
|
||||
{
|
||||
coff_symbol_type *coff_symbol_ptr = coff_symbol_from (bfd_ptr, symbol_ptr_ptr[symbol_index]);
|
||||
symbol_ptr_ptr[symbol_index]->udata.i = symbol_index;
|
||||
if (coff_symbol_ptr && coff_symbol_ptr->native)
|
||||
{
|
||||
combined_entry_type *s = coff_symbol_ptr->native;
|
||||
@ -516,6 +544,7 @@ coff_renumber_symbols (bfd_ptr)
|
||||
}
|
||||
}
|
||||
obj_conv_table_size (bfd_ptr) = native_index;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user